diff --git a/CHANGELOG.md b/CHANGELOG.md index 88806577cdcb049a92fb0380f520e0923772faa2..7abbad3509e7aad1e119371cb317cd914fee6cd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,80 @@ +2.0.0.0-dev73 +============= +* Framework Improvements: + * Eliminated the StoreConfig class, and ability to work with Configuration through the Store object. Scope Config was introduced instead. + * Fixed performance degradation caused by DI argument processors + * Covered Magento library components with unit tests: + * Magento/App/Request + * Magento/App/Resource directory and Magento/App/Resource.php + * Magento/App/Response + * Magento/App/Route + * Magento/App/Router + * Magento/App/Http.php + * Magento/Translate.php + * Improved the Web API framework based on Customer Service + * Updated the API Service Exception Handling + * Changed the conventional notation of Vendor name in theme path: from `app/design/<area>/<vendor>_<theme>` to `app/design/<area>/<vendor>/<theme>` + * Renamed the 3DSecure library to CardinalCommerce, and removed the unused flex library +* Themes update: + * Updated the look&feel of the Admin theme +* Modularity improvements: + * Introduced a new Store module. Moved all Store related logic from Magento_Core to Magento_Store + * Moved the library part of the Config component from the Magento_Core module to the library + * Moved the Session related logic from the Magento_Core module to the library + * Moved the abstract logic related to Magento "Module" from Magento_Core to the library + * Moved the form key related functionality to the library + * Introduced a new Magento_UrlRewrite module and moved related classes from Magento_Core to the new module + * Moved the resource model to Magento_Install module + * Eliminated the Core\Helper\Js class + * Moved the Email related logic from Magento_Core module to Magento_Email module + * Moved the Cache related logic from the Magento_Core module to the library + * Resolved issues which appeared when an order had been placed before the Magento_Payment module was disabled + * Eliminated Magento_Catalog dependency on Magento_Rating + * Removed the Magento_Rating module, its logic moved to Magento_Review + * Moved the View related components from Magento_Core to the Magento/View library +* Refactored the following modules to use Customer Service + * Magento_Multishipping + * Magento_Paypal + * Magento_Log + * Magento_RSS + * Magento_Review + * Magento_Wishlist + * Magento_Weee + * Magento_CatalogInventory + * Magento_CatalogRule + * Magento_SalesRule +* GitHub requests: + * [#520] (https://github.com/magento/magento2/issues/520) -- Fixed spelling in Magento\Payment\Model\Method\AbstractMethod + * [#481] (https://github.com/magento/magento2/issues/481) -- GD2 Adapter PHP memory_limit + * [#516] (https://github.com/magento/magento2/issues/516) -- Make Sure That save_before Event Is Dispatched + * [#465] (https://github.com/magento/magento2/issues/465) -- Absolute path is assembled incorrectly when merging js/css files + * [#504] (https://github.com/magento/magento2/issues/504) -- Renamed "contacts" module to "contact" + * [#529] (https://github.com/magento/magento2/issues/529) -- Fixed exception at admin dashboard + * [#535] (https://github.com/magento/magento2/issues/535) -- Fixed an issue during creating or editing product template + * [#535] (https://github.com/magento/magento2/issues/535) -- Fixed Typo in the module name + * [#538] (https://github.com/magento/magento2/issues/538) -- Fixed missing tax amount in the invoice + * [#518] (https://github.com/magento/magento2/issues/518) -- Change to Magento\Customer\Block\Widget\Dob new version +* Fixed bugs: + * Fixed implementation issues with Cron task group threading + * Fixed inability to place order during customer registration flow + * Fixed an issue where after JS minification errors appeared when loading pages which contained minified JS + * Fixed an issue where it was impossible for users with restricted permission to export certain entities + * Fixed an issue where checkout was blocked by the "Please enter the State/Province" pop-up for customers that had saved addresses + * Fixed an issue where a fatal error appeared when trying to check out the second time with OnePageCheckout + * Fixed an issue where a fatal error appeared when trying to create an online invoice for an order placed with PayPal Express Checkout (Payment Action = Order) + * Fixed an issue where the special price for a bundle product was calculated wrongly + * Fixed an issue where a fatal error appeared when trying to create a shipment for an order if Magento was installed without the USPS module + * Fixed an issue where the Lifetime Sales and Average Orders sections of the Admin Dashboard were missing + * Fixed an issue where the active tab changed after changing the attribute set + * Fixed an issue with incorrect order of product types in the Add Product menu in the backend + * Fixed an issue with saving the tier price attribute +* JavaScript improvements: + * Upgraded the frontend jQuery library to version 1.11 + * Upgraded the frontend jQuery UI library to version 1.10.4 + * Modified the loader widget to render content using handlebars + * Added the 'use strict' mode to the accordion widget + * Added the 'use strict' mode to the tab widget + 2.0.0.0-dev72 ============= * Framework Improvements: @@ -55,7 +132,7 @@ * Updated the whitelist filter with library code for integration tests code coverage calculation * GitHub requests: * [#512] (https://github.com/magento/magento2/issues/512) -- Theme Thumbnails not showing - * [#520] (https://github.com/magento/magento2/pull/502) -- Corrected Search Engine Optimization i18n + * [#520] (https://github.com/magento/magento2/pull/520) -- Corrected Search Engine Optimization i18n * [#519] (https://github.com/magento/magento2/issues/519) -- New Theme Activation * Customer Service usage: * Refactored the Log module to use Customer Service @@ -567,7 +644,7 @@ * Design loader moved to library * Theme label moved to library * Themes update: - * Reduced amount of templates and layouts in magento_plushe theme + * Reduced amount of templates and layouts in Magento/plushe theme * Responsive design improvements * Integrity improvements: * Covered all Magento classes with argument sequence validator diff --git a/app/code/Magento/AdminNotification/Block/Inbox.php b/app/code/Magento/AdminNotification/Block/Inbox.php index c87c86aaec5fbe022a40c4418e574910abee0086..637e3fdd8a279bb9a6c447977bcf12e4446710dc 100644 --- a/app/code/Magento/AdminNotification/Block/Inbox.php +++ b/app/code/Magento/AdminNotification/Block/Inbox.php @@ -38,15 +38,6 @@ class Inbox extends \Magento\Backend\Block\Widget\Grid\Container $this->_blockGroup = 'Magento_AdminNotification'; $this->_headerText = __('Messages Inbox'); parent::_construct(); - } - - /** - * @return $this - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); $this->_removeButton('add'); - return $this; } } diff --git a/app/code/Magento/AdminNotification/Helper/Data.php b/app/code/Magento/AdminNotification/Helper/Data.php index ccf89de26aaa1e7edec5ccc9c61da61b1828b654..b49459a58bc28bda7510c0781917059e4d355c0e 100644 --- a/app/code/Magento/AdminNotification/Helper/Data.php +++ b/app/code/Magento/AdminNotification/Helper/Data.php @@ -65,9 +65,9 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_unreadNoticeCounts; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\AdminNotification\Model\InboxFactory @@ -76,16 +76,16 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory ) { parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_inboxFactory = $inboxFactory; } diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php index db68ab173b8cdbe2ab92f3e9e528952c96bec816..9e8974a816f4f86c5ecdcf543a5e06cc54cd2ed0 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Baseurl.php @@ -31,31 +31,31 @@ class Baseurl implements \Magento\AdminNotification\Model\System\MessageInterfac protected $_urlBuilder; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; /** - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ValueFactory $configValueFactory */ public function __construct( - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, - \Magento\Core\Model\Config\ValueFactory $configValueFactory + \Magento\App\Config\ValueFactory $configValueFactory ) { $this->_urlBuilder = $urlBuilder; $this->_config = $config; @@ -71,18 +71,18 @@ class Baseurl implements \Magento\AdminNotification\Model\System\MessageInterfac protected function _getConfigUrl() { $output = ''; - $defaultUnsecure = $this->_config->getValue(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default'); + $defaultUnsecure = $this->_config->getValue(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default'); - $defaultSecure = $this->_config->getValue(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, 'default'); + $defaultSecure = $this->_config->getValue(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default'); - if ($defaultSecure == \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER || - $defaultUnsecure == \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER + if ($defaultSecure == \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER || + $defaultUnsecure == \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER ) { $output = $this->_urlBuilder->getUrl('adminhtml/system_config/edit', array('section' => 'web')); } else { /** @var $dataCollection \Magento\Core\Model\Resource\Config\Data\Collection */ $dataCollection = $this->_configValueFactory->create()->getCollection(); - $dataCollection->addValueFilter(\Magento\Core\Model\Store::BASE_URL_PLACEHOLDER); + $dataCollection->addValueFilter(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER); /** @var $data \Magento\App\Config\ValueInterface */ foreach ($dataCollection as $data) { diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Security.php b/app/code/Magento/AdminNotification/Model/System/Message/Security.php index d31b4237f1ac8f4aa7d6355864b7e064ace9119f..0b4b6861b3408b760837d6db1ad17cf935c883a0 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Security.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Security.php @@ -54,7 +54,7 @@ class Security implements \Magento\AdminNotification\Model\System\MessageInterfa protected $_backendConfig; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -66,13 +66,13 @@ class Security implements \Magento\AdminNotification\Model\System\MessageInterfa /** * @param \Magento\App\CacheInterface $cache * @param \Magento\Backend\App\ConfigInterface $backendConfig - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\HTTP\Adapter\CurlFactory $curlFactory */ public function __construct( \Magento\App\CacheInterface $cache, \Magento\Backend\App\ConfigInterface $backendConfig, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\HTTP\Adapter\CurlFactory $curlFactory ) { $this->_cache = $cache; @@ -108,7 +108,7 @@ class Security implements \Magento\AdminNotification\Model\System\MessageInterfa */ private function _isFileAccessible() { - $unsecureBaseURL = $this->_config->getValue(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default'); + $unsecureBaseURL = $this->_config->getValue(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default'); /** @var $http \Magento\HTTP\Adapter\Curl */ $http = $this->_curlFactory->create(); diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/di.xml b/app/code/Magento/AdminNotification/etc/adminhtml/di.xml index e99780fbc95b436a90a1f3b2c1e7d9e300fffb23..833f39912e9314313eaac3ba783ced4813216fe2 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/di.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/di.xml @@ -36,4 +36,11 @@ </argument> </arguments> </type> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="adminnotification" xsi:type="string">Magento_AdminNotification</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index ec72a95860892e5626b35ed8d74e47ce68c64a14..f70d9dab760e923d645aacd821791042eb6bb7ad 100644 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_AdminNotification" version="2.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Theme"/> diff --git a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php index 65bd8bf53a593fa4662a18f56da50300ea7e909e..076d14fb56326c8fbf3452c96de0c74c9af93572 100644 --- a/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php +++ b/app/code/Magento/AdminNotification/sql/adminnotification_setup/install-1.6.0.0.php @@ -32,7 +32,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); /** diff --git a/app/code/Magento/AdminNotification/sql/adminnotification_setup/upgrade-1.6.0.0-2.0.0.0.php b/app/code/Magento/AdminNotification/sql/adminnotification_setup/upgrade-1.6.0.0-2.0.0.0.php index 1844643ec282e2ae19d097f6e7562ab291353b13..08049ba1080bcf95966c15b1457c1150b7fc99e0 100644 --- a/app/code/Magento/AdminNotification/sql/adminnotification_setup/upgrade-1.6.0.0-2.0.0.0.php +++ b/app/code/Magento/AdminNotification/sql/adminnotification_setup/upgrade-1.6.0.0-2.0.0.0.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); /** diff --git a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml index 124d63f3f1b824eaacdceb51b57c0a8ecdc4c42f..7c7dbf54fa7b43b3070ad20af536818a91e53a74 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml +++ b/app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml @@ -29,9 +29,9 @@ <block class="Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup" name="unread_system_messages" as="unread_system_messages" after="system_messages" template="Magento_AdminNotification::system/messages/popup.phtml"/> <block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/> </referenceContainer> - <referenceBlock name="header"> - <block class="Magento\AdminNotification\Block\ToolbarEntry" template="toolbar_entry.phtml" before="-"/> - </referenceBlock> + <referenceContainer name="header"> + <block class="Magento\AdminNotification\Block\ToolbarEntry" template="toolbar_entry.phtml" /> + </referenceContainer> <referenceBlock name="head"> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminnotification-toolbar-entry-js" after="jquery-jquery-js"> <arguments> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.js b/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.js index a1327b2476c6c051e2cb003c9c6de7e4d16b7e5d..a12271564c345698e7b4791ea75bfefa109a6fb0 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.js +++ b/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.js @@ -28,7 +28,7 @@ $(document).ready(function() { // Mark notification as read via AJAX call var markNotificationAsRead = function(notificationId) { - var requestUrl = $('.notifications .dropdown-menu').attr('data-mark-as-read-url'); + var requestUrl = $('.notifications-summary .dropdown-menu').attr('data-mark-as-read-url'); $.ajax({ url: requestUrl, type: 'POST', @@ -39,36 +39,36 @@ showLoader: false }); }; - var notificationCount = $('.notifications').attr('data-notification-count'); + var notificationCount = $('.notifications-summary').attr('data-notification-count'); // Remove notification from the list var removeNotificationFromList = function(notificationEntry) { notificationEntry.remove(); notificationCount--; - $('.notifications').attr('data-notification-count', notificationCount); + $('.notifications-summary').attr('data-notification-count', notificationCount); if (notificationCount == 0) { // Change appearance of the bubble and its behavior when the last notification is removed - $('.notifications .dropdown-menu').remove(); - var notificationIcon = $('.notifications .notifications-icon'); + $('.notifications-summary .dropdown-menu').remove(); + var notificationIcon = $('.notifications-summary .notifications-icon'); notificationIcon.removeAttr('data-toggle'); notificationIcon.off('click.dropdown'); - $('.notifications .notifications-icon .value').text(''); - $('.notifications .notifications-icon .value').hide(); + $('.notifications-action .counter').text(''); + $('.notifications-action .counter').hide(); } else { - $('.notifications .notifications-icon .value').text(notificationCount); + $('.notifications-action .counter').text(notificationCount); // Modify caption of the 'See All' link - var actionElement = $('.notifications .dropdown-menu .last .action-more'); + var actionElement = $('.notifications-summary .dropdown-menu .last .action-more'); actionElement.text(actionElement.text().replace(/\d+/, notificationCount)); } }; // Show popup with notification details var showNotificationDetails = function(notificationEntry) { - var popupElement = notificationEntry.find('.notification-dialog-content').clone(); + var popupElement = notificationEntry.find('.notifications-dialog-content').clone(); var notificationId = notificationEntry.attr('data-notification-id'); - var dialogClassSeverity = 'notification-entry-dialog'; + var dialogClassSeverity = 'notifications-entry-dialog'; if (notificationEntry.attr('data-notification-severity')) { - dialogClassSeverity = 'notification-entry-dialog notification-entry-dialog-critical'; + dialogClassSeverity = 'notifications-entry-dialog notifications-entry-dialog-critical'; } popupElement.dialog({ title: popupElement.attr('data-title'), @@ -99,16 +99,16 @@ }; // Show notification description when corresponding item is clicked - $('.notifications .dropdown-menu .notification-entry').on('click.showNotification', function(event) { + $('.notifications-summary .dropdown-menu .notifications-entry').on('click.showNotification', function(event) { // hide notification dropdown - $('.notifications .notifications-icon').trigger('click.dropdown'); + $('.notifications-summary .notifications-icon').trigger('click.dropdown'); showNotificationDetails($(this)); event.stopPropagation(); }); // Remove corresponding notification from the list and mark it as read - $('.notifications .dropdown-menu .notification-entry .action-close').on('click.removeNotification', function(event) { - var notificationEntry = $(this).closest('.notification-entry') + $('.notifications-close').on('click.removeNotification', function(event) { + var notificationEntry = $(this).closest('.notifications-entry') var notificationId = notificationEntry.attr('data-notification-id'); markNotificationAsRead(notificationId); removeNotificationFromList(notificationEntry); @@ -117,9 +117,9 @@ // Hide notifications bubble if (notificationCount == 0) { - $('.notifications .notifications-icon .value').hide(); + $('.notifications-action .counter').hide(); } else { - $('.notifications .notifications-icon .value').show(); + $('.notifications-action .counter').show(); } }); })(window.jQuery); diff --git a/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.phtml index b94db072282b47c2b567e0ed4ad66e5f1b54e06a..71f33e8913f4638da2f9f9521524dffc6b09e7c6 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/toolbar_entry.phtml @@ -26,38 +26,39 @@ ?> <?php /** @var $this \Magento\AdminNotification\Block\ToolbarEntry */ ?> <?php $notificationCount = $this->getUnreadNotificationCount(); ?> -<div class="notifications" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>"> +<div class="notifications-summary" data-notification-count="<?php echo $this->escapeHtml($notificationCount); ?>"> <?php if ($notificationCount > 0) : ?> - <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="notifications-icon" title="<?php echo __('Notifications'); ?>" data-toggle="dropdown"> - <span class="value"><?php echo $this->escapeHtml($notificationCount); ?></span> + <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="action notifications-action" title="<?php echo __('Notifications'); ?>" data-toggle="dropdown"> + <span class="text"><?php echo __('Notifications'); ?></span> + <span class="counter qty"><?php echo $this->escapeHtml($notificationCount); ?></span> </a> - <ul class="dropdown-menu" data-mark-as-read-url="<?php echo $this->getUrl('adminhtml/notification/ajaxMarkAsRead'); ?>"> + <ul class="dropdown-menu notifications-list" data-mark-as-read-url="<?php echo $this->getUrl('adminhtml/notification/ajaxMarkAsRead'); ?>"> <?php foreach ($this->getLatestUnreadNotifications() as $notification) : ?> <?php /** @var $notification \Magento\AdminNotification\Model\Inbox*/ ?> - <li class="notification-entry<?php if ($notification->getSeverity() == 1): ?> notification-critical<?php endif; ?>" + <li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>" data-notification-id="<?php echo $this->escapeHtml($notification->getId()); ?>" data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>"> - <strong><?php echo $this->escapeHtml($notification->getTitle()); ?></strong> - <span class="notification-description"><?php echo $this->escapeHtml($notification->getDescription()); ?></span> - <time><?php echo $this->escapeHtml($this->formatNotificationDate($notification->getDateAdded())); ?></time> - <button class="action-close"><?php echo __('Close'); ?></button> - <div class="notification-dialog-content" data-title="<?php echo __('Notification'); ?>" data-cancel-caption="<?php echo __('Cancel'); ?>" data-acknowledge-caption="<?php echo __('Acknowledge'); ?>"> - <strong><?php echo $this->escapeHtml($notification->getTitle()); ?></strong> - <span class="notification-description"><?php echo $this->escapeHtml($notification->getDescription()); ?></span> - <div class="actions"> - <a class="notification-url" href="<?php echo $this->escapeUrl($notification->getUrl()); ?>" target="_blank"><?php echo __('Read Details'); ?></a> + <strong class="notifications-entry-title"><?php echo $this->escapeHtml($notification->getTitle()); ?></strong> + <span class="notifications-entry-description"><?php echo $this->escapeHtml($notification->getDescription()); ?></span> + <time class="notifications-entry-time"><?php echo $this->escapeHtml($this->formatNotificationDate($notification->getDateAdded())); ?></time> + <button class="action close notifications-close"><span><?php echo __('Close'); ?></span></button> + <div class="notifications-dialog-content" data-title="<?php echo __('Notification'); ?>" data-cancel-caption="<?php echo __('Cancel'); ?>" data-acknowledge-caption="<?php echo __('Acknowledge'); ?>"> + <strong class="notifications-entry-title"><?php echo $this->escapeHtml($notification->getTitle()); ?></strong> + <span class="notifications-entry-description"><?php echo $this->escapeHtml($notification->getDescription()); ?></span> + <div class="actions notifications-entry-actions"> + <a class="notifications-url" href="<?php echo $this->escapeUrl($notification->getUrl()); ?>" target="_blank"><?php echo __('Read Details'); ?></a> </div> - <time><?php echo $this->escapeHtml($this->formatNotificationDate($notification->getDateAdded())); ?></time> + <time class="notifications-entry-time"><?php echo $this->escapeHtml($this->formatNotificationDate($notification->getDateAdded())); ?></time> </div> </li> <?php endforeach; ?> <li class="last"> - <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="action-more"><?php echo __('See All (%1 unread)', $notificationCount); ?></a> + <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="action more notification-more"><?php echo __('See All (%1 unread)', $notificationCount); ?></a> </li> </ul> <?php else : ?> - <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="notifications-icon" title="<?php echo __('Notifications'); ?>"> - <span class="value"></span> + <a href="<?php echo $this->getUrl('adminhtml/notification/index'); ?>" class="action notifications-action empty" title="<?php echo __('Notifications'); ?>"> + <span class="text"><?php echo __('Notifications'); ?></span> </a> <?php endif; ?> </div> diff --git a/app/code/Magento/Authorizenet/Helper/Backend.php b/app/code/Magento/Authorizenet/Helper/Backend.php index a35e66d6525c90f488a1aff86b53e923c1a7d92f..4909cc32432257d2f94a7362a2d6e779ced770d4 100644 --- a/app/code/Magento/Authorizenet/Helper/Backend.php +++ b/app/code/Magento/Authorizenet/Helper/Backend.php @@ -32,13 +32,13 @@ class Backend extends Data { /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Backend\Model\UrlInterface $backendUrl */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Backend\Model\UrlInterface $backendUrl ) { diff --git a/app/code/Magento/Authorizenet/Helper/Data.php b/app/code/Magento/Authorizenet/Helper/Data.php index a96f459a35f263d1803f797fa3c016f25ac1fca8..9b7fb737ccd8f52b3998e8929703e7edc704ac2d 100644 --- a/app/code/Magento/Authorizenet/Helper/Data.php +++ b/app/code/Magento/Authorizenet/Helper/Data.php @@ -31,7 +31,7 @@ namespace Magento\Authorizenet\Helper; class Data extends \Magento\App\Helper\AbstractHelper implements HelperInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -42,12 +42,12 @@ class Data extends \Magento\App\Helper\AbstractHelper implements HelperInterface /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\OrderFactory $orderFactory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\OrderFactory $orderFactory ) { parent::__construct($context); diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index 04ac998df3aaa3a3ff9bf2ebc00930c073b53235..4dea7bf1e30409ef51dba9aad2d69c939067822d 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -314,7 +314,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList @@ -333,7 +333,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, @@ -356,7 +356,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index fb2ced68a254f624ac951bf1e8f8420cadd5afff..3b4c40502256f90371615f278ef4d2f330cd281f 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -71,7 +71,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet /**#@-*/ /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -93,7 +93,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList @@ -105,7 +105,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Authorizenet\Helper\Data $authorizenetData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory * @param \Magento\Authorizenet\Model\Directpost\Response $response @@ -117,7 +117,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, @@ -129,7 +129,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Session\SessionManagerInterface $session, \Magento\Authorizenet\Helper\Data $authorizenetData, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory, \Magento\Authorizenet\Model\Directpost\Response $response, @@ -139,7 +139,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php index 0cf3d64840677ba598ae52d4c8256c03b1e966a3..286c3c29981a4130a485144c0acce7006e54dc19 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php @@ -64,7 +64,7 @@ class Observer protected $_session; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -74,7 +74,7 @@ class Observer * @param \Magento\Registry $coreRegistry * @param \Magento\Authorizenet\Model\Directpost $payment * @param \Magento\Authorizenet\Model\Directpost\Session $session - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Authorizenet\Helper\Data $authorizenetData, @@ -82,7 +82,7 @@ class Observer \Magento\Registry $coreRegistry, \Magento\Authorizenet\Model\Directpost $payment, \Magento\Authorizenet\Model\Directpost\Session $session, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_coreRegistry = $coreRegistry; $this->_authorizenetData = $authorizenetData; diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Session.php b/app/code/Magento/Authorizenet/Model/Directpost/Session.php index 659cab1f0ddedab382c3247b2a8e5df3b1a30b89..59d0884644c79763655619d171b4e9d9d72ae82e 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Session.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Session.php @@ -31,7 +31,7 @@ namespace Magento\Authorizenet\Model\Directpost; class Session extends \Magento\Session\SessionManager { /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -41,7 +41,7 @@ class Session extends \Magento\Session\SessionManager * @internal param array $data */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml index 30827b5f82e2c003f29d46d58b8c352fef34562c..2a1baabe9f32e1df2e52443095482172f5cafd17 100644 --- a/app/code/Magento/Authorizenet/etc/module.xml +++ b/app/code/Magento/Authorizenet/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Checkout"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Sales"/> <module name="Magento_Checkout"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Authz/Service/AuthorizationV1.php b/app/code/Magento/Authz/Service/AuthorizationV1.php index 85560afb42a0e9cf5fb1678f5900e32c265581e3..a2c4a65b594f09c4722127e9e737253ab5354f81 100644 --- a/app/code/Magento/Authz/Service/AuthorizationV1.php +++ b/app/code/Magento/Authz/Service/AuthorizationV1.php @@ -27,8 +27,8 @@ use Magento\Acl\Builder as AclBuilder; use Magento\Acl; use Magento\Authz\Model\UserIdentifier; use Magento\Logger; -use Magento\Service\Exception as ServiceException; -use Magento\Service\ResourceNotFoundException; +use Magento\Webapi\ServiceException as ServiceException; +use Magento\Webapi\ServiceResourceNotFoundException; use Magento\User\Model\Resource\Role\CollectionFactory as RoleCollectionFactory; use Magento\User\Model\Resource\Rules\CollectionFactory as RulesCollectionFactory; use Magento\User\Model\Role; @@ -126,7 +126,7 @@ class AuthorizationV1 implements AuthorizationV1Interface try { $role = $this->_getUserRole($userIdentifier); if (!$role) { - throw new ResourceNotFoundException( + throw new ServiceResourceNotFoundException( __( 'Role for user with ID "%1" and user type "%2" cannot be found.', $userIdentifier->getUserId(), diff --git a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php b/app/code/Magento/Authz/Service/AuthorizationV1Interface.php index dba4b3e1ac766b82858f41b227e69ab38fa31e9e..22769fa794db335cffedb00dcd6a1fd55b2cc39d 100644 --- a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php +++ b/app/code/Magento/Authz/Service/AuthorizationV1Interface.php @@ -24,7 +24,7 @@ namespace Magento\Authz\Service; use Magento\Authz\Model\UserIdentifier; -use Magento\Service\Exception as ServiceException; +use Magento\Webapi\ServiceException as ServiceException; /** * Authorization service interface. diff --git a/app/code/Magento/Authz/etc/module.xml b/app/code/Magento/Authz/etc/module.xml index 1e2d85488113d8ebe6b50b5490ea7014a2e78353..9c997c43014d5d5ad39806b2306e6d854d28b856 100644 --- a/app/code/Magento/Authz/etc/module.xml +++ b/app/code/Magento/Authz/etc/module.xml @@ -29,7 +29,7 @@ <!--TODO: Dependency on Magento_User is temporary and should be eliminated when ACL is made global--> <module name="Magento_User"/> <module name="Magento_Backend"/> - <module name="Magento_Service"/> + <module name="Magento_Webapi"/> </depends> </module> </config> diff --git a/app/code/Magento/Backend/App/Config.php b/app/code/Magento/Backend/App/Config.php index 506195f5c987cd525e3a99f336490b7f94b10223..65946410642405e828bd34f381e07e5124ad6dea 100644 --- a/app/code/Magento/Backend/App/Config.php +++ b/app/code/Magento/Backend/App/Config.php @@ -51,7 +51,7 @@ class Config implements ConfigInterface */ public function getValue($path) { - return $this->_scopePool->getScope('default', null)->getValue($path); + return $this->_scopePool->getScope(\Magento\App\ScopeInterface::SCOPE_DEFAULT, null)->getValue($path); } /** @@ -63,17 +63,7 @@ class Config implements ConfigInterface */ public function setValue($path, $value) { - $this->_scopePool->getScope('default', null)->setValue($path, $value); - } - - /** - * Reinitialize configuration - * - * @return void - */ - public function reinit() - { - $this->_scopePool->clean(); + $this->_scopePool->getScope(\Magento\App\ScopeInterface::SCOPE_DEFAULT, null)->setValue($path, $value); } /** @@ -84,6 +74,6 @@ class Config implements ConfigInterface */ public function isSetFlag($path) { - return !!$this->_scopePool->getScope('default', null)->getValue($path); + return !!$this->_scopePool->getScope(\Magento\App\ScopeInterface::SCOPE_DEFAULT, null)->getValue($path); } } diff --git a/app/code/Magento/Backend/App/ConfigInterface.php b/app/code/Magento/Backend/App/ConfigInterface.php index 0b124e5a1fb808d8cf9ac75eed1222a72f431037..fe642439a366d5393aaa21b2e565cd66306351f6 100644 --- a/app/code/Magento/Backend/App/ConfigInterface.php +++ b/app/code/Magento/Backend/App/ConfigInterface.php @@ -47,13 +47,6 @@ interface ConfigInterface */ public function setValue($path, $value); - /** - * Reinitialize config object - * - * @return void - */ - public function reinit(); - /** * Retrieve config flag * diff --git a/app/code/Magento/Backend/App/Request/PathInfoProcessor.php b/app/code/Magento/Backend/App/Request/PathInfoProcessor.php index 13745a7473dbc4bf2c49f8ead89b6b18b6616aa7..27760b6527729e19f5bcade67bef2603baa269e0 100644 --- a/app/code/Magento/Backend/App/Request/PathInfoProcessor.php +++ b/app/code/Magento/Backend/App/Request/PathInfoProcessor.php @@ -33,16 +33,16 @@ class PathInfoProcessor implements \Magento\App\Request\PathInfoProcessorInterfa private $_helper; /** - * @var \Magento\Core\App\Request\PathInfoProcessor + * @var \Magento\Store\App\Request\PathInfoProcessor */ private $_subject; /** - * @param \Magento\Core\App\Request\PathInfoProcessor $subject + * @param \Magento\Store\App\Request\PathInfoProcessor $subject * @param \Magento\Backend\Helper\Data $helper */ public function __construct( - \Magento\Core\App\Request\PathInfoProcessor $subject, + \Magento\Store\App\Request\PathInfoProcessor $subject, \Magento\Backend\Helper\Data $helper ) { $this->_helper = $helper; diff --git a/app/code/Magento/Backend/App/Router/DefaultRouter.php b/app/code/Magento/Backend/App/Router/DefaultRouter.php index 8c234f0454dea0a7b5c91a0e085f36115076c4a1..ba6ca3306d7e3fe59f82e221953b53d908d88940 100644 --- a/app/code/Magento/Backend/App/Router/DefaultRouter.php +++ b/app/code/Magento/Backend/App/Router/DefaultRouter.php @@ -39,7 +39,7 @@ class DefaultRouter extends \Magento\Core\App\Router\Base protected $_url; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -58,11 +58,11 @@ class DefaultRouter extends \Magento\Core\App\Router\Base * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\State $appState * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo * @param string $routerId - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Backend\App\ConfigInterface $backendConfig * @param \Magento\Code\NameBuilder $nameBuilder * @@ -75,12 +75,12 @@ class DefaultRouter extends \Magento\Core\App\Router\Base \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\State $appState, \Magento\UrlInterface $url, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Url\SecurityInfoInterface $urlSecurityInfo, $routerId, \Magento\Code\NameBuilder $nameBuilder, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Backend\App\ConfigInterface $backendConfig ) { parent::__construct( @@ -91,7 +91,7 @@ class DefaultRouter extends \Magento\Core\App\Router\Base $appState, $url, $storeManager, - $storeConfig, + $scopeConfig, $urlSecurityInfo, $routerId, $nameBuilder diff --git a/app/code/Magento/Backend/Block/Cache.php b/app/code/Magento/Backend/Block/Cache.php index da9c525623945f6a021a23fb4c8aac1c8a43a4e3..8b6c9cad6f81b57da5f27823ff25f81af43a8ce0 100644 --- a/app/code/Magento/Backend/Block/Cache.php +++ b/app/code/Magento/Backend/Block/Cache.php @@ -43,7 +43,7 @@ class Cache extends \Magento\Backend\Block\Widget\Grid\Container array( 'label' => __('Flush Magento Cache'), 'onclick' => 'setLocation(\'' . $this->getFlushSystemUrl() . '\')', - 'class' => 'delete' + 'class' => 'primary flush-cache-magento' ) ); @@ -53,7 +53,7 @@ class Cache extends \Magento\Backend\Block\Widget\Grid\Container array( 'label' => __('Flush Cache Storage'), 'onclick' => 'confirmSetLocation(\'' . $message . '\', \'' . $this->getFlushStorageUrl() . '\')', - 'class' => 'delete' + 'class' => 'flush-cache-storage' ) ); } diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index 235f2f10913c8b5e0a97624de7db995a73970192..e2d11aae32e4cc7b913ac3fedac090703e651f97 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -47,7 +47,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\DesignInterface $design * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -70,7 +70,7 @@ class Context extends \Magento\View\Element\Context \Magento\View\DesignInterface $design, \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -92,7 +92,7 @@ class Context extends \Magento\View\Element\Context $design, $session, $sidResolver, - $storeConfig, + $scopeConfig, $viewUrl, $viewConfig, $cacheState, diff --git a/app/code/Magento/Backend/Block/Dashboard.php b/app/code/Magento/Backend/Block/Dashboard.php index 2340fd9280423ee102a8f391eeebd069d5775be9..8140865b63af9c9ed7703ff7041d0723fa98c32b 100644 --- a/app/code/Magento/Backend/Block/Dashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard.php @@ -52,7 +52,7 @@ class Dashboard extends \Magento\Backend\Block\Template $this->addChild('topSearches', 'Magento\Backend\Block\Dashboard\Searches\Top'); - if ($this->_storeConfig->getConfig(self::XML_PATH_ENABLE_CHARTS)) { + if ($this->_scopeConfig->getValue(self::XML_PATH_ENABLE_CHARTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $block = $this->getLayout()->createBlock('Magento\Backend\Block\Dashboard\Diagrams'); } else { $block = $this->getLayout()->createBlock( diff --git a/app/code/Magento/Backend/Block/Dashboard/Bar.php b/app/code/Magento/Backend/Block/Dashboard/Bar.php index 8ea931654504c29063f17adfd57cf9e0c34c393c..b1b67c956e4fd8249eca56761caf0bb4fd739e80 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Bar.php +++ b/app/code/Magento/Backend/Block/Dashboard/Bar.php @@ -47,7 +47,7 @@ class Bar extends \Magento\Backend\Block\Dashboard\AbstractDashboard /** * @return array */ - protected function getTotals() + public function getTotals() { return $this->_totals; } diff --git a/app/code/Magento/Backend/Block/Dashboard/Graph.php b/app/code/Magento/Backend/Block/Dashboard/Graph.php index 634a0671d0983fc52f08ae87ae9ffe03b06d19f2..3f79191b59bd9e301d2a8acb8199ba3186275ba3 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Graph.php +++ b/app/code/Magento/Backend/Block/Dashboard/Graph.php @@ -86,14 +86,14 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard * * @var string */ - protected $_width = '587'; + protected $_width = '780'; /** * Chart height * * @var string */ - protected $_height = '300'; + protected $_height = '384'; /** * Google chart api data encoding @@ -213,9 +213,11 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard { $params = array( 'cht' => 'lc', - 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0', - 'chm' => 'B,f4d4b2,0,0,0', - 'chco' => 'db4814' + 'chf' => 'bg,s,ffffff', + 'chco' => 'ef672f', + 'chls' => '7', + 'chxs' => '0,676056,15,0,l,676056|1,676056,15,0,l,676056', + 'chm' => 'h,f2ebde,0,0:1:.1,1,-1' ); $this->_allSeries = $this->getRowsData($this->_dataRows); @@ -224,7 +226,10 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard $this->setAxisLabels($axis, $this->getRowsData($attr, true)); } - $timezoneLocal = $this->_storeConfig->getConfig($this->_localeDate->getDefaultTimezonePath()); + $timezoneLocal = $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); list($dateStart, $dateEnd) = $this->_collectionFactory->create()->getDateRange( $this->getDataHelper()->getParam('period'), @@ -270,10 +275,12 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard */ if (count($dates) > 8 && count($dates) < 15) { $c = 1; - } else if (count($dates) >= 15) { - $c = 2; } else { - $c = 0; + if (count($dates) >= 15) { + $c = 2; + } else { + $c = 0; + } } /** * skipping some x labels for good reading @@ -355,7 +362,6 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard $chartdata[] = $dataMissing . $dataDelimiter; } } - // END SIMPLE ENCODING } else { // EXTENDED ENCODING for ($j = 0; $j < sizeof($thisdataarray); $j++) { @@ -382,7 +388,6 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard $chartdata[] = $dataMissing . $dataDelimiter; } } - // ============= END EXTENDED ENCODING ============= } $chartdata[] = $dataSetdelimiter; } @@ -436,18 +441,6 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard $tmpstring = implode('|', $this->_axisLabels[$idx]); $valueBuffer[] = $indexid . ":|" . $tmpstring; - if (sizeof($this->_axisLabels[$idx]) > 1) { - $deltaX = 100 / (sizeof($this->_axisLabels[$idx]) - 1); - } else { - $deltaX = 100; - } - } else if ($idx == 'y') { - $valueBuffer[] = $indexid . ":|" . implode('|', $yLabels); - if (sizeof($yLabels) - 1) { - $deltaY = 100 / (sizeof($yLabels) - 1); - } else { - $deltaY = 100; - } } $indexid++; } @@ -457,10 +450,6 @@ class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard // chart size $params['chs'] = $this->getWidth() . 'x' . $this->getHeight(); - if (isset($deltaX) && isset($deltaY)) { - $params['chg'] = $deltaX . ',' . $deltaY . ',1,0'; - } - // return the encoded data if ($directUrl) { $p = array(); diff --git a/app/code/Magento/Backend/Block/Dashboard/Totals.php b/app/code/Magento/Backend/Block/Dashboard/Totals.php index ada89747531169bbe1caf96bef4490f60a710efe..ade17ef66738d654e49564f10dcc01338e9998c3 100644 --- a/app/code/Magento/Backend/Block/Dashboard/Totals.php +++ b/app/code/Magento/Backend/Block/Dashboard/Totals.php @@ -90,17 +90,21 @@ class Totals extends \Magento\Backend\Block\Dashboard\Bar if ($this->getRequest()->getParam('store')) { $collection->addFieldToFilter('store_id', $this->getRequest()->getParam('store')); - } else if ($this->getRequest()->getParam('website')) { - $storeIds = $this->_storeManager->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); - $collection->addFieldToFilter('store_id', array('in' => $storeIds)); - } else if ($this->getRequest()->getParam('group')) { - $storeIds = $this->_storeManager->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); - $collection->addFieldToFilter('store_id', array('in' => $storeIds)); - } elseif (!$collection->isLive()) { - $collection->addFieldToFilter( - 'store_id', - array('eq' => $this->_storeManager->getStore(\Magento\Core\Model\Store::ADMIN_CODE)->getId()) - ); + } else { + if ($this->getRequest()->getParam('website')) { + $storeIds = $this->_storeManager->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); + } else { + if ($this->getRequest()->getParam('group')) { + $storeIds = $this->_storeManager->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); + $collection->addFieldToFilter('store_id', array('in' => $storeIds)); + } elseif (!$collection->isLive()) { + $collection->addFieldToFilter( + 'store_id', + array('eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()) + ); + } + } } $collection->load(); diff --git a/app/code/Magento/Backend/Block/Page/Header.php b/app/code/Magento/Backend/Block/Page/Header.php index e5ecdc3ea589c9aa1e23443d0d101c3177e6fe83..76a00fb64c600ff7a7ddb9222fce73e28127fbc5 100644 --- a/app/code/Magento/Backend/Block/Page/Header.php +++ b/app/code/Magento/Backend/Block/Page/Header.php @@ -99,6 +99,6 @@ class Header extends \Magento\Backend\Block\Template */ public function displayNoscriptNotice() { - return $this->_storeConfig->getConfig('web/browser_capabilities/javascript'); + return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Backend/Block/Page/Locale.php b/app/code/Magento/Backend/Block/Page/Locale.php new file mode 100644 index 0000000000000000000000000000000000000000..41d5165c51b11dc236d1323c802d50c73718c936 --- /dev/null +++ b/app/code/Magento/Backend/Block/Page/Locale.php @@ -0,0 +1,110 @@ +<?php +/** + * Backend locale switcher block + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\Block\Page; + +class Locale extends \Magento\Backend\Block\Template +{ + /** + * Path to template file in theme + * + * @var string + */ + protected $_template = 'page/locale.phtml'; + + /** + * @var \Magento\Locale\ListsInterface + */ + protected $_localeLists; + + /** + * @var \Magento\Locale\ResolverInterface + */ + protected $_localeResolver; + + /** + * @var \Magento\Core\Helper\Url + */ + protected $_urlHelper; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Locale\ListsInterface $localeLists + * @param \Magento\Locale\ResolverInterface $localeResolver + * @param \Magento\Core\Helper\Url $urlHelper + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Locale\ListsInterface $localeLists, + \Magento\Locale\ResolverInterface $localeResolver, + \Magento\Core\Helper\Url $urlHelper, + array $data = array() + ) { + $this->_localeLists = $localeLists; + $this->_localeResolver = $localeResolver; + $this->_urlHelper = $urlHelper; + parent::__construct($context, $data); + } + + /** + * Prepare URL for change locale + * + * @return string + */ + public function getChangeLocaleUrl() + { + return $this->getUrl('adminhtml/index/changeLocale'); + } + + /** + * Prepare current URL for referer + * + * @return string + */ + public function getUrlForReferer() + { + return \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED . '/' . $this->_urlHelper->getEncodedUrl(); + } + + /** + * Retrieve locale select element + * + * @return string + */ + public function getLocaleSelect() + { + $html = $this->getLayout()->createBlock('Magento\View\Element\Html\Select') + ->setName('locale') + ->setId('interface_locale') + ->setTitle(__('Interface Language')) + ->setClass('select locale-switcher-select') + ->setValue($this->_localeResolver->getLocale()->__toString()) + ->setOptions($this->_localeLists->getTranslatedOptionLocales()) + ->getHtml(); + + return $html; + } +} diff --git a/app/code/Magento/Backend/Block/Page/Notices.php b/app/code/Magento/Backend/Block/Page/Notices.php index b67fade25eab4c29bf37b9f65bf36a84481fa499..9837ec92d33cd8d334ebd05c3d4b78ac200cb335 100644 --- a/app/code/Magento/Backend/Block/Page/Notices.php +++ b/app/code/Magento/Backend/Block/Page/Notices.php @@ -42,7 +42,7 @@ class Notices extends \Magento\Backend\Block\Template */ public function displayNoscriptNotice() { - return $this->_storeConfig->getConfig('web/browser_capabilities/javascript'); + return $this->_scopeConfig->getValue('web/browser_capabilities/javascript', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -52,6 +52,6 @@ class Notices extends \Magento\Backend\Block\Template */ public function displayDemoNotice() { - return $this->_storeConfig->getConfig('design/head/demonotice'); + return $this->_scopeConfig->getValue('design/head/demonotice', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php index 046da13141199df64358b96183e6d761ca182e08..344549318551708de9485d8a626eb70f58f5f4d5 100644 --- a/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php +++ b/app/code/Magento/Backend/Block/Page/System/Config/Robots/Reset.php @@ -39,24 +39,14 @@ class Reset extends \Magento\Backend\Block\System\Config\Form\Field */ const XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS = 'design/search_engine_robots/default_custom_instructions'; - /** - * Page robots - * - * @var \Magento\Theme\Helper\Robots - */ - protected $coreConfig; - /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\App\ConfigInterface $coreConfig * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\App\ConfigInterface $coreConfig, array $data = array() ) { - $this->coreConfig = $coreConfig; parent::__construct($context, $data); } @@ -78,7 +68,9 @@ class Reset extends \Magento\Backend\Block\System\Config\Form\Field */ public function getRobotsDefaultCustomInstructions() { - return trim((string)$this->coreConfig->getValue(self::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS, 'default')); + return trim((string)$this->_scopeConfig->getValue( + self::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS, \Magento\App\ScopeInterface::SCOPE_DEFAULT + )); } /** diff --git a/app/code/Magento/Backend/Block/Store/Switcher.php b/app/code/Magento/Backend/Block/Store/Switcher.php index 0b2a173451026389cb5e0d1a9e9631b021cea6bb..a79710eeaaccfa1cbe05b58564dd761a7b7f6891 100644 --- a/app/code/Magento/Backend/Block/Store/Switcher.php +++ b/app/code/Magento/Backend/Block/Store/Switcher.php @@ -44,16 +44,30 @@ class Switcher extends \Magento\Backend\Block\Template const HINT_URL = 'http://www.magentocommerce.com/knowledge-base/entry/understanding-store-scopes'; /** - * @var array + * Name of website variable + * + * @var string */ - protected $_storeIds; + protected $_defaultWebsiteVarName = 'website'; + + /** + * Name of store group variable + * + * @var string + */ + protected $_defaultStoreGroupVarName = 'group'; /** * Name of store variable * * @var string */ - protected $_storeVarName = 'store'; + protected $_defaultStoreVarName = 'store'; + + /** + * @var array + */ + protected $_storeIds; /** * Url for store switcher hint @@ -77,36 +91,36 @@ class Switcher extends \Magento\Backend\Block\Template /** * Website factory * - * @var \Magento\Core\Model\Website\Factory + * @var \Magento\Store\Model\Website\Factory */ protected $_websiteFactory; /** * Store Group Factory * - * @var \Magento\Core\Model\Store\Group\Factory + * @var \Magento\Store\Model\Group\Factory */ protected $_storeGroupFactory; /** * Store Factory * - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Website\Factory $websiteFactory - * @param \Magento\Core\Model\Store\Group\Factory $storeGroupFactory - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\Group\Factory $storeGroupFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Website\Factory $websiteFactory, - \Magento\Core\Model\Store\Group\Factory $storeGroupFactory, - \Magento\Core\Model\StoreFactory $storeFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\Group\Factory $storeGroupFactory, + \Magento\Store\Model\StoreFactory $storeFactory, array $data = array() ) { parent::__construct($context, $data); @@ -124,11 +138,23 @@ class Switcher extends \Magento\Backend\Block\Template $this->setUseConfirm(true); $this->setUseAjax(true); - $this->setDefaultStoreName(__('All Store Views')); + + $this->setShowManageStoresLink(0); + + if (!$this->hasData('switch_websites')) { + $this->setSwitchWebsites(false); + } + if (!$this->hasData('switch_store_groups')) { + $this->setSwitchStoreGroups(false); + } + if (!$this->hasData('switch_store_views')) { + $this->setSwitchStoreViews(true); + } + $this->setDefaultSelectionName(__('All Store Views')); } /** - * @return \Magento\Core\Model\Resource\Website\Collection + * @return \Magento\Store\Model\Resource\Website\Collection */ public function getWebsiteCollection() { @@ -145,7 +171,7 @@ class Switcher extends \Magento\Backend\Block\Template /** * Get websites * - * @return \Magento\Core\Model\Website[] + * @return \Magento\Store\Model\Website[] */ public function getWebsites() { @@ -161,12 +187,64 @@ class Switcher extends \Magento\Backend\Block\Template } /** - * @param int|\Magento\Core\Model\Website $website - * @return \Magento\Core\Model\Resource\Store\Group\Collection + * Check if can switch to websites + * + * @return bool + */ + public function isWebsiteSwitchEnabled() + { + return (bool)$this->getData('switch_websites'); + } + + /** + * @param string $varName + * @return $this + */ + public function setWebsiteVarName($varName) + { + $this->setData('website_var_name', $varName); + return $this; + } + + /** + * @return string + */ + public function getWebsiteVarName() + { + if ($this->hasData('website_var_name')) { + return (string)$this->getData('website_var_name'); + } else { + return (string)$this->_defaultWebsiteVarName; + } + } + + /** + * @param \Magento\Store\Model\Website $website + * @return bool + */ + public function isWebsiteSelected(\Magento\Store\Model\Website $website) + { + return $this->getWebsiteId() === $website->getId() && $this->getStoreId() === null; + } + + /** + * @return int|null + */ + public function getWebsiteId() + { + if (!$this->hasData('website_id')) { + $this->setData('website_id', $this->getRequest()->getParam($this->getWebsiteVarName())); + } + return $this->getData('website_id'); + } + + /** + * @param int|\Magento\Store\Model\Website $website + * @return \Magento\Store\Model\Resource\Group\Collection */ public function getGroupCollection($website) { - if (!$website instanceof \Magento\Core\Model\Website) { + if (!$website instanceof \Magento\Store\Model\Website) { $website = $this->_websiteFactory->create()->load($website); } return $website->getGroupCollection(); @@ -175,24 +253,76 @@ class Switcher extends \Magento\Backend\Block\Template /** * Get store groups for specified website * - * @param \Magento\Core\Model\Website|int $website + * @param \Magento\Store\Model\Website|int $website * @return array */ public function getStoreGroups($website) { - if (!$website instanceof \Magento\Core\Model\Website) { + if (!$website instanceof \Magento\Store\Model\Website) { $website = $this->_storeManager->getWebsite($website); } return $website->getGroups(); } /** - * @param \Magento\Core\Model\Store\Group|int $group - * @return \Magento\Core\Model\Resource\Store\Collection + * Check if can switch to store group + * + * @return bool + */ + public function isStoreGroupSwitchEnabled() + { + return (bool)$this->getData('switch_store_groups'); + } + + /** + * @param string $varName + * @return $this + */ + public function setStoreGroupVarName($varName) + { + $this->setData('store_group_var_name', $varName); + return $this; + } + + /** + * @return string + */ + public function getStoreGroupVarName() + { + if ($this->hasData('store_group_var_name')) { + return (string)$this->getData('store_group_var_name'); + } else { + return (string)$this->_defaultStoreGroupVarName; + } + } + + /** + * @param \Magento\Store\Model\Group $group + * @return bool + */ + public function isStoreGroupSelected(\Magento\Store\Model\Group $group) + { + return $this->getStoreGroupId() === $group->getId() && $this->getStoreGroupId() === null; + } + + /** + * @return int|null + */ + public function getStoreGroupId() + { + if (!$this->hasData('store_group_id')) { + $this->setData('store_group_id', $this->getRequest()->getParam($this->getStoreGroupVarName())); + } + return $this->getData('store_group_id'); + } + + /** + * @param \Magento\Store\Model\Group|int $group + * @return \Magento\Store\Model\Resource\Store\Collection */ public function getStoreCollection($group) { - if (!$group instanceof \Magento\Core\Model\Store\Group) { + if (!$group instanceof \Magento\Store\Model\Group) { $group = $this->_storeGroupFactory->create()->load($group); } $stores = $group->getStoreCollection(); @@ -206,12 +336,12 @@ class Switcher extends \Magento\Backend\Block\Template /** * Get store views for specified store group * - * @param \Magento\Core\Model\Store\Group|int $group - * @return \Magento\Core\Model\Store[] + * @param \Magento\Store\Model\Group|int $group + * @return \Magento\Store\Model\Store[] */ public function getStores($group) { - if (!$group instanceof \Magento\Core\Model\Store\Group) { + if (!$group instanceof \Magento\Store\Model\Group) { $group = $this->_storeManager->getGroup($group); } $stores = $group->getStores(); @@ -226,14 +356,33 @@ class Switcher extends \Magento\Backend\Block\Template } /** - * @return string + * @return int|null */ - public function getSwitchUrl() + public function getStoreId() { - if ($url = $this->getData('switch_url')) { - return $url; + if (!$this->hasData('store_id')) { + $this->setData('store_id', $this->getRequest()->getParam($this->getStoreVarName())); } - return $this->getUrl('*/*/*', array('_current' => true, $this->_storeVarName => null)); + return $this->getData('store_id'); + } + + /** + * @param \Magento\Store\Model\Store $store + * @return bool + */ + public function isStoreSelected(\Magento\Store\Model\Store $store) + { + return $this->getStoreId() !== null && (int)$this->getStoreId() === (int)$store->getId(); + } + + /** + * Check if can switch to store views + * + * @return bool + */ + public function isStoreSwitchEnabled() + { + return (bool)$this->getData('switch_store_views'); } /** @@ -242,32 +391,112 @@ class Switcher extends \Magento\Backend\Block\Template */ public function setStoreVarName($varName) { - $this->_storeVarName = $varName; + $this->setData('store_var_name', $varName); return $this; } /** - * Get current store + * @return mixed|string + */ + public function getStoreVarName() + { + if ($this->hasData('store_var_name')) { + return (string)$this->getData('store_var_name'); + } else { + return (string)$this->_defaultStoreVarName; + } + } + + /** + * @return string + */ + public function getSwitchUrl() + { + if ($url = $this->getData('switch_url')) { + return $url; + } + return $this->getUrl( + '*/*/*', + [ + '_current' => true, + $this->getStoreVarName() => null, + $this->getStoreGroupVarName() => null, + $this->getWebsiteVarName() => null, + ] + ); + } + + /** + * @return bool + */ + public function hasScopeSelected() + { + return $this->getStoreId() !== null || $this->getStoreGroupId() !== null || $this->getWebsiteId() !== null; + } + + /** + * Get current selection name * * @return string */ - public function getCurrentStoreName() + public function getCurrentSelectionName() { - $store = $this->_storeFactory->create(); - $store->load($this->getStoreId()); - if ($store->getId()) { - return $store->getName(); - } else { - return $this->getDefaultStoreName(); + if (!($name = $this->getCurrentStoreName())) { + if (!($name = $this->getCurrentStoreGroupName())) { + if (!($name = $this->getCurrentWebsiteName())) { + $name = $this->getDefaultSelectionName(); + } + } } + return $name; } /** - * @return int + * Get current website name + * + * @return string */ - public function getStoreId() + public function getCurrentWebsiteName() { - return $this->getRequest()->getParam($this->_storeVarName); + if ($this->getWebsiteId() !== null) { + $website = $this->_websiteFactory->create(); + $website->load($this->getWebsiteId()); + if ($website->getId()) { + return $website->getName(); + } + } + } + + /** + * Get current store group name + * + * @return string + */ + public function getCurrentStoreGroupName() + { + if ($this->getStoreGroupId() !== null) { + $group = $this->_storeGroupFactory->create(); + $group->load($this->getStoreGroupId()); + if ($group->getId()) { + return $group->getName(); + } + } + } + + /** + * Get current store view name + * + * @return string + */ + public function getCurrentStoreName() + { + if ($this->getStoreId() !== null) { + $store = $this->_storeFactory->create(); + $store->load($this->getStoreId()); + if ($store->getId()) { + return $store->getName(); + } + } } /** @@ -345,9 +574,9 @@ class Switcher extends \Magento\Backend\Block\Template $url ) . '"' . ' onclick="this.target=\'_blank\'"' . ' title="' . __( 'What is this?' - ) . '"' . ' class="link-store-scope">' . __( + ) . '"' . ' class="link-store-scope"><span>' . __( 'What is this?' - ) . '</a></span>' . ' </div>'; + ) . '</span></a></span>' . ' </div>'; } return $html; } diff --git a/app/code/Magento/Backend/Block/System/Config/Dwstree.php b/app/code/Magento/Backend/Block/System/Config/Dwstree.php index 54791aa7ea1a543481f4fdc18e6eeffca2f9bda3..ab13c3e2ecb40c9b855f2734f379680af6a83941 100644 --- a/app/code/Magento/Backend/Block/System/Config/Dwstree.php +++ b/app/code/Magento/Backend/Block/System/Config/Dwstree.php @@ -60,7 +60,7 @@ class Dwstree extends \Magento\Backend\Block\Widget\Tabs ) ); - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($this->_storeManager->getWebsites(true) as $website) { $wCode = $website->getCode(); $wName = $website->getName(); @@ -73,7 +73,7 @@ class Dwstree extends \Magento\Backend\Block\Widget\Tabs $this->_addBreadcrumb($wName); } } - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($website->getStores() as $store) { $sCode = $store->getCode(); $sName = $store->getName(); diff --git a/app/code/Magento/Backend/Block/System/Config/Edit.php b/app/code/Magento/Backend/Block/System/Config/Edit.php index 5be60469ddf034b163a88306d2eeee8c5d21f674..27023a62af53b87b9d560c49d2c55cfedb729605 100644 --- a/app/code/Magento/Backend/Block/System/Config/Edit.php +++ b/app/code/Magento/Backend/Block/System/Config/Edit.php @@ -91,7 +91,7 @@ class Edit extends \Magento\Backend\Block\Widget $this->setTitle($section->getLabel()); $this->setHeaderCss($section->getHeaderCss()); - $this->addChild( + $this->getToolbar()->addChild( 'save_button', 'Magento\Backend\Block\Widget\Button', array( diff --git a/app/code/Magento/Backend/Block/System/Config/Form.php b/app/code/Magento/Backend/Block/System/Config/Form.php index 8f7fe731554cb0c000ff34b3fb38c5152baeeaa5..4635bc1f0e97b26b772600d7173cc47728511510 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form.php +++ b/app/code/Magento/Backend/Block/System/Config/Form.php @@ -116,13 +116,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ protected $_fieldFactory; - /** - * Form field factory - * - * @var \Magento\App\ConfigInterface - */ - protected $_config; - /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry @@ -131,7 +124,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\Backend\Block\System\Config\Form\Fieldset\Factory $fieldsetFactory * @param \Magento\Backend\Block\System\Config\Form\Field\Factory $fieldFactory - * @param \Magento\App\ConfigInterface $coreConfig * @param array $data */ public function __construct( @@ -142,7 +134,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Model\Config\Structure $configStructure, \Magento\Backend\Block\System\Config\Form\Fieldset\Factory $fieldsetFactory, \Magento\Backend\Block\System\Config\Form\Field\Factory $fieldFactory, - \Magento\App\ConfigInterface $coreConfig, array $data = array() ) { parent::__construct($context, $registry, $formFactory, $data); @@ -150,7 +141,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $this->_configStructure = $configStructure; $this->_fieldsetFactory = $fieldsetFactory; $this->_fieldFactory = $fieldFactory; - $this->_config = $coreConfig; $this->_scopeLabels = array( self::SCOPE_DEFAULT => __('[GLOBAL]'), @@ -477,7 +467,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic */ public function getConfigValue($path) { - return $this->_config->getValue($path, $this->getScope(), $this->getScopeCode()); + return $this->_scopeConfig->getValue($path, $this->getScope(), $this->getScopeCode()); } /** diff --git a/app/code/Magento/Backend/Block/System/Config/Switcher.php b/app/code/Magento/Backend/Block/System/Config/Switcher.php index bafcd9194620cc9ecd4a5c17b502667cdd4a80d4..274d0e885ab5854979de5b2a39c8eabdd775e9f6 100644 --- a/app/code/Magento/Backend/Block/System/Config/Switcher.php +++ b/app/code/Magento/Backend/Block/System/Config/Switcher.php @@ -25,21 +25,26 @@ */ namespace Magento\Backend\Block\System\Config; +/** + * Class Switcher + * @package Magento\Backend\Block\System\Config + * @deprecated + */ class Switcher extends \Magento\Backend\Block\Template { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; @@ -91,8 +96,8 @@ class Switcher extends \Magento\Backend\Block\Template /** * Process website info * - * @param \Magento\Core\Model\System\Store $storeModel - * @param \Magento\Core\Model\Website $website + * @param \Magento\Store\Model\System\Store $storeModel + * @param \Magento\Store\Model\Website $website * @param string $section * @param string $curStore * @param string $curWebsite @@ -100,8 +105,8 @@ class Switcher extends \Magento\Backend\Block\Template * @return array */ protected function _processWebsite( - \Magento\Core\Model\System\Store $storeModel, - \Magento\Core\Model\Website $website, + \Magento\Store\Model\System\Store $storeModel, + \Magento\Store\Model\Website $website, $section, $curStore, $curWebsite, diff --git a/app/code/Magento/Backend/Block/System/Design.php b/app/code/Magento/Backend/Block/System/Design.php index dc3bbe0f1a6e5a223c7bdb625f671f63c5bfc297..00348970b4cac0f083ef789c1107631b58a41fb9 100644 --- a/app/code/Magento/Backend/Block/System/Design.php +++ b/app/code/Magento/Backend/Block/System/Design.php @@ -34,13 +34,13 @@ class Design extends \Magento\Backend\Block\Template { $this->setTemplate('Magento_Backend::system/design/index.phtml'); - $this->addChild( + $this->getToolbar()->addChild( 'add_new_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add Design Change'), 'onclick' => "setLocation('" . $this->getUrl('adminhtml/*/new') . "')", - 'class' => 'add' + 'class' => 'add primary add-design-change' ) ); diff --git a/app/code/Magento/Backend/Block/System/Design/Edit.php b/app/code/Magento/Backend/Block/System/Design/Edit.php index 8727b5dadf741365e8a5995634838c6c37a83afb..c5a476d5f3ccf2036f52566d3f83664bbb12d0e8 100644 --- a/app/code/Magento/Backend/Block/System/Design/Edit.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit.php @@ -68,7 +68,7 @@ class Edit extends \Magento\Backend\Block\Widget */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'back_button', 'Magento\Backend\Block\Widget\Button', array( @@ -78,27 +78,32 @@ class Edit extends \Magento\Backend\Block\Widget ) ); - $this->addChild( + if ($this->getDesignChangeId()) { + $this->getToolbar()->addChild( + 'delete_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Delete'), + 'onclick' => 'confirmSetLocation(\'' . __( + 'Are you sure?' + ) . '\', \'' . $this->getDeleteUrl() . '\')', + 'class' => 'delete' + ) + ); + } + + $this->getToolbar()->addChild( 'save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save'), - 'class' => 'save', + 'class' => 'save primary', 'data_attribute' => array( 'mage-init' => array('button' => array('event' => 'save', 'target' => '#design-edit-form')) ) ) ); - $this->addChild( - 'delete_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Delete'), - 'onclick' => 'confirmSetLocation(\'' . __('Are you sure?') . '\', \'' . $this->getDeleteUrl() . '\')', - 'class' => 'delete' - ) - ); return parent::_prepareLayout(); } diff --git a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php index 5cbbdee0559acbfdc6293a1d22061e0a63c75bc9..2582798da8f09577f9e379eba8d50e7a97431081 100644 --- a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php @@ -33,7 +33,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic protected $_labelFactory; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -42,7 +42,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\View\Design\Theme\LabelFactory $labelFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( @@ -50,7 +50,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\View\Design\Theme\LabelFactory $labelFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_labelFactory = $labelFactory; diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php index eb33604f39ef6e509f343f2368087c511a6d23f5..2573b7ee6c273c40b711534b60895babee3e7bb1 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Group.php @@ -42,12 +42,12 @@ class Group extends \Magento\Backend\Block\System\Store\Edit\AbstractForm protected $_category; /** - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; /** - * @var \Magento\Core\Model\Website\Factory + * @var \Magento\Store\Model\Website\Factory */ protected $_websiteFactory; @@ -56,8 +56,8 @@ class Group extends \Magento\Backend\Block\System\Store\Edit\AbstractForm * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Catalog\Model\Config\Source\Category $category - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\Core\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory * @param array $data */ public function __construct( @@ -65,8 +65,8 @@ class Group extends \Magento\Backend\Block\System\Store\Edit\AbstractForm \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Catalog\Model\Config\Source\Category $category, - \Magento\Core\Model\StoreFactory $storeFactory, - \Magento\Core\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\StoreFactory $storeFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, array $data = array() ) { $this->_category = $category; diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php index 45a3e75b38c9dabd652ea0bf89920561da130f87..cadd37eee18db23d1b20f20d2f23d8e0f52fabe4 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php @@ -37,12 +37,12 @@ namespace Magento\Backend\Block\System\Store\Edit\Form; class Store extends \Magento\Backend\Block\System\Store\Edit\AbstractForm { /** - * @var \Magento\Core\Model\Website\Factory + * @var \Magento\Store\Model\Website\Factory */ protected $_websiteFactory; /** - * @var \Magento\Core\Model\Store\Group\Factory + * @var \Magento\Store\Model\Group\Factory */ protected $_groupFactory; @@ -50,16 +50,16 @@ class Store extends \Magento\Backend\Block\System\Store\Edit\AbstractForm * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Store\Group\Factory $groupFactory - * @param \Magento\Core\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\Group\Factory $groupFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Store\Group\Factory $groupFactory, - \Magento\Core\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\Group\Factory $groupFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, array $data = array() ) { $this->_groupFactory = $groupFactory; diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php index 0f7bbd97ac738b274fd0944b422b5bc8dce156de..dfe0e4f01d73cc1f3c1b279c6954f5a84877a7fb 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php @@ -37,7 +37,7 @@ namespace Magento\Backend\Block\System\Store\Edit\Form; class Website extends \Magento\Backend\Block\System\Store\Edit\AbstractForm { /** - * @var \Magento\Core\Model\Store\GroupFactory + * @var \Magento\Store\Model\GroupFactory */ protected $_groupFactory; @@ -45,14 +45,14 @@ class Website extends \Magento\Backend\Block\System\Store\Edit\AbstractForm * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Store\GroupFactory $groupFactory + * @param \Magento\Store\Model\GroupFactory $groupFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Store\GroupFactory $groupFactory, + \Magento\Store\Model\GroupFactory $groupFactory, array $data = array() ) { $this->_groupFactory = $groupFactory; diff --git a/app/code/Magento/Backend/Block/System/Store/Store.php b/app/code/Magento/Backend/Block/System/Store/Store.php index 4e5cae867ce9d17df04da7cd1689f5fc62cff884..72d38eb32d8b94e07de72fedc5006bafbaacdf21 100644 --- a/app/code/Magento/Backend/Block/System/Store/Store.php +++ b/app/code/Magento/Backend/Block/System/Store/Store.php @@ -65,8 +65,9 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Container array( 'label' => __('Create Store'), 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/newGroup') . '\')', - 'class' => 'add' - ) + 'class' => 'add add-store' + ), + 1 ); /* Add Store button */ @@ -75,7 +76,7 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Container array( 'label' => __('Create Store View'), 'onclick' => 'setLocation(\'' . $this->getUrl('adminhtml/*/newStore') . '\')', - 'class' => 'add' + 'class' => 'add add-store-view' ) ); diff --git a/app/code/Magento/Backend/Block/System/Variable/Edit.php b/app/code/Magento/Backend/Block/System/Variable/Edit.php index ba222ed1ead9a6a00321568642c43a307b040057..dfc9a310bd3b8953ffed27b87d4695e16d3464f6 100644 --- a/app/code/Magento/Backend/Block/System/Variable/Edit.php +++ b/app/code/Magento/Backend/Block/System/Variable/Edit.php @@ -109,8 +109,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container { $formHtml = parent::getFormHtml(); if (!$this->_storeManager->isSingleStoreMode() && $this->getVariable()->getId()) { - $storeSwitcher = $this->getLayout()->createBlock('Magento\Backend\Block\Store\Switcher')->toHtml(); - $formHtml = $storeSwitcher . $formHtml; + $formHtml = $formHtml; } return $formHtml; } diff --git a/app/code/Magento/Backend/Block/Template.php b/app/code/Magento/Backend/Block/Template.php index 6e72d65ec20ee69de74be8121cf552d6b8c2466a..879f149a19c0258743b6660ada7499226329b9bf 100644 --- a/app/code/Magento/Backend/Block/Template.php +++ b/app/code/Magento/Backend/Block/Template.php @@ -96,7 +96,11 @@ class Template extends \Magento\View\Element\Template if ($moduleName === null) { $moduleName = $this->getModuleName(); } - return !$this->_storeConfig->getConfigFlag('advanced/modules_disable_output/' . $moduleName); + + return !$this->_scopeConfig->isSetFlag( + 'advanced/modules_disable_output/' . $moduleName, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -119,4 +123,14 @@ class Template extends \Magento\View\Element\Template $this->_eventManager->dispatch('adminhtml_block_html_before', array('block' => $this)); return parent::_toHtml(); } + + /** + * Return toolbar block instance + * + * @return bool|\Magento\View\Element\BlockInterface + */ + public function getToolbar() + { + return $this->getLayout()->getBlock('page.actions.toolbar'); + } } diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 7939d9d275b3e5f924aaacb8d947292424e43d1e..6d979e3b9cc7d56cef9a0fe738023c3cc03426eb 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -62,9 +62,9 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\TranslateInterface $translator * @param \Magento\App\CacheInterface $cache * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\Generic $session * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -77,7 +77,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Backend\Model\Session $backendSession * @param \Magento\Math\Random $mathRandom @@ -94,9 +94,9 @@ class Context extends \Magento\View\Element\Template\Context \Magento\TranslateInterface $translator, \Magento\App\CacheInterface $cache, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Session $session, + \Magento\Session\Generic $session, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -109,7 +109,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, \Magento\Math\Random $mathRandom, @@ -131,7 +131,7 @@ class Context extends \Magento\View\Element\Template\Context $design, $session, $sidResolver, - $storeConfig, + $scopeConfig, $viewUrl, $viewConfig, $cacheState, @@ -151,7 +151,7 @@ class Context extends \Magento\View\Element\Template\Context /** * Get store manager * - * @return \Magento\Core\Model\StoreManagerInterface + * @return \Magento\Store\Model\StoreManagerInterface */ public function getStoreManager() { diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php index bad9decfd39493203ced881d8f1be29218986bb7..3d62f8cf2896cfdd8dac328f85797300177f2c86 100644 --- a/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Catalog/Edit/Form.php @@ -67,7 +67,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form * @param \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory * @param \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory @@ -83,7 +83,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory, \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, @@ -173,7 +173,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form * Get catalog entity associated stores * * @return array - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ protected function _getEntityStores() { @@ -192,7 +192,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form } // @codingStandardsIgnoreStart if (!$entityStores) { - throw new \Magento\Core\Model\Store\Exception( + throw new \Magento\Store\Model\Exception( __( 'We can\'t set up a URL rewrite because the product you chose is not associated with a website.' ) @@ -202,7 +202,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form } elseif ($category->getId()) { $entityStores = (array)$category->getStoreIds(); if (!$entityStores) { - throw new \Magento\Core\Model\Store\Exception( + throw new \Magento\Store\Model\Exception( __( 'We can\'t set up a URL rewrite because the category your chose is not associated with a website.' ) diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php index 657d747c53e8105870d1e27ab3441f0cb150c8de..f4ebd00ac8658887781ef29d7a22fb522e7a1d08 100644 --- a/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/Form.php @@ -60,7 +60,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form * @param \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory * @param \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\Cms\Model\Page\UrlrewriteFactory $urlRewriteFactory * @param \Magento\Cms\Model\PageFactory $pageFactory @@ -75,7 +75,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory, \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\Cms\Model\Page\UrlrewriteFactory $urlRewriteFactory, \Magento\Cms\Model\PageFactory $pageFactory, @@ -148,7 +148,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form * Get catalog entity associated stores * * @return array - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ protected function _getEntityStores() { @@ -161,7 +161,7 @@ class Form extends \Magento\Backend\Block\Urlrewrite\Edit\Form $this->_requireStoresFilter = !in_array(0, $entityStores); if (!$entityStores) { - throw new \Magento\Core\Model\Store\Exception( + throw new \Magento\Store\Model\Exception( __('Chosen cms page does not associated with any website.') ); } diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Edit.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit.php index dc397d549d860fd6f9773f27b135122f12fcf8c3..b8b2474c26c67a0f30c2b9ed763cc6044cee9785 100644 --- a/app/code/Magento/Backend/Block/Urlrewrite/Edit.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Edit.php @@ -218,7 +218,7 @@ class Edit extends \Magento\Backend\Block\Widget\Container 'save', array( 'label' => __('Save'), - 'class' => 'save', + 'class' => 'save primary save-url-redirect', 'level' => -1, 'data_attribute' => array( 'mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form')) diff --git a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php index 5c00e1e87b489831351541111f7d0fe82c5a982e..4c5887dd15a3bb4bd0feb8e8bbd2750e5292cade 100644 --- a/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php +++ b/app/code/Magento/Backend/Block/Urlrewrite/Edit/Form.php @@ -68,7 +68,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_adminhtmlData = null; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -94,7 +94,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory * @param \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Backend\Helper\Data $adminhtmlData * @param array $data * @@ -107,7 +107,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\UrlRewrite\Model\UrlRewrite\TypeProviderFactory $typesFactory, \Magento\UrlRewrite\Model\UrlRewrite\OptionProviderFactory $optionFactory, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Backend\Helper\Data $adminhtmlData, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Container.php b/app/code/Magento/Backend/Block/Widget/Container.php index d47d4336a6668093d0f38d961008916f5801ac81..8dd542df3f9921d4175ed5b130bcd72a2079ab8d 100644 --- a/app/code/Magento/Backend/Block/Widget/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Container.php @@ -87,10 +87,10 @@ class Container extends \Magento\Backend\Block\Template * @param array $data * @param integer $level * @param integer $sortOrder - * @param string|null $region That button should be displayed in ('header', 'footer', null) + * @param string|null $region That button should be displayed in ('toolbar', 'header', 'footer', null) * @return $this */ - protected function _addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'header') + protected function _addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') { if (!isset($this->_buttons[$level])) { $this->_buttons[$level] = array(); @@ -118,10 +118,10 @@ class Container extends \Magento\Backend\Block\Template * @param array $data * @param integer $level * @param integer $sortOrder - * @param string|null $region That button should be displayed in ('header', 'footer', null) + * @param string|null $region That button should be displayed in ('toolbar', 'header', 'footer', null) * @return $this */ - public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'header') + public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') { return $this->_addButton($buttonId, $data, $level, $sortOrder, $region); } @@ -208,7 +208,14 @@ class Container extends \Magento\Backend\Block\Template foreach ($buttons as $buttonId => $data) { $childId = $this->_prepareButtonBlockId($buttonId); $blockClassName = isset($data['class_name']) ? $data['class_name'] : null; - $this->_addButtonChildBlock($childId, $blockClassName); + $block = $this->_getButtonChildBlock($childId, $blockClassName); + if (isset($data['name'])) { + $data['element_name'] = $data['name']; + } + if ($block) { + $block->setData($data); + $this->_getButtonParentBlock($data['region'])->setChild($childId, $block); + } } } return parent::_prepareLayout(); @@ -225,6 +232,27 @@ class Container extends \Magento\Backend\Block\Template return $buttonId . '_button'; } + /** + * Return button parent block. + * + * @param string $region + * @return \Magento\Backend\Block\Template + */ + protected function _getButtonParentBlock($region) + { + if (!$region || $region == 'header' || $region == 'footer') { + $parent = $this; + } elseif ($region == 'toolbar') { + $parent = $this->getLayout()->getBlock('page.actions.toolbar'); + } else { + $parent = $this->getLayout()->getBlock($region); + } + if ($parent) { + return $parent; + } + return $this; + } + /** * Adding child block with specified child's id. * @@ -232,14 +260,12 @@ class Container extends \Magento\Backend\Block\Template * @param null|string $blockClassName * @return \Magento\Backend\Block\Widget */ - protected function _addButtonChildBlock($childId, $blockClassName = null) + protected function _getButtonChildBlock($childId, $blockClassName = null) { if (null === $blockClassName) { $blockClassName = 'Magento\Backend\Block\Widget\Button'; } - $block = $this->getLayout()->createBlock($blockClassName, $this->getNameInLayout() . '-' . $childId); - $this->setChild($childId, $block); - return $block; + return $this->getLayout()->createBlock($blockClassName, $this->getNameInLayout() . '-' . $childId); } /** @@ -254,23 +280,11 @@ class Container extends \Magento\Backend\Block\Template foreach ($this->_buttons as $buttons) { $_buttons = $this->_sortButtons($buttons); foreach ($_buttons as $button) { - $buttonId = $button['id']; $data = $button['data']; if ($region && isset($data['region']) && $region != $data['region']) { continue; } - $childId = $this->_prepareButtonBlockId($buttonId); - $child = $this->getChildBlock($childId); - - if (!$child) { - $blockClassName = isset($data['class_name']) ? $data['class_name'] : null; - $child = $this->_addButtonChildBlock($childId, $blockClassName); - } - if (isset($data['name'])) { - $data['element_name'] = $data['name']; - } - $child->setData($data); - + $childId = $this->_prepareButtonBlockId($button['id']); $out .= $this->getChildHtml($childId); } } diff --git a/app/code/Magento/Backend/Block/Widget/Form/Container.php b/app/code/Magento/Backend/Block/Widget/Form/Container.php index da887970fe2f40b4ac78ab891561004f30397de6..85a223c88f0c189d3b3b60440d8f5a8bdde02426 100644 --- a/app/code/Magento/Backend/Block/Widget/Form/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Form/Container.php @@ -82,7 +82,7 @@ class Container extends \Magento\Backend\Block\Widget\Container ); $this->_addButton( 'reset', - array('label' => __('Reset'), 'onclick' => 'setLocation(window.location.href)'), + array('label' => __('Reset'), 'onclick' => 'setLocation(window.location.href)', 'class' => 'reset'), -1 ); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php index b11bf3d249647ad83bf76c0eed8e8f47e9988d7e..cc66b359a21348a6d9faeb4030787ff3326e3cc6 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php @@ -228,7 +228,12 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt $dateObj = $this->_localeDate->date(null, null, $locale, false); //set default timezone for store (admin) - $dateObj->setTimezone($this->_storeConfig->getConfig($this->_localeDate->getDefaultTimezonePath())); + $dateObj->setTimezone( + $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); //set beginning of day $dateObj->setHour(00); diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php index cf6b36c3459b56d085e8ecb4641148077a9bc3d6..1b90823bab02a5ff6d3a025d2ceea35c03b8184b 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php @@ -60,7 +60,12 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date $datetimeTo = $value['to']; //calculate end date considering timezone specification - $datetimeTo->setTimezone($this->_storeConfig->getConfig($this->_localeDate->getDefaultTimezonePath())); + $datetimeTo->setTimezone( + $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); $datetimeTo->addDay(1)->subSecond(1); $datetimeTo->setTimezone(\Magento\Stdlib\DateTime\TimezoneInterface::DEFAULT_TIMEZONE); } @@ -81,7 +86,12 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date $dateObj = $this->getLocaleDate()->date(null, null, $locale, false); //set default timezone for store (admin) - $dateObj->setTimezone($this->_storeConfig->getConfig($this->_localeDate->getDefaultTimezonePath())); + $dateObj->setTimezone( + $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); //set date with applying timezone of store $dateObj->set( @@ -120,32 +130,18 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date ); } - $html = '<div class="range" id="' . - $htmlId . - '_range"><div class="range-line date">' . - '<input type="text" name="' . - $this->_getHtmlName() . - '[from]" id="' . - $htmlId . - '_from"' . - ' value="' . - $this->getEscapedValue( - 'from' - ) . '" class="input-text no-changes" placeholder="' . __( + $html = + '<div class="range" id="' . $htmlId . '_range"><div class="range-line date">' . '<input type="text" name="' + . $this->_getHtmlName() . '[from]" id="' . $htmlId . '_from"' . ' value="' . $this->getEscapedValue('from') + . '" class="input-text no-changes" placeholder="' . __( 'From' ) . '" ' . $this->getUiId( 'filter', $this->_getHtmlName(), 'from' ) . '/>' . '</div>'; - $html .= '<div class="range-line date">' . - '<input type="text" name="' . - $this->_getHtmlName() . - '[to]" id="' . - $htmlId . - '_to"' . - ' value="' . - $this->getEscapedValue( + $html .= '<div class="range-line date">' . '<input type="text" name="' . $this->_getHtmlName() . '[to]" id="' + . $htmlId . '_to"' . ' value="' . $this->getEscapedValue( 'to' ) . '" class="input-text no-changes" placeholder="' . __( 'To' @@ -154,41 +150,21 @@ class Datetime extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Date $this->_getHtmlName(), 'to' ) . '/>' . '</div></div>'; - $html .= '<input type="hidden" name="' . - $this->_getHtmlName() . - '[locale]"' . - ' value="' . - $this->_localeResolver->getLocaleCode() . - '"/>'; + $html .= '<input type="hidden" name="' . $this->_getHtmlName() . '[locale]"' . ' value="' + . $this->_localeResolver->getLocaleCode() . '"/>'; $html .= '<script type="text/javascript"> (function( $ ) { - $("#' . - $htmlId . - '_range").dateRange({ - dateFormat: "' . - $format . - '", - timeFormat: "' . - $timeFormat . - '", - showsTime: ' . - ($this->getColumn()->getFilterTime() ? 'true' : 'false') . - ', - buttonImage: "' . - $this->getViewFileUrl( - 'images/grid-cal.gif' - ) . '", - buttonText: "' . $this->escapeHtml(__('Date selector')) . - '", + $("#' . $htmlId . '_range").dateRange({ + dateFormat: "' . $format . '", + timeFormat: "' . $timeFormat . '", + showsTime: ' . ($this->getColumn()->getFilterTime() ? 'true' : 'false') . ', + buttonImage: "' . $this->getViewFileUrl('images/grid-cal.gif') . '", + buttonText: "' . $this->escapeHtml(__('Date selector')) . '", from: { - id: "' . - $htmlId . - '_from" + id: "' . $htmlId . '_from" }, to: { - id: "' . - $htmlId . - '_to" + id: "' . $htmlId . '_to" } }) })(jQuery) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php index 522d1ae89bf20945ced6e2386506df702c551aa4..ad7ef82f61ec202433149795d160432f0f062d8f 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php @@ -24,7 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Store grid column filter */ @@ -33,20 +32,20 @@ namespace Magento\Backend\Block\Widget\Grid\Column\Filter; class Store extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** * @param \Magento\Backend\Block\Context $context * @param \Magento\DB\Helper $resourceHelper - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\DB\Helper $resourceHelper, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php index 29aa72bf2265472cf88bf7e45c37677eff03cdb3..4adbdd42a701dac18c6979bf5062e181a5008166 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Currency.php @@ -49,7 +49,7 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * Application object * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -70,19 +70,17 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\App\ConfigInterface $config * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\App\ConfigInterface $config, \Magento\Locale\CurrencyInterface $localeCurrency, array $data = array() ) { @@ -90,7 +88,10 @@ class Currency extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra $this->_storeManager = $storeManager; $this->_currencyLocator = $currencyLocator; $this->_localeCurrency = $localeCurrency; - $baseCurrencyCode = $config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); + $baseCurrencyCode = $this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); $this->_baseCurrency = $currencyFactory->create()->load($baseCurrencyCode); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php index c65c96ccceef24f1ff3502ec12efa86da7b99da9..52597b93f11f976024aa621b5f6b77e7f2685270 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Store.php @@ -41,18 +41,18 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR protected $_skipEmptyStoresLabel = false; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; @@ -62,7 +62,7 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Retrieve System Store model * - * @return \Magento\Core\Model\System\Store + * @return \Magento\Store\Model\System\Store */ protected function _getStoreModel() { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Container.php b/app/code/Magento/Backend/Block/Widget/Grid/Container.php index ba9ed9b29db301f6ae83d806a0b001efed4e7263..b43691bed235933533ae56e913d7912be33f5b26 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Container.php @@ -167,7 +167,7 @@ class Container extends \Magento\Backend\Block\Widget\Container array( 'label' => $this->getAddButtonLabel(), 'onclick' => 'setLocation(\'' . $this->getCreateUrl() . '\')', - 'class' => 'add' + 'class' => 'add primary' ) ); } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Index.php b/app/code/Magento/Backend/Controller/Adminhtml/Index.php index 7c0fc3c3bbe9c06c2dce4448bd8407fb59e18fd0..47f251cee745d4f86ad419ec1a3fa79f7afb05a3 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Index.php @@ -106,6 +106,16 @@ class Index extends AbstractAction $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($items)); } + /** + * Change locale action + * + * @return void + */ + public function changeLocaleAction() + { + $this->getResponse()->setRedirect($this->_redirect->getRefererUrl()); + } + /** * Check if user has permissions to access this controller * diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php index f04ec6a0b72f0de7c7bbc297ac4dccb9c77068bd..6da10497e8319865ff7ce82a93a12954b8967656 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php @@ -38,7 +38,7 @@ class Config extends AbstractConfig protected $_fileFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -46,13 +46,13 @@ class Config extends AbstractConfig * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\App\Response\Http\FileFactory $fileFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Backend\Model\Config\Structure $configStructure, \Magento\App\Response\Http\FileFactory $fileFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; $this->_fileFactory = $fileFactory; diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index ae50f92d7144dad859f4dbd56dbf11a89194b58a..a81106f3b54e0fe424479322d0dce3b09ba42833 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -162,21 +162,21 @@ class Store extends Action switch ($this->_coreRegistry->registry('store_type')) { case 'website': $itemId = $this->getRequest()->getParam('website_id', null); - $model = $this->_objectManager->create('Magento\Core\Model\Website'); + $model = $this->_objectManager->create('Magento\Store\Model\Website'); $title = __("Web Site"); $notExists = __("The website does not exist."); $codeBase = __('Before modifying the website code please make sure that it is not used in index.php.'); break; case 'group': $itemId = $this->getRequest()->getParam('group_id', null); - $model = $this->_objectManager->create('Magento\Core\Model\Store\Group'); + $model = $this->_objectManager->create('Magento\Store\Model\Group'); $title = __("Store"); $notExists = __("The store does not exist"); $codeBase = false; break; case 'store': $itemId = $this->getRequest()->getParam('store_id', null); - $model = $this->_objectManager->create('Magento\Core\Model\Store'); + $model = $this->_objectManager->create('Magento\Store\Model\Store'); $title = __("Store View"); $notExists = __("Store view doesn't exist"); $codeBase = __( @@ -228,7 +228,7 @@ class Store extends Action switch ($postData['store_type']) { case 'website': $postData['website']['name'] = $this->filterManager->removeTags($postData['website']['name']); - $websiteModel = $this->_objectManager->create('Magento\Core\Model\Website'); + $websiteModel = $this->_objectManager->create('Magento\Store\Model\Website'); if ($postData['website']['website_id']) { $websiteModel->load($postData['website']['website_id']); } @@ -243,7 +243,7 @@ class Store extends Action case 'group': $postData['group']['name'] = $this->filterManager->removeTags($postData['group']['name']); - $groupModel = $this->_objectManager->create('Magento\Core\Model\Store\Group'); + $groupModel = $this->_objectManager->create('Magento\Store\Model\Group'); if ($postData['group']['group_id']) { $groupModel->load($postData['group']['group_id']); } @@ -261,7 +261,7 @@ class Store extends Action case 'store': $eventName = 'store_edit'; - $storeModel = $this->_objectManager->create('Magento\Core\Model\Store'); + $storeModel = $this->_objectManager->create('Magento\Store\Model\Store'); $postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']); if ($postData['store']['store_id']) { $storeModel->load($postData['store']['store_id']); @@ -272,14 +272,14 @@ class Store extends Action $eventName = 'store_add'; } $groupModel = $this->_objectManager->create( - 'Magento\Core\Model\Store\Group' + 'Magento\Store\Model\Group' )->load( $storeModel->getGroupId() ); $storeModel->setWebsiteId($groupModel->getWebsiteId()); $storeModel->save(); - $this->_objectManager->get('Magento\Core\Model\StoreManager')->reinitStores(); + $this->_objectManager->get('Magento\Store\Model\StoreManager')->reinitStores(); $this->_eventManager->dispatch($eventName, array('store' => $storeModel)); @@ -315,7 +315,7 @@ class Store extends Action $this->_title->add(__('Delete Web Site')); $itemId = $this->getRequest()->getParam('item_id', null); - if (!($model = $this->_objectManager->create('Magento\Core\Model\Website')->load($itemId))) { + if (!($model = $this->_objectManager->create('Magento\Store\Model\Website')->load($itemId))) { $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return; @@ -355,7 +355,7 @@ class Store extends Action $this->_title->add(__('Delete Store')); $itemId = $this->getRequest()->getParam('item_id', null); - if (!($model = $this->_objectManager->create('Magento\Core\Model\Store\Group')->load($itemId))) { + if (!($model = $this->_objectManager->create('Magento\Store\Model\Group')->load($itemId))) { $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return; @@ -395,7 +395,7 @@ class Store extends Action $this->_title->add(__('Delete Store View')); $itemId = $this->getRequest()->getParam('item_id', null); - if (!($model = $this->_objectManager->create('Magento\Core\Model\Store')->load($itemId))) { + if (!($model = $this->_objectManager->create('Magento\Store\Model\Store')->load($itemId))) { $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return; @@ -433,7 +433,7 @@ class Store extends Action public function deleteWebsitePostAction() { $itemId = $this->getRequest()->getParam('item_id'); - $model = $this->_objectManager->create('Magento\Core\Model\Website'); + $model = $this->_objectManager->create('Magento\Store\Model\Website'); $model->load($itemId); if (!$model) { @@ -469,7 +469,7 @@ class Store extends Action { $itemId = $this->getRequest()->getParam('item_id'); - if (!($model = $this->_objectManager->create('Magento\Core\Model\Store\Group')->load($itemId))) { + if (!($model = $this->_objectManager->create('Magento\Store\Model\Group')->load($itemId))) { $this->messageManager->addError(__('Unable to proceed. Please, try again.')); $this->_redirect('adminhtml/*/'); return; @@ -486,7 +486,7 @@ class Store extends Action $model->delete(); $this->messageManager->addSuccess(__('The store has been deleted.')); $this->_redirect('adminhtml/*/'); - return ; + return; } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -504,7 +504,7 @@ class Store extends Action { $itemId = $this->getRequest()->getParam('item_id'); - if (!($model = $this->_objectManager->create('Magento\Core\Model\Store')->load($itemId))) { + if (!($model = $this->_objectManager->create('Magento\Store\Model\Store')->load($itemId))) { $this->messageManager->addError(__('Unable to proceed. Please, try again')); $this->_redirect('adminhtml/*/'); return; diff --git a/app/code/Magento/Backend/Helper/Dashboard/Data.php b/app/code/Magento/Backend/Helper/Dashboard/Data.php index 3359e59c16da90ceec2f81e7810be012c4a005b8..43df1c3fa9f2e01b7037263a72590131ac580bea 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Data.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Data.php @@ -42,21 +42,21 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param string $installDate * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, $installDate, $dbCompatibleMode = true ) { - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); $this->_installDate = $installDate; } diff --git a/app/code/Magento/Backend/Helper/Dashboard/Order.php b/app/code/Magento/Backend/Helper/Dashboard/Order.php index 882745d24eff4ea4ee8a7a93199576aee17f6576..43c528ea6f67761d98d4c286e188476baf7886ab 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Order.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Order.php @@ -37,22 +37,22 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\Reports\Model\Resource\Order\Collection $orderCollection * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\Reports\Model\Resource\Order\Collection $orderCollection, $dbCompatibleMode = true ) { $this->_orderCollection = $orderCollection; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** @@ -75,7 +75,7 @@ class Order extends \Magento\Backend\Helper\Dashboard\AbstractDashboard } elseif (!$this->_collection->isLive()) { $this->_collection->addFieldToFilter( 'store_id', - array('eq' => $this->_storeManager->getStore(\Magento\Core\Model\Store::ADMIN_CODE)->getId()) + array('eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()) ); } diff --git a/app/code/Magento/Backend/Model/Auth.php b/app/code/Magento/Backend/Model/Auth.php index 7816b3f9a9457a2821ef1ff13006e84b0c52dd11..2f6418115d937cd5f29dce63070c9717d0c3c920 100644 --- a/app/code/Magento/Backend/Model/Auth.php +++ b/app/code/Magento/Backend/Model/Auth.php @@ -55,7 +55,7 @@ class Auth protected $_eventManager; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -69,7 +69,7 @@ class Auth * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Backend\Model\Auth\StorageInterface $authStorage * @param \Magento\Backend\Model\Auth\Credential\StorageInterface $credentialStorage - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Core\Model\Factory $modelFactory */ public function __construct( @@ -77,7 +77,7 @@ class Auth \Magento\Backend\Helper\Data $backendData, \Magento\Backend\Model\Auth\StorageInterface $authStorage, \Magento\Backend\Model\Auth\Credential\StorageInterface $credentialStorage, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Core\Model\Factory $modelFactory ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/Backend/Model/Auth/Session.php b/app/code/Magento/Backend/Model/Auth/Session.php index 805d6dab0ff7854c88fb066df08e2f4904ed97e6..fc8100b24e2761f1fe441ce6b9ec30387d52d48c 100644 --- a/app/code/Magento/Backend/Model/Auth/Session.php +++ b/app/code/Magento/Backend/Model/Auth/Session.php @@ -67,7 +67,7 @@ class Session extends \Magento\Session\SessionManager implements \Magento\Backen protected $_config; /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -78,7 +78,7 @@ class Session extends \Magento\Session\SessionManager implements \Magento\Backen * @param \Magento\Backend\App\ConfigInterface $config */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, @@ -230,6 +230,7 @@ class Session extends \Magento\Session\SessionManager implements \Magento\Backen * * @param string $path * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function isValidForPath($path) { diff --git a/app/code/Magento/Backend/Model/Config.php b/app/code/Magento/Backend/Model/Config.php index 75cb407b5a497528654493f5e1ed8773b26b2df9..c1db716e7aee8096f3c9e8581500d0db72d26206 100644 --- a/app/code/Magento/Backend/Model/Config.php +++ b/app/code/Magento/Backend/Model/Config.php @@ -59,14 +59,14 @@ class Config extends \Magento\Object /** * Application config * - * @var \Magento\App\ReinitableConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_appConfig; /** * Global factory * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_objectFactory; @@ -87,33 +87,33 @@ class Config extends \Magento\Object /** * Config data factory * - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\App\ReinitableConfigInterface $config + * @param \Magento\App\Config\ReinitableConfigInterface $config * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\DB\TransactionFactory $transactionFactory * @param \Magento\Backend\Model\Config\Loader $configLoader - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ValueFactory $configValueFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( - \Magento\App\ReinitableConfigInterface $config, + \Magento\App\Config\ReinitableConfigInterface $config, \Magento\Event\ManagerInterface $eventManager, \Magento\Backend\Model\Config\Structure $configStructure, \Magento\DB\TransactionFactory $transactionFactory, \Magento\Backend\Model\Config\Loader $configLoader, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ValueFactory $configValueFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { parent::__construct($data); @@ -135,8 +135,7 @@ class Config extends \Magento\Object */ public function save() { - $this->_validate(); - $this->_getScope(); + $this->initScope(); $sectionId = $this->getSection(); $groups = $this->getGroups(); @@ -214,10 +213,9 @@ class Config extends \Magento\Object \Magento\DB\Transaction $deleteTransaction ) { $groupPath = $sectionPath . '/' . $groupId; - $website = $this->getWebsite(); - $store = $this->getStore(); $scope = $this->getScope(); $scopeId = $this->getScopeId(); + $scopeCode = $this->getScopeCode(); /** * * Map field names if they were cloned @@ -267,10 +265,9 @@ class Config extends \Magento\Object 'field' => $fieldId, 'groups' => $groups, 'group_id' => $group->getId(), - 'store_code' => $store, - 'website_code' => $website, 'scope' => $scope, 'scope_id' => $scopeId, + 'scope_code' => $scopeCode, 'field_config' => $field->getData(), 'fieldset_data' => $fieldsetData ); @@ -345,8 +342,7 @@ class Config extends \Magento\Object public function load() { if (is_null($this->_configData)) { - $this->_validate(); - $this->_getScope(); + $this->initScope(); $this->_configData = $this->_getConfig(false); } return $this->_configData; @@ -370,11 +366,11 @@ class Config extends \Magento\Object } /** - * Validate isset required parameters - * + * Get scope name and scopeId + * @todo refactor to scope resolver * @return void */ - protected function _validate() + private function initScope() { if (is_null($this->getSection())) { $this->setSection(''); @@ -385,15 +381,8 @@ class Config extends \Magento\Object if (is_null($this->getStore())) { $this->setStore(''); } - } - /** - * Get scope name and scopeId - * - * @return void - */ - protected function _getScope() - { + if ($this->getStore()) { $scope = 'stores'; $store = $this->_storeManager->getStore($this->getStore()); @@ -450,6 +439,7 @@ class Config extends \Magento\Object $singleStoreWebsite = array_shift($websites); $dataObject->setScope('websites'); $dataObject->setWebsiteCode($singleStoreWebsite->getCode()); + $dataObject->setScopeCode($singleStoreWebsite->getCode()); $dataObject->setScopeId($singleStoreWebsite->getId()); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php index 6f227aed02e0f2be67fcfded7971b77b16272b95..68a9c4314545437a7ab5b0a91a81c03ee5c1b567 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php @@ -34,7 +34,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin; -class Custom extends \Magento\Core\Model\Config\Value +class Custom extends \Magento\App\Config\Value { const CONFIG_SCOPE = 'stores'; @@ -58,8 +58,7 @@ class Custom extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -68,15 +67,14 @@ class Custom extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_configWriter = $configWriter; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php index 6e3a3e2e44601cff6761b28679a76900d75e7685..2ea5d4766e42cb48097a977f9b7f6f8648e8c4e1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php @@ -33,7 +33,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin; -class Custompath extends \Magento\Core\Model\Config\Value +class Custompath extends \Magento\App\Config\Value { /** * Check whether redirect should be set diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php index 39bdd3248e53b95652b8293deb6ca65623bf18d8..ce3528710cd355e58488323a4c217e9294b35d37 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php @@ -52,7 +52,7 @@ class Observer protected $_response; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -61,14 +61,14 @@ class Observer * @param \Magento\Registry $coreRegistry * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\App\ResponseInterface $response - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterfac $storeManager */ public function __construct( \Magento\Backend\Helper\Data $backendData, \Magento\Registry $coreRegistry, \Magento\Backend\Model\Auth\Session $authSession, \Magento\App\ResponseInterface $response, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_backendData = $backendData; $this->_coreRegistry = $coreRegistry; @@ -93,9 +93,7 @@ class Observer $route = $this->_backendData->getAreaFrontName(); - $this->_response - ->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route) - ->sendResponse(); + $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse(); exit(0); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php index f5698887a1019afe6fec81d13cd03e36a76075f3..ab1a3f1754217740777d5d5e421c05cc781dd17b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php @@ -33,7 +33,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin\Password\Link; -class Expirationperiod extends \Magento\Core\Model\Config\Value +class Expirationperiod extends \Magento\App\Config\Value { /** * Validate expiration period value before saving diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php index 04bf0c0e0cae7c1f51fadd7b8592d00d21aab9ce..59ef6fda5603ea03f7f0f388d9614925cab5f25d 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin; -class Robots extends \Magento\Core\Model\Config\Value +class Robots extends \Magento\App\Config\Value { /** * @var \Magento\Filesystem\Directory\Write @@ -44,8 +44,7 @@ class Robots extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Filesystem $filesystem * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,14 +53,13 @@ class Robots extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Filesystem $filesystem, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $this->_file = 'robots.txt'; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php index 15dca031687bb0fc95d66484d7cd26bc5f6cbb20..2f7dad4121453bd4a7dd62092772e3704a0aabda 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php @@ -30,7 +30,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin; -class Usecustom extends \Magento\Core\Model\Config\Value +class Usecustom extends \Magento\App\Config\Value { /** * Writer of configuration storage @@ -42,8 +42,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,15 +51,14 @@ class Usecustom extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_configWriter = $configWriter; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php index 5c4274c14d68e8d8c38bf8ba9d7d4e71585789dc..870582b3a65757f0eb3305e16cd04e74bcd6b433 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Admin; -class Usesecretkey extends \Magento\Core\Model\Config\Value +class Usesecretkey extends \Magento\App\Config\Value { /** * @var \Magento\Backend\Model\UrlInterface @@ -39,8 +39,7 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Backend\Model\UrlInterface $backendUrl * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -49,15 +48,14 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Backend\Model\UrlInterface $backendUrl, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_backendUrl = $backendUrl; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php index 972557ece8025a4d6bc0835eb7507cc6f5bcf28e..080f735488453a840282a395a16e1efc94423f40 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php @@ -23,7 +23,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Baseurl extends \Magento\Core\Model\Config\Value +class Baseurl extends \Magento\App\Config\Value { /** * @var \Magento\View\Asset\MergeService @@ -33,8 +33,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -43,15 +42,14 @@ class Baseurl extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_mergeService = $mergeService; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -86,16 +84,16 @@ class Baseurl extends \Magento\Core\Model\Config\Value { $placeholders = array('{{unsecure_base_url}}'); switch ($this->getPath()) { - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL: $this->_assertValuesOrUrl(array('{{base_url}}'), $value); break; - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL: $this->_assertStartsWithValuesOrUrl($placeholders, $value); break; - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL: - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL: - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL: - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL: $this->_assertStartsWithValuesOrUrlOrEmpty($placeholders, $value); break; default: @@ -114,16 +112,16 @@ class Baseurl extends \Magento\Core\Model\Config\Value { $placeholders = array('{{unsecure_base_url}}', '{{secure_base_url}}'); switch ($this->getPath()) { - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL: $this->_assertValuesOrUrl(array('{{base_url}}', '{{unsecure_base_url}}'), $value); break; - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL: $this->_assertStartsWithValuesOrUrl($placeholders, $value); break; - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL: $this->_assertStartsWithValuesOrUrlOrEmpty($placeholders, $value); break; default: @@ -228,12 +226,12 @@ class Baseurl extends \Magento\Core\Model\Config\Value { if ($this->isValueChanged()) { switch ($this->getPath()) { - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL: - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL: - case \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL: - case \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL: + case \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL: + case \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL: $this->_mergeService->cleanMergedJsCss(); break; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cache.php b/app/code/Magento/Backend/Model/Config/Backend/Cache.php index 4f3075ee371c50156a248c12b996547f7138073d..b6aaccd2ce9c4dd2eae3a2fcc2203af7546f1e37 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cache.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cache.php @@ -30,7 +30,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Cache extends \Magento\Core\Model\Config\Value +class Cache extends \Magento\App\Config\Value { /** * Cache tags to clean diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cookie.php b/app/code/Magento/Backend/Model/Config/Backend/Cookie.php index c607f17ae66fb4e8ae61235cea238e31a3f903dd..09a3bfea8d084456edadd430f17bd97470714a64 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cookie.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cookie.php @@ -33,7 +33,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Cookie extends \Magento\Core\Model\Config\Value +class Cookie extends \Magento\App\Config\Value { /** * @var string diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php index 059904ef3c3c8f4572ce9a0f720f2ef624047aa9..6e27e8f20888dd5e6c31e27af23ae91ff9a2734e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php @@ -36,23 +36,22 @@ */ namespace Magento\Backend\Model\Config\Backend\Currency; -abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value +abstract class AbstractCurrency extends \Magento\App\Config\Value { /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Constructor * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -60,15 +59,14 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + $this->_scopeConfig = $scopeConfig; + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -94,7 +92,13 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value */ protected function _getInstalledCurrencies() { - return explode(',', $this->_coreStoreConfig->getConfig('system/currency/installed')); + return explode( + ',', + $this->_scopeConfig->getValue( + 'system/currency/installed', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php index 2154477dad9b53032a26ede917633cde420e485a..199030889a6a3ba28e87a5695042d2c43ba35acd 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php @@ -40,9 +40,8 @@ class Allow extends AbstractCurrency /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -51,25 +50,15 @@ class Allow extends AbstractCurrency public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Locale\CurrencyInterface $localeCurrency, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_localeCurrency = $localeCurrency; - parent::__construct( - $context, - $registry, - $storeManager, - $config, - $coreStoreConfig, - $resource, - $resourceCollection, - $data - ); + parent::__construct($context, $registry, $config, $scopeConfig, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php index d564eef8ae76afa6cde183f47e8c28852333b7d1..c63633bda0a83864eab2a88047689a93ab5879f3 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php @@ -29,21 +29,20 @@ */ namespace Magento\Backend\Model\Config\Backend\Currency; -class Cron extends \Magento\Core\Model\Config\Value +class Cron extends \Magento\App\Config\Value { const CRON_STRING_PATH = 'crontab/default/jobs/currency_rates_update/schedule/cron_expr'; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -51,15 +50,14 @@ class Cron extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_configValueFactory = $configValueFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Datashare.php b/app/code/Magento/Backend/Model/Config/Backend/Datashare.php index 840db1f7e83bcb5e1a0e9f9e1ddf5c61b5f504bc..39e175a515060b1a16f3930912b884f33f9e3148 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Datashare.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Datashare.php @@ -33,7 +33,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Datashare extends \Magento\Core\Model\Config\Value +class Datashare extends \Magento\App\Config\Value { /** * @return void diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php index eb67af0d76aefb39916f7be7a289177e9ecc7ccc..786a085aba1c3ae777672bf26e27d49ed9e75fad 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php @@ -31,7 +31,7 @@ namespace Magento\Backend\Model\Config\Backend\Email; use Magento\Model\Exception; -class Address extends \Magento\Core\Model\Config\Value +class Address extends \Magento\App\Config\Value { /** * @return $this diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php index 4fa9d9e57aaf1308ee571f9b94d8a246e3cebad1..a6806f6ba1ed113d4f48881a305c72114cc1a002 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Email; -class Sender extends \Magento\Core\Model\Config\Value +class Sender extends \Magento\App\Config\Value { /** * Check sender name validity diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index d418f55fb6512942640225a555064d2845a40f36..0bebdca2f0f52965a78374a5b8504327edaa5a9f 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -27,7 +27,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App\Config\Data\ProcessorInterface +class Encrypted extends \Magento\App\Config\Value implements \Magento\App\Config\Data\ProcessorInterface { /** * @var \Magento\Encryption\EncryptorInterface @@ -37,8 +37,7 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -47,15 +46,14 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_encryptor = $encryptor; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index b89281cc29bba62d0e2f3a646d489a36f04c44dd..63270e104efcd39f350dfd191dbb5cfd658df8d7 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -30,7 +30,7 @@ namespace Magento\Backend\Model\Config\Backend; * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class File extends \Magento\Core\Model\Config\Value +class File extends \Magento\App\Config\Value { /** * @var \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface @@ -62,8 +62,7 @@ class File extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory * @param \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData * @param \Magento\App\Filesystem $filesystem @@ -74,8 +73,7 @@ class File extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData, \Magento\App\Filesystem $filesystem, @@ -87,7 +85,7 @@ class File extends \Magento\Core\Model\Config\Value $this->_requestData = $requestData; $this->_filesystem = $filesystem; $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -213,7 +211,7 @@ class File extends \Magento\Core\Model\Config\Value protected function _prependScopeInfo($path) { $scopeInfo = $this->getScope(); - if ('default' != $this->getScope()) { + if (\Magento\App\ScopeInterface::SCOPE_DEFAULT != $this->getScope()) { $scopeInfo .= '/' . $this->getScopeId(); } return $scopeInfo . '/' . $path; @@ -230,7 +228,7 @@ class File extends \Magento\Core\Model\Config\Value protected function _appendScopeInfo($path) { $path .= '/' . $this->getScope(); - if ('default' != $this->getScope()) { + if (\Magento\App\ScopeInterface::SCOPE_DEFAULT != $this->getScope()) { $path .= '/' . $this->getScopeId(); } return $path; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Filename.php b/app/code/Magento/Backend/Model/Config/Backend/Filename.php index 02e90b75d79c77df03b8db86bc53b3450759c894..30a194964479eca90ef7bf4c81eea70d0a76764e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Filename.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Filename.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Filename extends \Magento\Core\Model\Config\Value +class Filename extends \Magento\App\Config\Value { /** * @return $this diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php index fbbbf9c28dafeea86bb05c81274ea0496cc778de..8e52f2bce56752559c3f2892c162251ff3da751e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php @@ -34,7 +34,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Image; -class Adapter extends \Magento\Core\Model\Config\Value +class Adapter extends \Magento\App\Config\Value { /** * @var \Magento\Image\AdapterFactory @@ -44,8 +44,7 @@ class Adapter extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Image\AdapterFactory $imageFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,14 +53,13 @@ class Adapter extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Image\AdapterFactory $imageFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); $this->_imageFactory = $imageFactory; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale.php b/app/code/Magento/Backend/Model/Config/Backend/Locale.php index 14d3714fa52e1df2207544b2b6521eaae59a210c..3bc53f0bf23b7606928b0f7e76429a193e57532a 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Locale extends \Magento\Core\Model\Config\Value +class Locale extends \Magento\App\Config\Value { /** * @var \Magento\Core\Model\Resource\Config\Data\CollectionFactory @@ -37,12 +37,12 @@ class Locale extends \Magento\Core\Model\Config\Value protected $_configsFactory; /** - * @var \Magento\Core\Model\Website\Factory + * @var \Magento\Store\Model\Website\Factory */ protected $_websiteFactory; /** - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; @@ -54,11 +54,10 @@ class Locale extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Core\Model\Resource\Config\Data\CollectionFactory $configsFactory - * @param \Magento\Core\Model\Website\Factory $websiteFactory - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -69,11 +68,10 @@ class Locale extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Core\Model\Resource\Config\Data\CollectionFactory $configsFactory, - \Magento\Core\Model\Website\Factory $websiteFactory, - \Magento\Core\Model\StoreFactory $storeFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Locale\CurrencyInterface $localeCurrency, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -83,7 +81,7 @@ class Locale extends \Magento\Core\Model\Config\Value $this->_websiteFactory = $websiteFactory; $this->_storeFactory = $storeFactory; $this->_localeCurrency = $localeCurrency; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -113,19 +111,19 @@ class Locale extends \Magento\Core\Model\Config\Value } switch ($data->getScope()) { - case 'default': + case \Magento\App\ScopeInterface::SCOPE_DEFAULT: $scopeName = __('Default scope'); break; - case 'website': - /** @var $website \Magento\Core\Model\Website */ + case \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE: + /** @var $website \Magento\Store\Model\Website */ $website = $this->_websiteFactory->create(); $websiteName = $website->load($data->getScopeId())->getName(); $scopeName = __('website(%1) scope', $websiteName); break; - case 'store': - /** @var $store \Magento\Core\Model\Store */ + case \Magento\Store\Model\ScopeInterface::SCOPE_STORE: + /** @var $store \Magento\Store\Model\Store */ $store = $this->_storeFactory->create(); $storeName = $store->load($data->getScopeId())->getName(); $scopeName = __('store(%1) scope', $storeName); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php index 144a11eee4185399f7e5952b055d4cbe7cea448c..2ac4ccc21183bc3c843fa6ed7700e7714080fa37 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php @@ -31,7 +31,7 @@ namespace Magento\Backend\Model\Config\Backend\Locale; use Magento\Model\Exception; -class Timezone extends \Magento\Core\Model\Config\Value +class Timezone extends \Magento\App\Config\Value { /** * @return $this diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php index a4a0a725b3b185b9ae94e0c5ac646e59dceaee5b..b1d1d8cfb9b704cc68e340155b8f19ee5d33087e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php @@ -29,14 +29,14 @@ */ namespace Magento\Backend\Model\Config\Backend\Log; -class Cron extends \Magento\Core\Model\Config\Value +class Cron extends \Magento\App\Config\Value { const CRON_STRING_PATH = 'crontab/default/jobs/log_clean/schedule/cron_expr'; const CRON_MODEL_PATH = 'crontab/default/jobs/log_clean/run/model'; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; @@ -48,9 +48,8 @@ class Cron extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath @@ -59,9 +58,8 @@ class Cron extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', @@ -69,7 +67,7 @@ class Cron extends \Magento\Core\Model\Config\Value ) { $this->_configValueFactory = $configValueFactory; $this->_runModelPath = $runModelPath; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Secure.php b/app/code/Magento/Backend/Model/Config/Backend/Secure.php index 91742ff6a4b76fd97ddb1d63de313cbae5eefea8..af421cc31fef508dbbc91f45dec699065c286e93 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Secure.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Secure.php @@ -23,7 +23,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Secure extends \Magento\Core\Model\Config\Value +class Secure extends \Magento\App\Config\Value { /** * @var \Magento\View\Asset\MergeService @@ -33,8 +33,7 @@ class Secure extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -43,15 +42,14 @@ class Secure extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_mergeService = $mergeService; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Serialized.php b/app/code/Magento/Backend/Model/Config/Backend/Serialized.php index baa8fc9fbcd037d4045a448da820739dfd686fe8..c96625163efbbad0bf912c1f248eb09538dc7ea5 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Serialized.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Serialized.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Serialized extends \Magento\Core\Model\Config\Value +class Serialized extends \Magento\App\Config\Value { /** * @return void diff --git a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php index b4dbe01c9b22e13157d7c3faeb5e844bd5512c48..875493c5809ba284cc11ec2c4ea07901444dffd4 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Storage\Media; -class Database extends \Magento\Core\Model\Config\Value +class Database extends \Magento\App\Config\Value { /** * Core file storage @@ -37,8 +37,7 @@ class Database extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Core\Helper\File\Storage $coreFileStorage * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -47,15 +46,14 @@ class Database extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Core\Helper\File\Storage $coreFileStorage, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_coreFileStorage = $coreFileStorage; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backend/Model/Config/Backend/Store.php b/app/code/Magento/Backend/Model/Config/Backend/Store.php index 30767f937821a8cb314576aa6a46c454767e26d9..f8b8586c15acf972077b85cec5871ee9b3bdf780 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Store.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Store.php @@ -29,16 +29,44 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Store extends \Magento\Core\Model\Config\Value +class Store extends \Magento\App\Config\Value { + /** + * @var \Magento\App\Config\MutableScopeConfigInterface + */ + protected $_mutableConfig; + + /** + * @param \Magento\Model\Context $context + * @param \Magento\Registry $registry + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\MutableScopeConfigInterface $mutableConfig + * @param \Magento\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Model\Context $context, + \Magento\Registry $registry, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\MutableScopeConfigInterface $mutableConfig, + \Magento\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + $this->_mutableConfig = $mutableConfig; + } + /** * @return void */ protected function _afterSave() { - $this->_storeManager->getStore()->setConfig( - \Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, - $this->getValue() + $this->_mutableConfig->setValue( + \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, + $this->getValue(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $this->_cacheManager->clean(); } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Translate.php b/app/code/Magento/Backend/Model/Config/Backend/Translate.php index 46fa8c0a74ef74c582164364d3178bd65fd16f2f..5a3f9101d45b024693694cc3afaaf39d6ad6c762 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Translate.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Translate.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend; -class Translate extends \Magento\Core\Model\Config\Value +class Translate extends \Magento\App\Config\Value { /** * @var \Magento\App\Cache\TypeListInterface @@ -46,18 +46,17 @@ class Translate extends \Magento\Core\Model\Config\Value /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Constructor * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Cache\TypeListInterface $cacheTypeList * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -66,17 +65,16 @@ class Translate extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Cache\TypeListInterface $cacheTypeList, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_cacheTypeList = $cacheTypeList; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -86,7 +84,12 @@ class Translate extends \Magento\Core\Model\Config\Value */ protected function _afterSave() { - $types = array_keys($this->_coreStoreConfig->getConfig(self::XML_PATH_INVALID_CACHES)); + $types = array_keys( + $this->_scopeConfig->getValue( + self::XML_PATH_INVALID_CACHES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); if ($this->isValueChanged()) { $this->_cacheTypeList->invalidate($types); } diff --git a/app/code/Magento/Backend/Model/Config/Loader.php b/app/code/Magento/Backend/Model/Config/Loader.php index a4489f447d42dbc250960eea3708d10b8a18fe55..9babd351ccc8fad4a0dfca93eb0f51bc6f294fe5 100644 --- a/app/code/Magento/Backend/Model/Config/Loader.php +++ b/app/code/Magento/Backend/Model/Config/Loader.php @@ -34,14 +34,14 @@ class Loader /** * Config data factory * - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; /** - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ValueFactory $configValueFactory */ - public function __construct(\Magento\Core\Model\Config\ValueFactory $configValueFactory) + public function __construct(\Magento\App\Config\ValueFactory $configValueFactory) { $this->_configValueFactory = $configValueFactory; } diff --git a/app/code/Magento/Backend/Model/Config/ScopeDefiner.php b/app/code/Magento/Backend/Model/Config/ScopeDefiner.php index 40eaf5aa7fe28288a49d0c49cff8676095274a6c..e0ddf6d21207ee0b48e669fe4a4a35d66665b092 100644 --- a/app/code/Magento/Backend/Model/Config/ScopeDefiner.php +++ b/app/code/Magento/Backend/Model/Config/ScopeDefiner.php @@ -31,12 +31,6 @@ namespace Magento\Backend\Model\Config; class ScopeDefiner { - const SCOPE_WEBSITE = 'website'; - - const SCOPE_STORE = 'store'; - - const SCOPE_DEFAULT = 'default'; - /** * Request object * @@ -61,8 +55,8 @@ class ScopeDefiner { return $this->_request->getParam( 'store' - ) ? self::SCOPE_STORE : ($this->_request->getParam( + ) ? \Magento\Store\Model\ScopeInterface::SCOPE_STORE : ($this->_request->getParam( 'website' - ) ? self::SCOPE_WEBSITE : self::SCOPE_DEFAULT); + ) ? \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE : \Magento\App\ScopeInterface::SCOPE_DEFAULT); } } diff --git a/app/code/Magento/Backend/Model/Config/Source/Store.php b/app/code/Magento/Backend/Model/Config/Source/Store.php index 1325d5db66d421a6ec66d580941033c0624d096c..51911fb124f6467a80e743fc12cfa197d07083d0 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Store.php +++ b/app/code/Magento/Backend/Model/Config/Source/Store.php @@ -33,14 +33,14 @@ class Store implements \Magento\Option\ArrayInterface protected $_options; /** - * @var \Magento\Core\Model\Resource\Store\CollectionFactory + * @var \Magento\Store\Model\Resource\Store\CollectionFactory */ protected $_storesFactory; /** - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory + * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storesFactory */ - public function __construct(\Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory) + public function __construct(\Magento\Store\Model\Resource\Store\CollectionFactory $storesFactory) { $this->_storesFactory = $storesFactory; } @@ -51,7 +51,7 @@ class Store implements \Magento\Option\ArrayInterface public function toOptionArray() { if (!$this->_options) { - /** @var $stores \Magento\Core\Model\Resource\Store\Collection */ + /** @var $stores \Magento\Store\Model\Resource\Store\Collection */ $stores = $this->_storesFactory->create(); $this->_options = $stores->load()->toOptionArray(); } diff --git a/app/code/Magento/Backend/Model/Config/Source/Website.php b/app/code/Magento/Backend/Model/Config/Source/Website.php index 2818ffc5f0bf40bccb191db73445cdc858174433..f8ad8579a2cee203871d2c80d15205d5cb2f4f78 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Website.php +++ b/app/code/Magento/Backend/Model/Config/Source/Website.php @@ -33,14 +33,14 @@ class Website implements \Magento\Option\ArrayInterface protected $_options; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Backend/Model/Config/Source/Website/AdminOptionHash.php b/app/code/Magento/Backend/Model/Config/Source/Website/AdminOptionHash.php index f49bafb8c18b648a176e54a19fac22e49ca6e1b6..a4ec7bb24f840fa0ec684a7615c5f926f4b781c9 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Website/AdminOptionHash.php +++ b/app/code/Magento/Backend/Model/Config/Source/Website/AdminOptionHash.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Source\Website; -use Magento\Core\Model\System\Store; +use Magento\Store\Model\System\Store; /** * Admin OptionHash will include the default store (Admin) with the OptionHash. diff --git a/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php b/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php index 76aa7165ead5050a31c6bbc67050080ad949a6d0..46b8e9e1de3d783a20110a351ec353326adbe025 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php +++ b/app/code/Magento/Backend/Model/Config/Source/Website/OptionHash.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Source\Website; -use Magento\Core\Model\System\Store; +use Magento\Store\Model\System\Store; use Magento\Option\ArrayInterface; class OptionHash implements ArrayInterface diff --git a/app/code/Magento/Backend/Model/Config/Structure/AbstractElement.php b/app/code/Magento/Backend/Model/Config/Structure/AbstractElement.php index 161ad5ab300ae1b353b88700a7cd27c017af95da..ed48faa5515b310df779594f5020a34a1a502068 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/AbstractElement.php +++ b/app/code/Magento/Backend/Model/Config/Structure/AbstractElement.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Model\Config\Structure; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; abstract class AbstractElement implements ElementInterface { @@ -154,9 +154,9 @@ abstract class AbstractElement implements ElementInterface public function isVisible() { $showInScope = array( - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_STORE => $this->_hasVisibilityValue('showInStore'), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_WEBSITE => $this->_hasVisibilityValue('showInWebsite'), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT => $this->_hasVisibilityValue('showInDefault') + \Magento\Store\Model\ScopeInterface::SCOPE_STORE => $this->_hasVisibilityValue('showInStore'), + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE => $this->_hasVisibilityValue('showInWebsite'), + \Magento\App\ScopeInterface::SCOPE_DEFAULT => $this->_hasVisibilityValue('showInDefault') ); if ($this->_storeManager->isSingleStoreMode()) { diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/AbstractComposite.php b/app/code/Magento/Backend/Model/Config/Structure/Element/AbstractComposite.php index 8e4756f94709e05fb524c6e7faada5f58c6d624e..e4ad0ec82796f719167e72a8602a99d4e443bcb5 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/AbstractComposite.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/AbstractComposite.php @@ -35,10 +35,10 @@ abstract class AbstractComposite extends \Magento\Backend\Model\Config\Structure protected $_childrenIterator; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Iterator $childrenIterator */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager, Iterator $childrenIterator) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager, Iterator $childrenIterator) { parent::__construct($storeManager); $this->_childrenIterator = $childrenIterator; diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Dependency/Mapper.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Dependency/Mapper.php index 4352e5040d2d628d3f8440a3742c7de151f54447..c86eb30c0afb8757d04031dcc1bd8c2288e32252 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Dependency/Mapper.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Dependency/Mapper.php @@ -42,26 +42,24 @@ class Mapper protected $_fieldFactory; /** - * Store Manager - * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeManager; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Backend\Model\Config\Structure\SearchInterface $fieldLocator * @param FieldFactory $fieldFactory + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Backend\Model\Config\Structure\SearchInterface $fieldLocator, - FieldFactory $fieldFactory + FieldFactory $fieldFactory, + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_fieldLocator = $fieldLocator; - $this->_storeManager = $storeManager; $this->_fieldFactory = $fieldFactory; + $this->_scopeConfig = $scopeConfig; } /** @@ -87,10 +85,10 @@ class Mapper * based on not shown field (not rendered field) */ if (false == $dependentField->isVisible()) { - $valueInStore = $this->_storeManager->getStore( + $valueInStore = $this->_scopeConfig->getValue( + $dependentField->getPath($fieldPrefix), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeCode - )->getConfig( - $dependentField->getPath($fieldPrefix) ); $shouldAddDependency = !$field->isValueSatisfy($valueInStore); } diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php index 7b5ae70d6f61cd29668c3e7210db7d2559fea8b9..26a68fa2d331b4841e731a56816e628120b93497 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php @@ -69,7 +69,7 @@ class Field extends \Magento\Backend\Model\Config\Structure\AbstractElement protected $_blockFactory; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Backend\Model\Config\BackendFactory $backendFactory * @param \Magento\Backend\Model\Config\SourceFactory $sourceFactory * @param \Magento\Backend\Model\Config\CommentFactory $commentFactory @@ -77,7 +77,7 @@ class Field extends \Magento\Backend\Model\Config\Structure\AbstractElement * @param \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Backend\Model\Config\BackendFactory $backendFactory, \Magento\Backend\Model\Config\SourceFactory $sourceFactory, \Magento\Backend\Model\Config\CommentFactory $commentFactory, diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php index f6832e85d8759306aa29e4bc1cc5558bfe03e990..afe9add50936fd35cdfa97983ac65ff4a433d283 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php @@ -41,13 +41,13 @@ class Group extends AbstractComposite protected $_dependencyMapper; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Backend\Model\Config\Structure\Element\Iterator\Field $childrenIterator * @param \Magento\Backend\Model\Config\BackendClone\Factory $cloneModelFactory * @param \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Backend\Model\Config\Structure\Element\Iterator\Field $childrenIterator, \Magento\Backend\Model\Config\BackendClone\Factory $cloneModelFactory, \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Section.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Section.php index 390c08f6520005f319f84821ed6957cf9f27aa03..fc94657841c3e75a9e8bdda31af1edc5fb544836 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Section.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Section.php @@ -35,12 +35,12 @@ class Section extends AbstractComposite protected $_authorization; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Iterator $childrenIterator * @param \Magento\AuthorizationInterface $authorization */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, Iterator $childrenIterator, \Magento\AuthorizationInterface $authorization ) { diff --git a/app/code/Magento/Backend/Model/Locale/Resolver.php b/app/code/Magento/Backend/Model/Locale/Resolver.php index 31f6a1a19de5dd3fa13548f2acd7b8653020b0a5..77fe314a42508e97d644ef2ee673b0e38e334a5f 100644 --- a/app/code/Magento/Backend/Model/Locale/Resolver.php +++ b/app/code/Magento/Backend/Model/Locale/Resolver.php @@ -51,11 +51,11 @@ class Resolver extends \Magento\Locale\Resolver protected $_localeValidator; /** - * @param \Magento\Locale\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath - * @param \Magento\ObjectManager $objectManager + * @param string $scopeType * @param \Magento\Backend\Model\Session $session * @param Manager $localeManager * @param \Magento\App\RequestInterface $request @@ -63,11 +63,11 @@ class Resolver extends \Magento\Locale\Resolver * @param null $locale */ public function __construct( - \Magento\Locale\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, - \Magento\ObjectManager $objectManager, + $scopeType, \Magento\Backend\Model\Session $session, \Magento\Backend\Model\Locale\Manager $localeManager, \Magento\App\RequestInterface $request, @@ -78,7 +78,7 @@ class Resolver extends \Magento\Locale\Resolver $this->_localeManager = $localeManager; $this->_request = $request; $this->_localeValidator = $localeValidator; - parent::__construct($scopeConfig, $cache, $localeFactory, $defaultLocalePath, $locale); + parent::__construct($scopeConfig, $cache, $localeFactory, $defaultLocalePath, $scopeType, $locale); } /** diff --git a/app/code/Magento/Backend/Model/Menu/Config.php b/app/code/Magento/Backend/Model/Menu/Config.php index 4de93be1d1dab895c0ea216c46bba6c4f4f41e93..deed8f64c9020f46cfcd4f095c3f308219d9bcd6 100644 --- a/app/code/Magento/Backend/Model/Menu/Config.php +++ b/app/code/Magento/Backend/Model/Menu/Config.php @@ -64,9 +64,9 @@ class Config protected $_configReader; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeManager; + protected $_scopeConfig; /** * @var \Magento\Backend\Model\Menu\AbstractDirector @@ -86,7 +86,7 @@ class Config * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\State $appState */ public function __construct( @@ -97,7 +97,7 @@ class Config \Magento\App\Cache\Type\Config $configCacheType, \Magento\Event\ManagerInterface $eventManager, \Magento\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\State $appState ) { $this->_menuBuilder = $menuBuilder; @@ -107,7 +107,7 @@ class Config $this->_logger = $logger; $this->_menuFactory = $menuFactory; $this->_configReader = $configReader; - $this->_storeManager = $storeManager; + $this->_scopeConfig = $scopeConfig; $this->_appState = $appState; } @@ -122,7 +122,7 @@ class Config */ public function getMenu() { - if ($this->_storeManager->getStore()->getConfig('dev/log/active')) { + if ($this->_scopeConfig->getValue('dev/log/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_logger->addStreamLog(\Magento\Backend\Model\Menu::LOGGER_KEY); } diff --git a/app/code/Magento/Backend/Model/Menu/Item.php b/app/code/Magento/Backend/Model/Menu/Item.php index b40c7404833ac1d44de497e1744013b6685119df..60ea56d4279aaf9a7b9b6698f8368b502c6c85ed 100644 --- a/app/code/Magento/Backend/Model/Menu/Item.php +++ b/app/code/Magento/Backend/Model/Menu/Item.php @@ -134,9 +134,9 @@ class Item protected $_urlModel; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\Backend\Model\Menu\Item\Validator @@ -165,7 +165,7 @@ class Item /** * @param Item\Validator $validator * @param \Magento\AuthorizationInterface $authorization - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Backend\Model\MenuFactory $menuFactory * @param \Magento\Backend\Model\UrlInterface $urlModel * @param \Magento\Module\ModuleListInterface $moduleList @@ -175,7 +175,7 @@ class Item public function __construct( \Magento\Backend\Model\Menu\Item\Validator $validator, \Magento\AuthorizationInterface $authorization, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Backend\Model\MenuFactory $menuFactory, \Magento\Backend\Model\UrlInterface $urlModel, \Magento\Module\ModuleListInterface $moduleList, @@ -187,7 +187,7 @@ class Item $this->_moduleManager = $moduleManager; $this->_acl = $authorization; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_menuFactory = $menuFactory; $this->_urlModel = $urlModel; $this->_moduleName = isset($data['module']) ? $data['module'] : 'Magento_Backend'; @@ -442,7 +442,7 @@ class Item protected function _isConfigDependenciesAvailable() { if ($this->_dependsOnConfig) { - return $this->_storeConfig->getConfigFlag((string)$this->_dependsOnConfig); + return $this->_scopeConfig->isSetFlag((string)$this->_dependsOnConfig, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } return true; } @@ -494,7 +494,7 @@ class Item $this->_moduleManager = $objectManager->get('Magento\Module\Manager'); $this->_validator = $objectManager->get('Magento\Backend\Model\Menu\Item\Validator'); $this->_acl = $objectManager->get('Magento\AuthorizationInterface'); - $this->_storeConfig = $objectManager->get('Magento\Core\Model\Store\Config'); + $this->_scopeConfig = $objectManager->get('Magento\App\Config\ScopeConfigInterface'); $this->_menuFactory = $objectManager->get('Magento\Backend\Model\MenuFactory'); $this->_urlModel = $objectManager->get('Magento\Backend\Model\UrlInterface'); $this->_moduleList = $objectManager->get('Magento\Module\ModuleListInterface'); diff --git a/app/code/Magento/Backend/Model/Observer.php b/app/code/Magento/Backend/Model/Observer.php index 652bdf5e2b84d97ae0b79e948050867cecb4a715..7c46ee84ff1aafd3efb90b9a458c40f1246c07ba 100644 --- a/app/code/Magento/Backend/Model/Observer.php +++ b/app/code/Magento/Backend/Model/Observer.php @@ -96,9 +96,9 @@ class Observer */ public function setUrlClassName(\Magento\Event\Observer $observer) { - /** @var $storeCollection \Magento\Core\Model\Resource\Store\Collection */ + /** @var $storeCollection \Magento\Store\Model\Resource\Store\Collection */ $storeCollection = $observer->getEvent()->getStoreCollection(); - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($storeCollection as $store) { if ($store->getId() == 0) { $store->setUrlClassName('Magento\Backend\Model\UrlInterface'); diff --git a/app/code/Magento/SalesRule/Model/Resource/Setup.php b/app/code/Magento/Backend/Model/Resource/Translate.php similarity index 72% rename from app/code/Magento/SalesRule/Model/Resource/Setup.php rename to app/code/Magento/Backend/Model/Resource/Translate.php index 047f8b7f6997ce05428c443fa4bfe83cd0318628..45fe25c8a6abecfc0fe6182150a468bde2022911 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Setup.php +++ b/app/code/Magento/Backend/Model/Resource/Translate.php @@ -19,22 +19,25 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_SalesRule + * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\SalesRule\Model\Resource; +namespace Magento\Backend\Model\Resource; /** - * Resource setup model + * Backend translate resource model */ -class Setup extends \Magento\Sales\Model\Resource\Setup +class Translate extends \Magento\Translation\Model\Resource\Translate { /** - * @return \Magento\Core\Model\Resource\Setup\Migration + * Get current store id + * Use always default scope for store id + * + * @return int */ - public function getMigrationModel() + protected function _getStoreId() { - return $this->_migrationFactory->create(array('resourceName' => 'core_setup')); + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } } diff --git a/app/code/Magento/Core/Model/Resource/Setup/Generic.php b/app/code/Magento/Backend/Model/Resource/Translate/String.php similarity index 69% rename from app/code/Magento/Core/Model/Resource/Setup/Generic.php rename to app/code/Magento/Backend/Model/Resource/Translate/String.php index ebbb5728eabbd4a7686f1911402d283b6386bca0..dcee12d0822ccbf202169272a683ad3fe9a9a40b 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Generic.php +++ b/app/code/Magento/Backend/Model/Resource/Translate/String.php @@ -18,21 +18,26 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Setup; +namespace Magento\Backend\Model\Resource\Translate; -class Generic extends \Magento\Core\Model\Resource\Setup +/** + * Backend string translate resource model + */ +class String extends \Magento\Translation\Model\Resource\String { /** - * Get migration instance + * Get current store id + * Use always default scope for store id * - * @param array $data - * @return \Magento\Core\Model\Resource\Setup\Migration + * @return int */ - public function createMigrationSetup(array $data = array()) + protected function _getStoreId() { - return $this->_migrationFactory->create($data); + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } } diff --git a/app/code/Magento/Backend/Model/Session.php b/app/code/Magento/Backend/Model/Session.php index d664faddf22bf2f9545d88621b683d60894113db..50a6f81c60bf10b194b4b645469d515dcdd585e6 100644 --- a/app/code/Magento/Backend/Model/Session.php +++ b/app/code/Magento/Backend/Model/Session.php @@ -28,7 +28,7 @@ namespace Magento\Backend\Model; class Session extends \Magento\Session\SessionManager { /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -36,7 +36,7 @@ class Session extends \Magento\Session\SessionManager * @param \Magento\Session\StorageInterface $storage */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, @@ -52,6 +52,7 @@ class Session extends \Magento\Session\SessionManager * * @param string $path * @return bool + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function isValidForPath($path) { diff --git a/app/code/Magento/Backend/Model/Session/Quote.php b/app/code/Magento/Backend/Model/Session/Quote.php index 9cfc5e10c79c3012aa1585486595a5386164d4d5..d6048515270aa1060060529607b1f00235384f23 100644 --- a/app/code/Magento/Backend/Model/Session/Quote.php +++ b/app/code/Magento/Backend/Model/Session/Quote.php @@ -49,7 +49,7 @@ class Quote extends \Magento\Session\SessionManager /** * Store model object * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store = null; @@ -76,17 +76,17 @@ class Quote extends \Magento\Session\SessionManager protected $_quoteFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -95,11 +95,11 @@ class Quote extends \Magento\Session\SessionManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, @@ -108,14 +108,14 @@ class Quote extends \Magento\Session\SessionManager \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_quoteFactory = $quoteFactory; $this->_customerFactory = $customerFactory; $this->_orderFactory = $orderFactory; $this->_storeManager = $storeManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); $this->start(); if ($this->_storeManager->hasSingleStore()) { @@ -138,7 +138,10 @@ class Quote extends \Magento\Session\SessionManager $this->_quote->setStoreId( $this->getStoreId() )->setCustomerGroupId( - $this->_coreStoreConfig->getConfig(self::XML_PATH_DEFAULT_CREATEACCOUNT_GROUP) + $this->_scopeConfig->getValue( + self::XML_PATH_DEFAULT_CREATEACCOUNT_GROUP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->assignCustomer( $this->getCustomer() )->setIsActive( @@ -190,7 +193,7 @@ class Quote extends \Magento\Session\SessionManager /** * Retrieve store model object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index b431163ce857b8d97bd3ade4f63b65743a1938dd..8ab29b9965465824338a2835fbd037ddff90eabd 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -77,32 +77,17 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface protected $_encryptor; /** - * @var \Magento\Backend\App\ConfigInterface - */ - protected $_config; - - /** - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_coreConfig; - - /** - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - /** * @var \Magento\Data\Form\FormKey */ protected $formKey; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_scope; @@ -111,20 +96,19 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface * @param \Magento\App\RequestInterface $request * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo * @param \Magento\Backend\Model\Url\ScopeResolver $scopeResolver - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\Generic $session * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Url\RouteParamsResolverFactory $routeParamsResolver * @param \Magento\Url\QueryParamsResolverInterface $queryParamsResolver + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Backend\Helper\Data $backendHelper * @param Menu\Config $menuConfig * @param \Magento\App\CacheInterface $cache * @param Auth\Session $authSession * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Backend\App\ConfigInterface $config - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param \Magento\Data\Form\FormKey $formKey - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param string $scopeType * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -134,20 +118,19 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface \Magento\App\RequestInterface $request, \Magento\Url\SecurityInfoInterface $urlSecurityInfo, \Magento\Backend\Model\Url\ScopeResolver $scopeResolver, - \Magento\Core\Model\Session $session, + \Magento\Session\Generic $session, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Url\RouteParamsResolverFactory $routeParamsResolver, \Magento\Url\QueryParamsResolverInterface $queryParamsResolver, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Backend\Helper\Data $backendHelper, \Magento\Backend\Model\Menu\Config $menuConfig, \Magento\App\CacheInterface $cache, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Backend\App\ConfigInterface $config, - \Magento\Core\Model\StoreFactory $storeFactory, - \Magento\App\ConfigInterface $coreConfig, + \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Data\Form\FormKey $formKey, - \Magento\Core\Model\Store\Config $coreStoreConfig, + $scopeType, array $data = array() ) { $this->_encryptor = $encryptor; @@ -160,17 +143,16 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface $sidResolver, $routeParamsResolver, $queryParamsResolver, + $scopeConfig, + $scopeType, $data ); - $this->_config = $config; $this->_backendHelper = $backendHelper; $this->_menuConfig = $menuConfig; $this->_cache = $cache; $this->_session = $authSession; $this->formKey = $formKey; $this->_storeFactory = $storeFactory; - $this->_coreConfig = $coreConfig; - $this->_coreStoreConfig = $coreStoreConfig; } /** @@ -183,7 +165,7 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface if ($this->hasData('secure_is_forced')) { return $this->getData('secure'); } - return $this->_config->isSetFlag('web/secure/use_in_adminhtml'); + return $this->_scopeConfig->isSetFlag('web/secure/use_in_adminhtml'); } /** @@ -288,7 +270,7 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface */ public function useSecretKey() { - return $this->_config->isSetFlag('admin/security/use_form_key') && !$this->getNoSecret(); + return $this->_scopeConfig->isSetFlag('admin/security/use_form_key') && !$this->getNoSecret(); } /** @@ -330,7 +312,9 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface */ public function getStartupPageUrl() { - $menuItem = $this->_getMenu()->get($this->_coreStoreConfig->getConfig(self::XML_PATH_STARTUP_MENU_ITEM)); + $menuItem = $this->_getMenu()->get( + $this->_scopeConfig->getValue(self::XML_PATH_STARTUP_MENU_ITEM, $this->_scopeType) + ); if (!is_null($menuItem)) { if ($menuItem->isAllowed() && $menuItem->getAction()) { return $menuItem->getAction(); @@ -428,7 +412,7 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface /** * Get scope for the url instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getScope() { @@ -463,6 +447,6 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface */ protected function _getConfig($path) { - return $this->_coreConfig->getValue($path, 'default'); + return $this->_scopeConfig->getValue($path); } } diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 1efa27a99d571652417a91ac33b668eb9decd645..4a59ee7af1cb588fcd78843e8216be558b08578c 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -36,7 +36,7 @@ <preference for="Magento\App\Response\Http\FileFactory" type="Magento\Backend\App\Response\Http\FileFactory" /> <preference for="Magento\App\View" type="Magento\Backend\Model\View" /> <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> - <type name="Magento\Backend\App\Action\Context"> + <type name="Magento\Backend\App\Action\Context"> <arguments> <argument name="helper" xsi:type="object">Magento\Backend\Helper\Data</argument> </arguments> @@ -46,7 +46,7 @@ <argument name="backendUrl" xsi:type="object">Magento\Backend\Model\UrlInterface\Proxy</argument> </arguments> </type> - <type name="Magento\Core\Model\Session"> + <type name="Magento\Session\Generic"> <arguments> <argument name="sessionName" xsi:type="string">adminhtml</argument> </arguments> @@ -85,7 +85,7 @@ </arguments> </type> <type name="Magento\Backend\Model\Config\Structure\Element\Group\Proxy" shared="false" /> - <type name="Magento\Core\Model\Layout"> + <type name="Magento\View\Layout"> <arguments> <argument name="area" xsi:type="string">adminhtml</argument> </arguments> @@ -110,7 +110,7 @@ <plugin name="adminAuthentication" type="Magento\Backend\App\Action\Plugin\Authentication" sortOrder="100" /> <plugin name="adminMassactionKey" type="Magento\Backend\App\Action\Plugin\MassactionKey" sortOrder="11" /> </type> - <type name="Magento\Core\App\Response\Redirect"> + <type name="Magento\Store\App\Response\Redirect"> <arguments> <argument name="canUseSessionIdInParam" xsi:type="boolean">false</argument> </arguments> diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index 8dd99014def25260517f61945ccae5c5fe98f0c9..e0f0f94a0a655baf62447f1b6487f59661b8062d 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\Core\Model\Config\Storage\Db" /> + <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\App\Config\Storage\Writer" /> <preference for="Magento\App\Request\PathInfoProcessorInterface" type="Magento\Backend\App\Request\PathInfoProcessor" /> <preference for="Magento\Backend\Model\Auth\StorageInterface" type="Magento\Backend\Model\Auth\Session" /> <preference for="Magento\Backend\Model\Config\Structure\SearchInterface" type="Magento\Backend\Model\Config\Structure" /> @@ -99,6 +99,7 @@ <arguments> <argument name="authSession" xsi:type="object">Magento\Backend\Model\Auth\Session\Proxy</argument> <argument name="formKey" xsi:type="object">Magento\Data\Form\FormKey\Proxy</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> </arguments> </type> <type name="Magento\Backend\Helper\Dashboard\Data"> diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 26702f8307909f3c40faa161a215a034651b6d2c..9bed921e83ccc82c60119263abaededafb79ff5f 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Directory"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Directory"/> <module name="Magento_Core"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml index 239285b23777bc54cb8f243435c76bfe1a3cfdc8..fed267ed88a6443d65e2ce91e1d5436555adb759 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/login.phtml @@ -38,13 +38,12 @@ <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/elements.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/form.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/admin.css') ?>" media="all" /> - <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/header.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" /> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script> diff --git a/app/code/Magento/Backend/view/adminhtml/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/admin/page.phtml index 58a927f5cd13bdddbcb31b2d281ad93c12225ab7..5af0b981220ec5be252c293daeded8884725f85c 100644 --- a/app/code/Magento/Backend/view/adminhtml/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/admin/page.phtml @@ -33,10 +33,12 @@ </head> <body id="html-body"<?php echo $this->getBodyClass() ? ' class="' . $this->getBodyClass() . '"' : ''; ?> data-container="body" data-mage-init='{"loaderAjax":{},"loader":{}}'> - <div class="wrapper"> + <div class="page-wrapper"> <?php echo $this->getChildHtml('notification_window'); ?> <?php echo $this->getChildHtml('global_notices') ?> - <?php echo $this->getChildHtml('header') ?> + <div class="page-header-wrapper"> + <?php echo $this->getChildHtml('header') ?> + </div> <?php echo $this->getChildHtml('menu') ?> <?php echo $this->getChildHtml('notifications'); ?> @@ -45,7 +47,7 @@ <div id="messages" data-container-for="messages" class="messages"> <?php echo $this->getLayout()->getMessagesBlock()->getGroupedHtml() ?> </div> - + <?php echo $this->getChildHtml('page_main_actions'); ?> <?php if($this->getChildHtml('left')): ?> <div id="page:main-container" class="<?php echo $this->getContainerCssClass() ?> col-2-left-layout"> <div class="main-col" id="content"> @@ -64,11 +66,10 @@ </section> <?php echo $this->getChildHtml('js') ?> + <div class="page-footer-wrapper"> + <?php echo $this->getChildHtml('footer') ?> + </div> </div> - - <footer class="footer"> - <div class="footer-content"><?php echo $this->getChildHtml('footer') ?></div> - </footer> <?php echo $this->getChildHtml('before_body_end') ?> <!-- TODO: remove this popup after refactoring of "varienLoader.js" file --> <div class="loading-old" id="loading-mask" style="display:none;"> diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml index a0523a85a999847353203c1cc23b94e99bdec278..729944c21de1bf90ca2a69e2816c2975cf2ca991 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/graph.phtml @@ -25,22 +25,22 @@ */ ?> <div class="dashboard-diagram"> - <div class="store-switcher"> - <label><?php echo __('Select Range') ?>: - <select name="period" id="order_<?php echo $this->getHtmlId() ?>_period" onchange="changeDiagramsPeriod(this);"> - <?php foreach ($this->helper('Magento\Backend\Helper\Dashboard\Data')->getDatePeriods() as $value => $label): ?> - <?php if(in_array($value, array('custom'))) continue; ?> - <option value="<?php echo $value ?>" <?php if ($this->getRequest()->getParam('period') == $value): ?> selected="selected"<?php endif; ?>><?php echo $label ?></option> - <?php endforeach; ?> - </select> - </label> + <div class="dashboard-diagram-switcher"> + <label for="order_<?php echo $this->getHtmlId() ?>_period"><?php echo __('Select Range:') ?></label> + <select name="period" id="order_<?php echo $this->getHtmlId() ?>_period" onchange="changeDiagramsPeriod(this);"> + <?php foreach ($this->helper('Magento\Backend\Helper\Dashboard\Data')->getDatePeriods() as $value => $label): ?> + <?php if(in_array($value, array('custom'))) continue; ?> + <option value="<?php echo $value ?>" <?php if ($this->getRequest()->getParam('period') == $value): ?> selected="selected"<?php endif; ?>><?php echo $label ?></option> + <?php endforeach; ?> + </select> </div> -<?php - $containerStyle = "width:{$this->getWidth()}px;height:{$this->getHeight()}px; margin:0 auto;"; -?> <?php if($this->getCount()): ?> - <div style="<?php echo $containerStyle?>"><img src="<?php echo $this->getChartUrl(false) ?>" alt="chart" title="chart" /></div> + <div class="dashboard-diagram-image"> + <img src="<?php echo $this->getChartUrl(false) ?>" class="dashboard-diagram-chart" alt="Chart" title="Chart" /> + </div> <?php else: ?> - <div class="dashboard-diagram-nodata"><?php echo __('No Data Found') ?></div> + <div class="dashboard-diagram-nodata"> + <span><?php echo __('No Data Found') ?></span> + </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml index b5d69c0d547a2f64d2aae1ea94ea5ba4ba03b492..06ffee92c2de70a2311e39d2ac9c1715c0bdd334 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/grid.phtml @@ -29,40 +29,40 @@ $numColumns = sizeof($this->getColumns()); ?> <?php if($this->getCollection()): ?> -<div class="grid"> -<table cellspacing="0" id="<?php echo $this->getId() ?>_table"> - <?php - /* This part is commented to remove all <col> tags from the code. */ - /* foreach ($this->getColumns() as $_column): ?> - <col <?php echo $_column->getHtmlProperty() ?> /> - <?php endforeach; */ ?> - <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?> - <thead> - <?php if ($this->getHeadersVisibility()): ?> - <tr class="headings"> - <?php foreach ($this->getColumns() as $_column): ?> - <th <?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th> - <?php endforeach; ?> - </tr> - <?php endif; ?> - </thead> - <?php endif; ?> - <tbody> - <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?> - <?php foreach ($this->getCollection() as $_index=>$_item): ?> - <tr title="<?php echo $this->getRowUrl($_item) ?>"> - <?php $i=0;foreach ($this->getColumns() as $_column): ?> - <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> +<div class="dashboard-data-wrapper"> + <table class="dashboard-data" id="<?php echo $this->getId() ?>_table"> + <?php + /* This part is commented to remove all <col> tags from the code. */ + /* foreach ($this->getColumns() as $_column): ?> + <col <?php echo $_column->getHtmlProperty() ?> /> + <?php endforeach; */ ?> + <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?> + <thead> + <?php if ($this->getHeadersVisibility()): ?> + <tr class="headings"> + <?php foreach ($this->getColumns() as $_column): ?> + <th <?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getHeaderHtml() ?></th> + <?php endforeach; ?> + </tr> + <?php endif; ?> + </thead> + <?php endif; ?> + <tbody> + <?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?> + <?php foreach ($this->getCollection() as $_index=>$_item): ?> + <tr title="<?php echo $this->getRowUrl($_item) ?>"> + <?php $i=0;foreach ($this->getColumns() as $_column): ?> + <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td> + <?php endforeach; ?> + </tr> <?php endforeach; ?> - </tr> - <?php endforeach; ?> - <?php elseif ($this->getEmptyText()): ?> - <tr> - <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td> - </tr> - <?php endif; ?> - </tbody> -</table> + <?php elseif ($this->getEmptyText()): ?> + <tr> + <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td> + </tr> + <?php endif; ?> + </tbody> + </table> </div> <?php if($this->canDisplayContainer()): ?> <script type="text/javascript"> diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml index 0d5dcc420079a969159f7b6dce26e0e411eeed1a..90c958cc9cd2c6ee56f4e8e22d7c80c6120029bb 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/index.phtml @@ -88,34 +88,40 @@ function toggleCal(id) { //]]> </script> <?php endif; ?> -<!-- TODO: redesign dashboard --> - <div class="dashboard-container columns col-2-left-layout"> - <div class="columns-content"> - <div class="main-col"> - <?php echo $this->getChildHtml('store_switcher') ?> - <div class="dashboard-inner"> + <div class="dashboard-container"> + <div class="dashboard-inner"> + <div class="dashboard-main"> + <div class="dashboard-diagram-container"> <?php echo $this->getChildHtml('diagrams') ?> <?php if (is_array($this->getChildBlock('diagrams')->getTabsIds())) : ?> - <div id="diagram_tab_content"></div> + <div id="diagram_tab_content" class="dashboard-diagram-tab-content"></div> <?php endif; ?> - <?php echo $this->getChildHtml('totals') ?> - <?php echo $this->getChildHtml('grids') ?> - <div id="grid_tab_content"></div> </div> + <?php echo $this->getChildHtml('totals') ?> + <div class="dashboard-store-stats"> + <?php echo $this->getChildHtml('grids') ?> + <div id="grid_tab_content" class="dashboard-store-stats-content"></div> + </div> </div> - <div class="side-col"> + <div class="dashboard-secondary"> <?php echo $this->getChildHtml('sales') ?> - <div class="entry-edit"> - <div class="entry-edit-head"><h4><?php echo __('Last 5 Orders') ?></h4></div> - <fieldset class="np"><?php echo $this->getChildHtml('lastOrders'); ?></fieldset> + <div class="dashboard-item"> + <header class="dashboard-item-header"> + <h3 class="title"><?php echo __('Last 5 Orders') ?></h3> + </header> + <?php echo $this->getChildHtml('lastOrders'); ?> </div> - <div class="entry-edit"> - <div class="entry-edit-head"><h4><?php echo __('Last 5 Search Terms') ?></h4></div> - <fieldset class="np"><?php echo $this->getChildHtml('lastSearches'); ?></fieldset> + <div class="dashboard-item"> + <header class="dashboard-item-header"> + <h3 class="title"><?php echo __('Last 5 Search Terms') ?></h3> + </header> + <?php echo $this->getChildHtml('lastSearches'); ?> </div> - <div class="entry-edit"> - <div class="entry-edit-head"><h4><?php echo __('Top 5 Search Terms') ?></h4></div> - <fieldset class="np"><?php echo $this->getChildHtml('topSearches'); ?></fieldset> + <div class="dashboard-item"> + <header class="dashboard-item-header"> + <h3 class="title"><?php echo __('Top 5 Search Terms') ?></h3> + </header> + <?php echo $this->getChildHtml('topSearches'); ?> </div> </div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml index be2794e5c0422dd71e80771ee13272f2a524a5c2..009c2aa07e12b42cbdff0f3df079d42b72aec563 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/salebar.phtml @@ -25,12 +25,15 @@ */ ?> <?php if( sizeof($this->getTotals()) > 0 ): ?> - <?php foreach( $this->getTotals() as $_total ): ?> - <div class="entry-edit"> - <div class="entry-edit-head"><h4><?php echo $_total['label'] ?></h4></div> - <fieldset class="a-center bold"> - <span class="nowrap" style="font-size:18px;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#686868;"><?php echo $_total['decimals'] ?></span></span> - </fieldset> - </div> - <?php endforeach; ?> + <?php foreach( $this->getTotals() as $_total ): ?> + <div class="dashboard-item dashboard-item-primary"> + <header class="dashboard-item-header"> + <h3 class="title"><?php echo $_total['label'] ?></h3> + </header> + <strong class="dashboard-sales-value"> + <?php echo $_total['value'] ?> + <span class="dashboard-sales-decimals"><?php echo $_total['decimals'] ?></span> + </strong> + </div> + <?php endforeach; ?> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml b/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml index f4ebb07549d3cf4c121540f951120549461fd873..093d4d13c4ca6d1ac466c85075556e868d0288ad 100644 --- a/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml +++ b/app/code/Magento/Backend/view/adminhtml/dashboard/totalbar.phtml @@ -25,18 +25,17 @@ */ ?> <?php if( sizeof($this->getTotals()) > 0 ): ?> -<div class="box" id="dashboard_diagram_totals"> - <div class="entry-edit"> - <table cellspacing="0" width="100%"> - <tr> - <?php foreach( $this->getTotals() as $_total ): ?> - <td class="a-center bold"> - <span><?php echo $_total['label'] ?></span><br /> - <span class="nowrap" style="font-size:18px; color:#EA7601;"><?php echo $_total['value'] ?><span style="font-size:14px; color:#DE8946;"><?php echo $_total['decimals'] ?></span></span> - </td> - <?php endforeach; ?> - </tr> - </table> - </div> +<div class="dashboard-totals" id="dashboard_diagram_totals"> + <ul class="dashboard-totals-list"> + <?php foreach( $this->getTotals() as $_total ): ?> + <li class="dashboard-totals-item"> + <span class="dashboard-totals-label"><?php echo $_total['label'] ?></span> + <strong class="dashboard-totals-value"> + <?php echo $_total['value'] ?> + <span class="dashboard-totals-decimals"><?php echo $_total['decimals'] ?></span> + </strong> + </li> + <?php endforeach; ?> + </ul> </div> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_dashboard_index.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_dashboard_index.xml index da56a65d2d592f582d3b8ce138eb1d238b13212d..960ac53c977fc3382ad33f12d180d255cba7de32 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_dashboard_index.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_dashboard_index.xml @@ -24,13 +24,18 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <referenceContainer name="content"> - <block class="Magento\Backend\Block\Dashboard" name="dashboard"> - <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" as="store_switcher" template="store/switcher.phtml"> - <action method="setUseConfirm"> - <argument name="params" xsi:type="string">0</argument> - </action> - </block> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="store_switcher" + as="store_switcher" + template="Magento_Backend::store/switcher.phtml"> + <action method="setUseConfirm"> + <argument name="params" xsi:type="string">0</argument> + </action> </block> </referenceContainer> + + <referenceContainer name="content"> + <block class="Magento\Backend\Block\Dashboard" name="dashboard" /> + </referenceContainer> </layout> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml index 39519b513f4b6525d55e1809a79b0c515ff79b31..6996cf87c8ffe3bf9bc85c64747d0f9f502be377 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_config_edit.xml @@ -35,9 +35,21 @@ <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/config/js.phtml"/> <block class="Magento\Backend\Block\Template" template="Magento_Backend::system/shipping/applicable_country.phtml"/> </referenceContainer> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="adminhtml.system.config.switcher" + template="Magento_Backend::store/switcher.phtml"> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">0</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">Default Config</argument> + <argument name="show_manage_stores_link" xsi:type="string">1</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="left"> <block class="Magento\Backend\Block\System\Config\Tabs" name="adminhtml.system.config.tabs" before="-"/> - <block class="Magento\Backend\Block\System\Config\Switcher" name="adminhtml.system.config.switcher" before="-"/> </referenceContainer> <referenceContainer name="content"> <block name="system.config.edit" class="Magento\Backend\Block\System\Config\Edit"/> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml index d5d0748d648bc49af7f1af62392a01cdc45d3739..b005f130920b13b97458cbebe83811b673f7dff1 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_store_grid_block.xml @@ -29,7 +29,7 @@ <arguments> <argument name="id" xsi:type="string">storeGrid</argument> <argument name="save_parameters_in_session" xsi:type="string">1</argument> - <argument name="dataSource" xsi:type="object">Magento\Core\Model\Resource\Website\Grid\Collection</argument> + <argument name="dataSource" xsi:type="object">Magento\Store\Model\Resource\Website\Grid\Collection</argument> </arguments> <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="adminhtml.system.store.grid.columnSet" as="grid.columnSet"> <arguments> diff --git a/app/code/Magento/Service/etc/module.xml b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_edit.xml similarity index 74% rename from app/code/Magento/Service/etc/module.xml rename to app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_edit.xml index 38cd40bff9e57e44907022d58309d9231bb33c33..9313f41dc301d8fa358617bc456ac8a5588562a2 100644 --- a/app/code/Magento/Service/etc/module.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/adminhtml_system_variable_edit.xml @@ -1,6 +1,6 @@ -<?xml version="1.0"?> -<!-- -/** +<?xml version="1.0"?> +<!-- +/** * Magento * * NOTICE OF LICENSE @@ -17,12 +17,14 @@ * * 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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> - <module name="Magento_Service" version="1.0.0.0" active="true" /> -</config> + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" /> + </referenceContainer> +</layout> diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index b29d7f09056b11e375f0788141aed7458a68f0ae..3e7a64b5318034407cbef15ccc733a7fd77df18f 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -31,7 +31,7 @@ </action> <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js"> <arguments> - <argument name="file" xsi:type="string">jquery/jquery.js</argument> + <argument name="file" xsi:type="string">jquery/jquery-1.8.2.js</argument> </arguments> </block> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-jquery-no-conflict-js"> @@ -41,7 +41,7 @@ </block> <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-js"> <arguments> - <argument name="file" xsi:type="string">jquery/jquery-ui.js</argument> + <argument name="file" xsi:type="string">jquery/jquery-ui-1.9.2.js</argument> </arguments> </block> <block class="Magento\Theme\Block\Html\Head\Script" name="head-load-min-js"> @@ -276,28 +276,47 @@ </block> <block class="Magento\Backend\Block\Menu" name="menu" as="menu" template="Magento_Backend::menu.phtml"/> <block class="Magento\Backend\Block\Page\Notices" name="global_notices" as="global_notices" template="page/notices.phtml"/> - <block class="Magento\Backend\Block\Page\Header" name="header" as="header"> - <block class="Magento\Backend\Block\GlobalSearch" as="search" acl="Magento_Adminhtml::global_search"/> - </block> + <container name="header" htmlTag="header" htmlClass="page-header"> + <block class="Magento\Backend\Block\Page\Header" name="logo" before="-"> + <arguments> + <argument name="show_part" xsi:type="string">logo</argument> + <argument name="edition" translate="true" xsi:type="string">Community Edition</argument> + </arguments> + </block> + <block class="Magento\Backend\Block\GlobalSearch" as="search" after="logo" acl="Magento_Adminhtml::global_search"/> + <block class="Magento\Backend\Block\Page\Header" name="user" after="-"> + <arguments> + <argument name="show_part" xsi:type="string">user</argument> + </arguments> + </block> + </container> <container name="notifications" as="notifications" label="Notifications"/> <block class="Magento\Backend\Block\Widget\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/> - <!--<update handle="formkey"/> this won't work, see the try/catch and a jammed exception in \Magento\Core\Model\Layout::createBlock() --> + <!--<update handle="formkey"/> this won't work, see the try/catch and a jammed exception in \Magento\View\Layout::createBlock() --> <block class="Magento\Backend\Block\Admin\Formkey" name="formkey" as="formkey" template="Magento_Backend::admin/formkey.phtml"/> <!-- deprecated since 1.7.0.0 see \Magento\Theme\Block\Js\Translate --> <block class="Magento\View\Element\Template" name="js_translate" as="js_translate" template="Magento_Backend::page/js/translate.phtml"/> <container name="main-top" label="main-top" as="main-top"> <block class="Magento\Theme\Block\Html\Title" name="page-title" template="title.phtml"/> </container> + <container name="page.main.actions" as="page_main_actions" htmlTag="div" htmlClass="page-main-actions"> + <block class="Magento\View\Element\Template" name="page.actions.toolbar" template="Magento_Backend::pageactions.phtml" after="-"/> + </container> <container name="left" as="left" label="Left Column"/> <container name="content" as="content" label="Content"/> <block class="Magento\View\Element\Messages" name="messages" as="messages"/> <container name="js" as="js" label="JavaScript"/> - <block class="Magento\Backend\Block\Page\Footer" name="footer" as="footer"> - <block class="Magento\Backend\Block\Page\Copyright" name="copyright" as="copyright"/> - <action method="setBugreportUrl"> - <argument name="url" xsi:type="string">http://www.magentocommerce.com/bug-tracking</argument> - </action> - </block> + <container name="footer" htmlTag="footer" htmlClass="page-footer"> + <block class="Magento\Backend\Block\Page\Locale" name="locale.switcher" template="Magento_Backend::page/locale.phtml"/> + <container name="legal" htmlTag="div" htmlClass="footer-legal"> + <block class="Magento\Backend\Block\Page\Copyright" name="copyright" as="copyright"/> + <block class="Magento\Backend\Block\Page\Footer" name="version" as="version"> + <arguments> + <argument name="bugreport_url" xsi:type="string">http://www.magentocommerce.com/bug-tracking</argument> + </arguments> + </block> + </container> + </container> <container name="before_body_end" as="before_body_end" label="Before Body End"/> </block> </layout> diff --git a/app/code/Magento/Backend/view/adminhtml/page/copyright.phtml b/app/code/Magento/Backend/view/adminhtml/page/copyright.phtml index 0ee85590dacd513d39cc46f99151dc167d1cf192..6d18ebbb382b16f1ca4338bb3b39a6e5d22f2dd6 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/copyright.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/copyright.phtml @@ -22,4 +22,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php echo __('Magento is an eBay Inc. company. Copyright© %1 Magento, Inc. All rights reserved.', date('Y')) ?> +<small class="copyright"> + <?php echo __('Magento is an eBay Inc. company. Copyright© %1 Magento, Inc. All rights reserved.', date('Y')) ?> +</small> diff --git a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml index 463dfe4454896e17b13098dbf4d5716561cfbcfc..4d176481d18f67993b9ccd3acacbca3eb20435af 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml @@ -19,10 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package default_default * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php echo $this->getChildHtml('copyright');?> / -<?php echo __('Magento ver. %1', \Magento\AppInterface::VERSION) ?> +<small class="magento-version"><?php echo __('Magento ver. %1', \Magento\AppInterface::VERSION) ?></small> +<?php if ($this->getBugreportUrl()): ?> +<a class="link-report" href="<?php echo $this->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php echo __('Help Us Keep Magento Healthy - Report All Bugs') ?></a> +<?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/page/header.phtml index 61c7572b847b8bca4a32d91fb642a7f4e482ca15..b6f6befb735281bc0b875c65410f1f148a5d145a 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/header.phtml @@ -26,28 +26,30 @@ /** @var $this \Magento\Backend\Block\Page\Header */ ?> -<header class="header"> - <div class="header-inner"> - <a href="<?php echo $this->getHomeLink() ?>" class="logo" title="<?php echo __('Magento Admin Panel') ?>"><span><?php echo __('Magento Admin Panel') ?></span></a> - <div class="header-panel"> - <div class="account"> - <a href="<?php echo $this->getUrl('adminhtml/system_account/index') ?>" class="account-avatar" title="<?php echo __('My Account') ?>" data-toggle="dropdown"> - <?php echo $this->escapeHtml($this->getUser()->getUsername()); ?> - </a> - <ul class="dropdown-menu"> - <?php if ($this->getAuthorization()->isAllowed('Magento_Adminhtml::myaccount')): ?> - <li class="first"> - <a href="<?php echo $this->getUrl('adminhtml/system_account/index') ?>" <?php echo $this->getUiId('user', 'account', 'settings')?> title="<?php echo __('Account Setting') ?>"><?php echo __('Account Setting') ?></a> - <div><?php echo $this->escapeHtml($this->getUser()->getUsername()); ?></div> - </li> - <?php endif; ?> - <li class="last"> - <a href="<?php echo $this->getLogoutLink() ?>" class="account-signout" title="<?php echo __('Sign Out') ?>"><?php echo __('Sign Out') ?></a> - </li> - </ul> - </div> - <a href="<?php echo $this->getBaseUrl(); ?>" title="<?php echo __('Customer View'); ?>" target="_blank" class="store-front"><?php echo __('Customer View'); ?></a> - <?php echo $this->getChildHtml(); ?> +<?php switch($this->getShowPart()): + case 'logo': ?> + <?php $edition = $this->getEdition() ? 'data-edition="' . $this->getEdition() . '"' : ''; ?> + <a href="<?php echo $this->getHomeLink() ?>" <?php echo $edition; ?> class="logo" title="<?php echo __('Magento Admin Panel') ?>"><span><?php echo __('Magento Admin Panel') ?></span></a> + <?php break; ?> + <?php case 'user': ?> + <div class="admin-user"> + <a href="<?php echo $this->getUrl('adminhtml/system_account/index') ?>" class="admin-user-account" title="<?php echo __('My Account') ?>" data-toggle="dropdown"> + <?php echo $this->escapeHtml($this->getUser()->getUsername()); ?> + </a> + <ul class="dropdown-menu admin-user-menu"> + <?php if ($this->getAuthorization()->isAllowed('Magento_Adminhtml::myaccount')): ?> + <li> + <a href="<?php echo $this->getUrl('adminhtml/system_account/index') ?>" <?php echo $this->getUiId('user', 'account', 'settings')?> title="<?php echo __('Account Setting') ?>"><?php echo __('Account Setting') ?> <span><?php echo $this->escapeHtml($this->getUser()->getUsername()); ?></span></a> + </li> + <?php endif; ?> + <li><a href="<?php echo $this->getBaseUrl(); ?>" title="<?php echo __('Customer View'); ?>" target="_blank" class="store-front"><?php echo __('Customer View'); ?></a></li> + <li> + <a href="<?php echo $this->getLogoutLink() ?>" class="account-signout" title="<?php echo __('Sign Out') ?>"><?php echo __('Sign Out') ?></a> + </li> + </ul> </div> - </div> -</header> + <?php break; ?> + <?php case 'other': ?> + <?php echo $this->getChildHtml(); ?> + <?php break; ?> +<?php endswitch; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/page/js/components.phtml b/app/code/Magento/Backend/view/adminhtml/page/js/components.phtml index ee4901963a47b6d96f9e49fd788775d0f11377e9..55bdcb4356993adc266be3267bfe3f507194dbf4 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/js/components.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/js/components.phtml @@ -71,10 +71,10 @@ loader: [ '<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>', '<?php echo $this->getViewFileUrl('mage/translate.js') ?>', - '<?php echo $this->getViewFileUrl('mage/loader.js') ?>' + '<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>' ], loaderAjax: [ - '<?php echo $this->getViewFileUrl('mage/loader.js') ?>' + '<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>' ], floatingHeader: [ '<?php echo $this->getViewFileUrl('mage/backend/floating-header.js') ?>' diff --git a/app/code/Magento/Backend/view/adminhtml/page/locale.phtml b/app/code/Magento/Backend/view/adminhtml/page/locale.phtml new file mode 100644 index 0000000000000000000000000000000000000000..29e90861534902134e570a9d3134b6ef20f1092d --- /dev/null +++ b/app/code/Magento/Backend/view/adminhtml/page/locale.phtml @@ -0,0 +1,40 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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 design + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<div class="locale-switcher-field field"> + <label class="label" for="locale-switcher"><span><?php echo __('Interface Locale'); ?></span></label> + <div class="control"> + <?php echo $this->getLocaleSelect(); ?> + </div> + <script type="text/javascript"> + function setInterfaceLanguage(event) { + var elem = Event.element(event); + if (elem) { + setLocation('<?php echo $this->getChangeLocaleUrl() ?>locale/'+elem.value+'/<?php echo $this->getUrlForReferer() ?>'); + } + } + Event.observe('interface_locale', 'change', setInterfaceLanguage) + </script> +</div> diff --git a/app/code/Magento/Core/view/frontend/formkey.phtml b/app/code/Magento/Backend/view/adminhtml/pageactions.phtml similarity index 81% rename from app/code/Magento/Core/view/frontend/formkey.phtml rename to app/code/Magento/Backend/view/adminhtml/pageactions.phtml index 9270333bc130864e4df2c77c49db76ae6a01911d..ea9f59ef8807b3c8d4dc9132d158d994c16a3bd5 100644 --- a/app/code/Magento/Core/view/frontend/formkey.phtml +++ b/app/code/Magento/Backend/view/adminhtml/pageactions.phtml @@ -19,10 +19,13 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design - * @package base_default + * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /** @var $this \Magento\Core\Block\Formkey */ ?> -<input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" /> +<?php if($this->getChildHtml()):?> + <div class="page-actions" <?php echo $this->getUiId('content-header') ?>> + <?php echo $this->getChildHtml(); ?> + </div> +<?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml index 115a9f1dddbe10ac18699275ef4e5a9afb149455..f2e31892703748a7697567831acf03d5b7f2d836 100644 --- a/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/store/switcher.phtml @@ -26,22 +26,35 @@ /* @var $this \Magento\Backend\Block\Store\Switcher */ ?> <?php if ($websites = $this->getWebsites()): ?> - <div class="store-switcher-alt"> - <input type="hidden" name="store_switcher" id="store_switcher" - data-role="store-id" - value="<?php echo $this->escapeHtml($this->getStoreId()) ?>" - onchange="return switchStore(this);"<?php echo $this->getUiId()?> /> - <strong class="store-selected" data-toggle="dropdown"> - <?php echo $this->getCurrentStoreName() ?> - </strong> +<div class="store-switcher store-view"> + <span class="label"><?php echo __('Scope:') ?></span> + <div class="actions dropdown closable"> + <input type="hidden" name="store_switcher" id="store_switcher" + data-role="store-view-id" data-param="<?php echo $this->getStoreVarName() ?>" + value="<?php echo $this->escapeHtml($this->getStoreId()) ?>" + onchange="switchScope(this);"<?php echo $this->getUiId()?> /> + <input type="hidden" name="store_group_switcher" id="store_group_switcher" + data-role="store-group-id" data-param="<?php echo $this->getStoreGroupVarName() ?>" + value="<?php echo $this->escapeHtml($this->getStoreGroupId()) ?>" + onchange="switchScope(this);"<?php echo $this->getUiId()?> /> + <input type="hidden" name="website_switcher" id="website_switcher" + data-role="website-id" data-param="<?php echo $this->getWebsiteVarName() ?>" + value="<?php echo $this->escapeHtml($this->getWebsiteId()) ?>" + onchange="switchScope(this);"<?php echo $this->getUiId()?> /> + <button class="action toggle" data-toggle="dropdown" aria-haspopup="true"> + <span><?php echo $this->getCurrentSelectionName() ?></span> + </button> <ul class="dropdown-menu" data-role="stores-list"> <?php if ($this->hasDefaultOption()): ?> - <li class="store-switcher-all"> - <a data-value="" - href="#"> - <?php echo $this->getDefaultStoreName() ?> - </a> + <li class="store-switcher-all <?php if (!($this->getDefaultSelectionName() != $this->getCurrentSelectionName())) echo "disabled"; ?> <?php if (!$this->hasScopeSelected()) { ?> current<?php }?>"> + <?php if ($this->getDefaultSelectionName() != $this->getCurrentSelectionName()) { ?> + <a data-role="store-view-id" data-value="" href="#"> + <?php echo $this->getDefaultSelectionName() ?> + </a> + <?php } else { ?> + <span><?php echo $this->getDefaultSelectionName() ?></span> + <?php }?> </li> <?php endif; ?> <?php foreach ($websites as $website): ?> @@ -51,58 +64,97 @@ <?php foreach ($this->getStores($group) as $store): ?> <?php if ($showWebsite == false): ?> <?php $showWebsite = true; ?> - <li class="store-switcher-website"> - <strong><?php echo $this->escapeHtml($website->getName()) ?></strong> + <li class="store-switcher-website <?php if (!($this->isWebsiteSwitchEnabled() && !$this->isWebsiteSelected($website))) echo "disabled"; ?> <?php if ($this->isWebsiteSelected($website)) { ?> current<?php }?>"> + <?php if ($this->isWebsiteSwitchEnabled() && !$this->isWebsiteSelected($website)) { ?> + <a data-role="website-id" data-value="<?php echo $this->escapeHtml($website->getId()) ?>" href="#"> + <?php echo $this->escapeHtml($website->getName()) ?> + </a> + <?php } else { ?> + <span><?php echo $this->escapeHtml($website->getName()) ?></span> + <?php }?> </li> <?php endif; ?> <?php if ($showGroup == false): ?> <?php $showGroup = true; ?> - <li class="store-switcher-store"> - <strong><?php echo $this->escapeHtml($group->getName()) ?></strong> + <li class="store-switcher-store <?php if (!($this->isStoreGroupSwitchEnabled() && !$this->isStoreGroupSelected($group))) echo "disabled"; ?> <?php if ($this->isStoreGroupSelected($group)) { ?> current<?php }?>"> + <?php if ($this->isStoreGroupSwitchEnabled() && !$this->isStoreGroupSelected($group)) { ?> + <a data-role="store-group-id" data-value="<?php echo $this->escapeHtml($group->getId()) ?>" href="#"> + <?php echo $this->escapeHtml($group->getName()) ?> + </a> + <?php } else { ?> + <span><?php echo $this->escapeHtml($group->getName()) ?></span> + <?php }?> </li> <?php endif; ?> - <li class="store-switcher-store-view"> - <?php if ($store->getId() == $this->getStoreId()) { ?> - <strong><?php echo $this->escapeHtml($store->getName()) ?></strong> - <?php } else { ?> - <a data-value="<?php echo $this->escapeHtml($store->getId()) ?>" - href="#"> + <li class="store-switcher-store-view <?php if (!($this->isStoreSwitchEnabled() && !$this->isStoreSelected($store))) echo "disabled"; ?> <?php if ($this->isStoreSelected($store)) { ?> current<?php }?>"> + <?php if ($this->isStoreSwitchEnabled() && !$this->isStoreSelected($store)) { ?> + <a data-role="store-view-id" data-value="<?php echo $this->escapeHtml($store->getId()) ?>" href="#"> <?php echo $this->escapeHtml($store->getName()) ?> </a> + <?php } else { ?> + <span><?php echo $this->escapeHtml($store->getName()) ?></span> <?php }?> </li> <?php endforeach; ?> <?php endforeach; ?> <?php endforeach; ?> + <?php if ($this->getShowManageStoresLink() && $this->getAuthorization()->isAllowed('Magento_Adminhtml::store')): ?> + <li class="dropdown-toolbar"> + <a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo __('Stores Configuration') ?></a> + </li> + <?php endif; ?> </ul> </div> + <?php echo $this->getHintHtml() ?> +</div> + <script type="text/javascript"> (function($) { var $storesList = $('[data-role=stores-list]'); $storesList.on('click', '[data-value]', function(event) { var val = $(event.target).data('value'); - var storeSwitcher = $('[data-role=store-id]'); - if (val != storeSwitcher.val()) { - storeSwitcher.val(val).trigger('change'); + var role = $(event.target).data('role'); + var switcher = $('[data-role='+role+']'); + + event.preventDefault(); + + if (!switcher.val() || val != switcher.val()) { + switcher.val(val).trigger('change'); // Set the value & trigger event } }); })(jQuery) - function switchStore(obj) { - var storeParam = obj.value ? 'store/' + obj.value + '/' : ''; + + var scopeSwitcherHandler; + + function switchScope(obj) { + var switcher = jQuery(obj); + var scopeId = switcher.val(); + var scopeParams = switcher.data('param') + '/' + scopeId + '/'; + if (obj.switchParams) { - storeParam += obj.switchParams; + scopeParams += obj.switchParams; } - <?php if ($this->getUseConfirm()): ?> - if (confirm("<?php echo __('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")) { - setLocation('<?php echo $this->getSwitchUrl() ?>' + storeParam); - return true; + + var url = '<?php echo $this->getSwitchUrl() ?>' + scopeParams; + + if ((typeof scopeSwitcherHandler) != 'undefined') { + var switcherParams = { + scopeId: scopeId, + scopeParams: scopeParams, + useConfirm: <?php echo (int)$this->getUseConfirm() ?> + }; + scopeSwitcherHandler(switcherParams); } else { - obj.value = '<?php echo $this->getStoreId() ?>'; + <?php if ($this->getUseConfirm()): ?> + if (confirm("<?php echo __('Please confirm scope switching. All data that hasn\'t been saved will be lost.') ?>")) { + setLocation(url); + } else { + obj.value = '<?php echo $this->getStoreId() ?>'; + } + <?php else: ?> + setLocation(url); + <?php endif; ?> } - return false; - <?php else: ?> - setLocation('<?php echo $this->getSwitchUrl() ?>' + storeParam); - <?php endif; ?> } </script> <?php endif; ?> diff --git a/app/code/Magento/Backend/view/adminhtml/store/switcher/enhanced.phtml b/app/code/Magento/Backend/view/adminhtml/store/switcher/enhanced.phtml index 035dd3b4ee6aeb816b5f876f6d567d0326af9620..e793773a46820bc7f60370351a202e1bc41bfac1 100644 --- a/app/code/Magento/Backend/view/adminhtml/store/switcher/enhanced.phtml +++ b/app/code/Magento/Backend/view/adminhtml/store/switcher/enhanced.phtml @@ -27,32 +27,35 @@ <?php $_websiteCollection = $this->getWebsiteCollection() ?> <?php if ($_websiteCollection->getSize()): ?> <div id="store_switcher_container"> -<p class="switcher"><label for="store_switcher"><?php echo __('Choose Store View:') ?></label> -<select name="store_switcher" id="store_switcher" class="left-col-block"> - <option value=""><?php echo $this->getDefaultStoreName() ?></option> - <?php foreach ($_websiteCollection as $_website): ?> - <?php $showWebsite=false; ?> - <?php foreach ($this->getGroupCollection($_website) as $_group): ?> - <?php $showGroup=false; ?> - <?php foreach ($this->getStoreCollection($_group) as $_store): ?> - <?php if ($showWebsite == false): ?> - <?php $showWebsite = true; ?> - <optgroup label="<?php echo $_website->getName() ?>"></optgroup> - <?php endif; ?> - <?php if ($showGroup == false): ?> - <?php $showGroup = true; ?> - <optgroup label=" <?php echo $_group->getName() ?>"> - <?php endif; ?> - <option group="<?php echo $_group->getId() ?>" value="<?php echo $_store->getId() ?>"<?php if($this->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>> <?php echo $_store->getName() ?></option> - <?php endforeach; ?> - <?php if ($showGroup): ?> - </optgroup> - <?php endif; ?> - <?php endforeach; ?> - <?php endforeach; ?> -</select> -<?php echo $this->getHintHtml() ?> -</p> + <div class="field field-store-switcher"> + <label for="store_switcher" class="label"><?php echo __('Choose Store View:') ?></label> + <div class="control"> + <select name="store_switcher" id="store_switcher"> + <option value=""><?php echo $this->getDefaultStoreName() ?></option> + <?php foreach ($_websiteCollection as $_website): ?> + <?php $showWebsite=false; ?> + <?php foreach ($this->getGroupCollection($_website) as $_group): ?> + <?php $showGroup=false; ?> + <?php foreach ($this->getStoreCollection($_group) as $_store): ?> + <?php if ($showWebsite == false): ?> + <?php $showWebsite = true; ?> + <optgroup label="<?php echo $_website->getName() ?>"></optgroup> + <?php endif; ?> + <?php if ($showGroup == false): ?> + <?php $showGroup = true; ?> + <optgroup label=" <?php echo $_group->getName() ?>"> + <?php endif; ?> + <option group="<?php echo $_group->getId() ?>" value="<?php echo $_store->getId() ?>"<?php if($this->getStoreId() == $_store->getId()): ?> selected="selected"<?php endif; ?>> <?php echo $_store->getName() ?></option> + <?php endforeach; ?> + <?php if ($showGroup): ?> + </optgroup> + <?php endif; ?> + <?php endforeach; ?> + <?php endforeach; ?> + </select> + </div> + <?php echo $this->getHintHtml() ?> + </div> </div> <script type="text/javascript"> //<![CDATA[ diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml index 97b92e27185d110a9dd22922569cfe8d72315db6..4ffff74e10a4b557c7b43bbcc056e9957325d351 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/edit.phtml @@ -33,7 +33,6 @@ * getForm() - html */ ?> -<div class="page-actions"><?php echo $this->getSaveButtonHtml() ?></div> <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="config-edit-form" enctype="multipart/form-data"> <?php echo $this->getBlockHtml('formkey')?> <div class="accordion"> diff --git a/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml b/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml index 1f3f3426587b62b8cd4087d1c5661c01aa988fc0..f8df989ac1d8739c3daf4b98120e7b747cfc06b9 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/config/switcher.phtml @@ -46,6 +46,8 @@ </div> <?php echo $this->getHintHtml() ?> <?php if ($this->getAuthorization()->isAllowed('Magento_Adminhtml::store')): ?> - <div><a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo __('Stores') ?></a></div> + <div class="actions"> + <a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo __('Stores') ?></a> + </div> <?php endif; ?> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml b/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml index bb5be9411ec9bc938597dfb3ef536a9ebc650868..c29b1095e0d32c7dae55026a3542bb0a208575f0 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/design/edit.phtml @@ -24,13 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getChildHtml('back_button') ?> - <?php if($this->getDesignChangeId()): ?> - <?php echo $this->getChildHtml('delete_button') ?> - <?php endif; ?> - <?php echo $this->getChildHtml('save_button') ?> -</div> <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="design-edit-form"> <?php echo $this->getBlockHtml('formkey')?> </form> diff --git a/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml b/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml index e04197e65ade925ea719ce61ca0f439c508bb049..da27b57cf2f5d450695109604dc72b9b798003e9 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/design/index.phtml @@ -24,5 +24,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"><?php echo $this->getChildHtml('add_new_button') ?></div> <?php echo $this->getChildHtml('grid') ?> diff --git a/app/code/Magento/Backend/view/adminhtml/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/system/search.phtml index 4135c8939ae89cba4cbeca8db6770b59965af5eb..580645c316b4b767b706d8d5310c07a6bff78b8b 100644 --- a/app/code/Magento/Backend/view/adminhtml/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/system/search.phtml @@ -26,30 +26,38 @@ /** @var $this \Magento\Backend\Block\GlobalSearch */ ?> -<script data-template="search-suggest" type="text/x-jquery-tmpl"> - <ul class="dropdown-menu"> - {{if items.length}} - {{each items}} - <li class="item" - {{html optionData($value)}} - > - <a href="${$value.url}" class="title">${$value.name}</a> - <div class="type">${$value.type}</div> - ${$value.description || ""} - </li> - {{/each}} - {{else}} - <li><span class="mage-suggest-no-records"><?php echo __('No records found.') ?></span></li> - {{/if}} - </ul> -</script> -<div class="search"> +<div class="search-global miniform"> <form action="#" id="form-search"> - <label for="search-global"> - <input type="text" id="search-global" name="query" data-mage-init='<?php - echo $this->escapeHtml($this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getWidgetInitOptions())) - ?>'> - </label> - <button type="submit" title="<?php echo __('Search') ?>"><?php echo __('Search') ?></button> + <div class="field search-global-field"> + <label class="label" for="search-global"><span><?php echo __('Search')?></span></label> + <div class="control"> + <input type="text" + class="search-global-input" + id="search-global" + placeholder="<?php echo __('Search')?>" + name="query" + data-mage-init='<?php echo $this->escapeHtml($this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getWidgetInitOptions()))?>'> + </div> + </div> + <div class="actions search-global-actions"> + <button type="submit" class="action search-global-action" title="<?php echo __('Search') ?>"><span><?php echo __('Search') ?></span></button> + </div> </form> -</div> + <script data-template="search-suggest" type="text/x-jquery-tmpl"> + <ul class="dropdown-menu search-global-menu"> + {{if items.length}} + {{each items}} + <li class="item" + {{html optionData($value)}} + > + <a href="${$value.url}" class="title">${$value.name}</a> + <div class="type">${$value.type}</div> + ${$value.description || ""} + </li> + {{/each}} + {{else}} + <li><span class="mage-suggest-no-records"><?php echo __('No records found.') ?></span></li> + {{/if}} + </ul> + </script> +</div> \ No newline at end of file diff --git a/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml b/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml index 03f19db12c3ea18b9665608b31fdacbd90564618..8f1f83a5e1bd7457547833d39277f9f92f064d21 100644 --- a/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml +++ b/app/code/Magento/Backend/view/adminhtml/urlrewrite/edit.phtml @@ -30,7 +30,6 @@ * @see \Magento\Backend\Block\Urlrewrite\Edit */ ?> -<div class="page-actions"><?php echo $this->getButtonsHtml() ?></div> <?php echo $this->getChildHtml() ?> <?php if ($this->getChildBlock('form')): ?> diff --git a/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml b/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml index f4c1b5ef436a86a6a775e7ceff9758dcdd9f36de..278f65fb0b14a0d547001bb5a734e2682a005d74 100644 --- a/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml +++ b/app/code/Magento/Backend/view/adminhtml/widget/form/container.phtml @@ -26,7 +26,9 @@ /** @var $this \Magento\Backend\Block\Widget\Form\Container */ ?> <?php echo $this->getFormInitScripts() ?> -<div class="page-actions" <?php echo $this->getUiId('content-header') ?>><?php echo $this->getButtonsHtml('header') ?></div> +<?php if($this->getButtonsHtml('header')): ?> + <div class="page-form-actions" <?php echo $this->getUiId('content-header') ?>><?php echo $this->getButtonsHtml('header') ?></div> +<?php endif; ?> <?php echo $this->getFormHtml() ?> <?php if ($this->hasFooterButtons()): ?> <div class="content-footer"> diff --git a/app/code/Magento/Backup/Block/Adminhtml/Backup.php b/app/code/Magento/Backup/Block/Adminhtml/Backup.php index 074d6087d3592d1f9c40ea0480556b2bf451d7f7..a0af20e61457c8beba24bae61d6c69a51e735135 100644 --- a/app/code/Magento/Backup/Block/Adminhtml/Backup.php +++ b/app/code/Magento/Backup/Block/Adminhtml/Backup.php @@ -47,65 +47,38 @@ class Backup extends \Magento\Backend\Block\Template protected function _prepareLayout() { parent::_prepareLayout(); - $this->addChild( - 'createButton', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Database Backup'), - 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_DB . "')", - 'class' => 'task' - ) - ); - $this->addChild( + + $this->getToolbar()->addChild( 'createSnapshotButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('System Backup'), 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_SYSTEM_SNAPSHOT . "')", - 'class' => '' + 'class' => 'primary system-backup' ) ); - $this->addChild( + $this->getToolbar()->addChild( 'createMediaBackupButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Database and Media Backup'), 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_MEDIA . "')", - 'class' => '' + 'class' => 'primary database-media-backup' + ) + ); + $this->getToolbar()->addChild( + 'createButton', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Database Backup'), + 'onclick' => "return backup.backup('" . \Magento\Backup\Factory::TYPE_DB . "')", + 'class' => 'task primary database-backup' ) ); $this->addChild('dialogs', 'Magento\Backup\Block\Adminhtml\Dialogs'); } - /** - * @return string - */ - public function getCreateButtonHtml() - { - return $this->getChildHtml('createButton'); - } - - /** - * Generate html code for "Create System Snapshot" button - * - * @return string - */ - public function getCreateSnapshotButtonHtml() - { - return $this->getChildHtml('createSnapshotButton'); - } - - /** - * Generate html code for "Create Media Backup" button - * - * @return string - */ - public function getCreateMediaBackupButtonHtml() - { - return $this->getChildHtml('createMediaBackupButton'); - } - /** * @return string */ diff --git a/app/code/Magento/Backup/Model/Config/Backend/Cron.php b/app/code/Magento/Backup/Model/Config/Backend/Cron.php index 091966d59b3f0411a5fba455628718de991a71ce..82717345b53f4c0ac74279098cb63d33daf2be1c 100644 --- a/app/code/Magento/Backup/Model/Config/Backend/Cron.php +++ b/app/code/Magento/Backup/Model/Config/Backend/Cron.php @@ -26,7 +26,7 @@ namespace Magento\Backup\Model\Config\Backend; /** * Backup by cron backend model */ -class Cron extends \Magento\Core\Model\Config\Value +class Cron extends \Magento\App\Config\Value { const CRON_STRING_PATH = 'crontab/default/jobs/system_backup/schedule/cron_expr'; @@ -41,7 +41,7 @@ class Cron extends \Magento\Core\Model\Config\Value /** * Config value factory * - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; @@ -53,9 +53,8 @@ class Cron extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath @@ -64,9 +63,8 @@ class Cron extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', @@ -74,7 +72,7 @@ class Cron extends \Magento\Core\Model\Config\Value ) { $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php index ef9a89f613a4fec1f24d8a2f1b93048cd1ce8403..159b241f2521b5490d6798590da2ce6b446a450e 100644 --- a/app/code/Magento/Backup/Model/Observer.php +++ b/app/code/Magento/Backup/Model/Observer.php @@ -70,9 +70,9 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Filesystem facade @@ -90,7 +90,7 @@ class Observer * @param \Magento\Backup\Helper\Data $backupData * @param \Magento\Registry $coreRegistry * @param \Magento\Logger $logger - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backup\Factory $backupFactory */ @@ -98,14 +98,14 @@ class Observer \Magento\Backup\Helper\Data $backupData, \Magento\Registry $coreRegistry, \Magento\Logger $logger, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { $this->_backupData = $backupData; $this->_coreRegistry = $coreRegistry; $this->_logger = $logger; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_filesystem = $filesystem; $this->_backupFactory = $backupFactory; } @@ -117,15 +117,15 @@ class Observer */ public function scheduledBackup() { - if (!$this->_coreStoreConfig->getConfigFlag(self::XML_PATH_BACKUP_ENABLED)) { + if (!$this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { return $this; } - if ($this->_coreStoreConfig->getConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { + if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_backupData->turnOnMaintenanceMode(); } - $type = $this->_coreStoreConfig->getConfig(self::XML_PATH_BACKUP_TYPE); + $type = $this->_scopeConfig->getValue(self::XML_PATH_BACKUP_TYPE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); $this->_errors = array(); try { @@ -159,7 +159,7 @@ class Observer $this->_logger->logException($e); } - if ($this->_coreStoreConfig->getConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { + if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_backupData->turnOffMaintenanceMode(); } diff --git a/app/code/Magento/Backup/etc/module.xml b/app/code/Magento/Backup/etc/module.xml index 49db05779b390e41fa5df64241ea4d374cfa2140..6291bebfbb1fd7ce2b9135bbb71c4145560bdbb4 100644 --- a/app/code/Magento/Backup/etc/module.xml +++ b/app/code/Magento/Backup/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Backup" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Cron"/> diff --git a/app/code/Magento/Backup/view/adminhtml/backup/list.phtml b/app/code/Magento/Backup/view/adminhtml/backup/list.phtml index 9f5e41d017184da2d95622eb7f32d067cf244511..efa3074819ca31feb01ebd23afb3545e157e98ca 100644 --- a/app/code/Magento/Backup/view/adminhtml/backup/list.phtml +++ b/app/code/Magento/Backup/view/adminhtml/backup/list.phtml @@ -24,11 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getCreateSnapshotButtonHtml(); ?> - <?php echo $this->getCreateMediaBackupButtonHtml(); ?> - <?php echo $this->getCreateButtonHtml(); ?> -</div> <?php echo $this->getChildHtml('grid') ?> <?php echo $this->getGridHtml() ?> <?php echo $this->getDialogsHtml() ?> diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php index 5b9ae734db374eef68ef7704303464220a9f9ecd..0e4482bcf8876be60a3878eac20f95bf4ed94629 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php @@ -135,7 +135,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended 'type_id', array('in' => $this->getAllowedSelectionTypes()) )->addFilterByRequiredOptions()->addStoreFilter( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); if ($this->getFirstShow()) { @@ -230,10 +230,12 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { if ($products = $this->getRequest()->getPost('products', null)) { return $products; - } else if ($productss = $this->getRequest()->getParam('productss', null)) { - return explode(',', $productss); } else { - return array(); + if ($productss = $this->getRequest()->getParam('productss', null)) { + return explode(',', $productss); + } else { + return array(); + } } } diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index 47da60685828efc9242219792541c40000f656cf..7a0290cbd1f98e87295ea442f911096632c88b21 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -150,8 +150,8 @@ class Price extends \Magento\Catalog\Block\Product\Price } /** - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId - * @return bool|\Magento\Core\Model\Website + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId + * @return bool|\Magento\Store\Model\Website */ public function getWebsite($storeId) { diff --git a/app/code/Magento/Bundle/Model/Price/Index.php b/app/code/Magento/Bundle/Model/Price/Index.php index 7020138f4727bbd3c90749eba616554e1ff3ed47..011bb203d9153e2ce53dd5f50128511e04a82d9b 100644 --- a/app/code/Magento/Bundle/Model/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Price/Index.php @@ -51,14 +51,14 @@ class Index extends \Magento\Model\AbstractModel protected $_customerSession; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -67,7 +67,7 @@ class Index extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php index da321c3c4112d59ba7efdfac4cbc267cfd9218d6..6e92904df4fced07a1b035b20869ed26f8099f50 100644 --- a/app/code/Magento/Bundle/Model/Product/CatalogPrice.php +++ b/app/code/Magento/Bundle/Model/Product/CatalogPrice.php @@ -29,7 +29,7 @@ namespace Magento\Bundle\Model\Product; class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -44,12 +44,12 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa protected $coreRegistry; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel * @param \Magento\Registry $coreRegistry */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel, \Magento\Registry $coreRegistry ) { @@ -62,13 +62,13 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa * Minimal price for "regular" user * * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Core\Model\Store $store Store view + * @param null|\Magento\Store\Model\Store $store Store view * @param bool $inclTax * @return null|float */ public function getCatalogPrice(\Magento\Catalog\Model\Product $product, $store = null, $inclTax = false) { - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $oldStore = $this->storeManager->getStore(); $this->storeManager->setCurrentStore($store); } @@ -87,7 +87,7 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa $minPrice = $product->getPriceModel()->getTotalPrices($product, 'min', $inclTax); - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $this->storeManager->setCurrentStore($oldStore); } return $minPrice; diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index 635fa75aa4d77a4edb4e3ca26591bc7d5f57248a..b47fbd330c6e75307f0bc98c2ecbde8e4c3a656d 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -61,7 +61,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * Construct * * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Event\ManagerInterface $eventManager @@ -69,7 +69,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Event\ManagerInterface $eventManager, @@ -640,4 +640,31 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price { return false; } + + /** + * Calculate and apply special price + * + * @param float $finalPrice + * @param float $specialPrice + * @param string $specialPriceFrom + * @param string $specialPriceTo + * @param mixed $store + * @return float + */ + public function calculateSpecialPrice( + $finalPrice, + $specialPrice, + $specialPriceFrom, + $specialPriceTo, + $store = null + ) { + if (!is_null($specialPrice) && $specialPrice != false) { + if ($this->_localeDate->isScopeDateInInterval($store, $specialPriceFrom, $specialPriceTo)) { + $specialPrice = $this->_storeManager->getStore()->roundPrice($finalPrice * $specialPrice / 100); + $finalPrice = min($finalPrice, $specialPrice); + } + } + + return $finalPrice; + } } diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index fe2da7542303ea4702c2afadf4ffe77efbb6222a..80e62a4061f490dd9e740f56278d6f010be24a00 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -105,7 +105,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType protected $_catalogProduct = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -160,7 +160,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Catalog\Model\Config $config * @param \Magento\Bundle\Model\Resource\Selection $bundleSelection * @param \Magento\Bundle\Model\OptionFactory $bundleOption - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -184,7 +184,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Catalog\Model\Config $config, \Magento\Bundle\Model\Resource\Selection $bundleSelection, \Magento\Bundle\Model\OptionFactory $bundleOption, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { $this->_catalogProduct = $catalogProduct; @@ -508,7 +508,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType )->setPositionOrder(); $storeId = $this->getStoreFilter($product); - if ($storeId instanceof \Magento\Core\Model\Store) { + if ($storeId instanceof \Magento\Store\Model\Store) { $storeId = $storeId->getId(); } diff --git a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php index 26ac9349f2854da4b0f881b09fe83862f91aa9e9..5d33b1fb98835aba3f18c24e4a8e574cb06d0a6c 100644 --- a/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php +++ b/app/code/Magento/Bundle/Model/Resource/Indexer/Price.php @@ -613,7 +613,7 @@ class Price extends \Magento\Catalog\Model\Resource\Product\Indexer\Price\Defaul 'tp.all_groups = 1 OR (tp.all_groups = 0 AND tp.customer_group_id = cg.customer_group_id)', array('customer_group_id') )->join( - array('cw' => $this->getTable('core_website')), + array('cw' => $this->getTable('store_website')), 'tp.website_id = 0 OR tp.website_id = cw.website_id', array('website_id') )->where( @@ -674,7 +674,7 @@ class Price extends \Magento\Catalog\Model\Resource\Product\Indexer\Price\Defaul 'gp.all_groups = 1 OR (gp.all_groups = 0 AND gp.customer_group_id = cg.customer_group_id)', array('customer_group_id') )->join( - array('cw' => $this->getTable('core_website')), + array('cw' => $this->getTable('store_website')), 'gp.website_id = 0 OR gp.website_id = cw.website_id', array('website_id') )->where( diff --git a/app/code/Magento/Bundle/Model/Resource/Price/Index.php b/app/code/Magento/Bundle/Model/Resource/Price/Index.php index 52f0c99b3174b5da071f4a28fac14cfb4922c5ff..11129d59d2e275f5b1e06d2cad4b48645fa7106a 100644 --- a/app/code/Magento/Bundle/Model/Resource/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Resource/Price/Index.php @@ -25,7 +25,7 @@ */ namespace Magento\Bundle\Model\Resource\Price; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; /** * Bundle Product Price Index Resource model @@ -85,13 +85,13 @@ class Index extends \Magento\Model\Resource\Db\AbstractDb protected $_localeDate; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\CatalogRule\Model\Resource\RuleFactory $catalogRuleFactory * @param \Magento\Customer\Model\GroupFactory $customerGroup @@ -100,7 +100,7 @@ class Index extends \Magento\Model\Resource\Db\AbstractDb */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\CatalogRule\Model\Resource\RuleFactory $catalogRuleFactory, \Magento\Customer\Model\GroupFactory $customerGroup, diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index 6970d55280498ad71b01890a4402afffbae037d4..f3f1e5f19d997a2f82c813c91fa3711b65c7462c 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Tax"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Bundle/etc/product_types.xml b/app/code/Magento/Bundle/etc/product_types.xml index c28da2cc8ea00ec4c5afe856a50afcd76f5df6f0..42849641c9d3d3ce3a866347649a74f5fdce2f9d 100644 --- a/app/code/Magento/Bundle/etc/product_types.xml +++ b/app/code/Magento/Bundle/etc/product_types.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Catalog/etc/product_types.xsd"> - <type name="bundle" label="Bundle Product" modelInstance="Magento\Bundle\Model\Product\Type" composite='true' indexPriority="40"> + <type name="bundle" label="Bundle Product" modelInstance="Magento\Bundle\Model\Product\Type" composite='true' indexPriority="40" sortOrder="50"> <priceModel instance="Magento\Bundle\Model\Product\Price" /> <indexerModel instance="Magento\Bundle\Model\Resource\Indexer\Price" /> <stockIndexerModel instance="Magento\Bundle\Model\Resource\Indexer\Stock" /> diff --git a/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php b/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php index 14551218d1fa24adffd368924b671ef8a773a3a9..f844150bb796be8f2229a4535e1e0d329e1f2e54 100644 --- a/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php +++ b/app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php @@ -261,9 +261,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('catalog_product_bundle_selection_price', array('website_id')), array('website_id') )->addForeignKey( - $installer->getFkName('catalog_product_bundle_selection_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_bundle_selection_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -345,9 +345,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_bundle_price_index', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_bundle_price_index', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php index 83856706fdf86afb0c33ce775ffa69cbd9796bce..6fbe0ab7feebad13c6f02ebd173752bae2c4fcbc 100644 --- a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php +++ b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php @@ -42,16 +42,16 @@ class Data extends \Magento\Captcha\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManager $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\Store\Model\StoreManager $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Filesystem $filesystem * @param \Magento\Captcha\Model\CaptchaFactory $factory * @param \Magento\Backend\App\ConfigInterface $backendConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManager $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\Store\Model\StoreManager $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Filesystem $filesystem, \Magento\Captcha\Model\CaptchaFactory $factory, \Magento\Backend\App\ConfigInterface $backendConfig @@ -64,8 +64,8 @@ class Data extends \Magento\Captcha\Helper\Data * Returns config value for admin captcha * * @param string $key The last part of XML_PATH_$area_CAPTCHA_ constant (case insensitive) - * @param \Magento\Core\Model\Store $store - * @return \Magento\Core\Model\Config\Element + * @param \Magento\Store\Model\Store $store + * @return \Magento\App\Config\Element */ public function getConfig($key, $store = null) { diff --git a/app/code/Magento/Captcha/Helper/Data.php b/app/code/Magento/Captcha/Helper/Data.php index 100d453f7bcc60ed6d68e058091df961d4cca0a5..2d61edb054b999b78738f172f1fbc0070ad786a2 100644 --- a/app/code/Magento/Captcha/Helper/Data.php +++ b/app/code/Magento/Captcha/Helper/Data.php @@ -62,7 +62,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_captcha = array(); /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -72,7 +72,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_filesystem; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -83,15 +83,15 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Filesystem $filesystem * @param \Magento\Captcha\Model\CaptchaFactory $factory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Filesystem $filesystem, \Magento\Captcha\Model\CaptchaFactory $factory ) { @@ -127,12 +127,16 @@ class Data extends \Magento\App\Helper\AbstractHelper * Returns config value * * @param string $key The last part of XML_PATH_$area_CAPTCHA_ constant (case insensitive) - * @param \Magento\Core\Model\Store $store - * @return \Magento\Core\Model\Config\Element + * @param \Magento\Store\Model\Store $store + * @return \Magento\App\Config\Element */ public function getConfig($key, $store = null) { - return $this->_storeManager->getStore($store)->getConfig('customer/captcha/' . $key); + return $this->_config->getValue( + 'customer/captcha/' . $key, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** diff --git a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php index db72a1eb368c859a82c5a91526317eff5ed90450..3a9a82081a17b094896aa225772ea334c00e901a 100644 --- a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php +++ b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php @@ -33,7 +33,7 @@ */ namespace Magento\Captcha\Model\Config\Form; -abstract class AbstractForm extends \Magento\Core\Model\Config\Value implements \Magento\Option\ArrayInterface +abstract class AbstractForm extends \Magento\App\Config\Value implements \Magento\Option\ArrayInterface { /** * @var string diff --git a/app/code/Magento/Captcha/Model/Cron.php b/app/code/Magento/Captcha/Model/Cron.php index 606af25e72c75aa30ae9e43a57df5f5f1b7c888e..c7074996c266ca8a91de3e51c86fc15a798cfa8c 100644 --- a/app/code/Magento/Captcha/Model/Cron.php +++ b/app/code/Magento/Captcha/Model/Cron.php @@ -50,7 +50,7 @@ class Cron protected $_mediaDirectory; /** - * @var \Magento\Core\Model\StoreManager + * @var \Magento\Store\Model\StoreManager */ protected $_storeManager; @@ -64,14 +64,14 @@ class Cron * @param \Magento\Captcha\Helper\Data $helper * @param \Magento\Captcha\Helper\Adminhtml\Data $adminHelper * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\StoreManager $storeManager + * @param \Magento\Store\Model\StoreManager $storeManager */ public function __construct( Resource\LogFactory $resLogFactory, \Magento\Captcha\Helper\Data $helper, \Magento\Captcha\Helper\Adminhtml\Data $adminHelper, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\StoreManager $storeManager + \Magento\Store\Model\StoreManager $storeManager ) { $this->_resLogFactory = $resLogFactory; $this->_helper = $helper; @@ -109,14 +109,14 @@ class Cron * Delete Expired Captcha Images for specific website * * @param \Magento\Captcha\Helper\Data $helper - * @param \Magento\Core\Model\Website|null $website - * @param \Magento\Core\Model\Store|null $store + * @param \Magento\Store\Model\Website|null $website + * @param \Magento\Store\Model\Store|null $store * @return void */ protected function _deleteExpiredImagesForWebsite( \Magento\Captcha\Helper\Data $helper, - \Magento\Core\Model\Website $website = null, - \Magento\Core\Model\Store $store = null + \Magento\Store\Model\Website $website = null, + \Magento\Store\Model\Store $store = null ) { $expire = time() - $helper->getConfig('timeout', $store) * 60; $imageDirectory = $this->_mediaDirectory->getRelativePath($helper->getImgDir($website)); diff --git a/app/code/Magento/Captcha/Model/Observer.php b/app/code/Magento/Captcha/Model/Observer.php index b6f1652020293e60ee2dc76b4a12e6a0acb15bc1..3ede80442b71093737f8111967563319ef2b4a2a 100644 --- a/app/code/Magento/Captcha/Model/Observer.php +++ b/app/code/Magento/Captcha/Model/Observer.php @@ -174,7 +174,7 @@ class Observer if (!$captcha->isCorrect($this->_getCaptchaString($controller->getRequest(), $formId))) { $this->messageManager->addError(__('Incorrect CAPTCHA.')); $this->_actionFlag->set('', \Magento\App\Action\Action::FLAG_NO_DISPATCH, true); - $this->redirect->redirect($controller->getResponse(), 'contacts/index/index'); + $this->redirect->redirect($controller->getResponse(), 'contact/index/index'); } } } diff --git a/app/code/Magento/Captcha/etc/frontend/events.xml b/app/code/Magento/Captcha/etc/frontend/events.xml index 90965f3066a1187b4c70c166738463dd24a18293..95cf7f85915396c74196ec8b9972b23b066d12e5 100644 --- a/app/code/Magento/Captcha/etc/frontend/events.xml +++ b/app/code/Magento/Captcha/etc/frontend/events.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="controller_action_predispatch_contacts_index_post"> + <event name="controller_action_predispatch_contact_index_post"> <observer name="captcha_contact_us_form" instance="Magento\Captcha\Model\Observer" method="checkContactUsForm" /> </event> </config> diff --git a/app/code/Magento/Captcha/etc/module.xml b/app/code/Magento/Captcha/etc/module.xml index 2201eff77c42361ee274622376385c9fff92a05e..4198e63d2f143849a9bbc5be56c6dc90b03e2309 100644 --- a/app/code/Magento/Captcha/etc/module.xml +++ b/app/code/Magento/Captcha/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Checkout"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Customer"/> <module name="Magento_Checkout"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Captcha/sql/captcha_setup/install-1.7.0.0.0.php b/app/code/Magento/Captcha/sql/captcha_setup/install-1.7.0.0.0.php index e0359c6b4e1c94c2431a457515406a970abc9c9b..da5fa5ed1dda9dfded51098bdac94e3205b1f09a 100644 --- a/app/code/Magento/Captcha/sql/captcha_setup/install-1.7.0.0.0.php +++ b/app/code/Magento/Captcha/sql/captcha_setup/install-1.7.0.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php index f29b9d3317eea67daead40a197dfc865c7f683bb..b8a174fff7da378cae49e34e2c1602716705bdb2 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/AbstractCategory.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Category; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Data\Tree\Node; class AbstractCategory extends \Magento\Backend\Block\Template diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php index 58909ce909310f2a16c316f1d86663dc8d3af209..b737197119dde8e00e3cdb33a634fcb41b47b4da 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit.php @@ -49,5 +49,8 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container $this->_controller = 'adminhtml_category'; $this->_mode = 'edit'; parent::_construct(); + $this->_removeButton('back'); + $this->_removeButton('reset'); + $this->_removeButton('save'); } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php index 265d15497a6e9e512bfd8082f9618f5563490f9d..ec14a87ebc6e511de05091c02ad695fdb4769156 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php @@ -102,7 +102,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory array( 'label' => __('Save Category'), 'onclick' => "categorySubmit('" . $this->getSaveUrl() . "', true)", - 'class' => 'save' + 'class' => 'save primary save-category' ) ); } @@ -131,7 +131,8 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), - 'onclick' => "categoryReset('" . $this->getUrl($resetPath, array('_current' => true)) . "',true)" + 'onclick' => "categoryReset('" . $this->getUrl($resetPath, array('_current' => true)) . "',true)", + 'class' => 'reset' ) ); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php index 97d5a12b55c6933b5343185eefc8103c9c027785..abb0e72465cd156ba2fee8bccff0664d4b8b2fad 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php @@ -36,7 +36,7 @@ namespace Magento\Catalog\Block\Adminhtml\Category\Helper; class Image extends \Magento\Data\Form\Element\Image { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -45,7 +45,7 @@ class Image extends \Magento\Data\Form\Element\Image * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Escaper $escaper * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( @@ -53,7 +53,7 @@ class Image extends \Magento\Data\Form\Element\Image \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Escaper $escaper, \Magento\UrlInterface $urlBuilder, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $data = array() ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php index 77d20e1153b4f215ed1cab6ac8bb6c1363f92304..17343d2db2dce97fd8ea068bffadfe0c162d1afe 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tab/Product.php @@ -179,8 +179,9 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended 'header' => __('Price'), 'type' => 'currency', 'width' => '1', - 'currency_code' => (string)$this->_storeConfig->getConfig( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE + 'currency_code' => (string)$this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), 'index' => 'price' ) @@ -193,7 +194,6 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended 'type' => 'number', 'index' => 'position', 'editable' => !$this->getCategory()->getProductsReadonly() - //'renderer' => 'Magento\Backend\Block\Widget\Grid\Column\Renderer\Input' ) ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index 23604b12a1c3ea4263d440e99210ec7c41b89e97..dd9edacbb23ef52349e4d5ca4c9331945c34241c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -138,16 +138,6 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory ); } - $this->setChild( - 'store_switcher', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Store\Switcher' - )->setSwitchUrl( - $this->getUrl('catalog/*/*', array('_current' => true, '_query' => false, 'store' => null)) - )->setTemplate( - 'Magento_Backend::store/switcher/enhanced.phtml' - ) - ); return parent::_prepareLayout(); } @@ -156,7 +146,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory */ protected function _getDefaultStoreId() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php index c53bab02c6f9cf07e37c5a719dd79c3dc50445ce..3bb696831a9604d61bbaacfd00c7e3d7e6d7f8d3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Fieldset/Element.php @@ -182,6 +182,6 @@ class Element extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Eleme */ protected function _getDefaultStoreId() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product.php b/app/code/Magento/Catalog/Block/Adminhtml/Product.php index beca9822ac0bf8e5648bae9470444272e677aecb..3ad04059da31f8e159a68cb435b814488e82bd0e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product.php @@ -78,8 +78,8 @@ class Product extends \Magento\Backend\Block\Widget\Container $addButtonProps = array( 'id' => 'add_new_product', 'label' => __('Add Product'), - 'class' => 'btn-add', - 'button_class' => 'btn-round', + 'class' => 'add', + 'button_class' => '', 'class_name' => 'Magento\Backend\Block\Widget\Button\SplitButton', 'options' => $this->_getAddProductButtonOptions() ); @@ -100,12 +100,19 @@ class Product extends \Magento\Backend\Block\Widget\Container protected function _getAddProductButtonOptions() { $splitButtonOptions = array(); + $types = $this->_typeFactory->create()->getTypes(); + uasort( + $types, + function ($elementOne, $elementTwo) { + return ($elementOne['sort_order'] < $elementTwo['sort_order']) ? -1 : 1; + } + ); - foreach ($this->_typeFactory->create()->getOptionArray() as $key => $label) { - $splitButtonOptions[$key] = array( - 'label' => $label, - 'onclick' => "setLocation('" . $this->_getProductCreateUrl($key) . "')", - 'default' => \Magento\Catalog\Model\Product\Type::DEFAULT_TYPE == $key + foreach ($types as $typeId => $type) { + $splitButtonOptions[$typeId] = array( + 'label' => __($type['label']), + 'onclick' => "setLocation('" . $this->_getProductCreateUrl($typeId) . "')", + 'default' => \Magento\Catalog\Model\Product\Type::DEFAULT_TYPE == $typeId ); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php index 8a0c20d28a4f62fb3e312029d0b3a21459ece5a2..272f8616e0a3b39e095de40be6a8143d32381fff 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php @@ -112,6 +112,17 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container } } + /** + * {@inheritdoc} + */ + protected function _addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') + { + if ($this->getRequest()->getParam('popup')) { + $region = 'header'; + } + parent::_addButton($buttonId, $data, $level, $sortOrder, $region); + } + /** * Retrieve header text * diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php index 947515b0c3ccaad308e2d249473e5c8d39932e87..1e0668e8206cb7883f4340ab80fe2edc17c25f6d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Main.php @@ -134,7 +134,7 @@ class Main extends \Magento\Backend\Block\Template array('label' => __('Add New'), 'onclick' => 'editSet.addGroup();', 'class' => 'add') ); - $this->addChild( + $this->getToolbar()->addChild( 'back_button', 'Magento\Backend\Block\Widget\Button', array( @@ -144,32 +144,39 @@ class Main extends \Magento\Backend\Block\Template ) ); - $this->addChild( + $this->getToolbar()->addChild( 'reset_button', 'Magento\Backend\Block\Widget\Button', - array('label' => __('Reset'), 'onclick' => 'window.location.reload()') + array('label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset') ); - $this->addChild( - 'save_button', - 'Magento\Backend\Block\Widget\Button', - array('label' => __('Save Attribute Set'), 'onclick' => 'editSet.save();', 'class' => 'save') - ); + if (!$this->getIsCurrentSetDefault()) { + $this->getToolbar()->addChild( + 'delete_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Delete Attribute Set'), + 'onclick' => 'deleteConfirm(\'' . $this->escapeJsQuote( + __( + 'You are about to delete all products in this set. ' . + 'Are you sure you want to delete this attribute set?' + ) + ) . '\', \'' . $this->getUrl( + 'catalog/*/delete', + array('id' => $setId) + ) . '\')', + 'class' => 'delete' + ) + ); + } - $this->addChild( - 'delete_button', + $this->getToolbar()->addChild( + 'save_button', 'Magento\Backend\Block\Widget\Button', array( - 'label' => __('Delete Attribute Set'), - 'onclick' => 'deleteConfirm(\'' . $this->escapeJsQuote( - __( - 'You are about to delete all products in this set. Are you sure you want to delete this attribute set?' - ) - ) . '\', \'' . $this->getUrl( - 'catalog/*/delete', - array('id' => $setId) - ) . '\')', - 'class' => 'delete' + 'label' => __('Save Attribute Set'), + 'onclick' => 'editSet.save();', + 'class' => 'save primary save-attribute-set' ) ); @@ -323,49 +330,6 @@ class Main extends \Magento\Backend\Block\Template return $this->_jsonEncoder->encode($items); } - /** - * Retrieve Back Button HTML - * - * @return string - */ - public function getBackButtonHtml() - { - return $this->getChildHtml('back_button'); - } - - /** - * Retrieve Reset Button HTML - * - * @return string - */ - public function getResetButtonHtml() - { - return $this->getChildHtml('reset_button'); - } - - /** - * Retrieve Save Button HTML - * - * @return string - */ - public function getSaveButtonHtml() - { - return $this->getChildHtml('save_button'); - } - - /** - * Retrieve Delete Button HTML - * - * @return string - */ - public function getDeleteButtonHtml() - { - if ($this->getIsCurrentSetDefault()) { - return ''; - } - return $this->getChildHtml('delete_button'); - } - /** * Retrieve Delete Group Button HTML * @@ -386,16 +350,6 @@ class Main extends \Magento\Backend\Block\Template return $this->getChildHtml('add_group_button'); } - /** - * Retrieve Rename Button HTML - * - * @return string - */ - public function getRenameButton() - { - return $this->getChildHtml('rename_button'); - } - /** * Retrieve current Attribute Set object * diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php index 54e848f095442a59cb9fce963a2a972db277cb46..0e989b17633b9cb66e5d4bf2429f0eb00aa6d6dc 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Add.php @@ -47,26 +47,28 @@ class Add extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( - 'save_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Save Attribute Set'), - 'class' => 'save', - 'data_attribute' => array( - 'mage-init' => array('button' => array('event' => 'save', 'target' => '#set-prop-form')) + if ($this->getToolbar()) { + $this->getToolbar()->addChild( + 'save_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Save Attribute Set'), + 'class' => 'save primary save-attribute-set', + 'data_attribute' => array( + 'mage-init' => array('button' => array('event' => 'save', 'target' => '#set-prop-form')) + ) ) - ) - ); - $this->addChild( - 'back_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Back'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/') . '\')', - 'class' => 'back' - ) - ); + ); + $this->getToolbar()->addChild( + 'back_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Back'), + 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/') . '\')', + 'class' => 'back' + ) + ); + } $this->addChild('setForm', 'Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main\Formset'); return parent::_prepareLayout(); @@ -80,22 +82,6 @@ class Add extends \Magento\Backend\Block\Template return __('Add New Attribute Set'); } - /** - * @return string - */ - public function getSaveButtonHtml() - { - return $this->getChildHtml('save_button'); - } - - /** - * @return string - */ - public function getBackButtonHtml() - { - return $this->getChildHtml('back_button'); - } - /** * @return string */ diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php index ccebc72794ac830f558d056192da3c071c9b8a24..a3736d152d2ca20fcc34efe38f8c0901872615b7 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/Main.php @@ -45,13 +45,13 @@ class Main extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'addButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Set'), 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/add') . '\')', - 'class' => 'add' + 'class' => 'add primary add-set' ) ); return parent::_prepareLayout(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index 6fe81270ff3749199eae86b6799625562bbe7eb2..28744a37aaabdf2f8e510e86a707010867f10bb8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -113,19 +113,21 @@ class Edit extends \Magento\Backend\Block\Widget protected function _prepareLayout() { if (!$this->getRequest()->getParam('popup')) { - $this->addChild( - 'back_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Back'), - 'title' => __('Back'), - 'onclick' => 'setLocation(\'' . $this->getUrl( - 'catalog/*/', - array('store' => $this->getRequest()->getParam('store', 0)) - ) . '\')', - 'class' => 'action-back' - ) - ); + if ($this->getToolbar()) { + $this->getToolbar()->addChild( + 'back_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Back'), + 'title' => __('Back'), + 'onclick' => 'setLocation(\'' . $this->getUrl( + 'catalog/*/', + array('store' => $this->getRequest()->getParam('store', 0)) + ) . '\')', + 'class' => 'action-back' + ) + ); + } } else { $this->addChild( 'back_button', @@ -145,8 +147,8 @@ class Edit extends \Magento\Backend\Block\Widget ); } - if (!$this->getProduct()->isReadonly()) { - $this->addChild( + if (!$this->getProduct()->isReadonly() && $this->getToolbar()) { + $this->getToolbar()->addChild( 'save-split-button', 'Magento\Backend\Block\Widget\Button\SplitButton', array( diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php index 1dcd2b90c13be3e70d4b3e2d718aa0a22fd28c6d..943bf71bc754bb602a4e34da936fea2956dd41d8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute.php @@ -83,7 +83,8 @@ class Attribute extends \Magento\Backend\Block\Widget 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Reset'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('_current' => true)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('_current' => true)) . '\')', + 'class' => 'reset' ) ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php index 47e0d6844d5673bcdc7559e256a9a6ce2b38d80c..d9e317596ac0cdfef717fc730b06ff2134f32be6 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php @@ -95,7 +95,7 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen */ public function getDefaultConfigValue($field) { - return $this->_storeConfig->getConfig(Item::XML_PATH_ITEM . $field, $this->getStoreId()); + return $this->_scopeConfig->getValue(Item::XML_PATH_ITEM . $field, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStoreId()); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php index 6e9c4102f149f305e41cdb8d58466cea8372688a..9c2079b5ea3705902f221284c5d390c5dd53080d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Websites.php @@ -33,8 +33,8 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab; -use Magento\Core\Model\Store\Group; -use Magento\Core\Model\Website; +use Magento\Store\Model\Group; +use Magento\Store\Model\Website; class Websites extends \Magento\Backend\Block\Widget implements \Magento\Backend\Block\Widget\Tab\TabInterface { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php index e0118f405ec6d8b98f71008cd17110244846f88e..727d8247026ed397aa6d5152303c01ae811842be 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php @@ -61,7 +61,7 @@ class Js extends \Magento\Backend\Block\Template /** * Get store object of curently edited product * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php index dfa4bcebf1d69fb1c9a4f19fe58c8fcdcc0af28f..dc1a4b76bd6449a6ab9eb5b64c98299aa0ccfae8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php @@ -49,8 +49,8 @@ class Alerts extends \Magento\Backend\Block\Widget\Tab $accordion = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Accordion')->setId('productAlerts'); /* @var $accordion \Magento\Backend\Block\Widget\Accordion */ - $alertPriceAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_price'); - $alertStockAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_stock'); + $alertPriceAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_price', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + $alertStockAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_stock', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if ($alertPriceAllow) { $accordion->addItem( @@ -97,8 +97,8 @@ class Alerts extends \Magento\Backend\Block\Widget\Tab */ public function canShowTab() { - $alertPriceAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_price'); - $alertStockAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_stock'); + $alertPriceAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_price', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + $alertStockAllow = $this->_scopeConfig->getValue('catalog/productalert/allow_stock', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); return ($alertPriceAllow || $alertStockAllow) && parent::canShowTab(); } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php index 25bbd533344fd926209c6bbc3ff5bd43e0f2d851..08ae155dae02b222a42cc5822889ec0bc42fde5f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts/Price.php @@ -119,8 +119,9 @@ class Price extends Extended 'header' => __('Price'), 'index' => 'price', 'type' => 'currency', - 'currency_code' => $this->_storeConfig->getConfig( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE + 'currency_code' => $this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php index 28c6b6145c7056a8bd53a71c450971699e4c1941..adca7ce052827fefe67638aa23e59e26e0778e03 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Crosssell.php @@ -316,8 +316,9 @@ class Crosssell extends Extended array( 'header' => __('Price'), 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE + 'currency_code' => (string)$this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), 'index' => 'price', 'header_css_class' => 'col-price', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php index 6d6325bf4b4051a216b9bb0f8d559e9a5badece0..c28a5ad9fb5d177f3bbf2f4ce8ed34ede6b6d04a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Inventory.php @@ -140,7 +140,7 @@ class Inventory extends \Magento\Backend\Block\Widget return $this->getStockItem()->getDataUsingMethod($field); } - return $this->_storeConfig->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field); + return $this->_scopeConfig->getValue(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -155,7 +155,7 @@ class Inventory extends \Magento\Backend\Block\Widget } } - return $this->_storeConfig->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field); + return $this->_scopeConfig->getValue(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -164,7 +164,7 @@ class Inventory extends \Magento\Backend\Block\Widget */ public function getDefaultConfigValue($field) { - return $this->_storeConfig->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field); + return $this->_scopeConfig->getValue(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_ITEM . $field, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 8031afd37b1bc18b5c62f4e46d76e18079ff29ff..410f4ec19ae418ef4fed36c692df242a5877cfb1 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -297,7 +297,10 @@ class Option extends Widget if (!$this->_values || $this->getIgnoreCaching()) { $showPrice = $this->getCanReadPrice(); $values = array(); - $scope = (int)$this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); + $scope = (int)$this->_scopeConfig->getValue( + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); foreach ($optionsArr as $option) { /* @var $option \Magento\Catalog\Model\Product\Option */ @@ -352,7 +355,7 @@ class Option extends Widget $value['optionValues'][$i]['scopeTitleDisabled'] = is_null( $_value->getStoreTitle() ) ? 'disabled' : null; - if ($scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE) { + if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { $value['optionValues'][$i]['checkboxScopePrice'] = $this->getCheckboxScopeHtml( $_value->getOptionId(), 'price', @@ -377,8 +380,8 @@ class Option extends Widget $value['file_extension'] = $option->getFileExtension(); $value['image_size_x'] = $option->getImageSizeX(); $value['image_size_y'] = $option->getImageSizeY(); - if ($this->getProduct()->getStoreId() != '0' && - $scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE + if ($this->getProduct()->getStoreId() != '0' + && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE ) { $value['checkboxScopePrice'] = $this->getCheckboxScopeHtml( $option->getOptionId(), @@ -417,36 +420,14 @@ class Option extends Widget $selectNameHtml = '[values][' . $select_id . ']'; $selectIdHtml = 'select_' . $select_id . '_'; } - $useDefault = '<div class="field-service">' . - '<label for="' . - $this->getFieldId() . - '_' . - $id . - '_' . - $selectIdHtml . - $name . - '" class="use-default">' . - '<input value="1" type="checkbox" class="use-default-control"' . - 'name="' . - $this->getFieldName() . - '[' . - $id . - ']' . - $selectNameHtml . - '[scope][' . - $name . - ']"' . - 'id="' . - $this->getFieldId() . - '_' . - $id . - '_' . - $selectIdHtml . - $name . - '_use_default"' . - $checkedHtml . - ' /><span class="use-default-label">' . - __('Use Default') . '</span></label></div>'; + $useDefault = + '<div class="field-service">' . '<label for="' . $this->getFieldId() . '_' . $id . '_' . $selectIdHtml + . $name . '" class="use-default">' . '<input value="1" type="checkbox" class="use-default-control"' + . 'name="' . $this->getFieldName() . '[' . $id . ']' . $selectNameHtml . '[scope][' . $name . ']"' . 'id="' + . $this->getFieldId() . '_' . $id . '_' . $selectIdHtml . $name . '_use_default"' . $checkedHtml + . ' /><span class="use-default-label">' . __( + 'Use Default' + ) . '</span></label></div>'; return $useDefault; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index 905da4d583e0d57597fa464fca90e359b6e6cefa..8c811ae86a770dcb35bf7318ab3bb02d0c803003 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -251,7 +251,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface ); if (!$this->isScopeGlobal() && $this->getProduct()->getStoreId()) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ $website = $this->_storeManager->getStore($this->getProduct()->getStoreId())->getWebsite(); $this->_websites[$website->getId()] = array( @@ -262,7 +262,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface $websites = $this->_storeManager->getWebsites(false); $productWebsiteIds = $this->getProduct()->getWebsiteIds(); foreach ($websites as $website) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ if (!in_array($website->getId(), $productWebsiteIds)) { continue; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php index 91ad35db7890d1ece9235b7c902d3ca58898ce36..f739c25ce849e10ee75ef2f01a291431f17192bd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php @@ -312,8 +312,9 @@ class Related extends Extended array( 'header' => __('Price'), 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE + 'currency_code' => (string)$this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), 'index' => 'price', 'header_css_class' => 'col-price', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php index 2be7f00c2131993577fceb70e4dceb4dd8f37381..43df097064980d1a693140b51b4b8777d1988011 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Upsell.php @@ -308,8 +308,9 @@ class Upsell extends \Magento\Backend\Block\Widget\Grid\Extended array( 'header' => __('Price'), 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE + 'currency_code' => (string)$this->_scopeConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), 'index' => 'price', 'header_css_class' => 'col-price', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php index 31d3ff7c84bda0b8957827da26f0ebbdfc9f62a0..addb5750e1ed746f0d6d1d4b27c19a22d3b4b4fd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Websites.php @@ -54,17 +54,17 @@ class Websites extends \Magento\Backend\Block\Store\Switcher /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Website\Factory $websiteFactory - * @param \Magento\Core\Model\Store\Group\Factory $storeGroupFactory - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\Group\Factory $storeGroupFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param \Magento\Registry $coreRegistry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Website\Factory $websiteFactory, - \Magento\Core\Model\Store\Group\Factory $storeGroupFactory, - \Magento\Core\Model\StoreFactory $storeFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\Group\Factory $storeGroupFactory, + \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Registry $coreRegistry, array $data = array() ) { @@ -147,7 +147,7 @@ class Websites extends \Magento\Backend\Block\Store\Switcher /** * Get HTML of store chooser * - * @param \Magento\Core\Model\Store $storeTo + * @param \Magento\Store\Model\Store $storeTo * @return string */ public function getChooseFromStoreHtml($storeTo) diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php index 7e0209fbde561563935a4a78eedad5cffdf726bc..361f2b5b028167e6bdeac5871ce27154f27d242e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Grid.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { @@ -70,14 +70,14 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended protected $_visibility; /** - * @var \Magento\Core\Model\WebsiteFactory + * @var \Magento\Store\Model\WebsiteFactory */ protected $_websiteFactory; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Type $type @@ -91,7 +91,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Core\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Type $type, diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php index 58c9b14ff77ac7351da7ef79214b388063925a06..79b6f440e2dbc5dd5336d4e40e20362c54c1745c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php @@ -40,7 +40,7 @@ use Magento\Eav\Model\Entity\Attribute; class Gallery extends AbstractElement { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -54,7 +54,7 @@ class Gallery extends AbstractElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Escaper $escaper * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( @@ -62,7 +62,7 @@ class Gallery extends AbstractElement \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Escaper $escaper, \Magento\View\LayoutInterface $layout, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $data = array() ) { $this->_layout = $layout; @@ -227,6 +227,6 @@ class Gallery extends AbstractElement */ protected function _getDefaultStoreId() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php index 4a1bbe32f32841ba3d6d9844443f42ccef797377..147dcff7913c9a77895d2abc9cf278adaea6f413 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php @@ -56,7 +56,7 @@ class Price extends \Magento\Data\Form\Element\Text * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Escaper $escaper - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param \Magento\Tax\Helper\Data $taxData * @param array $data @@ -65,7 +65,7 @@ class Price extends \Magento\Data\Form\Element\Text \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Escaper $escaper, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\CurrencyInterface $localeCurrency, \Magento\Tax\Helper\Data $taxData, array $data = array() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php index d7b61f916d001c9d906b9df71c618292589e9958..25af2cf32275a050fa9c58e6e8588eba1b75820c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Price.php @@ -36,8 +36,8 @@ namespace Magento\Catalog\Block\Adminhtml\Product; class Price extends \Magento\Catalog\Block\Product\Price { /** - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId - * @return bool|\Magento\Core\Model\Website + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId + * @return bool|\Magento\Store\Model\Website */ public function getWebsite($storeId) { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php index acbfa8603ecdd2ed7ab99a32334f5f3515535545..619310cc6e375aeb18978e7eff036f75b804e78f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php @@ -36,7 +36,7 @@ namespace Magento\Catalog\Block\Adminhtml\Search\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -44,14 +44,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; diff --git a/app/code/Magento/Catalog/Block/Breadcrumbs.php b/app/code/Magento/Catalog/Block/Breadcrumbs.php index e8e5664ba5907bef1c7bc8df47cdaf01bdeca354..ac55ee2f6c73896c4613980aa5c284a2e4a695c0 100644 --- a/app/code/Magento/Catalog/Block/Breadcrumbs.php +++ b/app/code/Magento/Catalog/Block/Breadcrumbs.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Block; use Magento\Catalog\Helper\Data; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\View\Element\Template\Context; class Breadcrumbs extends \Magento\View\Element\Template @@ -65,7 +65,7 @@ class Breadcrumbs extends \Magento\View\Element\Template */ public function getTitleSeparator($store = null) { - $separator = (string)$this->_storeConfig->getConfig('catalog/seo/title_separator', $store); + $separator = (string)$this->_scopeConfig->getValue('catalog/seo/title_separator', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); return ' ' . $separator . ' '; } diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index 73e60480511cc4e4340cad79c4ef01ae124e4a9c..6efd4abba3d843d5cd803f44dd2326a363224447 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -133,7 +133,7 @@ class View extends \Magento\View\Element\Template implements \Magento\View\Block */ public function isRssCatalogEnable() { - return $this->_storeConfig->getConfig('rss/catalog/category'); + return $this->_scopeConfig->getValue('rss/catalog/category', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php index 5230d504ab0a135737b220f4601d5f8cee0ad704..30db850df32a5b24c6c7e6c2c64bd58028dd6ac6 100644 --- a/app/code/Magento/Catalog/Block/Navigation.php +++ b/app/code/Magento/Catalog/Block/Navigation.php @@ -96,7 +96,6 @@ class Navigation extends \Magento\View\Element\Template implements \Magento\View * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Layer\Category $catalogLayer - * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Registry $registry @@ -108,7 +107,6 @@ class Navigation extends \Magento\View\Element\Template implements \Magento\View \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Layer\Category $catalogLayer, - \Magento\Customer\Model\Session $customerSession, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Registry $registry, @@ -134,7 +132,7 @@ class Navigation extends \Magento\View\Element\Template implements \Magento\View $this->addData( array( 'cache_lifetime' => false, - 'cache_tags' => array(Category::CACHE_TAG, \Magento\Core\Model\Store\Group::CACHE_TAG) + 'cache_tags' => array(Category::CACHE_TAG, \Magento\Store\Model\Group::CACHE_TAG) ) ); } @@ -525,6 +523,6 @@ class Navigation extends \Magento\View\Element\Template implements \Magento\View */ public function getIdentities() { - return array(\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Core\Model\Store\Group::CACHE_TAG); + return array(\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Store\Model\Group::CACHE_TAG); } } diff --git a/app/code/Magento/Catalog/Block/Product/Context.php b/app/code/Magento/Catalog/Block/Product/Context.php index 48a9aab045427c8168743d0b5d4de32c3deab6a8..449a29d06ed43afd5163c031aa6974124f75de2c 100644 --- a/app/code/Magento/Catalog/Block/Product/Context.php +++ b/app/code/Magento/Catalog/Block/Product/Context.php @@ -90,7 +90,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\View\DesignInterface $design * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface|\Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -103,7 +103,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Registry $registry * @param \Magento\Tax\Helper\Data $taxHelper @@ -128,7 +128,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\View\DesignInterface $design, \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -141,7 +141,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Config $catalogConfig, \Magento\Registry $registry, \Magento\Tax\Helper\Data $taxHelper, @@ -175,7 +175,7 @@ class Context extends \Magento\View\Element\Template\Context $design, $session, $sidResolver, - $storeConfig, + $scopeConfig, $viewUrl, $viewConfig, $cacheState, diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index b45779ebadf01fa3e997b999d1e03c7ad8b74511..f3455ebd192aacfb344d908b1eb9552789b3398f 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -273,7 +273,7 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct impleme } /** - * @param array|string|integer|\Magento\Core\Model\Config\Element $code + * @param array|string|integer|\Magento\App\Config\Element $code * @return $this */ public function addAttribute($code) diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index c0f8ba2117f6441b269129fea95e7a9a85befaa0..87176446f3086b9d72bb307c8774bb1395155c62 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -174,7 +174,7 @@ class Toolbar extends \Magento\View\Element\Template protected function _construct() { parent::_construct(); - $this->_orderField = $this->_productListHelper->getDefaultSortField(); + $this->_orderField = $this->_productListHelper->getDefaultSortField(); $this->_availableOrder = $this->_catalogConfig->getAttributeUsedForSortByArray(); $this->_availableMode = $this->_productListHelper->getAvailableViewMode(); } @@ -547,9 +547,9 @@ class Toolbar extends \Magento\View\Element\Template */ public function getDefaultPerPageValue() { - if ($this->getCurrentMode() == 'list' && $default = $this->getDefaultListPerPage()) { + if ($this->getCurrentMode() == 'list' && ($default = $this->getDefaultListPerPage())) { return $default; - } elseif ($this->getCurrentMode() == 'grid' && $default = $this->getDefaultGridPerPage()) { + } elseif ($this->getCurrentMode() == 'grid' && ($default = $this->getDefaultGridPerPage())) { return $default; } return $this->_productListHelper->getDefaultLimitPerPageValue($this->getCurrentMode()); @@ -662,12 +662,25 @@ class Toolbar extends \Magento\View\Element\Template /* @var $pagerBlock \Magento\Theme\Block\Html\Pager */ $pagerBlock->setAvailableLimit($this->getAvailableLimit()); - $pagerBlock->setUseContainer(false) - ->setShowPerPage(false) - ->setShowAmounts(false) - ->setFrameLength($this->_storeConfig->getConfig('design/pagination/pagination_frame')) - ->setJump($this->_storeConfig->getConfig('design/pagination/pagination_frame_skip')) - ->setCollection($this->getCollection()); + $pagerBlock->setUseContainer( + false + )->setShowPerPage( + false + )->setShowAmounts( + false + )->setFrameLength( + $this->_scopeConfig->getValue( + 'design/pagination/pagination_frame', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + )->setJump( + $this->_scopeConfig->getValue( + 'design/pagination/pagination_frame_skip', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + )->setCollection( + $this->getCollection() + ); return $pagerBlock->toHtml(); } diff --git a/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php index e115ec10aa4b64fdd38ec72140037cafda704e78..a39770f593f93f7cc4cb087f0ef75335d3406ed6 100644 --- a/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php @@ -39,7 +39,7 @@ class DefaultProvider implements ReviewRendererInterface */ public function getReviewsSummaryHtml( \Magento\Catalog\Model\Product $product, - $templateType = self::DEFAULT_REVIEW, + $templateType = self::DEFAULT_VIEW, $displayIfNoReviews = false ) { return ''; diff --git a/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php index 723a60f1c985cb9bf1eb52c6a52d74a6fdbbb7e3..6e301c09ff4205b71d8bfbc94f4bb551bab60653 100644 --- a/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php @@ -26,8 +26,9 @@ namespace Magento\Catalog\Block\Product; interface ReviewRendererInterface { - const SHORT_REVIEW = 'short'; - const DEFAULT_REVIEW = 'default'; + const SHORT_VIEW = 'short'; + const FULL_VIEW = 'default'; + const DEFAULT_VIEW = self::FULL_VIEW; /** * Get product review summary html @@ -39,7 +40,7 @@ interface ReviewRendererInterface */ public function getReviewsSummaryHtml( \Magento\Catalog\Model\Product $product, - $templateType = self::DEFAULT_REVIEW, + $templateType = self::DEFAULT_VIEW, $displayIfNoReviews = false ); } diff --git a/app/code/Magento/Catalog/Block/Widget/Link.php b/app/code/Magento/Catalog/Block/Widget/Link.php index 6ae1edb11ca4fa9d0abfa27310e5eaf4c2c320c0..9395faf88f04ff329059f6e232be512963f1d639 100644 --- a/app/code/Magento/Catalog/Block/Widget/Link.php +++ b/app/code/Magento/Catalog/Block/Widget/Link.php @@ -92,7 +92,7 @@ class Link extends \Magento\View\Element\Html\Link implements \Magento\Widget\Bl $store = $this->_storeManager->getStore(); } - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $href = ""; if ($this->getData('id_path')) { $href = $this->_urlRewrite->getRequestPathByIdPath($this->getData('id_path'), $store); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index ca30e9cfa4ff7fba43ba9e5433db0d405bdaa039..6a9695087ab3c14d0f884333bc062c1482128357 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -50,7 +50,7 @@ class Category extends \Magento\Backend\App\Action $category->load($categoryId); if ($storeId) { $rootId = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $storeId )->getRootCategoryId(); @@ -115,7 +115,7 @@ class Category extends \Magento\Backend\App\Action $parentId = (int)$this->getRequest()->getParam('parent'); $prevStoreId = $this->_objectManager->get('Magento\Backend\Model\Auth\Session')->getLastViewedStore(true); - if (!empty($prevStoreId) && !$this->getRequest()->getQuery('isAjax')) { + if (!is_null($prevStoreId) && !$this->getRequest()->getQuery('isAjax')) { $params['store'] = $prevStoreId; $redirect = true; } @@ -137,7 +137,7 @@ class Category extends \Magento\Backend\App\Action } if ($storeId && !$categoryId && !$parentId) { - $store = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore($storeId); + $store = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore($storeId); $_prevCategoryId = (int)$store->getRootCategoryId(); $this->getRequest()->setParam('id', $_prevCategoryId); } @@ -242,7 +242,7 @@ class Category extends \Magento\Backend\App\Action $elementId = $this->getRequest()->getParam('element_id', md5(microtime())); $storeId = $this->getRequest()->getParam('store_id', 0); $storeMediaUrl = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $storeId )->getBaseUrl( @@ -314,7 +314,7 @@ class Category extends \Magento\Backend\App\Action if (!$parentId) { if ($storeId) { $parentId = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $storeId )->getRootCategoryId(); @@ -539,7 +539,7 @@ class Category extends \Magento\Backend\App\Action if ($storeId) { if (!$categoryId) { - $store = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore($storeId); + $store = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore($storeId); $rootId = $store->getRootCategoryId(); $this->getRequest()->setParam('id', $rootId); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php index 438fd69ae97f50b69a406436e4cbb03653b4ea1d..2c83c6c5e4a00cfe653a5730386ac4f767347518 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -260,7 +260,7 @@ class Product extends \Magento\Backend\App\Action $this->_setActiveMenu('Magento_Catalog::catalog_products'); if (!$this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->isSingleStoreMode() && ($switchBlock = $this->_view->getLayout()->getBlock( 'store_switcher' )) @@ -297,7 +297,7 @@ class Product extends \Magento\Backend\App\Action $elementId = $this->getRequest()->getParam('element_id', md5(microtime())); $storeId = $this->getRequest()->getParam('store_id', 0); $storeMediaUrl = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $storeId )->getBaseUrl( @@ -477,8 +477,6 @@ class Product extends \Magento\Backend\App\Action $this->_view->renderLayout(); } - - /** * Validate product * diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php index f3ae7d5a42c9791ccdfe844240fdc73166b2ebef..6dfd2b595a24e40e7fc51c4b23474134a1677672 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -31,7 +31,7 @@ class Helper protected $request; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -47,13 +47,13 @@ class Helper /** * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param StockDataFilter $stockFilter * @param Helper\ProductLinks $productLinks */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, StockDataFilter $stockFilter, Helper\ProductLinks $productLinks ) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php index 169f55b7564f7faa70245e4f7f9cab88f63e5e6d..1de77447d2cfe39319611d085cb191c2ee73a908 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php @@ -31,16 +31,16 @@ class StockDataFilter const MAX_QTY_VALUE = 99999999.9999; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeManager; + protected $scopeConfig; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; } /** @@ -56,8 +56,9 @@ class StockDataFilter } if ($stockData['use_config_manage_stock'] == 1 && !isset($stockData['manage_stock'])) { - $stockData['manage_stock'] = $this->storeManager->getStore()->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK + $stockData['manage_stock'] = $this->scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } if (isset($stockData['qty']) && (double)$stockData['qty'] > self::MAX_QTY_VALUE) { diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php index 0a2b3b6aac7739f43b455847c8e2bcd065106ea5..87194a8241b07423779d04a73853c838984fb15d 100644 --- a/app/code/Magento/Catalog/Controller/Category.php +++ b/app/code/Magento/Catalog/Controller/Category.php @@ -63,7 +63,7 @@ class Category extends \Magento\App\Action\Action protected $_categoryFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -73,7 +73,7 @@ class Category extends \Magento\App\Action\Action * @param \Magento\Catalog\Model\Design $catalogDesign * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Action\Context $context, @@ -81,7 +81,7 @@ class Category extends \Magento\App\Action\Action \Magento\Catalog\Model\Design $catalogDesign, \Magento\Catalog\Model\Session $catalogSession, \Magento\Registry $coreRegistry, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; $this->_categoryFactory = $categoryFactory; diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index f05238fcac2cecea96d5d93e4f859b645fd63c5b..d1857c5055ff8219823cb1b6c9c62507fbed0d66 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -91,7 +91,7 @@ class Compare extends \Magento\App\Action\Action protected $_compareItemFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -109,7 +109,7 @@ class Compare extends \Magento\App\Action\Action * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Catalog\Model\Product\Compare\ListCompare $catalogProductCompareList * @param \Magento\Catalog\Model\Session $catalogSession - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param FormKeyValidator $formKeyValidator */ public function __construct( @@ -121,7 +121,7 @@ class Compare extends \Magento\App\Action\Action \Magento\Log\Model\Visitor $logVisitor, \Magento\Catalog\Model\Product\Compare\ListCompare $catalogProductCompareList, \Magento\Catalog\Model\Session $catalogSession, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; @@ -183,7 +183,7 @@ class Compare extends \Magento\App\Action\Action $product = $this->_productFactory->create(); $product->setStoreId($this->_storeManager->getStore()->getId())->load($productId); - if ($product->getId()/* && !$product->isSuper()*/) { + if ($product->getId()) { $this->_catalogProductCompareList->addProduct($product); $productName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($product->getName()); $this->messageManager->addSuccess(__('You added product %1 to the comparison list.', $productName)); diff --git a/app/code/Magento/Catalog/Helper/Catalog.php b/app/code/Magento/Catalog/Helper/Catalog.php index 092ac94b3506d899c2fdca9a771563ed52fb98e9..d1b3362d0dc693934433c2ffc3b1062e5aeed046 100644 --- a/app/code/Magento/Catalog/Helper/Catalog.php +++ b/app/code/Magento/Catalog/Helper/Catalog.php @@ -61,21 +61,21 @@ class Catalog extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -131,8 +131,8 @@ class Catalog extends \Magento\App\Helper\AbstractHelper public function getSitemapValidPaths() { return array_merge( - $this->_coreStoreConfig->getConfig(self::XML_PATH_SITEMAP_VALID_PATHS), - $this->_coreStoreConfig->getConfig(self::XML_PATH_PUBLIC_FILES_VALID_PATHS) + $this->_scopeConfig->getValue(self::XML_PATH_SITEMAP_VALID_PATHS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE), + $this->_scopeConfig->getValue(self::XML_PATH_PUBLIC_FILES_VALID_PATHS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ); } } diff --git a/app/code/Magento/Catalog/Helper/Category.php b/app/code/Magento/Catalog/Helper/Category.php index d74aeaee1865c4bd2a57b6a6a6ba151952955771..d03bc66737df677636ec462517f102985fb1493e 100644 --- a/app/code/Magento/Catalog/Helper/Category.php +++ b/app/code/Magento/Catalog/Helper/Category.php @@ -27,7 +27,7 @@ namespace Magento\Catalog\Helper; use Magento\App\Helper\AbstractHelper; use Magento\Catalog\Model\Category as ModelCategory; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * Catalog category helper @@ -57,16 +57,16 @@ class Category extends AbstractHelper protected $_categoryUrlSuffix = array(); /** - * Core store config + * Scope config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -87,21 +87,21 @@ class Category extends AbstractHelper /** * @param \Magento\App\Helper\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Data\CollectionFactory $dataCollectionFactory */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Data\CollectionFactory $dataCollectionFactory ) { $this->_categoryFactory = $categoryFactory; $this->_storeManager = $storeManager; $this->_dataCollectionFactory = $dataCollectionFactory; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -133,7 +133,13 @@ class Category extends AbstractHelper return array(); } - $recursionLevel = max(0, (int)$this->_storeManager->getStore()->getConfig('catalog/navigation/max_depth')); + $recursionLevel = max( + 0, + (int)$this->_scopeConfig->getValue( + 'catalog/navigation/max_depth', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); $storeCategories = $category->getCategories($parent, $recursionLevel, $sorted, $asCollection, $toLoad); $this->_storeCategories[$cacheKey] = $storeCategories; @@ -193,8 +199,9 @@ class Category extends AbstractHelper } if (!isset($this->_categoryUrlSuffix[$storeId])) { - $this->_categoryUrlSuffix[$storeId] = $this->_coreStoreConfig->getConfig( + $this->_categoryUrlSuffix[$storeId] = $this->_scopeConfig->getValue( self::XML_PATH_CATEGORY_URL_SUFFIX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); } @@ -234,6 +241,10 @@ class Category extends AbstractHelper */ public function canUseCanonicalTag($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_USE_CATEGORY_CANONICAL_TAG, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_USE_CATEGORY_CANONICAL_TAG, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } } diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index f9ea8c39ac1bc32764ed9119afe4b459fa0936ee..2e53b8f5f730bc6559b6b4aa5c99092bf4e7f8e8 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -130,7 +130,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -172,13 +172,13 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Stdlib\String $string * @param Category $catalogCategory * @param Product $catalogProduct * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory * @param \Magento\Escaper $escaper * @param string $templateFilterModel @@ -188,13 +188,13 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Session $catalogSession, \Magento\Stdlib\String $string, Category $catalogCategory, Product $catalogProduct, \Magento\Registry $coreRegistry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, \Magento\Escaper $escaper, $templateFilterModel @@ -208,7 +208,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $this->string = $string; $this->_catalogCategory = $catalogCategory; $this->_catalogProduct = $catalogProduct; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_coreRegistry = $coreRegistry; $this->_templateFilterModel = $templateFilterModel; $this->_escaper = $escaper; @@ -363,7 +363,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getPriceScope() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_PRICE_SCOPE); + return $this->_scopeConfig->getValue( + self::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -384,7 +387,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function shouldSaveUrlRewritesHistory($storeId = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_SEO_SAVE_HISTORY, $storeId); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_SEO_SAVE_HISTORY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -394,7 +401,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isUsingStaticUrlsAllowed() { - return $this->_coreStoreConfig->getConfigFlag(self::CONFIG_USE_STATIC_URLS, $this->_storeId); + return $this->_scopeConfig->isSetFlag( + self::CONFIG_USE_STATIC_URLS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); } /** @@ -404,7 +415,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isUrlDirectivesParsingAllowed() { - return $this->_coreStoreConfig->getConfigFlag(self::CONFIG_PARSE_URL_DIRECTIVES, $this->_storeId); + return $this->_scopeConfig->isSetFlag( + self::CONFIG_PARSE_URL_DIRECTIVES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); } /** @@ -424,7 +439,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isMsrpEnabled() { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_ENABLED, $this->_storeId); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_MSRP_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); } /** @@ -434,7 +453,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMsrpDisplayActualPriceType() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE, $this->_storeId); + return $this->_scopeConfig->getValue( + self::XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); } /** @@ -444,7 +467,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isMsrpApplyToAll() { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_APPLY_TO_ALL, $this->_storeId); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_MSRP_APPLY_TO_ALL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); } /** @@ -455,7 +482,11 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getMsrpExplanationMessage() { return $this->_escaper->escapeHtml( - $this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_EXPLANATION_MESSAGE, $this->_storeId), + $this->_scopeConfig->getValue( + self::XML_PATH_MSRP_EXPLANATION_MESSAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ), array('b', 'br', 'strong', 'i', 'u', 'p', 'span') ); } @@ -468,7 +499,11 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getMsrpExplanationMessageWhatsThis() { return $this->_escaper->escapeHtml( - $this->_coreStoreConfig->getConfig(self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS, $this->_storeId), + $this->_scopeConfig->getValue( + self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ), array('b', 'br', 'strong', 'i', 'u', 'p', 'span') ); } @@ -593,6 +628,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function shouldDisplayProductCountOnLayer($storeId = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_DISPLAY_PRODUCT_COUNT, $storeId); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_DISPLAY_PRODUCT_COUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } } diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index b775eab874f9d095c1b9017357217b26f5c4da36..ad0a9992b748bd9d9d69b887f645d596347e2c55 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -117,9 +117,9 @@ class Image extends AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Product image factory @@ -132,17 +132,17 @@ class Image extends AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\Catalog\Model\Product\ImageFactory $productImageFactory * @param \Magento\View\Url $viewUrl - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Catalog\Model\Product\ImageFactory $productImageFactory, \Magento\View\Url $viewUrl, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_productImageFactory = $productImageFactory; parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_viewUrl = $viewUrl; } @@ -182,20 +182,28 @@ class Image extends AbstractHelper $this->setProduct($product); $this->setWatermark( - $this->_coreStoreConfig->getConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_image") + $this->_scopeConfig->getValue( + "design/watermark/{$this->_getModel()->getDestinationSubdir()}_image", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); $this->setWatermarkImageOpacity( - $this->_coreStoreConfig->getConfig( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity" + $this->_scopeConfig->getValue( + "design/watermark/{$this->_getModel()->getDestinationSubdir()}_imageOpacity", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); $this->setWatermarkPosition( - $this->_coreStoreConfig->getConfig( - "design/watermark/{$this->_getModel()->getDestinationSubdir()}_position" + $this->_scopeConfig->getValue( + "design/watermark/{$this->_getModel()->getDestinationSubdir()}_position", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ); $this->setWatermarkSize( - $this->_coreStoreConfig->getConfig("design/watermark/{$this->_getModel()->getDestinationSubdir()}_size") + $this->_scopeConfig->getValue( + "design/watermark/{$this->_getModel()->getDestinationSubdir()}_size", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); if ($imageFile) { diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index af5b79588de2e1ac695c66240c3a6036c36cc19c..ae4ed2e949b1aee1d46bc609829c2c941424df5e 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Helper; use Magento\Catalog\Model\Product as ModelProduct; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * Catalog category helper @@ -90,12 +90,12 @@ class Product extends \Magento\Core\Helper\Url /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -134,29 +134,29 @@ class Product extends \Magento\Core\Helper\Url /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\View\Url $viewUrl * @param \Magento\Registry $coreRegistry * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param string $typeSwitcherLabel * @param \Magento\Catalog\Model\CategoryFactory $reindexPriceIndexerData */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Session $catalogSession, \Magento\View\Url $viewUrl, \Magento\Registry $coreRegistry, \Magento\Catalog\Model\Attribute\Config $attributeConfig, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, $typeSwitcherLabel, $reindexPriceIndexerData ) { @@ -166,11 +166,9 @@ class Product extends \Magento\Core\Helper\Url $this->_typeSwitcherLabel = $typeSwitcherLabel; $this->_attributeConfig = $attributeConfig; $this->_coreRegistry = $coreRegistry; - $this->_coreRegistry = $coreRegistry; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_viewUrl = $viewUrl; $this->_coreConfig = $coreConfig; - $this->_coreStoreConfig = $coreStoreConfig; $this->_logger = $context->getLogger(); $this->_reindexPriceIndexerData = $reindexPriceIndexerData; parent::__construct($context, $storeManager); @@ -351,8 +349,9 @@ class Product extends \Magento\Core\Helper\Url } if (!isset($this->_productUrlSuffix[$storeId])) { - $this->_productUrlSuffix[$storeId] = $this->_coreStoreConfig->getConfig( + $this->_productUrlSuffix[$storeId] = $this->_scopeConfig->getValue( self::XML_PATH_PRODUCT_URL_SUFFIX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); } @@ -367,7 +366,11 @@ class Product extends \Magento\Core\Helper\Url */ public function canUseCanonicalTag($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_USE_PRODUCT_CANONICAL_TAG, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_USE_PRODUCT_CANONICAL_TAG, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -390,8 +393,10 @@ class Product extends \Magento\Core\Helper\Url if (is_null($inputType)) { return $inputTypes; - } else if (isset($inputTypes[$inputType])) { - return $inputTypes[$inputType]; + } else { + if (isset($inputTypes[$inputType])) { + return $inputTypes[$inputType]; + } } return array(); } @@ -547,7 +552,7 @@ class Product extends \Magento\Core\Helper\Url if ($currentConfig) { if (is_array($currentConfig)) { $params->setCurrentConfig(new \Magento\Object($currentConfig)); - } elseif (!($currentConfig instanceof \Magento\Object)) { + } elseif (!$currentConfig instanceof \Magento\Object) { $params->unsCurrentConfig(); } } @@ -590,9 +595,11 @@ class Product extends \Magento\Core\Helper\Url $idBySku = $product->getIdBySku($productId); if ($idBySku) { $productId = $idBySku; - } else if ($identifierType == 'sku') { - // Return empty product because it was not found by originally specified SKU identifier - return $product; + } else { + if ($identifierType == 'sku') { + // Return empty product because it was not found by originally specified SKU identifier + return $product; + } } } diff --git a/app/code/Magento/Catalog/Helper/Product/Compare.php b/app/code/Magento/Catalog/Helper/Product/Compare.php index cd8ba9b3ce34b2401736e6dece8c7f4ca991a5df..8f4d3af3c6e13c3487fcef36a9100ef7915f9660 100644 --- a/app/code/Magento/Catalog/Helper/Product/Compare.php +++ b/app/code/Magento/Catalog/Helper/Product/Compare.php @@ -115,7 +115,7 @@ class Compare extends \Magento\Core\Helper\Url /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Log\Model\Visitor $logVisitor @@ -127,7 +127,7 @@ class Compare extends \Magento\Core\Helper\Url */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Log\Model\Visitor $logVisitor, diff --git a/app/code/Magento/Catalog/Helper/Product/Composite.php b/app/code/Magento/Catalog/Helper/Product/Composite.php old mode 100755 new mode 100644 index 72558aa362fa477a810ad51368dcd03409eb9b05..0d21bd39163858c438391b1fb0605bb2dd238ce5 --- a/app/code/Magento/Catalog/Helper/Product/Composite.php +++ b/app/code/Magento/Catalog/Helper/Product/Composite.php @@ -29,7 +29,7 @@ use Magento\App\Helper\Context; use Magento\App\ViewInterface; use Magento\Catalog\Helper\Product; use Magento\Catalog\Model\ProductFactory; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Model\Converter; use Magento\Registry; @@ -78,7 +78,7 @@ class Composite extends \Magento\App\Helper\AbstractHelper protected $_converter; /** - * @param Context $context + * @param \Magento\App\Helper\Context $context * @param ProductFactory $productFactory * @param StoreManagerInterface $storeManager * @param Product $catalogProduct diff --git a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php index b003e39cbc7c60a321bbdce76f9543c224e55871..b42d978f6f68b9f1313484869eee454bcb66650e 100644 --- a/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php +++ b/app/code/Magento/Catalog/Helper/Product/Edit/Action/Attribute.php @@ -143,7 +143,7 @@ class Attribute extends \Magento\Backend\Helper\Data */ public function getSelectedStoreId() { - return (int)$this->_getRequest()->getParam('store', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + return (int)$this->_getRequest()->getParam('store', \Magento\Store\Model\Store::DEFAULT_STORE_ID); } /** diff --git a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php index a159314fb13c052535096251692778889abb2dc4..ede28e8eabd00947ccabb507aa6009197dbe34fe 100644 --- a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php +++ b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php @@ -121,7 +121,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper protected $_attributeFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -147,7 +147,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig * @param \Magento\Catalog\Model\Resource\ConfigFactory $configFactory * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Mview\View\Changelog $changelog * @param bool $addFilterableAttrs * @param bool $addChildData @@ -160,7 +160,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper \Magento\Catalog\Model\Attribute\Config $attributeConfig, \Magento\Catalog\Model\Resource\ConfigFactory $configFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Mview\View\Changelog $changelog, $addFilterableAttrs = false, $addChildData = false, diff --git a/app/code/Magento/Catalog/Helper/Product/ProductList.php b/app/code/Magento/Catalog/Helper/Product/ProductList.php index c605e91214a209e06bf1009bd818c29f817ecac0..50267b478e0e6bce298b5fd638617c538f83ab4a 100644 --- a/app/code/Magento/Catalog/Helper/Product/ProductList.php +++ b/app/code/Magento/Catalog/Helper/Product/ProductList.php @@ -41,9 +41,9 @@ class ProductList const DEFAULT_SORT_DIRECTION = 'asc'; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeConfig; + protected $scopeConfig; /** * Default limits per page @@ -53,12 +53,12 @@ class ProductList protected $_defaultAvailableLimit = array(10=>10,20=>20,50=>50); /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( - \Magento\Core\Model\Store\Config $storeConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; } /** @@ -68,7 +68,7 @@ class ProductList */ public function getAvailableViewMode() { - switch ($this->storeConfig->getConfig(self::XML_PATH_LIST_MODE)) { + switch ($this->scopeConfig->getValue(self::XML_PATH_LIST_MODE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { case 'grid': $availableMode = array('grid' => __('Grid')); break; @@ -112,8 +112,9 @@ class ProductList */ public function getDefaultSortField() { - return $this->storeConfig->getConfig( - \Magento\Catalog\Model\Config::XML_PATH_LIST_DEFAULT_SORT_BY + return $this->scopeConfig->getValue( + \Magento\Catalog\Model\Config::XML_PATH_LIST_DEFAULT_SORT_BY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } @@ -129,10 +130,16 @@ class ProductList return $this->_defaultAvailableLimit; } $perPageConfigKey = 'catalog/frontend/' . $mode . '_per_page_values'; - $perPageValues = (string)$this->storeConfig->getConfig($perPageConfigKey); + $perPageValues = (string)$this->scopeConfig->getValue( + $perPageConfigKey, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $perPageValues = explode(',', $perPageValues); $perPageValues = array_combine($perPageValues, $perPageValues); - if ($this->storeConfig->getConfigFlag('catalog/frontend/list_allow_all')) { + if ($this->scopeConfig->isSetFlag( + 'catalog/frontend/list_allow_all', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )) { return ($perPageValues + array('all'=>__('All'))); } else { return $perPageValues; @@ -148,9 +155,15 @@ class ProductList public function getDefaultLimitPerPageValue($viewMode) { if ($viewMode == self::VIEW_MODE_LIST) { - return $this->storeConfig->getConfig('catalog/frontend/list_per_page'); + return $this->scopeConfig->getValue( + 'catalog/frontend/list_per_page', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } elseif ($viewMode == self::VIEW_MODE_GRID) { - return $this->storeConfig->getConfig('catalog/frontend/grid_per_page'); + return $this->scopeConfig->getValue( + 'catalog/frontend/grid_per_page', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return 0; } diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 86ed8240b33720258e3aff8ca1e74316027c9d8b..bce49ff8e43dfcba232c27682fa79d0aa0d63e19 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -75,14 +75,14 @@ abstract class AbstractModel extends \Magento\Model\AbstractModel /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -90,7 +90,7 @@ abstract class AbstractModel extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -260,7 +260,7 @@ abstract class AbstractModel extends \Magento\Model\AbstractModel /** * Retrieve sore object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index bfc2b01f8088d31912e6f87d15c89321be0599c4..be7af4dfe395cf18c75c8d563b13d91e38176f79 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -143,7 +143,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * Store collection factory * - * @var \Magento\Core\Model\Resource\Store\CollectionFactory + * @var \Magento\Store\Model\Resource\Store\CollectionFactory */ protected $_storeCollectionFactory; @@ -191,12 +191,12 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource * @param \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory + * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory * @param \Magento\UrlInterface $url * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Config $catalogConfig @@ -212,12 +212,12 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource, \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory, - \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory, + \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory, \Magento\UrlInterface $url, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Config $catalogConfig, diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index 741fd0705f6c16ed5f105a4104bfad7ca9e7f0cc..9305a193735674cead4f2a6841bef27086f36d2a 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -37,19 +37,19 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Construct * * @param \Magento\Logger $logger - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig) + public function __construct(\Magento\Logger $logger, \Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($logger); } @@ -100,8 +100,9 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $postDataConfig ) ? $object->getData( $attributeCode - ) : $this->_coreStoreConfig->getConfig( - "catalog/frontend/default_sort_by" + ) : $this->_scopeConfig->getValue( + "catalog/frontend/default_sort_by", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!in_array($data, $available)) { throw new \Magento\Model\Exception( diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index 98aabb68c517e345c182a113e8933b2043012395..572f690a22b4f8ca8b2aac2f62f0a73a46decb32 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -84,9 +84,9 @@ class Config extends \Magento\Eav\Model\Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Eav config @@ -98,7 +98,7 @@ class Config extends \Magento\Eav\Model\Config /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -137,12 +137,12 @@ class Config extends \Magento\Eav\Model\Config * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Resource\ConfigFactory $configFactory * @param \Magento\Catalog\Model\Product\TypeFactory $productTypeFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setCollectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -152,15 +152,15 @@ class Config extends \Magento\Eav\Model\Config \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\App\Cache\StateInterface $cacheState, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Resource\ConfigFactory $configFactory, \Magento\Catalog\Model\Product\TypeFactory $productTypeFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setCollectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_configFactory = $configFactory; $this->_productTypeFactory = $productTypeFactory; $this->_groupCollectionFactory = $groupCollectionFactory; @@ -492,6 +492,6 @@ class Config extends \Magento\Eav\Model\Config */ public function getProductListDefaultSortBy($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_LIST_DEFAULT_SORT_BY, $store); + return $this->_scopeConfig->getValue(self::XML_PATH_LIST_DEFAULT_SORT_BY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } } diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Category.php b/app/code/Magento/Catalog/Model/Config/Backend/Category.php index 05b69eb3469990f56e9c00a0a7b6adf82bdd530f..5ce030cf7c6b07d41f3791a759aad87d802405a4 100644 --- a/app/code/Magento/Catalog/Model/Config/Backend/Category.php +++ b/app/code/Magento/Catalog/Model/Config/Backend/Category.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Config\Backend; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Category extends \Magento\Core\Model\Config\Value +class Category extends \Magento\App\Config\Value { /** * Catalog category @@ -46,8 +46,7 @@ class Category extends \Magento\Core\Model\Config\Value * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Category $catalogCategory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -56,15 +55,14 @@ class Category extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Category $catalogCategory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_catalogCategory = $catalogCategory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Seo/Product.php b/app/code/Magento/Catalog/Model/Config/Backend/Seo/Product.php index 539e03691f36406b2b11cc17365bbdff713a5828..852cfd334e8876577699aa9b05799f2b67e38665 100644 --- a/app/code/Magento/Catalog/Model/Config/Backend/Seo/Product.php +++ b/app/code/Magento/Catalog/Model/Config/Backend/Seo/Product.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Config\Backend\Seo; -use Magento\Core\Model\Config\Value; +use Magento\App\Config\Value; class Product extends Value { diff --git a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php index 9e15babe76e8d3d7350bacd1e58b373bce08bb12..0b1fbf32d795b3e99759e684710f49d03bea0780 100644 --- a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php +++ b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Model\Config\CatalogClone\Media; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Image extends \Magento\Core\Model\Config\Value +class Image extends \Magento\App\Config\Value { /** * Eav config @@ -49,8 +49,7 @@ class Image extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Model\Resource\AbstractResource $resource @@ -60,8 +59,7 @@ class Image extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Model\Resource\AbstractResource $resource = null, @@ -70,7 +68,7 @@ class Image extends \Magento\Core\Model\Config\Value ) { $this->_attributeCollectionFactory = $attributeCollectionFactory; $this->_eavConfig = $eavConfig; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php index 8f02f52739636abdf6ec8a078912fe1eb9c0b0b3..0dcacd6b2da6019dd788f9432c64d85f9610eee6 100644 --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -96,11 +96,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory + * @param \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList * @param \Magento\Locale\ResolverInterface $localeResolver * @param LockValidatorInterface $lockValidator * @param \Magento\Model\Resource\AbstractResource $resource @@ -113,11 +113,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Catalog\Model\ProductFactory $catalogProductFactory, + \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Locale\ResolverInterface $localeResolver, LockValidatorInterface $lockValidator, \Magento\Model\Resource\AbstractResource $resource = null, @@ -135,7 +135,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute $resourceHelper, $universalFactory, $localeDate, - $catalogProductFactory, + $reservedAttributeList, $localeResolver, $resource, $resourceCollection, diff --git a/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php b/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php index 5bbfbb6409d2248ba480dcce8c930777693f7657..89ff8710d11c49d60566c039e176304f09d32abe 100644 --- a/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php +++ b/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php @@ -36,9 +36,9 @@ abstract class AbstractFlatState const INDEXER_ENABLED_XML_PATH = ''; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeConfig; + protected $scopeConfig; /** * @var bool @@ -51,16 +51,16 @@ abstract class AbstractFlatState protected $flatIndexer; /** - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param bool $isAvailable */ public function __construct( - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Indexer\Model\IndexerInterface $flatIndexer, $isAvailable = false ) { - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; $this->flatIndexer = $flatIndexer; $this->isAvailable = $isAvailable; } @@ -72,7 +72,7 @@ abstract class AbstractFlatState */ public function isFlatEnabled() { - return $this->storeConfig->getConfigFlag(static::INDEXER_ENABLED_XML_PATH); + return $this->scopeConfig->isSetFlag(static::INDEXER_ENABLED_XML_PATH, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php index d9540e1d7478a4779d86ae273e8ac5b35a323b6c..13d6d4cd513dd279ca75df26e2bef3fcabb2ec57 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php @@ -43,7 +43,7 @@ class AbstractAction protected $resource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -63,12 +63,12 @@ class AbstractAction /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Helper $resourceHelper ) { $this->resource = $resource; @@ -104,7 +104,7 @@ class AbstractAction * @param integer $storeId * @return string */ - public function getMainStoreTable($storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID) + public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID) { if (is_string($storeId)) { $storeId = intval($storeId); @@ -443,7 +443,7 @@ class AbstractAction $entityIds )->where( 'def.store_id IN (?)', - array(\Magento\Core\Model\Store::DEFAULT_STORE_ID, $storeId) + array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId) ); return $this->getReadAdapter()->fetchAll($select); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php index 7384a79bc5eb3923dc02fb13b0f16ca5bfecd48d..7c4551b12170cb8d79715f2bf71c834fbde1c899 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Full.php @@ -51,7 +51,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /** * Populate category flat tables with data * - * @param \Magento\Core\Model\Store[] $stores + * @param \Magento\Store\Model\Store[] $stores * @return Full */ protected function populateFlatTables(array $stores) @@ -59,7 +59,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction $rootId = \Magento\Catalog\Model\Category::TREE_ROOT_ID; $categories = array(); $categoriesIds = array(); - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { if (!isset($categories[$store->getRootCategoryId()])) { $select = $this->getWriteAdapter()->select()->from( @@ -125,7 +125,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction * Create category flat tables and add attributes as fields. * Tables are created only if DDL operations are allowed * - * @param \Magento\Core\Model\Store[] $stores if empty, create tables for all stores of the application + * @param \Magento\Store\Model\Store[] $stores if empty, create tables for all stores of the application * @return Full */ protected function createTables(array $stores = array()) @@ -136,7 +136,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction if (empty($stores)) { $stores = $this->storeManager->getStores(); } - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { $this->createTable($store->getId()); } @@ -147,12 +147,12 @@ class Full extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /** * Switch table (temporary becomes active, old active will be dropped) * - * @param \Magento\Core\Model\Store[] $stores + * @param \Magento\Store\Model\Store[] $stores * @return Full */ protected function switchTables(array $stores = array()) { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { $activeTableName = $this->getMainStoreTable($store->getId()); $temporaryTableName = $this->addTemporaryTableSuffix($this->getMainStoreTable($store->getId())); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php index 4c6a7f35f79021c1382ae8e2212b30b3b2d44211..5543d49dea248594034937858d537fdeac320cfc 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Action/Rows.php @@ -32,13 +32,13 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory ) { @@ -49,11 +49,11 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /** * Return index table name * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @param bool $useTempTable * @return string */ - protected function getTableNameByStore(\Magento\Core\Model\Store $store, $useTempTable) + protected function getTableNameByStore(\Magento\Store\Model\Store $store, $useTempTable) { $tableName = $this->getMainStoreTable($store->getId()); return $useTempTable ? $this->addTemporaryTableSuffix($tableName) : $tableName; @@ -73,7 +73,7 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /* @var $category \Magento\Catalog\Model\Category */ $category = $this->categoryFactory->create(); - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { $tableName = $this->getTableNameByStore($store, $useTempTable); @@ -121,11 +121,11 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction /** * Delete non stores categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @param bool $useTempTable * @return void */ - protected function deleteNonStoreCategories(\Magento\Core\Model\Store $store, $useTempTable) + protected function deleteNonStoreCategories(\Magento\Store\Model\Store $store, $useTempTable) { $rootId = \Magento\Catalog\Model\Category::TREE_ROOT_ID; @@ -154,7 +154,7 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Flat\AbstractAction * Filter category ids by store * * @param int[] $ids - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return int[] */ protected function filterIdsByStore(array $ids, $store) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php index ff94adbd78d8aff3d8cdd8c70d5c66b22a94f375..f6ce0ede0bd16deb244d13d75cff56e0659033da 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Indexer\Category\Flat\System\Config; /** * Flat category on/off backend */ -class Mode extends \Magento\Core\Model\Config\Value +class Mode extends \Magento\App\Config\Value { /** * @var \Magento\Indexer\Model\IndexerInterface @@ -41,8 +41,7 @@ class Mode extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\Indexer\State $indexerState * @param \Magento\Model\Resource\AbstractResource $resource @@ -52,8 +51,7 @@ class Mode extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\Indexer\State $indexerState, \Magento\Model\Resource\AbstractResource $resource = null, @@ -62,7 +60,7 @@ class Mode extends \Magento\Core\Model\Config\Value ) { $this->flatIndexer = $flatIndexer; $this->indexerState = $indexerState; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 9b84b375c6f6713560fa967e9958b472fa5674d4..924989a190dc0488ea9c1cb03687f0247de5d799 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -79,7 +79,7 @@ abstract class AbstractAction protected $resource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -97,12 +97,12 @@ abstract class AbstractAction /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $config */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Config $config ) { $this->resource = $resource; @@ -216,10 +216,10 @@ abstract class AbstractAction /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getNonAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { if (!isset($this->nonAnchorSelects[$store->getId()])) { $statusAttributeId = $this->config->getAttribute( @@ -334,10 +334,10 @@ abstract class AbstractAction /** * Reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return void */ - protected function reindexNonAnchorCategories(\Magento\Core\Model\Store $store) + protected function reindexNonAnchorCategories(\Magento\Store\Model\Store $store) { $selects = $this->prepareSelectsByRange($this->getNonAnchorCategoriesSelect($store), 'entity_id'); foreach ($selects as $select) { @@ -355,10 +355,10 @@ abstract class AbstractAction /** * Check if anchor select isset * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return bool */ - protected function hasAnchorSelect(\Magento\Core\Model\Store $store) + protected function hasAnchorSelect(\Magento\Store\Model\Store $store) { return isset($this->anchorSelects[$store->getId()]); } @@ -366,10 +366,10 @@ abstract class AbstractAction /** * Create anchor select * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function createAnchorSelect(\Magento\Core\Model\Store $store) + protected function createAnchorSelect(\Magento\Store\Model\Store $store) { $isAnchorAttributeId = $this->config->getAttribute( \Magento\Catalog\Model\Category::ENTITY, @@ -465,10 +465,10 @@ abstract class AbstractAction /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { if (!$this->hasAnchorSelect($store)) { $this->anchorSelects[$store->getId()] = $this->createAnchorSelect($store); @@ -479,10 +479,10 @@ abstract class AbstractAction /** * Reindex products of anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return void */ - protected function reindexAnchorCategories(\Magento\Core\Model\Store $store) + protected function reindexAnchorCategories(\Magento\Store\Model\Store $store) { $selects = $this->prepareSelectsByRange($this->getAnchorCategoriesSelect($store), 'entity_id'); @@ -501,10 +501,10 @@ abstract class AbstractAction /** * Get select for all products * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getAllProducts(\Magento\Core\Model\Store $store) + protected function getAllProducts(\Magento\Store\Model\Store $store) { if (!isset($this->productsSelects[$store->getId()])) { $statusAttributeId = $this->config->getAttribute( @@ -602,10 +602,10 @@ abstract class AbstractAction /** * Reindex all products to root category * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return void */ - protected function reindexRootCategory(\Magento\Core\Model\Store $store) + protected function reindexRootCategory(\Magento\Store\Model\Store $store) { if ($this->isIndexRootCategoryNeeded()) { $selects = $this->prepareSelectsByRange( diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php index 64cfc207b420a4ea08c369af3520b8fb859762fe..1aa6cffbd666af64db391da4a2fd885eb5cc9976 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Rows.php @@ -81,10 +81,10 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getNonAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getNonAnchorCategoriesSelect($store); return $select->where('cc.entity_id IN (?)', $this->limitationByCategories); @@ -93,10 +93,10 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getAnchorCategoriesSelect($store); return $select->where('cc.entity_id IN (?)', $this->limitationByCategories); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php index 840bf14b3e5187b9351a583da419f93e2f1c5665..d015f346756089712f02d46c3b007de58c16c819 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php @@ -67,10 +67,10 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getNonAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getNonAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getNonAnchorCategoriesSelect($store); return $select->where('ccp.product_id IN (?)', $this->limitationByProducts); @@ -79,10 +79,10 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio /** * Retrieve select for reindex products of non anchor categories * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getAnchorCategoriesSelect(\Magento\Core\Model\Store $store) + protected function getAnchorCategoriesSelect(\Magento\Store\Model\Store $store) { $select = parent::getAnchorCategoriesSelect($store); return $select->where('ccp.product_id IN (?)', $this->limitationByProducts); @@ -91,10 +91,10 @@ class Rows extends \Magento\Catalog\Model\Indexer\Category\Product\AbstractActio /** * Get select for all products * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return \Magento\DB\Select */ - protected function getAllProducts(\Magento\Core\Model\Store $store) + protected function getAllProducts(\Magento\Store\Model\Store $store) { $select = parent::getAllProducts($store); return $select->where('cp.entity_id IN (?)', $this->limitationByProducts); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php index f0413711326064355e01a6e0b67ee667921cd377..20f987588fc47179a5a14d74d89d425df8672fa0 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php @@ -57,7 +57,7 @@ abstract class AbstractAction protected $_resource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -71,9 +71,9 @@ abstract class AbstractAction /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Suffix for drop table (uses on flat table rename) @@ -135,9 +135,9 @@ abstract class AbstractAction /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper * @param \Magento\Catalog\Model\Product\Type $productType * @param Processor $flatProductProcessor @@ -146,9 +146,9 @@ abstract class AbstractAction */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper, \Magento\Catalog\Model\Product\Type $productType, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $flatProductProcessor, @@ -158,7 +158,7 @@ abstract class AbstractAction $this->_resource = $resource; $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_productIndexerHelper = $productHelper; $this->_productType = $productType; $this->_connection = $resource->getConnection('default'); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index 6e13023565146f7dce3a78c955b33f0243d031b9..f8fe29af7930e6704b81f2bb4b4948cb3575ab31 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -42,12 +42,12 @@ class FlatTableBuilder protected $_connection; /** - * @var \Magento\App\ConfigInterface $config + * @var \Magento\App\Config\ScopeConfigInterface $config */ protected $_config; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -59,15 +59,15 @@ class FlatTableBuilder /** * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper * @param \Magento\App\Resource $resource - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param TableDataInterface $tableData */ public function __construct( \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, \Magento\App\Resource $resource, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData ) { $this->_productIndexerHelper = $productIndexerHelper; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php index 44f440b88e8b3d09c19c7a7455f2412f3afc1d8b..356b1623be79a2abca1e531a3a95780de14d0b84 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php @@ -45,13 +45,13 @@ class Store /** * Before save handler * - * @param \Magento\Core\Model\Resource\Store $subject + * @param \Magento\Store\Model\Resource\Store $subject * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave(\Magento\Core\Model\Resource\Store $subject, \Magento\Model\AbstractModel $object) + public function beforeSave(\Magento\Store\Model\Resource\Store $subject, \Magento\Model\AbstractModel $object) { if (!$object->getId() || $object->dataHasChangedFor('group_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php index af276b43d15b1bd84bbac0ae94847d2925099803..7705237b126c1ae9c183e1c40a88d3783ac95402 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php @@ -45,16 +45,14 @@ class StoreGroup /** * Before save handler * - * @param \Magento\Core\Model\Resource\Store\Group $subject + * @param \Magento\Store\Model\Resource\Group $subject * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave( - \Magento\Core\Model\Resource\Store\Group $subject, - \Magento\Model\AbstractModel $object - ) { + public function beforeSave(\Magento\Store\Model\Resource\Group $subject, \Magento\Model\AbstractModel $object) + { if (!$object->getId() || $object->dataHasChangedFor('root_category_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php index 360b8ae8253ad507edc2740c9855d8922ab8cb9a..c96d52583b54d55aed8182e81afc4811d6d574a6 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php @@ -41,22 +41,22 @@ class State extends \Magento\Catalog\Model\Indexer\AbstractFlatState protected $_productFlatIndexerHelper; /** - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper * @param bool $isAvailable */ public function __construct( - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper, $isAvailable = false ) { - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; $this->flatIndexer = $flatIndexer; $this->_productFlatIndexerHelper = $flatIndexerHelper; $this->isAvailable = $isAvailable; - parent::__construct($storeConfig, $flatIndexer, $isAvailable); + parent::__construct($scopeConfig, $flatIndexer, $isAvailable); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php index 1b14af3e689ad4e3f373b7c6bbd4e56838f10670..e7d4a87403964df4488c1b703cf8d4e387a37437 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Indexer\Product\Flat\System\Config; /** * Flat product on/off backend */ -class Mode extends \Magento\Core\Model\Config\Value +class Mode extends \Magento\App\Config\Value { /** * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor @@ -41,8 +41,7 @@ class Mode extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor * @param \Magento\Indexer\Model\Indexer\State $indexerState * @param \Magento\Model\Resource\AbstractResource $resource @@ -52,8 +51,7 @@ class Mode extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Indexer\Model\Indexer\State $indexerState, \Magento\Model\Resource\AbstractResource $resource = null, @@ -62,7 +60,7 @@ class Mode extends \Magento\Core\Model\Config\Value ) { $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor; $this->indexerState = $indexerState; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php index e5b443f8a43f32de27c0400cab60ec7521f74281..d5ec3726c7f5928da644fa7bbdc7cde43f835e2d 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php @@ -54,12 +54,12 @@ abstract class AbstractAction /** * Core config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -106,8 +106,8 @@ abstract class AbstractAction /** * @param \Magento\App\Resource $resource - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime @@ -117,8 +117,8 @@ abstract class AbstractAction */ public function __construct( \Magento\App\Resource $resource, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, @@ -209,10 +209,10 @@ abstract class AbstractAction $baseCurrency = $this->_config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); $select = $write->select()->from( - array('cw' => $this->_getTable('core_website')), + array('cw' => $this->_getTable('store_website')), array('website_id') )->join( - array('csg' => $this->_getTable('core_store_group')), + array('csg' => $this->_getTable('store_group')), 'cw.default_group_id = csg.group_id', array('store_id' => 'default_store_id') )->where( @@ -222,7 +222,7 @@ abstract class AbstractAction $data = array(); foreach ($write->fetchAll($select) as $item) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ $website = $this->_storeManager->getWebsite($item['website_id']); if ($website->getBaseCurrencyCode() != $baseCurrency) { @@ -238,7 +238,7 @@ abstract class AbstractAction $rate = 1; } - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ $store = $this->_storeManager->getStore($item['store_id']); if ($store) { $timestamp = $this->_localeDate->scopeTimeStamp($store); @@ -280,7 +280,7 @@ abstract class AbstractAction 'tp.all_groups = 1 OR (tp.all_groups = 0 AND tp.customer_group_id = cg.customer_group_id)', array('customer_group_id') )->join( - array('cw' => $this->_getTable('core_website')), + array('cw' => $this->_getTable('store_website')), 'tp.website_id = 0 OR tp.website_id = cw.website_id', array('website_id') )->join( @@ -326,7 +326,7 @@ abstract class AbstractAction 'gp.all_groups = 1 OR (gp.all_groups = 0 AND gp.customer_group_id = cg.customer_group_id)', array('customer_group_id') )->join( - array('cw' => $this->_getTable('core_website')), + array('cw' => $this->_getTable('store_website')), 'gp.website_id = 0 OR gp.website_id = cw.website_id', array('website_id') )->join( diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Observer.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Observer.php index f91f22f44555df697b3a32e273ec93eb17df438d..252f25320e5689f32cf8d320f925998cca1cf44a 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Observer.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Observer.php @@ -28,7 +28,7 @@ namespace Magento\Catalog\Model\Indexer\Product\Price; class Observer { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -63,7 +63,7 @@ class Observer protected $_connection; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Resource $resource * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -71,7 +71,7 @@ class Observer * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\Resource $resource, \Magento\Stdlib\DateTime $dateTime, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/Website.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/Website.php index 011cd307997e0981fa89d583a00a34c60526bfae..b298593925be4b59db02fe541d5277270543b110 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/Website.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/Website.php @@ -41,13 +41,13 @@ class Website /** * Invalidate price indexer * - * @param \Magento\Core\Model\Resource\Website $subject - * @param \Magento\Core\Model\Resource\Website $result - * @return \Magento\Core\Model\Resource\Website + * @param \Magento\Store\Model\Resource\Website $subject + * @param \Magento\Store\Model\Resource\Website $result + * @return \Magento\Store\Model\Resource\Website * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDelete(\Magento\Core\Model\Resource\Website $subject, $result) + public function afterDelete(\Magento\Store\Model\Resource\Website $subject, $result) { $this->_processor->markIndexerAsInvalid(); return $result; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php index e9c45da962841b8b6286d38732bc4dd333260e63..e38fb4c82d415ee04362249441a84864d48c5cd6 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Indexer\Product\Price\System\Config; /** * Price scope backend model */ -class PriceScope extends \Magento\Core\Model\Config\Value +class PriceScope extends \Magento\App\Config\Value { /** * @var \Magento\Indexer\Model\IndexerInterface @@ -36,8 +36,7 @@ class PriceScope extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $indexer * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -46,15 +45,14 @@ class PriceScope extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $indexer, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->indexer = $indexer; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Url.php b/app/code/Magento/Catalog/Model/Indexer/Url.php index 251c76ba61191f86407c68333291c8280e806a80..57ec21166d336e245e7d232c60362a15a41f5fc4 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Url.php +++ b/app/code/Magento/Catalog/Model/Indexer/Url.php @@ -50,8 +50,8 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer protected $_matchedEntities = array( \Magento\Catalog\Model\Product::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), \Magento\Catalog\Model\Category::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Core\Model\Store::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Core\Model\Store\Group::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), + \Magento\Store\Model\Store::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), + \Magento\Store\Model\Group::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), \Magento\App\Config\ValueInterface::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE) ); @@ -140,34 +140,39 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer } $entity = $event->getEntity(); - if ($entity == \Magento\Core\Model\Store::ENTITY) { + if ($entity == \Magento\Store\Model\Store::ENTITY) { $store = $event->getDataObject(); if ($store && ($store->isObjectNew() || $store->dataHasChangedFor('group_id'))) { $result = true; } else { $result = false; } - } else if ($entity == \Magento\Core\Model\Store\Group::ENTITY) { - $storeGroup = $event->getDataObject(); - $hasDataChanges = $storeGroup && ($storeGroup->dataHasChangedFor( - 'root_category_id' - ) || $storeGroup->dataHasChangedFor( - 'website_id' - )); - if ($storeGroup && !$storeGroup->isObjectNew() && $hasDataChanges) { - $result = true; - } else { - $result = false; - } - } else if ($entity == \Magento\App\Config\ValueInterface::ENTITY) { - $configData = $event->getDataObject(); - if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { - $result = $configData->isValueChanged(); + } else { + if ($entity == \Magento\Store\Model\Group::ENTITY) { + /** @var \Magento\Store\Model\Group $storeGroup */ + $storeGroup = $event->getDataObject(); + $hasDataChanges = $storeGroup && ($storeGroup->dataHasChangedFor( + 'root_category_id' + ) || $storeGroup->dataHasChangedFor( + 'website_id' + )); + if ($storeGroup && !$storeGroup->isObjectNew() && $hasDataChanges) { + $result = true; + } else { + $result = false; + } } else { - $result = false; + if ($entity == \Magento\App\Config\ValueInterface::ENTITY) { + $configData = $event->getDataObject(); + if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { + $result = $configData->isValueChanged(); + } else { + $result = false; + } + } else { + $result = parent::matchEvent($event); + } } - } else { - $result = parent::matchEvent($event); } $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result); @@ -194,8 +199,8 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer $this->_registerCategoryEvent($event); break; - case \Magento\Core\Model\Store::ENTITY: - case \Magento\Core\Model\Store\Group::ENTITY: + case \Magento\Store\Model\Store::ENTITY: + case \Magento\Store\Model\Store::ENTITY: case \Magento\App\Config\ValueInterface::ENTITY: $process = $event->getProcess(); $process->changeStatus(\Magento\Index\Model\Process::STATUS_REQUIRE_REINDEX); diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php index 69b1f01098de31f5d4f404a3a58daa5fcd5d5a49..2246332e6350d4d437cabe37804f92132ad34bd4 100644 --- a/app/code/Magento/Catalog/Model/Layer.php +++ b/app/code/Magento/Catalog/Model/Layer.php @@ -56,7 +56,7 @@ class Layer extends \Magento\Object /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -109,7 +109,7 @@ class Layer extends \Magento\Object * @param CategoryFactory $categoryFactory * @param Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param Resource\Product $catalogProduct - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry * @param array $data */ @@ -119,7 +119,7 @@ class Layer extends \Magento\Object \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Catalog\Model\Resource\Product $catalogProduct, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, array $data = array() ) { @@ -252,7 +252,7 @@ class Layer extends \Magento\Object /** * Retrieve current store model * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getCurrentStore() { diff --git a/app/code/Magento/Catalog/Model/Layer/Category.php b/app/code/Magento/Catalog/Model/Layer/Category.php index f3c7fff171a77271a95295fc4d261ce41be3ba18..7cd7e68cb5b148f86feaec58b9d394b88897b5dd 100644 --- a/app/code/Magento/Catalog/Model/Layer/Category.php +++ b/app/code/Magento/Catalog/Model/Layer/Category.php @@ -37,7 +37,7 @@ class Category extends \Magento\Catalog\Model\Layer * @param CategoryFactory $categoryFactory * @param Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param Resource\Product $catalogProduct - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry * @param array $data */ @@ -47,7 +47,7 @@ class Category extends \Magento\Catalog\Model\Layer CategoryFactory $categoryFactory, Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, Resource\Product $catalogProduct, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Layer/Category/FilterableAttributeList.php b/app/code/Magento/Catalog/Model/Layer/Category/FilterableAttributeList.php index ae8bb508376a806b63f247c07332f0686707af3c..8d7afa77589ebe50d4b53d4d6b576003ae392ee2 100644 --- a/app/code/Magento/Catalog/Model/Layer/Category/FilterableAttributeList.php +++ b/app/code/Magento/Catalog/Model/Layer/Category/FilterableAttributeList.php @@ -36,7 +36,7 @@ class FilterableAttributeList implements FilterableAttributeListInterface protected $collectionFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -49,12 +49,12 @@ class FilterableAttributeList implements FilterableAttributeListInterface * FilterableAttributeList constructor * * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer */ public function __construct( \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer ) { $this->collectionFactory = $collectionFactory; diff --git a/app/code/Magento/Catalog/Model/Layer/Category/StateKey.php b/app/code/Magento/Catalog/Model/Layer/Category/StateKey.php index 15b6402abdee615b9fccd2918a2d30c562606c3a..44a9d1b2b4ef0328be93c9500d24430eaa7255bc 100644 --- a/app/code/Magento/Catalog/Model/Layer/Category/StateKey.php +++ b/app/code/Magento/Catalog/Model/Layer/Category/StateKey.php @@ -30,7 +30,7 @@ use Magento\Catalog\Model\Layer\StateKeyInterface; class StateKey implements StateKeyInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -40,11 +40,11 @@ class StateKey implements StateKeyInterface protected $customerSession; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession ) { $this->storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php index 66424e85424d9375460a03749d73046ac3182de3..483a5a0900ccbad6eb6bef271b528ad002d49030 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php @@ -58,7 +58,7 @@ abstract class AbstractFilter extends \Magento\Object /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -73,13 +73,13 @@ abstract class AbstractFilter extends \Magento\Object * Constructor * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php index 395f64ead56ffaf85f8007b89fc87f11a1c463f3..3ff62e7fd19b9bb3ffa13a917ed3e45c42e6c5f6 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php @@ -52,7 +52,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * Constructor * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer * @param \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory * @param \Magento\Stdlib\String $string @@ -60,7 +60,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory, \Magento\Stdlib\String $string, diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php index ab71bb2960ca83225d07c94854ed49550aa9fd1a..5975cc0fa2d7dc3dbfa151d7675c5f322d6f8a85 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php @@ -74,7 +74,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * Construct * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Escaper $escaper @@ -83,7 +83,7 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Escaper $escaper, diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php b/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php index 449add4c7585e48e2b339967d27911d723ec05ad..5a5464f8e80b986509e7c4e7a5d921e295b0d12a 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php @@ -49,14 +49,14 @@ class Decimal extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * Construct * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer * @param \Magento\Catalog\Model\Resource\Layer\Filter\DecimalFactory $filterDecimalFactory * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\Resource\Layer\Filter\DecimalFactory $filterDecimalFactory, array $data = array() diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php index 1d4c3de9d13070f718c8d444d5cf21d461b452ca..01e3f0dbfbeade3454a519822e3f15b176886844 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php @@ -91,30 +91,38 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected $_customerSession; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer * @param \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm * @param \Magento\Registry $coreRegistry + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $priceAlgorithm, \Magento\Registry $coreRegistry, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $data = array() ) { $this->_resource = $filterPriceFactory->create(); $this->_customerSession = $customerSession; $this->_priceAlgorithm = $priceAlgorithm; $this->_coreRegistry = $coreRegistry; + $this->_scopeConfig = $scopeConfig; parent::__construct($filterItemFactory, $storeManager, $layer, $data); $this->_requestVar = 'price'; } @@ -147,7 +155,10 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter $maxPrice = $this->getMaxPriceInt(); if (!$range) { - $calculation = $this->_storeManager->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION); + $calculation = $this->_scopeConfig->getValue( + self::XML_PATH_RANGE_CALCULATION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($calculation == self::RANGE_CALCULATION_AUTO) { $index = 1; do { @@ -156,7 +167,10 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter $index++; } while ($range > self::MIN_RANGE_POWER && count($items) < 2); } else { - $range = (double)$this->_storeManager->getStore()->getConfig(self::XML_PATH_RANGE_STEP); + $range = (double)$this->_scopeConfig->getValue( + self::XML_PATH_RANGE_STEP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } @@ -199,7 +213,10 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter $i = 0; $lastIndex = null; $maxIntervalsNumber = $this->getMaxIntervalsNumber(); - $calculation = $this->_storeManager->getStore()->getConfig(self::XML_PATH_RANGE_CALCULATION); + $calculation = $this->_scopeConfig->getValue( + self::XML_PATH_RANGE_CALCULATION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); foreach ($items as $k => $v) { ++$i; if ($calculation == self::RANGE_CALCULATION_MANUAL && $i > 1 && $i > $maxIntervalsNumber) { @@ -245,8 +262,9 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter $formattedFromPrice = $store->formatPrice($fromPrice); if ($toPrice === '') { return __('%1 and above', $formattedFromPrice); - } elseif ($fromPrice == $toPrice && $this->_storeManager->getStore()->getConfig( - self::XML_PATH_ONE_PRICE_INTERVAL + } elseif ($fromPrice == $toPrice && $this->_scopeConfig->getValue( + self::XML_PATH_ONE_PRICE_INTERVAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { return $formattedFromPrice; @@ -326,8 +344,9 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected function _getItemsData() { - if ($this->_storeManager->getStore()->getConfig( - self::XML_PATH_RANGE_CALCULATION + if ($this->_scopeConfig->getValue( + self::XML_PATH_RANGE_CALCULATION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == self::RANGE_CALCULATION_IMPROVED ) { return $this->_getCalculatedItemsData(); @@ -514,7 +533,10 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function getMaxIntervalsNumber() { - return (int)$this->_storeManager->getStore()->getConfig(self::XML_PATH_RANGE_MAX_INTERVALS); + return (int)$this->_scopeConfig->getValue( + self::XML_PATH_RANGE_MAX_INTERVALS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -524,7 +546,10 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function getIntervalDivisionLimit() { - return (int)$this->_storeManager->getStore()->getConfig(self::XML_PATH_INTERVAL_DIVISION_LIMIT); + return (int)$this->_scopeConfig->getValue( + self::XML_PATH_INTERVAL_DIVISION_LIMIT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -552,8 +577,9 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function getClearLinkText() { - if ($this->_storeManager->getStore()->getConfig( - self::XML_PATH_RANGE_CALCULATION + if ($this->_scopeConfig->getValue( + self::XML_PATH_RANGE_CALCULATION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == self::RANGE_CALCULATION_IMPROVED && $this->getPriorIntervals() ) { return __('Clear Price'); diff --git a/app/code/Magento/Catalog/Model/Layer/Search.php b/app/code/Magento/Catalog/Model/Layer/Search.php index 2ea7310bf2d873b077bc45ee1cf6af3ad947d745..e9682a54fd0c16db923ddc4e244ab3887602002e 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search.php +++ b/app/code/Magento/Catalog/Model/Layer/Search.php @@ -37,7 +37,7 @@ class Search extends \Magento\Catalog\Model\Layer * @param CategoryFactory $categoryFactory * @param Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param Resource\Product $catalogProduct - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry * @param array $data */ @@ -47,7 +47,7 @@ class Search extends \Magento\Catalog\Model\Layer CategoryFactory $categoryFactory, Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, Resource\Product $catalogProduct, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Layer/Search/CollectionFilter.php b/app/code/Magento/Catalog/Model/Layer/Search/CollectionFilter.php index 8adf6cbedd4c224c5273c3a7cf51bb72d2de518a..ff92b26ead5146dd5fb67cdece74dfe85eb88ec0 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search/CollectionFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Search/CollectionFilter.php @@ -39,7 +39,7 @@ class CollectionFilter implements CollectionFilterInterface protected $helper; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -51,13 +51,13 @@ class CollectionFilter implements CollectionFilterInterface /** * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\CatalogSearch\Helper\Data $helper - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Visibility $productVisibility */ public function __construct( \Magento\Catalog\Model\Config $catalogConfig, \Magento\CatalogSearch\Helper\Data $helper, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Visibility $productVisibility ) { $this->catalogConfig = $catalogConfig; diff --git a/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php b/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php index 651705320766d078b8f6eb78051ac497bbb755d6..2f009577220184cba723a0b1c175a17c12db6229 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php +++ b/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php @@ -29,12 +29,12 @@ class FilterableAttributeList extends \Magento\Catalog\Model\Layer\Category\Filt { /** * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer\Search $layer */ public function __construct( \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer\Search $layer ) { parent::__construct($collectionFactory, $storeManager, $layer); diff --git a/app/code/Magento/Catalog/Model/Layer/Search/StateKey.php b/app/code/Magento/Catalog/Model/Layer/Search/StateKey.php index 93d930ab9bcb1ba730988fce70f58fb40f6fda72..955731d9f212268bd1c74fbba4639fdbed771c8a 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search/StateKey.php +++ b/app/code/Magento/Catalog/Model/Layer/Search/StateKey.php @@ -34,12 +34,12 @@ class StateKey extends \Magento\Catalog\Model\Layer\Category\StateKey protected $helper; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\CatalogSearch\Helper\Data $helper */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, \Magento\CatalogSearch\Helper\Data $helper ) { diff --git a/app/code/Magento/Catalog/Model/Observer.php b/app/code/Magento/Catalog/Model/Observer.php index c288b5afef6a28947456a075502a6f2e7f2bb053..00e72c38d4f52ccd2fc6f55c1ad84ff0fec38585 100644 --- a/app/code/Magento/Catalog/Model/Observer.php +++ b/app/code/Magento/Catalog/Model/Observer.php @@ -44,11 +44,6 @@ class Observer */ protected $_catalogCategory; - /** - * @var \Magento\App\ReinitableConfigInterface - */ - protected $_coreConfig; - /** * Index indexer * @@ -66,7 +61,7 @@ class Observer /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -102,26 +97,24 @@ class Observer * @param \Magento\Catalog\Model\UrlFactory $urlFactory * @param \Magento\Catalog\Model\Resource\Category $categoryResource * @param \Magento\Catalog\Model\Resource\Product $catalogProduct - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer\Category $catalogLayer * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Catalog\Helper\Data $catalogData * @param Indexer\Category\Flat\State $categoryFlatState - * @param \Magento\App\ReinitableConfigInterface $coreConfig * @param \Magento\Catalog\Model\Resource\ProductFactory $productResourceFactory */ public function __construct( \Magento\Catalog\Model\UrlFactory $urlFactory, \Magento\Catalog\Model\Resource\Category $categoryResource, \Magento\Catalog\Model\Resource\Product $catalogProduct, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Index\Model\Indexer $indexIndexer, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, - \Magento\App\ReinitableConfigInterface $coreConfig, \Magento\Catalog\Model\Resource\ProductFactory $productResourceFactory ) { $this->_urlFactory = $urlFactory; @@ -130,7 +123,6 @@ class Observer $this->_storeManager = $storeManager; $this->_catalogLayer = $catalogLayer; $this->_indexIndexer = $indexIndexer; - $this->_coreConfig = $coreConfig; $this->_catalogCategory = $catalogCategory; $this->_catalogData = $catalogData; $this->categoryFlatConfig = $categoryFlatState; diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index abafa246bb6d8a16335b2cacb0bb6f74b99268d3..3c336590c5e272d84e2a3e925556f3ff9933df47 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -127,13 +127,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O */ protected $_options = array(); - /** - * Product reserved attribute codes - * - * @var mixed - */ - protected $_reservedAttributes; - /** * Flag for available duplicate function * @@ -262,7 +255,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Product\Url $url * @param Product\Link $productLink * @param Product\Configuration\Item\OptionFactory $itemOptionFactory @@ -291,7 +284,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, Product\Url $url, Product\Link $productLink, \Magento\Catalog\Model\Product\Configuration\Item\OptionFactory $itemOptionFactory, @@ -1545,16 +1538,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O return $this->_getData('gift_message_available'); } - /** - * Returns rating summary - * - * @return mixed - */ - public function getRatingSummary() - { - return $this->_getData('rating_summary'); - } - /** * Check is product composite * @@ -1773,43 +1756,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O return $this->_catalogImage; } - /** - * Returns system reserved attribute codes - * - * @return array Reserved attribute names - */ - public function getReservedAttributes() - { - if ($this->_reservedAttributes === null) { - $_reserved = array('position'); - $methods = get_class_methods(__CLASS__); - foreach ($methods as $method) { - if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) { - $method = $matches[1]; - $tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method)); - $_reserved[] = $tmp; - } - } - $_allowed = array('type_id', 'calculated_final_price', 'request_path', 'rating_summary'); - $this->_reservedAttributes = array_diff($_reserved, $_allowed); - } - return $this->_reservedAttributes; - } - - /** - * Check whether attribute reserved or not - * - * @param \Magento\Catalog\Model\Entity\Attribute $attribute Attribute model object - * @return boolean - */ - public function isReservedAttribute($attribute) - { - return $attribute->getIsUserDefined() && in_array( - $attribute->getAttributeCode(), - $this->getReservedAttributes() - ); - } - /** * Reset all model data * diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php index a55269711f51469303edb7e8b51037b28c03d9be..6db0ec5764b242dab4baed9168339c2b53a25514 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php @@ -42,18 +42,18 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp /** * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice ) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index d2fdecefd4bdba498fd3b35e9f0e60893887d806..d7873cb3def2615659de967d62af3e9f7bd43135 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -56,17 +56,17 @@ abstract class AbstractGroupprice extends Price /** * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Product\Type $catalogProductType ) { $this->_catalogProductType = $catalogProductType; @@ -87,7 +87,7 @@ abstract class AbstractGroupprice extends Price 'default' ); foreach ($this->_storeManager->getWebsites() as $website) { - /* @var $website \Magento\Core\Model\Website */ + /* @var $website \Magento\Store\Model\Website */ if ($website->getBaseCurrencyCode() != $baseCurrency) { $rate = $this->_currencyFactory->create()->load( $baseCurrency diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index f12421e52d67b8aa41cd6c8397af70519fac8e99..c53584a94fb34e5ba0be634be2baed729d92a4dc 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -301,7 +301,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $storeId = $object->getStoreId(); $storeIds = $object->getStoreIds(); - $storeIds[] = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $storeIds[] = \Magento\Store\Model\Store::DEFAULT_STORE_ID; // remove current storeId $storeIds = array_flip($storeIds); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php index eebc0c6fa7ecb2d7976f2cd4ca0915ca415f0119..a255ce865fc69f1543fc56f05e6102bfffa333c1 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php @@ -44,7 +44,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,7 +58,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Core config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -67,16 +67,16 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $config + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php index 8855040f0c4d36cbee8626c72d7611c13ba29be8..5507f113041daeb7408beed1d8d120ba4c40b95e 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -46,18 +46,18 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr /** * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice ) { @@ -119,4 +119,14 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr { return $priceObject->isTierPriceFixed(); } + + /** + * By default attribute value is considered non-scalar that can be stored in a generic way + * + * @return bool + */ + public function isScalar() + { + return false; + } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Image.php b/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Image.php index 2166d62ff09cf39de1cbed2493ebbc3fc117b39d..d609ac198568b30627804c7288370c669e13ff52 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Image.php @@ -39,16 +39,16 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFronten /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Construct * - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Countryofmanufacture.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Countryofmanufacture.php index 8639dc69c4adf277d9ab2b8ad27e2d5480bd1c4e..18d6a073681b87cbe2a40834337281f7b2b4e2d6 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Countryofmanufacture.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Countryofmanufacture.php @@ -43,7 +43,7 @@ class Countryofmanufacture extends \Magento\Eav\Model\Entity\Attribute\Source\Ab /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,12 +58,12 @@ class Countryofmanufacture extends \Magento\Eav\Model\Entity\Attribute\Source\Ab * Construct * * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Cache\Type\Config $configCacheType */ public function __construct( \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\Cache\Type\Config $configCacheType ) { $this->_countryFactory = $countryFactory; diff --git a/app/code/Magento/Catalog/Model/Product/CatalogPrice.php b/app/code/Magento/Catalog/Model/Product/CatalogPrice.php index a6c8e00161af9953aca19bc62cb34f016aee4cc9..7fcd58a594eef6e7a5ff1b5513e7a2fa72301cfa 100644 --- a/app/code/Magento/Catalog/Model/Product/CatalogPrice.php +++ b/app/code/Magento/Catalog/Model/Product/CatalogPrice.php @@ -55,7 +55,7 @@ class CatalogPrice implements CatalogPriceInterface * Minimal price for "regular" user * * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Core\Model\Store $store Store view + * @param null|\Magento\Store\Model\Store $store Store view * @param bool $inclTax * @throws \UnexpectedValueException * @return null|float diff --git a/app/code/Magento/Catalog/Model/Product/CatalogPriceInterface.php b/app/code/Magento/Catalog/Model/Product/CatalogPriceInterface.php index 23756f200724269a7dcc6ef44d9471a5ee112303..19483c2e348b124dcf0eb651ea596af8d1d9db0b 100644 --- a/app/code/Magento/Catalog/Model/Product/CatalogPriceInterface.php +++ b/app/code/Magento/Catalog/Model/Product/CatalogPriceInterface.php @@ -33,7 +33,7 @@ interface CatalogPriceInterface * Minimal price for "regular" user * * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Core\Model\Store $store Store view + * @param null|\Magento\Store\Model\Store $store Store view * @param bool $inclTax * @return null|float */ diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index 9a82598ac7fa11d987f27ef54d11794a926871ff..7aecd57b07045e4c8867e6bcd01e5f3826d6dcff 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -85,14 +85,14 @@ class Item extends \Magento\Model\AbstractModel implements \Magento\Object\Ident /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare @@ -103,7 +103,7 @@ class Item extends \Magento\Model\AbstractModel implements \Magento\Object\Ident public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php index 9eca9068e8faacda8d63c1c5f1aab3963db56ed8..b1e256f59a5e2713a56be7c9ae73d98aa2623a1d 100644 --- a/app/code/Magento/Catalog/Model/Product/Copier.php +++ b/app/code/Magento/Catalog/Model/Product/Copier.php @@ -68,7 +68,7 @@ class Copier $duplicate->setCreatedAt(null); $duplicate->setUpdatedAt(null); $duplicate->setId(null); - $duplicate->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); $this->copyConstructor->build($product, $duplicate); $duplicate->save(); diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 806803108d4fc89a8708a23b59979833dfb0b254..0b20783ec64e495be545b15a27e2ea451de685c1 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Model\Product; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Image as MagentoImage; class Image extends \Magento\Model\AbstractModel @@ -163,9 +163,9 @@ class Image extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Catalog product media config @@ -177,21 +177,21 @@ class Image extends \Magento\Model\AbstractModel /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\App\Filesystem $filesystem * @param \Magento\Image\Factory $imageFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -199,14 +199,14 @@ class Image extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\App\Filesystem $filesystem, \Magento\Image\Factory $imageFactory, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -220,7 +220,7 @@ class Image extends \Magento\Model\AbstractModel $this->_imageFactory = $imageFactory; $this->_viewUrl = $viewUrl; $this->_viewFileSystem = $viewFileSystem; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -476,8 +476,9 @@ class Image extends \Magento\Model\AbstractModel if (!$file) { $this->_isBaseFilePlaceholder = true; // check if placeholder defined in config - $isConfigPlaceholder = $this->_coreStoreConfig->getConfig( - "catalog/placeholder/{$this->getDestinationSubdir()}_placeholder" + $isConfigPlaceholder = $this->_scopeConfig->getValue( + "catalog/placeholder/{$this->getDestinationSubdir()}_placeholder", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $configPlaceholder = '/placeholder/' . $isConfigPlaceholder; if (!empty($isConfigPlaceholder) && $this->_fileExists($baseDir . $configPlaceholder)) { diff --git a/app/code/Magento/Catalog/Model/Product/Media/Config.php b/app/code/Magento/Catalog/Model/Product/Media/Config.php index 476870e1ea2de132c34ecf8b6b4ac6dd8144c440..6e3b3fb617b49265c645616c3eb6ceecf36993f3 100644 --- a/app/code/Magento/Catalog/Model/Product/Media/Config.php +++ b/app/code/Magento/Catalog/Model/Product/Media/Config.php @@ -37,14 +37,14 @@ class Config implements ConfigInterface /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->storeManager = $storeManager; } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index 8adc72f513368b8a11cefb362d775a52d2d0952c..6f11f851272154341bb24deec92e5efa29ee6995 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -46,18 +46,18 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, array $data = array() ) { $this->_localeDate = $localeDate; - parent::__construct($checkoutSession, $coreStoreConfig, $data); + parent::__construct($checkoutSession, $scopeConfig, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 15e470002669998ec144b49b27f44a2a12544e1f..cccd40c2a807fd1d79da209b180d0b767ad6cebd 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -60,9 +60,9 @@ class DefaultType extends \Magento\Object /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Checkout session @@ -75,17 +75,17 @@ class DefaultType extends \Magento\Object * Construct * * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $data = array() ) { $this->_checkoutSession = $checkoutSession; parent::__construct($data); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -208,7 +208,7 @@ class DefaultType extends \Magento\Object */ public function getConfigData($key) { - return $this->_coreStoreConfig->getConfig('catalog/custom_options/' . $key); + return $this->_scopeConfig->getValue('catalog/custom_options/' . $key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index e327c3609be7217cde29b566765823a5ae8b6070..cbe1f6ad0742fdde419e4c8fe1672f66e9f1495c 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -116,7 +116,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory * @param \Magento\Catalog\Model\Product\Option\UrlBuilder $urlBuilder * @param \Magento\Escaper $escaper @@ -127,7 +127,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, \Magento\Catalog\Model\Product\Option\UrlBuilder $urlBuilder, \Magento\Escaper $escaper, @@ -145,7 +145,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $this->_mediaDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_fileSize = $fileSize; $this->_data = $data; - parent::__construct($checkoutSession, $coreStoreConfig, $data); + parent::__construct($checkoutSession, $scopeConfig, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index e239ae4acc1da7cfb89f77251f22811144c6fcef..c0211c1fb064a68c52d216c7395bad8e83641da2 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -51,21 +51,21 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Stdlib\String $string * @param \Magento\Escaper $escaper * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Stdlib\String $string, \Magento\Escaper $escaper, array $data = array() ) { $this->string = $string; $this->_escaper = $escaper; - parent::__construct($checkoutSession, $coreStoreConfig, $data); + parent::__construct($checkoutSession, $scopeConfig, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index 2ef030b0f46084318f80a883476647cfd2e5b6ee..c1941fc397d4fd35c4b48162139a8e9f34658f86 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -46,21 +46,21 @@ class Text extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Escaper $escaper * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Escaper $escaper, \Magento\Stdlib\String $string, array $data = array() ) { $this->_escaper = $escaper; $this->string = $string; - parent::__construct($checkoutSession, $coreStoreConfig, $data); + parent::__construct($checkoutSession, $scopeConfig, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Product/ReservedAttributeList.php b/app/code/Magento/Catalog/Model/Product/ReservedAttributeList.php new file mode 100644 index 0000000000000000000000000000000000000000..811339e0813e98c192b0d0559def0185033c5aac --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/ReservedAttributeList.php @@ -0,0 +1,64 @@ +<?php +/** + * Reserved product attribute list + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product; + +class ReservedAttributeList +{ + /** + * @var string[] + */ + protected $_reservedAttributes; + + /** + * @param string $productModel + * @param array $reservedAttributes + * @param array $allowedAttributes + */ + public function __construct($productModel, array $reservedAttributes = array(), array $allowedAttributes = array()) + { + $methods = get_class_methods($productModel); + foreach ($methods as $method) { + if (preg_match('/^get([A-Z]{1}.+)/', $method, $matches)) { + $method = $matches[1]; + $tmp = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $method)); + $reservedAttributes[] = $tmp; + } + } + $this->_reservedAttributes = array_diff($reservedAttributes, $allowedAttributes); + } + + /** + * Check whether attribute reserved or not + * + * @param \Magento\Catalog\Model\Entity\Attribute $attribute + * @return boolean + */ + public function isReservedAttribute($attribute) + { + return $attribute->getIsUserDefined() && in_array($attribute->getAttributeCode(), $this->_reservedAttributes); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 1e19df3bfa6578ae359d4bbd92e163755d3d9290..9b4a2518030ba9d6a9cdea68497e62423dfa312d 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -894,7 +894,7 @@ abstract class AbstractType * Retrieve store filter for associated products * * @param \Magento\Catalog\Model\Product $product - * @return int|\Magento\Core\Model\Store + * @return int|\Magento\Store\Model\Store */ public function getStoreFilter($product) { @@ -905,7 +905,7 @@ abstract class AbstractType /** * Set store filter for associated products * - * @param $store int|\Magento\Core\Model\Store + * @param $store int|\Magento\Store\Model\Store * @param \Magento\Catalog\Model\Product $product * @return $this */ diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 5965d59c7b417a474baf2e1833dc7b735d154c59..a87d9712fa669c673312783623d2ed3ee546bddf 100755 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -34,7 +34,7 @@ namespace Magento\Catalog\Model\Product\Type; use Magento\Catalog\Model\Product; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; class Price { @@ -67,7 +67,7 @@ class Price /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -82,14 +82,14 @@ class Price * Construct * * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Event\ManagerInterface $eventManager */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Event\ManagerInterface $eventManager diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 450bb15e7d051fba0f3af48cfd8c250ec5a93c13..b63b315197a8210c94bfc4890cc2fd90a4d44cfa 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -67,7 +67,7 @@ class Url extends \Magento\Object /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -81,7 +81,7 @@ class Url extends \Magento\Object * * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Filter\FilterManager $filter * @param \Magento\Session\SidResolverInterface $sidResolver @@ -90,7 +90,7 @@ class Url extends \Magento\Object public function __construct( \Magento\UrlRewrite\Model\UrlRewriteFactory $urlRewriteFactory, \Magento\UrlInterface $url, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Filter\FilterManager $filter, \Magento\Session\SidResolverInterface $sidResolver, diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php b/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php index 0155df4a6f508bb3e1193e1789894467ab7e370c..2d472891271b9489c3a26faddb9a51cd3225ee33 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config/Converter.php @@ -53,6 +53,7 @@ class Converter implements \Magento\Config\ConverterInterface $data['index_priority'] = (int)$this->_getAttributeValue($typeNode, 'indexPriority', 0); $data['can_use_qty_decimals'] = !empty($isDecimal) && 'false' !== $isDecimal; $data['is_qty'] = !empty($isQty) && 'false' !== $isQty; + $data['sort_order'] = (int)$this->_getAttributeValue($typeNode, 'sortOrder', 0); /** @var $childNode \DOMNode */ foreach ($typeNode->childNodes as $childNode) { diff --git a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php index 4485dc868b3f20bac964f537731b207b39696b37..bea13f09562abec4332da6b469d926e96377319f 100644 --- a/app/code/Magento/Catalog/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Catalog/Model/Resource/AbstractResource.php @@ -44,7 +44,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -64,7 +64,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Factory $modelFactory * @param array $data */ @@ -75,7 +75,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity \Magento\Locale\FormatInterface $localeFormat, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Factory $modelFactory, $data = array() ) { @@ -101,7 +101,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity */ public function getDefaultStoreId() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } /** @@ -572,7 +572,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity * * @param int $entityId * @param int|string|array $attribute atrribute's ids or codes - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @return bool|string|array */ public function getAttributeRawValue($entityId, $attribute, $store) @@ -627,7 +627,7 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity /** * Collecting typed attributes, performing separate SQL query for each attribute type table */ - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $store = $store->getId(); } diff --git a/app/code/Magento/Catalog/Model/Resource/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Attribute.php index 173d6d46c2e7d663ae11f8b0e6f342e650a621ba..4fdf611c8274a608d0a091b41f9c0bedf9f0bb63 100644 --- a/app/code/Magento/Catalog/Model/Resource/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Attribute.php @@ -50,14 +50,14 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Entity\Type $eavEntityType * @param \Magento\Eav\Model\Config $eavConfig * @param LockValidatorInterface $lockValidator */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Entity\Type $eavEntityType, \Magento\Eav\Model\Config $eavConfig, LockValidatorInterface $lockValidator diff --git a/app/code/Magento/Catalog/Model/Resource/Category.php b/app/code/Magento/Catalog/Model/Resource/Category.php index 7c90160337102c23c51c1b509595da20e426316f..39796dd0929c125cfe722de8e3514a1cd8929de8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category.php +++ b/app/code/Magento/Catalog/Model/Resource/Category.php @@ -94,7 +94,7 @@ class Category extends AbstractResource * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Factory $modelFactory * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory @@ -110,7 +110,7 @@ class Category extends AbstractResource \Magento\Locale\FormatInterface $localeFormat, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Factory $modelFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory, @@ -836,7 +836,7 @@ class Category extends AbstractResource public function isForbiddenToDelete($categoryId) { $select = $this->_getReadAdapter()->select()->from( - $this->getTable('core_store_group'), + $this->getTable('store_group'), array('group_id') )->where( 'root_category_id = :root_category_id' diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php index c6fdfd75b3eab3a09291d0ba93443e7a0fe60b16..42f021948d7efd386c48ffcb073a1f704c640e74 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Frontend/Image.php @@ -39,16 +39,16 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFronten /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Construct * - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Collection.php index 0f2de5ec632ebaf9f3218240fcd6369468cf535e..e14f7b954a7da5e6b0a233a6495cac12fd56b7f1 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Collection.php @@ -172,7 +172,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl public function getProductStoreId() { if (is_null($this->_productStoreId)) { - $this->_productStoreId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $this->_productStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } return $this->_productStoreId; } diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index 93d6f6c08c7cc686e9998de969116dcad102468e..7ee17fbeca5b18742034ef80643a62bb01873239 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -75,7 +75,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -97,7 +97,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Event\ManagerInterface $eventManager */ @@ -105,7 +105,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource \Magento\App\Resource $resource, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Config $catalogConfig, \Magento\Event\ManagerInterface $eventManager ) { @@ -168,7 +168,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource * @param integer $storeId * @return string */ - public function getMainStoreTable($storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID) + public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID) { if (is_string($storeId)) { $storeId = intval($storeId); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php index 01fffa83ae84e24402cc9b824190ac7f2b6ee7d8..c4199ae4c71fd5fd058c9e80ee28b0da55f76510 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php @@ -58,7 +58,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -67,7 +67,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -76,7 +76,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php index 684b3314f07a30bb247febc6868a2ad3faa02b58..6edf7b8191fe056971bbf1342309c6ad767fe622 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php @@ -91,7 +91,7 @@ class Tree extends \Magento\Data\Tree\Dbp /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -114,7 +114,7 @@ class Tree extends \Magento\Data\Tree\Dbp * * @param \Magento\Catalog\Model\Resource\Category $catalogCategory * @param \Magento\App\CacheInterface $cache - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Resource $resource * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig @@ -123,7 +123,7 @@ class Tree extends \Magento\Data\Tree\Dbp public function __construct( \Magento\Catalog\Model\Resource\Category $catalogCategory, \Magento\App\CacheInterface $cache, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\Resource $resource, \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Attribute\Config $attributeConfig, @@ -645,7 +645,7 @@ class Tree extends \Magento\Data\Tree\Dbp ' AND %1$s.entity_type_id=e.entity_type_id AND %1$s.store_id=%3$d', $tableDefault, $attribute->getId(), - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ), array($attributeCode => 'value') )->joinLeft( diff --git a/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php index 0e9174997860a8cabb919ea7636d75014b6adbb5..b361dc0a5a54c99711dea7452039d5fe0e6ade66 100644 --- a/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Catalog/Model/Resource/Collection/AbstractCollection.php @@ -45,7 +45,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -59,7 +59,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -74,7 +74,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null ) { $this->_storeManager = $storeManager; @@ -95,7 +95,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo /** * Set store scope * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return $this */ public function setStore($store) @@ -107,12 +107,12 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo /** * Set store scope * - * @param int|string|\Magento\Core\Model\Store $storeId + * @param int|string|\Magento\Store\Model\Store $storeId * @return $this */ public function setStoreId($storeId) { - if ($storeId instanceof \Magento\Core\Model\Store) { + if ($storeId instanceof \Magento\Store\Model\Store) { $storeId = $storeId->getId(); } $this->_storeId = (int)$storeId; @@ -139,7 +139,7 @@ class AbstractCollection extends \Magento\Eav\Model\Entity\Collection\AbstractCo */ public function getDefaultStoreId() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + return \Magento\Store\Model\Store::DEFAULT_STORE_ID; } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Config.php b/app/code/Magento/Catalog/Model/Resource/Config.php index d8ebeaf670b97957463c731c453cd66bca93fbf9..7e18d0a53ee44dbac24e02098ae2343d032d43fb 100644 --- a/app/code/Magento/Catalog/Model/Resource/Config.php +++ b/app/code/Magento/Catalog/Model/Resource/Config.php @@ -58,18 +58,18 @@ class Config extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php index 69d86627aede42155fb723891094a7e7e026c3b1..f14cf4a2fb046004d1d94b0ae1a680dd49034c0d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php @@ -132,11 +132,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory + * @param \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList * @param \Magento\Locale\ResolverInterface $localeResolver * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor @@ -152,11 +152,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Catalog\Model\ProductFactory $catalogProductFactory, + \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Locale\ResolverInterface $localeResolver, \Magento\Index\Model\Indexer $indexIndexer, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, @@ -180,7 +180,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute $resourceHelper, $universalFactory, $localeDate, - $catalogProductFactory, + $reservedAttributeList, $localeResolver, $resource, $resourceCollection, diff --git a/app/code/Magento/Catalog/Model/Resource/Product.php b/app/code/Magento/Catalog/Model/Resource/Product.php index 60c87c60ac5893eb3766f7528180b4034ff99b0d..f8ea5c475eff15dfc9f9f59e2d8402be155746d6 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Product.php @@ -69,7 +69,7 @@ class Product extends AbstractResource * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Factory $modelFactory * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory * @param Category $catalogCategory @@ -84,7 +84,7 @@ class Product extends AbstractResource \Magento\Locale\FormatInterface $localeFormat, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Factory $modelFactory, \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory, Category $catalogCategory, diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index 7296897d6fad3fac1757049949d9222ccb9c5924..0353f9c5bc46aac2504782d1b83fe12a84570a93 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Resource\Product; use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** @@ -218,9 +218,9 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Customer session @@ -270,10 +270,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -293,10 +293,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -306,7 +306,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl ) { $this->_catalogData = $catalogData; $this->_catalogProductFlatState = $catalogProductFlatState; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_productOptionFactory = $productOptionFactory; $this->_catalogUrl = $catalogUrl; $this->_localeDate = $localeDate; @@ -582,7 +582,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl * Add attribute to entities in collection * If $attribute=='*' select all attributes * - * @param array|string|integer|\Magento\Core\Model\Config\Element $attribute + * @param array|string|integer|\Magento\App\Config\Element $attribute * @param bool|string $joinType * @return $this */ @@ -718,7 +718,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $select = $this->getConnection()->select()->from( array('product_website' => $this->_productWebsiteTable) )->join( - array('website' => $this->getResource()->getTable('core_website')), + array('website' => $this->getResource()->getTable('store_website')), 'website.website_id = product_website.website_id', array('name') )->where( @@ -842,8 +842,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $attributeCode = $attribute->getAttributeCode(); $tableAlias = $attributeCode . '_max_value'; $fieldAlias = 'max_' . $attributeCode; - $condition = 'e.entity_id = ' . $tableAlias . '.entity_id - AND ' . $this->_getConditionSql($tableAlias . '.attribute_id', $attribute->getId()); + $condition = 'e.entity_id = ' . $tableAlias . '.entity_id AND ' . $this->_getConditionSql( + $tableAlias . '.attribute_id', + $attribute->getId() + ); $select->join( array($tableAlias => $attribute->getBackend()->getTable()), @@ -875,8 +877,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $attributeCode = $attribute->getAttributeCode(); $tableAlias = $attributeCode . '_range_count_value'; - $condition = 'e.entity_id = ' . $tableAlias . '.entity_id - AND ' . $this->_getConditionSql($tableAlias . '.attribute_id', $attribute->getId()); + $condition = 'e.entity_id = ' . $tableAlias . '.entity_id AND ' . $this->_getConditionSql( + $tableAlias . '.attribute_id', + $attribute->getId() + ); $select->reset(\Zend_Db_Select::GROUP); $select->join( @@ -1241,8 +1245,9 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl public function addUrlRewrite($categoryId = '') { $this->_addUrlRewrite = true; - $useCategoryUrl = $this->_coreStoreConfig->getConfig( + $useCategoryUrl = $this->_scopeConfig->getValue( \Magento\Catalog\Helper\Product::XML_PATH_PRODUCT_URL_USE_CATEGORY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStoreId() ); if ($useCategoryUrl) { @@ -1743,14 +1748,14 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $fromPart = $this->getSelect()->getPart(\Zend_Db_Select::FROM); if (!isset($fromPart['store_index'])) { $this->getSelect()->joinLeft( - array('store_index' => $this->getTable('core_store')), + array('store_index' => $this->getTable('store')), 'store_index.store_id = ' . $filters['store_table'] . '.store_id', array() ); } if (!isset($fromPart['store_group_index'])) { $this->getSelect()->joinLeft( - array('store_group_index' => $this->getTable('core_store_group')), + array('store_group_index' => $this->getTable('store_group')), 'store_index.group_id = store_group_index.group_id', array() ); @@ -1864,7 +1869,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl //Clean duplicated fields $this->_resourceHelper->prepareColumnsList($select); - return $this; } @@ -2004,7 +2008,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl } } - foreach ($this->getItems() as $item) { $productId = $item->getId(); if (isset($categoryIds[$productId])) { @@ -2043,8 +2046,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl $attribute = $this->getAttribute('tier_price'); if ($attribute->isScopeGlobal()) { $websiteId = 0; - } else if ($this->getStoreId()) { - $websiteId = $this->_storeManager->getStore($this->getStoreId())->getWebsiteId(); + } else { + if ($this->getStoreId()) { + $websiteId = $this->_storeManager->getStore($this->getStoreId())->getWebsiteId(); + } } $adapter = $this->getConnection(); @@ -2079,8 +2084,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl 'cust_group' => $row['all_groups'] ? CustomerGroupServiceInterface::CUST_GROUP_ALL : $row['cust_group'], 'price_qty' => $row['price_qty'], 'price' => $row['price'], - 'website_price' => $row['price'], - + 'website_price' => $row['price'] ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php index 0fbc00133abda96679b4db639ba66f3b655d921c..03df6e6f556148f8349b2f76093bad70b92f8bb3 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php @@ -80,10 +80,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -105,10 +105,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -133,7 +133,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php index c6ec3435ecfb955c904fb88a33d9bf1a3dafaa42..76210c7377570ef2fbccff4bb9fcf70423cece10 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Resource\Product; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * Catalog Product Flat resource model @@ -53,18 +53,18 @@ class Flat extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Config $catalogConfig */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Config $catalogConfig ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php index 1145f67f12ce8101b86a2d7d5b2d05d0265e5337..a904f3c7e9fbe4daf3f325b29aa0989389d6c43e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/AbstractIndexer.php @@ -143,15 +143,15 @@ abstract class AbstractIndexer extends \Magento\Index\Model\Resource\AbstractRes $joinCondition = 'cw.website_id = ' . $joinCondition; } - $select->join(array('cw' => $this->getTable('core_website')), $joinCondition, array()); + $select->join(array('cw' => $this->getTable('store_website')), $joinCondition, array()); if ($store) { $select->join( - array('csg' => $this->getTable('core_store_group')), + array('csg' => $this->getTable('store_group')), 'csg.group_id = cw.default_group_id', array() )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), 'cs.store_id = csg.default_store_id', array() ); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php index 36f87930d2d93e21424c8ea8cf9e8e8b6c59346e..53b201e90c6d9e25df2ecfff037f3743ae8e8f53 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/AbstractEav.php @@ -208,7 +208,7 @@ abstract class AbstractEav extends \Magento\Catalog\Model\Resource\Product\Index array('l' => $this->getTable('catalog_product_relation')), 'parent_id' )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), '', array() )->join( diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Decimal.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Decimal.php index 3b97cf1abdc5ad322211732161ad378879ae9326..cb023e2d0fa0fe859317172955f34d015877b9d5 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Decimal.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Decimal.php @@ -71,7 +71,7 @@ class Decimal extends AbstractEav array('pdd' => $this->getTable('catalog_product_entity_decimal')), array('entity_id', 'attribute_id') )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), '', array('store_id') )->joinLeft( @@ -80,10 +80,10 @@ class Decimal extends AbstractEav array('value' => $productValueExpression) )->where( 'pdd.store_id=?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->where( 'cs.store_id!=?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->where( 'pdd.attribute_id IN(?)', $attrIds diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php index f62396e5c2778f5958e8bf3b684827b002e181ec..08e6de301426bed36dd159f5cbaef48ab8e9115d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav/Source.php @@ -138,7 +138,7 @@ class Source extends AbstractEav /**@var $subSelect \Magento\DB\Select*/ $subSelect = $adapter->select()->from( - array('s' => $this->getTable('core_store')), + array('s' => $this->getTable('store')), array('store_id', 'website_id') )->joinLeft( array('d' => $this->getTable('catalog_product_entity_int')), @@ -235,7 +235,7 @@ class Source extends AbstractEav array('pvd' => $this->getTable('catalog_product_entity_varchar')), array('entity_id', 'attribute_id') )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), '', array('store_id') )->joinLeft( @@ -244,10 +244,10 @@ class Source extends AbstractEav array('value' => $productValueExpression) )->where( 'pvd.store_id=?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->where( 'cs.store_id!=?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->where( 'pvd.attribute_id IN(?)', $attrIds diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php index 7f096acda652c7a2dc1bbabcb5630706faf0156f..67c27dbf38323cfef526dabed4b13252cf0bbf5c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php @@ -229,7 +229,7 @@ class DefaultPrice extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr '', array('customer_group_id') )->join( - array('cw' => $this->getTable('core_website')), + array('cw' => $this->getTable('store_website')), '', array('website_id') )->join( @@ -237,11 +237,11 @@ class DefaultPrice extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr 'cw.website_id = cwd.website_id', array() )->join( - array('csg' => $this->getTable('core_store_group')), + array('csg' => $this->getTable('store_group')), 'csg.website_id = cw.website_id AND cw.default_group_id = csg.group_id', array() )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), 'csg.default_store_id = cs.store_id AND cs.store_id != 0', array() )->join( @@ -417,15 +417,15 @@ class DefaultPrice extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr array('i' => $this->_getDefaultFinalPriceTable()), array('entity_id', 'customer_group_id', 'website_id') )->join( - array('cw' => $this->getTable('core_website')), + array('cw' => $this->getTable('store_website')), 'cw.website_id = i.website_id', array() )->join( - array('csg' => $this->getTable('core_store_group')), + array('csg' => $this->getTable('store_group')), 'csg.group_id = cw.default_group_id', array() )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), 'cs.store_id = csg.default_store_id', array() )->join( @@ -491,15 +491,15 @@ class DefaultPrice extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr array('i' => $this->_getDefaultFinalPriceTable()), array('entity_id', 'customer_group_id', 'website_id') )->join( - array('cw' => $this->getTable('core_website')), + array('cw' => $this->getTable('store_website')), 'cw.website_id = i.website_id', array() )->join( - array('csg' => $this->getTable('core_store_group')), + array('csg' => $this->getTable('store_group')), 'csg.group_id = cw.default_group_id', array() )->join( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), 'cs.store_id = csg.default_store_id', array() )->join( diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index a43c43a9df61d29a3b8214232be602014f458753..706394823712e35881f1f60862d4ee17e08e9c2c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -37,7 +37,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -51,7 +51,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb /** * Core config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -60,14 +60,14 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb * * @param \Magento\App\Resource $resource * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\Resource $resource, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; @@ -133,7 +133,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb $object->getId() )->where( 'store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $optionId = $readAdapter->fetchOne($statement); @@ -151,7 +151,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb $data, array( 'option_id = ?' => $object->getId(), - 'store_id = ?' => \Magento\Core\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ); } @@ -160,7 +160,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb new \Magento\Object( array( 'option_id' => $object->getId(), - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'price' => $object->getPrice(), 'price_type' => $object->getPriceType() ) @@ -171,9 +171,12 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb } } - $scope = (int)$this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); + $scope = (int)$this->_config->getValue( + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); - if ($object->getStoreId() != '0' && $scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE) { + if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { $baseCurrency = $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, @@ -233,7 +236,8 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb } } } - } elseif ($scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { + } elseif ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price') + ) { $writeAdapter->delete( $priceTable, array('option_id = ?' => $object->getId(), 'store_id = ?' => $object->getStoreId()) @@ -265,7 +269,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb $object->getId() )->where( 'store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); if ($readAdapter->fetchOne($statement)) { @@ -280,7 +284,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb $data, array( 'option_id = ?' => $object->getId(), - 'store_id = ?' => \Magento\Core\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ); } @@ -289,7 +293,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb new \Magento\Object( array( 'option_id' => $object->getId(), - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'title' => $object->getTitle() ) ), @@ -485,7 +489,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb ' AND ', array( 'option_title_default.option_id=product_option.option_id', - $adapter->quoteInto('option_title_default.store_id = ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID) + $adapter->quoteInto('option_title_default.store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID) ) ); @@ -523,7 +527,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb ' AND ', array( 'option_title_default.option_type_id=option_type.option_type_id', - $adapter->quoteInto('option_title_default.store_id = ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID) + $adapter->quoteInto('option_title_default.store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID) ) ); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php index 8662843eed807745091776dbbbf4fb6fb92ec5ad..84eda994c6601e9ff8ac367a5fa1671236f94ec7 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php @@ -35,7 +35,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -52,7 +52,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -62,7 +62,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -123,7 +123,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio array('store_title' => 'title', 'title' => $titleExpr) )->where( 'default_option_title.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); return $this; @@ -154,7 +154,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio array('default_option_price' => $productOptionPriceTable), 'default_option_price.option_id = main_table.option_id AND ' . $adapter->quoteInto( 'default_option_price.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ), array('default_price' => 'price', 'default_price_type' => 'price_type') )->joinLeft( diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php index fbb6d6b259d61facfdd069d83c01040a362ddd0b..490ffc219cafd55fe2b6dcaa5bbd866a3e5245f3 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php @@ -37,7 +37,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -51,7 +51,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb /** * Core config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -60,14 +60,14 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb * * @param \Magento\App\Resource $resource * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\Resource $resource, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; @@ -123,7 +123,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb (int)$object->getId() )->where( 'store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $optionTypeId = $this->_getReadAdapter()->fetchOne($select); @@ -132,7 +132,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb $bind = array('price' => $price, 'price_type' => $priceType); $where = array( 'option_type_id = ?' => $optionTypeId, - 'store_id = ?' => \Magento\Core\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $this->_getWriteAdapter()->update($priceTable, $bind, $where); @@ -140,7 +140,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb } else { $bind = array( 'option_type_id' => (int)$object->getId(), - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'price' => $price, 'price_type' => $priceType ); @@ -148,9 +148,12 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb } } - $scope = (int)$this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); + $scope = (int)$this->_config->getValue( + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); - if ($object->getStoreId() != '0' && $scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE) { + if ($object->getStoreId() != '0' && $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { $baseCurrency = $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, @@ -203,12 +206,14 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb } } } - } else if ($scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { - $where = array( - 'option_type_id = ?' => (int)$object->getId(), - 'store_id = ?' => (int)$object->getStoreId() - ); - $this->_getWriteAdapter()->delete($priceTable, $where); + } else { + if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE && $object->getData('scope', 'price')) { + $where = array( + 'option_type_id = ?' => (int)$object->getId(), + 'store_id = ?' => (int)$object->getStoreId() + ); + $this->_getWriteAdapter()->delete($priceTable, $where); + } } } @@ -231,7 +236,7 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb (int)$object->getId() )->where( 'store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $optionTypeId = $this->_getReadAdapter()->fetchOne($select); @@ -239,15 +244,16 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb if ($object->getStoreId() == '0') { $where = array( 'option_type_id = ?' => (int)$optionTypeId, - 'store_id = ?' => \Magento\Core\Model\Store::DEFAULT_STORE_ID + 'store_id = ?' => \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $bind = array('title' => $object->getTitle()); + $bind = array('title' => $object->getTitle()); $this->_getWriteAdapter()->update($titleTable, $bind, $where); } } else { $bind = array( 'option_type_id' => (int)$object->getId(), - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'title' => $object->getTitle() ); $this->_getWriteAdapter()->insert($titleTable, $bind); @@ -282,12 +288,14 @@ class Value extends \Magento\Model\Resource\Db\AbstractDb ); $this->_getWriteAdapter()->insert($titleTable, $bind); } - } else if ($object->getData('scope', 'title')) { - $where = array( - 'option_type_id = ?' => (int)$object->getId(), - 'store_id = ?' => (int)$object->getStoreId() - ); - $this->_getWriteAdapter()->delete($titleTable, $where); + } else { + if ($object->getData('scope', 'title')) { + $where = array( + 'option_type_id = ?' => (int)$object->getId(), + 'store_id = ?' => (int)$object->getStoreId() + ); + $this->_getWriteAdapter()->delete($titleTable, $where); + } } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php index a540942437eda0abe1dc43648f66a78def260975..7af0203394e41a68573f5e4425074570f8e9d16c 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php @@ -87,13 +87,15 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio 'store_value_title.title' ); $joinExprDefaultPrice = 'default_value_price.option_type_id = main_table.option_type_id AND ' . - $adapter->quoteInto('default_value_price.store_id = ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $adapter->quoteInto('default_value_price.store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); $joinExprStorePrice = 'store_value_price.option_type_id = main_table.option_type_id AND ' . $adapter->quoteInto('store_value_price.store_id = ?', $storeId); - $joinExprTitle = 'store_value_title.option_type_id = main_table.option_type_id AND ' . - $adapter->quoteInto('store_value_title.store_id = ?', $storeId); + $joinExprTitle = 'store_value_title.option_type_id = main_table.option_type_id AND ' . $adapter->quoteInto( + 'store_value_title.store_id = ?', + $storeId + ); $this->getSelect()->joinLeft( array('default_value_price' => $optionTypePriceTable), @@ -118,7 +120,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio array('store_title' => 'title', 'title' => $titleExpr) )->where( 'default_value_title.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); return $this; @@ -151,7 +153,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio array('store_title' => 'title', 'title' => $titleExpr) )->where( 'default_value_title.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); return $this; @@ -178,8 +180,10 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio ); $joinExprDefault = 'default_value_price.option_type_id = main_table.option_type_id AND ' . - $this->getConnection() - ->quoteInto('default_value_price.store_id = ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $this->getConnection()->quoteInto( + 'default_value_price.store_id = ?', + \Magento\Store\Model\Store::DEFAULT_STORE_ID + ); $joinExprStore = 'store_value_price.option_type_id = main_table.option_type_id AND ' . $this->getConnection()->quoteInto('store_value_price.store_id = ?', $storeId); $this->getSelect()->joinLeft( diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Website.php b/app/code/Magento/Catalog/Model/Resource/Product/Website.php index e126fb05668cbcf92eec948ffa20a80ede0dba8d..4d7a06a99a05499388971e5a91f5440ff10f5a9d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Website.php @@ -31,17 +31,17 @@ class Website extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; parent::__construct($resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index ee8119a9346bb8c66be8cc31e9c94b3c26ed4a43..b55e39064d4b610f06116eecb9748163dd3bf076 100644 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -68,7 +68,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Index\Model\IndexerFactory $indexerFactory, \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory, $moduleName = 'Magento_Catalog', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_categoryFactory = $categoryFactory; $this->_indexerFactory = $indexerFactory; @@ -94,17 +94,6 @@ class Setup extends \Magento\Eav\Model\Entity\Setup return $this->_categoryFactory->create($data); } - /** - * Creates setup migration model - * - * @param array $data - * @return \Magento\Core\Model\Resource\Setup\Migration - */ - public function createSetupMigration($data = array()) - { - return $this->_migrationFactory->create($data); - } - /** * Creates eav attribute resource model * diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index 71b468b41de1fe262622cb4f73ab28391ecbd62d..3a166f31e9914b8beed2355a38c3cd34bff1ee45 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -98,7 +98,7 @@ class Url extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -109,7 +109,7 @@ class Url extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * @param Product $productResource * @param \Magento\Catalog\Model\Category $catalogCategory @@ -117,7 +117,7 @@ class Url extends \Magento\Model\Resource\Db\AbstractDb */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, Product $productResource, \Magento\Catalog\Model\Category $catalogCategory, @@ -145,7 +145,7 @@ class Url extends \Magento\Model\Resource\Db\AbstractDb * Retrieve stores array or store model * * @param int $storeId - * @return \Magento\Core\Model\Store|\Magento\Core\Model\Store[] + * @return \Magento\Store\Model\Store|\Magento\Store\Model\Store[] */ public function getStores($storeId = null) { @@ -777,21 +777,21 @@ class Url extends \Magento\Model\Resource\Db\AbstractDb /** * Prepare stores root categories * - * @param \Magento\Core\Model\Store[] $stores - * @return \Magento\Core\Model\Store[] + * @param \Magento\Store\Model\Store[] $stores + * @return \Magento\Store\Model\Store[] */ protected function _prepareStoreRootCategories($stores) { $rootCategoryIds = array(); foreach ($stores as $store) { - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $rootCategoryIds[$store->getRootCategoryId()] = $store->getRootCategoryId(); } if ($rootCategoryIds) { $categories = $this->_getCategories($rootCategoryIds); } foreach ($stores as $store) { - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $rootCategoryId = $store->getRootCategoryId(); if (isset($categories[$rootCategoryId])) { $store->setRootCategoryPath($categories[$rootCategoryId]->getPath()); diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index e1f976875b9e12bcbc8eefa2d0ede9e9c3643899..00f25acfdad5b9bd10dab8b5244a2be7f35d7a35 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -29,7 +29,7 @@ */ namespace Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite; -class Suffix extends \Magento\Core\Model\Config\Value +class Suffix extends \Magento\App\Config\Value { /** * Core url rewrite @@ -41,8 +41,7 @@ class Suffix extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\UrlRewrite\Helper\UrlRewrite $coreUrlRewrite * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -51,15 +50,14 @@ class Suffix extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\UrlRewrite\Helper\UrlRewrite $coreUrlRewrite, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_coreUrlRewrite = $coreUrlRewrite; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index 2a12cdcf4404f6a9e4d9a523c62460b9cde1c5e3..914423b9c4d30a0b5a3a37f1526bf7c1d444ddab 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -59,19 +59,19 @@ class Filter extends \Magento\Filter\Template /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\Url $viewUrl * @param array $variables */ public function __construct( \Magento\Stdlib\String $string, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\Url $viewUrl, $variables = array() ) { diff --git a/app/code/Magento/Catalog/Model/Url.php b/app/code/Magento/Catalog/Model/Url.php index c489a597cd1232850d31d1551313515379832180..ce55ca67c6d5e469eb1f28d9879982198e1c9819 100644 --- a/app/code/Magento/Catalog/Model/Url.php +++ b/app/code/Magento/Catalog/Model/Url.php @@ -212,7 +212,7 @@ class Url * Retrieve stores array or store model * * @param int $storeId - * @return \Magento\Core\Model\Store|\Magento\Core\Model\Store[] + * @return \Magento\Store\Model\Store|\Magento\Store\Model\Store[] */ public function getStores($storeId = null) { diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php index 5cb8c4d507f00f94d6d7e6eb5ed52d524e4e191f..56833289649844a18af086cf0a2297cbf8ec7e73 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php @@ -66,7 +66,13 @@ $installer->createCategory()->setStoreId( true )->save(); -$installer->setConfigData(\Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, $category->getId()); +$data = array( + 'scope' => 'default', + 'scope_id' => 0, + 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, + 'value' => $category->getId() +); +$installer->getConnection()->insertOnDuplicate($installer->getTable('core_config_data'), $data, array('value')); $installer->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php index 9cc5d61bbf4b27cd89714aff997507f61ad65328..6219f336d87dd62581fd5327af28cd2577d23d3c 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php @@ -26,16 +26,16 @@ /** @var $this \Magento\Catalog\Model\Resource\Setup */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->createSetupMigration(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $attributeData = $this->getAttribute('catalog_category', 'custom_layout_update'); $installer->appendClassAliasReplace( 'catalog_category_entity_text', 'value', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, array('value_id'), 'attribute_id = ' . (int)$attributeData['attribute_id'] ); @@ -44,8 +44,8 @@ $attributeData = $this->getAttribute('catalog_product', 'custom_layout_update'); $installer->appendClassAliasReplace( 'catalog_product_entity_text', 'value', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, array('value_id'), 'attribute_id = ' . (int)$attributeData['attribute_id'] ); @@ -53,8 +53,8 @@ $installer->appendClassAliasReplace( $installer->appendClassAliasReplace( 'catalog_eav_attribute', 'frontend_input_renderer', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->doUpdateClassAliases(); diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index f0574227d63e18edb198e0a3ddb9be40db65335d..971c7021b9ce61e02a9437b9ac13dcb905a0f330 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -156,15 +156,15 @@ <argument name="flatIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument> </arguments> </type> - <type name="Magento\Core\Model\Resource\Website"> + <type name="Magento\Store\Model\Resource\Website"> <plugin name="priceIndexerOnWebsiteDelete" type="Magento\Catalog\Model\Indexer\Product\Price\Plugin\Website"/> </type> - <type name="Magento\Core\Model\Resource\Store"> + <type name="Magento\Store\Model\Resource\Store"> <plugin name="storeViewResourceAroundSave" type="Magento\Catalog\Model\Indexer\Category\Flat\Plugin\StoreView"/> <plugin name="catalogProductFlatIndexerStore" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\Store" /> <plugin name="categoryStoreAroundSave" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreView"/> </type> - <type name="Magento\Core\Model\Resource\Store\Group"> + <type name="Magento\Store\Model\Resource\Group"> <plugin name="storeGroupResourceAroundSave" type="Magento\Catalog\Model\Indexer\Category\Flat\Plugin\StoreGroup"/> <plugin name="catalogProductFlatIndexerStoreGroup" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\StoreGroup" /> <plugin name="categoryStoreGroupAroundSave" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup"/> @@ -319,4 +319,17 @@ </argument> </arguments> </type> + <type name="Magento\Catalog\Model\Product\ReservedAttributeList"> + <arguments> + <argument name="productModel" xsi:type="string">\Magento\Catalog\Model\Product</argument> + <argument name="reservedAttributes" xsi:type="array"> + <item name="position" xsi:type="string">position</item> + </argument> + <argument name="allowedAttributes" xsi:type="array"> + <item name="type_id" xsi:type="string">type_id</item> + <item name="calculated_final_price" xsi:type="string">calculated_final_price</item> + <item name="request_path" xsi:type="string">request_path</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 0c029453dbc5bb60eb2e14aca314b460a01ffbd2..cd92984b58261e794e41043fd9334cb5e3a4c127 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Customer"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Eav"/> <module name="Magento_Cms"/> <module name="Magento_Index"/> diff --git a/app/code/Magento/Catalog/etc/product_types.xml b/app/code/Magento/Catalog/etc/product_types.xml index 9302e23fbcda5b6211cceaf5ffb94db7a8b2a3ac..835c6df964448d038473b7027a80b961c10570e6 100644 --- a/app/code/Magento/Catalog/etc/product_types.xml +++ b/app/code/Magento/Catalog/etc/product_types.xml @@ -24,12 +24,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Catalog/etc/product_types.xsd"> - <type name="simple" label="Simple Product" modelInstance="Magento\Catalog\Model\Product\Type\Simple" indexPriority="10"> + <type name="simple" label="Simple Product" modelInstance="Magento\Catalog\Model\Product\Type\Simple" indexPriority="10" sortOrder="10"> <customAttributes> <attribute name="refundable" value="true"/> </customAttributes> </type> - <type name="virtual" label="Virtual Product" modelInstance="Magento\Catalog\Model\Product\Type\Virtual" indexPriority="20"> + <type name="virtual" label="Virtual Product" modelInstance="Magento\Catalog\Model\Product\Type\Virtual" indexPriority="20" sortOrder="40"> <customAttributes> <attribute name="is_real_product" value="false"/> <attribute name="refundable" value="false"/> diff --git a/app/code/Magento/Catalog/etc/product_types.xsd b/app/code/Magento/Catalog/etc/product_types.xsd index 6f5a6adc8c02428235a0e152ebf10678ac506e9f..7c32b4dd22470c9bee1ed5e090de6d6f035dd243 100644 --- a/app/code/Magento/Catalog/etc/product_types.xsd +++ b/app/code/Magento/Catalog/etc/product_types.xsd @@ -93,5 +93,6 @@ <xs:attribute name="indexPriority" type="xs:nonNegativeInteger" use="optional" /> <xs:attribute name="canUseQtyDecimals" type="xs:boolean" use="optional" /> <xs:attribute name="isQty" type="xs:boolean" use="optional" /> + <xs:attribute name="sortOrder" type="xs:integer" use="optional" /> </xs:complexType> </xs:schema> diff --git a/app/code/Magento/Catalog/etc/product_types_merged.xsd b/app/code/Magento/Catalog/etc/product_types_merged.xsd index 1cacd516e1b8fd57b899bf4b92ccd80ee017926c..8f8762fc741603a6a7e01038e2666b47e952765c 100644 --- a/app/code/Magento/Catalog/etc/product_types_merged.xsd +++ b/app/code/Magento/Catalog/etc/product_types_merged.xsd @@ -104,6 +104,7 @@ <xs:attribute name="indexPriority" type="xs:nonNegativeInteger" use="optional" /> <xs:attribute name="canUseQtyDecimals" type="xs:boolean" use="optional" /> <xs:attribute name="isQty" type="xs:boolean" use="optional" /> + <xs:attribute name="sortOrder" type="xs:integer" use="optional" /> </xs:complexType> </xs:schema> diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php index 748588748a9a2a7c935dd4e8e3366985129aaaa9..d2fd6618ef37056a476e5a7595bdced591a97365 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php @@ -191,9 +191,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -275,9 +275,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -359,9 +359,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -443,9 +443,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -527,9 +527,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -617,9 +617,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -775,9 +775,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -859,9 +859,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -943,9 +943,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1027,9 +1027,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1111,9 +1111,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1237,9 +1237,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_category_product_index', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_category_product_index', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1313,9 +1313,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_compare_item', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1345,9 +1345,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('catalog_product_website', array('website_id')), array('website_id') )->addForeignKey( - $installer->getFkName('catalog_product_website', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1397,9 +1397,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_enabled_index', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_enabled_index', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1836,9 +1836,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1952,9 +1952,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2100,9 +2100,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2162,9 +2162,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2279,9 +2279,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_option_type_price', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2346,9 +2346,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_option_type_title', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2583,9 +2583,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_index_eav', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_index_eav', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2650,9 +2650,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_index_eav_decimal', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_index_eav_decimal', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2744,9 +2744,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2810,9 +2810,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2848,9 +2848,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('catalog_product_index_website', array('website_date')), array('website_date') )->addForeignKey( - $installer->getFkName('catalog_product_index_website', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php new file mode 100644 index 0000000000000000000000000000000000000000..66a33ea2359c75a17363ae10f7bf25aed6b462c4 --- /dev/null +++ b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php @@ -0,0 +1,3995 @@ +<?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 Magento + * @package Magento_Catalog + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +$installer = $this; +/* @var $installer \Magento\Catalog\Model\Resource\Setup */ + +$installer->startSetup(); + +/** + * Create table 'catalog_product_entity' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_set_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute Set ID' +)->addColumn( + 'type_id', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 32, + array('nullable' => false, 'default' => \Magento\Catalog\Model\Product\Type::DEFAULT_TYPE), + 'Type ID' +)->addColumn( + 'sku', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 64, + array(), + 'SKU' +)->addColumn( + 'has_options', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => '0'), + 'Has Options' +)->addColumn( + 'required_options', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Required Options' +)->addColumn( + 'created_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array(), + 'Creation Time' +)->addColumn( + 'updated_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array(), + 'Update Time' +)->addIndex( + $installer->getIdxName('catalog_product_entity', array('entity_type_id')), + array('entity_type_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity', array('attribute_set_id')), + array('attribute_set_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity', array('sku')), + array('sku') +)->addForeignKey( + $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), + 'entity_type_id', + $installer->getTable('eav_entity_type'), + 'entity_type_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Table' +); +$installer->getConnection()->createTable($table); + + + +/** + * Create table 'catalog_product_entity_datetime' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_datetime') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DATETIME, + null, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_datetime', + array('entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Datetime Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_decimal' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_decimal') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_decimal', + array('entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', array('attribute_id')), + array('attribute_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Decimal Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_int' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_int') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_int', + array('entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_int', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_int', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_int', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Integer Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_text' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_text') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + '64k', + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_text', + array('entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_text', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_text', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_text', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Text Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_varchar' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_varchar') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_varchar', + array('entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Varchar Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_gallery' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_gallery') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Position' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_gallery', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Gallery Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_set_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attriute Set ID' +)->addColumn( + 'parent_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Parent Category ID' +)->addColumn( + 'created_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array(), + 'Creation Time' +)->addColumn( + 'updated_at', + \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + array(), + 'Update Time' +)->addColumn( + 'path', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => false), + 'Tree Path' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false), + 'Position' +)->addColumn( + 'level', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Tree Level' +)->addColumn( + 'children_count', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false), + 'Child Count' +)->addIndex( + $installer->getIdxName('catalog_category_entity', array('level')), + array('level') +)->setComment( + 'Catalog Category Table' +); +$installer->getConnection()->createTable($table); + + +/** + * Create table 'catalog_category_entity_datetime' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity_datetime') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DATETIME, + null, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_category_entity_datetime', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Datetime Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_decimal' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity_decimal') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_category_entity_decimal', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Decimal Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_int' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity_int') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_category_entity_int', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_category_entity_int', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_int', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_int', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Integer Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_text' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity_text') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + '64k', + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_category_entity_text', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_category_entity_text', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_text', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_text', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Text Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_varchar' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_entity_varchar') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity Type ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Value' +)->addIndex( + $installer->getIdxName( + 'catalog_category_entity_varchar', + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Varchar Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Product ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Position' +)->addIndex( + $installer->getIdxName('catalog_category_product', array('product_id')), + array('product_id') +)->addForeignKey( + $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product To Category Linkage Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product_index') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Product ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true), + 'Position' +)->addColumn( + 'is_parent', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Parent' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Store ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false), + 'Visibility' +)->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + array('product_id', 'store_id', 'category_id', 'visibility') + ), + array('product_id', 'store_id', 'category_id', 'visibility') +)->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + array('store_id', 'category_id', 'visibility', 'is_parent', 'position') + ), + array('store_id', 'category_id', 'visibility', 'is_parent', 'position') +)->addForeignKey( + $installer->getFkName('catalog_category_product_index', 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_category_product_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Category Product Index' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_compare_item' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_compare_item') +)->addColumn( + 'catalog_compare_item_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Compare Item ID' +)->addColumn( + 'visitor_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Visitor ID' +)->addColumn( + 'customer_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true), + 'Customer ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true), + 'Store ID' +)->addIndex( + $installer->getIdxName('catalog_compare_item', array('customer_id')), + array('customer_id') +)->addIndex( + $installer->getIdxName('catalog_compare_item', array('product_id')), + array('product_id') +)->addIndex( + $installer->getIdxName('catalog_compare_item', array('visitor_id', 'product_id')), + array('visitor_id', 'product_id') +)->addIndex( + $installer->getIdxName('catalog_compare_item', array('customer_id', 'product_id')), + array('customer_id', 'product_id') +)->addIndex( + $installer->getIdxName('catalog_compare_item', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Compare Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_website' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_website') +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Product ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addIndex( + $installer->getIdxName('catalog_product_website', array('website_id')), + array('website_id') +)->addForeignKey( + $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product To Website Linkage Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_enabled_index' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_enabled_index') +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Product ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Store ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Visibility' +)->addIndex( + $installer->getIdxName('catalog_product_enabled_index', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_product_enabled_index', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_enabled_index', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Visibility Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link_type' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link_type') +)->addColumn( + 'link_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Link Type ID' +)->addColumn( + 'code', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 32, + array('nullable' => true, 'default' => null), + 'Code' +)->setComment( + 'Catalog Product Link Type Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link') +)->addColumn( + 'link_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Link ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'linked_product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Linked Product ID' +)->addColumn( + 'link_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Link Type ID' +)->addIndex( + $installer->getIdxName( + 'catalog_product_link', + array('link_type_id', 'product_id', 'linked_product_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('link_type_id', 'product_id', 'linked_product_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_link', array('product_id')), + array('product_id') +)->addIndex( + $installer->getIdxName('catalog_product_link', array('linked_product_id')), + array('linked_product_id') +)->addIndex( + $installer->getIdxName('catalog_product_link', array('link_type_id')), + array('link_type_id') +)->addForeignKey( + $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), + 'linked_product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product To Product Linkage Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link_attribute' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link_attribute') +)->addColumn( + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Product Link Attribute ID' +)->addColumn( + 'link_type_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Link Type ID' +)->addColumn( + 'product_link_attribute_code', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 32, + array('nullable' => true, 'default' => null), + 'Product Link Attribute Code' +)->addColumn( + 'data_type', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 32, + array('nullable' => true, 'default' => null), + 'Data Type' +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute', array('link_type_id')), + array('link_type_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute', + 'link_type_id', + 'catalog_product_link_type', + 'link_type_id' + ), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Link Attribute Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_decimal' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link_attribute_decimal') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true), + 'Product Link Attribute ID' +)->addColumn( + 'link_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'unsigned' => true), + 'Link ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'default' => '0.0000'), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_decimal', array('product_link_attribute_id')), + array('product_link_attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_decimal', array('link_id')), + array('link_id') +)->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_decimal', + array('product_link_attribute_id', 'link_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('product_link_attribute_id', 'link_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_decimal', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Link Decimal Attribute Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_int' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link_attribute_int') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true), + 'Product Link Attribute ID' +)->addColumn( + 'link_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'unsigned' => true), + 'Link ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_int', array('product_link_attribute_id')), + array('product_link_attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_int', array('link_id')), + array('link_id') +)->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_int', + array('product_link_attribute_id', 'link_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('product_link_attribute_id', 'link_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_int', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Link Integer Attribute Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_varchar' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_link_attribute_varchar') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product Link Attribute ID' +)->addColumn( + 'link_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'unsigned' => true), + 'Link ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_varchar', array('product_link_attribute_id')), + array('product_link_attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_link_attribute_varchar', array('link_id')), + array('link_id') +)->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_varchar', + array('product_link_attribute_id', 'link_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('product_link_attribute_id', 'link_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_varchar', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Link Varchar Attribute Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_tier_price' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_tier_price') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'all_groups', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '1'), + 'Is Applicable To All Customer Groups' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Customer Group ID' +)->addColumn( + 'qty', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'default' => '1.0000'), + 'QTY' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'default' => '0.0000'), + 'Value' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false), + 'Website ID' +)->addIndex( + $installer->getIdxName( + 'catalog_product_entity_tier_price', + array('entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', array('customer_group_id')), + array('customer_group_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', array('website_id')), + array('website_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Tier Price Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_media_gallery' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_media_gallery') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Attribute ID' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Entity ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Media Gallery Attribute Backend Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_media_gallery_value' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_entity_media_gallery_value') +)->addColumn( + 'value_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Value ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Store ID' +)->addColumn( + 'label', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Label' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true), + 'Position' +)->addColumn( + 'disabled', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Disabled' +)->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'value_id', + 'catalog_product_entity_media_gallery', + 'value_id' + ), + 'value_id', + $installer->getTable('catalog_product_entity_media_gallery'), + 'value_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Media Gallery Attribute Value Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option') +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'type', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 50, + array('nullable' => true, 'default' => null), + 'Type' +)->addColumn( + 'is_require', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => '1'), + 'Is Required' +)->addColumn( + 'sku', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 64, + array(), + 'SKU' +)->addColumn( + 'max_characters', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true), + 'Max Characters' +)->addColumn( + 'file_extension', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 50, + array(), + 'File Extension' +)->addColumn( + 'image_size_x', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true), + 'Image Size X' +)->addColumn( + 'image_size_y', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true), + 'Image Size Y' +)->addColumn( + 'sort_order', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Sort Order' +)->addIndex( + $installer->getIdxName('catalog_product_option', array('product_id')), + array('product_id') +)->addForeignKey( + $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option_price' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option_price') +)->addColumn( + 'option_price_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option Price ID' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Option ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'default' => '0.0000'), + 'Price' +)->addColumn( + 'price_type', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 7, + array('nullable' => false, 'default' => 'fixed'), + 'Price Type' +)->addIndex( + $installer->getIdxName( + 'catalog_product_option_price', + array('option_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('option_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_option_price', array('option_id')), + array('option_id') +)->addIndex( + $installer->getIdxName('catalog_product_option_price', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Price Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option_title' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option_title') +)->addColumn( + 'option_title_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option Title ID' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Option ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'title', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Title' +)->addIndex( + $installer->getIdxName( + 'catalog_product_option_title', + array('option_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('option_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_option_title', array('option_id')), + array('option_id') +)->addIndex( + $installer->getIdxName('catalog_product_option_title', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Title Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option_type_value' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option_type_value') +)->addColumn( + 'option_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option Type ID' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Option ID' +)->addColumn( + 'sku', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 64, + array(), + 'SKU' +)->addColumn( + 'sort_order', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Sort Order' +)->addIndex( + $installer->getIdxName('catalog_product_option_type_value', array('option_id')), + array('option_id') +)->addForeignKey( + $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Type Value Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option_type_price' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option_type_price') +)->addColumn( + 'option_type_price_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option Type Price ID' +)->addColumn( + 'option_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Option Type ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'default' => '0.0000'), + 'Price' +)->addColumn( + 'price_type', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 7, + array('nullable' => false, 'default' => 'fixed'), + 'Price Type' +)->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_price', + array('option_type_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('option_type_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_option_type_price', array('option_type_id')), + array('option_type_id') +)->addIndex( + $installer->getIdxName('catalog_product_option_type_price', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_price', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Type Price Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_option_type_title' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_option_type_title') +)->addColumn( + 'option_type_title_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Option Type Title ID' +)->addColumn( + 'option_type_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Option Type ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'title', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Title' +)->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_title', + array('option_type_id', 'store_id'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('option_type_id', 'store_id'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('catalog_product_option_type_title', array('option_type_id')), + array('option_type_id') +)->addIndex( + $installer->getIdxName('catalog_product_option_type_title', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_title', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Option Type Title Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_eav_attribute' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_eav_attribute') +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'frontend_input_renderer', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Frontend Input Renderer' +)->addColumn( + 'is_global', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '1'), + 'Is Global' +)->addColumn( + 'is_visible', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '1'), + 'Is Visible' +)->addColumn( + 'is_searchable', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Searchable' +)->addColumn( + 'is_filterable', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Filterable' +)->addColumn( + 'is_comparable', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Comparable' +)->addColumn( + 'is_visible_on_front', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Visible On Front' +)->addColumn( + 'is_html_allowed_on_front', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is HTML Allowed On Front' +)->addColumn( + 'is_used_for_price_rules', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Used For Price Rules' +)->addColumn( + 'is_filterable_in_search', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Filterable In Search' +)->addColumn( + 'used_in_product_listing', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Used In Product Listing' +)->addColumn( + 'used_for_sort_by', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Used For Sorting' +)->addColumn( + 'apply_to', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true), + 'Apply To' +)->addColumn( + 'is_visible_in_advanced_search', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Visible In Advanced Search' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Position' +)->addColumn( + 'is_wysiwyg_enabled', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is WYSIWYG Enabled' +)->addColumn( + 'is_used_for_promo_rules', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Used For Promo Rules' +)->addIndex( + $installer->getIdxName('catalog_eav_attribute', array('used_for_sort_by')), + array('used_for_sort_by') +)->addIndex( + $installer->getIdxName('catalog_eav_attribute', array('used_in_product_listing')), + array('used_in_product_listing') +)->addForeignKey( + $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog EAV Attribute Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_relation' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_relation') +)->addColumn( + 'parent_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Parent ID' +)->addColumn( + 'child_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Child ID' +)->addIndex( + $installer->getIdxName('catalog_product_relation', array('child_id')), + array('child_id') +)->addForeignKey( + $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), + 'child_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Relation Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav', array('value')), + array('value') +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product EAV Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav_decimal') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', array('value')), + array('value') +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_eav_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product EAV Decimal Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'tax_class_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Tax Class ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'final_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Final Price' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->addIndex( + $installer->getIdxName('catalog_product_index_price', array('customer_group_id')), + array('customer_group_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price', array('website_id')), + array('website_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price', array('min_price')), + array('min_price') +)->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'customer_group_id', 'customer_group', 'customer_group_id'), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Price Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_tier_price' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_tier_price') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', array('customer_group_id')), + array('customer_group_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', array('website_id')), + array('website_id') +)->addForeignKey( + $installer->getFkName( + 'catalog_product_index_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Tier Price Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_website' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_website') +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'website_date', + \Magento\DB\Ddl\Table::TYPE_DATE, + null, + array(), + 'Website Date' +)->addColumn( + 'rate', + \Magento\DB\Ddl\Table::TYPE_FLOAT, + null, + array('default' => '1.0000'), + 'Rate' +)->addIndex( + $installer->getIdxName('catalog_product_index_website', array('website_date')), + array('website_date') +)->addForeignKey( + $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Catalog Product Website Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_agr_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') +)->addColumn( + 'parent_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Parent ID' +)->addColumn( + 'child_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Child ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') +)->addColumn( + 'parent_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Parent ID' +)->addColumn( + 'child_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Child ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Config Option Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Config Option Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_final_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_final_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'tax_class_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Tax Class ID' +)->addColumn( + 'orig_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Original Price' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->addColumn( + 'base_tier', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Base Tier' +)->setComment( + 'Catalog Product Price Indexer Final Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_final_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_final_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'tax_class_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Tax Class ID' +)->addColumn( + 'orig_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Original Price' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->addColumn( + 'base_tier', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Base Tier' +)->setComment( + 'Catalog Product Price Indexer Final Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_opt_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Option Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_opt_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Option Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_agr_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Option ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Option Aggregate Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_agr_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), + 'Option ID' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->setComment( + 'Catalog Product Price Indexer Option Aggregate Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', array('value')), + array('value') +)->setComment( + 'Catalog Product EAV Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', array('value')), + array('value') +)->setComment( + 'Catalog Product EAV Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav_decimal_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('value')), + array('value') +)->setComment( + 'Catalog Product EAV Decimal Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_eav_decimal_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'attribute_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Attribute ID' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store ID' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array('nullable' => false, 'primary' => true), + 'Value' +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('entity_id')), + array('entity_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('attribute_id')), + array('attribute_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('store_id')), + array('store_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('value')), + array('value') +)->setComment( + 'Catalog Product EAV Decimal Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_idx') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'tax_class_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Tax Class ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'final_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Final Price' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', array('customer_group_id')), + array('customer_group_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', array('website_id')), + array('website_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', array('min_price')), + array('min_price') +)->setComment( + 'Catalog Product Price Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_index_price_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_product_index_price_tmp') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity ID' +)->addColumn( + 'customer_group_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Customer Group ID' +)->addColumn( + 'website_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website ID' +)->addColumn( + 'tax_class_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Tax Class ID' +)->addColumn( + 'price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Price' +)->addColumn( + 'final_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Final Price' +)->addColumn( + 'min_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Min Price' +)->addColumn( + 'max_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Max Price' +)->addColumn( + 'tier_price', + \Magento\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + array(), + 'Tier Price' +)->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', array('customer_group_id')), + array('customer_group_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', array('website_id')), + array('website_id') +)->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', array('min_price')), + array('min_price') +)->setComment( + 'Catalog Product Price Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product_index_idx') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Position' +)->addColumn( + 'is_parent', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Parent' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false), + 'Visibility' +)->addIndex( + $installer->getIdxName('catalog_category_product_index_idx', array('product_id', 'category_id', 'store_id')), + array('product_id', 'category_id', 'store_id') +)->setComment( + 'Catalog Category Product Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product_index_tmp') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('nullable' => false, 'default' => '0'), + 'Position' +)->addColumn( + 'is_parent', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Is Parent' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false), + 'Visibility' +)->setComment( + 'Catalog Category Product Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index_enbl_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product_index_enbl_idx') +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Visibility' +)->addIndex( + $installer->getIdxName('catalog_category_product_index_enbl_idx', array('product_id')), + array('product_id') +)->setComment( + 'Catalog Category Product Enabled Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index_enbl_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_product_index_enbl_tmp') +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'visibility', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Visibility' +)->addIndex( + $installer->getIdxName('catalog_category_product_index_enbl_tmp', array('product_id')), + array('product_id') +)->setComment( + 'Catalog Category Product Enabled Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_anc_categs_index_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_anc_categs_index_idx') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'path', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Path' +)->addIndex( + $installer->getIdxName('catalog_category_anc_categs_index_idx', array('category_id')), + array('category_id') +)->setComment( + 'Catalog Category Anchor Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_anc_categs_index_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_anc_categs_index_tmp') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'path', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => true, 'default' => null), + 'Path' +)->addIndex( + $installer->getIdxName('catalog_category_anc_categs_index_tmp', array('category_id')), + array('category_id') +)->setComment( + 'Catalog Category Anchor Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_anc_products_index_idx' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_anc_products_index_idx') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true), + 'Position' +)->setComment( + 'Catalog Category Anchor Product Indexer Index Table' +); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_anc_products_index_tmp' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('catalog_category_anc_products_index_tmp') +)->addColumn( + 'category_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Category ID' +)->addColumn( + 'product_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Product ID' +)->setComment( + 'Catalog Category Anchor Product Indexer Temp Table' +); +$installer->getConnection()->createTable($table); + +/** + * Modify core/url_rewrite table + */ +$installer->getConnection()->addColumn( + $installer->getTable('core_url_rewrite'), + 'category_id', + array( + 'type' => \Magento\DB\Ddl\Table::TYPE_INTEGER, + 'unsigned' => true, + 'nullable' => true, + 'comment' => 'Category Id' + ) +); +$installer->getConnection()->addColumn( + $installer->getTable('core_url_rewrite'), + 'product_id', + array( + 'type' => \Magento\DB\Ddl\Table::TYPE_INTEGER, + 'unsigned' => true, + 'nullable' => true, + 'comment' => 'Product Id' + ) +); +$installer->getConnection()->addForeignKey( + $installer->getFkName('core_url_rewrite', 'category_id', 'catalog_category_entity', 'entity_id'), + $installer->getTable('core_url_rewrite'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id' +); +$installer->getConnection()->addForeignKey( + $installer->getFkName('core_url_rewrite', 'product_id', 'catalog_category_entity', 'entity_id'), + $installer->getTable('core_url_rewrite'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id' +); + +$installer->endSetup(); + +$installer->installEntities(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php index 2b41b5760311e252e05e8654ff98d41c81bafb8c..10705ba17aa454b03897c20d19e7623700bf1518 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php @@ -34,7 +34,7 @@ $connection->dropForeignKey( $this->getFkName('catalog_category_product_index', 'product_id', 'catalog_product_entity', 'entity_id') )->dropForeignKey( $this->getTable('catalog_category_product_index'), - $this->getFkName('catalog_category_product_index', 'store_id', 'core_store', 'store_id') + $this->getFkName('catalog_category_product_index', 'store_id', 'store', 'store_id') ); $connection->dropTable($this->getTable('catalog_product_enabled_index')); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php index ee1e79cd44ab3dd0751dcc68ebee02ade2dc86fe..0100e4bbf01cd4c1485ef3a1abca0103baf94c67 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php @@ -106,9 +106,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -188,9 +188,9 @@ $table = $connection->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/category/tree.phtml index 57dc8687d4256d84765c61432be577fb4da5c6bd..168203a6380a1ce9ac78faccb79eaea561fdc08d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/category/tree.phtml @@ -25,13 +25,12 @@ */ ?> <div class="categories-side-col"> -<div class="sidebar-actions"> - <?php if ($this->getRoot()): ?> - <?php echo $this->getAddRootButtonHtml() ?><br/> - <?php echo $this->getAddSubButtonHtml() ?> - <?php endif; ?> -</div> -<?php echo $this->getStoreSwitcherHtml(); ?> + <div class="sidebar-actions"> + <?php if ($this->getRoot()): ?> + <?php echo $this->getAddRootButtonHtml() ?><br/> + <?php echo $this->getAddSubButtonHtml() ?> + <?php endif; ?> + </div> <div class="tree-actions"> <?php if ($this->getRoot()): ?> <?php //echo $this->getCollapseButtonHtml() ?> @@ -187,40 +186,33 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { } }); -function reRenderTree(event, switcher) { +function reRenderTree(switcherParams) { // re-render tree by store switcher - if (tree && event) { - var obj = event.target; - var newStoreId = obj.value * 1; - var storeParam = newStoreId ? 'store/' + newStoreId + '/' : ''; - - if (obj.switchParams) { - storeParam += obj.switchParams; - } - if (switcher.useConfirm) { + if (tree && switcherParams) { + if (switcherParams.useConfirm) { if (!confirm("<?php echo __('Please confirm site switching. All data that hasn\'t been saved will be lost.') ?>")) { - obj.value = '<?php echo (int)$this->getStoreId() ?>'; return false; } } if ($('add_root_category_button')) { - if (newStoreId == 0) { + if (!switcherParams.scopeId) { $('add_root_category_button').show(); } else { $('add_root_category_button').hide(); } } + // add form key + switcherParams.scopeParams.form_key = FORM_KEY; // retain current selected category id - storeParam = storeParam + 'id/' + tree.currentNodeId + '/'; - var url = tree.switchTreeUrl + storeParam; + var url = tree.switchTreeUrl + switcherParams.scopeParams + 'id/' + tree.currentNodeId + '/'; // load from cache // load from ajax new Ajax.Request(url + (url.match(new RegExp('\\?')) ? '&isAjax=true' : '?isAjax=true' ), { - parameters:{store:newStoreId, form_key:FORM_KEY}, + parameters:switcherParams.scopeParams, method:'post', onComplete:function (transport) { var response = eval('(' + transport.responseText + ')'); @@ -228,7 +220,7 @@ function reRenderTree(event, switcher) { return false; } - _renderNewTree(response, storeParam); + _renderNewTree(response, switcherParams.scopeParams); } }); } @@ -238,7 +230,7 @@ function reRenderTree(event, switcher) { } } -function _renderNewTree(config, storeParam) { +function _renderNewTree(config, scopeParams) { if (!config) { var config = defaultLoadTreeParams; } @@ -258,8 +250,8 @@ function _renderNewTree(config, storeParam) { // update content area var url = tree.editUrl; - if (storeParam) { - url = url + storeParam; + if (scopeParams) { + url = url + scopeParams; } <?php if ($this->isClearEdit()): ?> if (selectedNode) { @@ -348,9 +340,7 @@ Ext.onReady(function () { varienWindowOnload(); }); - if ((typeof varienStoreSwitcher) != 'undefined') { - varienStoreSwitcher.storeSelectorClickCallback = reRenderTree; - } + scopeSwitcherHandler = reRenderTree; newTreeParams = { animate:false, diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product.phtml index 4fb8b580665347d93ab586385aada901091d6e45..2043ae3db8442a63bed42a3e7df5ead04d910098 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product.phtml @@ -29,9 +29,5 @@ * @see \Magento\Catalog\Block\Adminhtml\Product */ ?> -<?php if( !$this->isSingleStoreMode() ): ?> - <?php echo $this->getChildHtml('store_switcher');?> -<?php endif;?> -<div class="page-actions<?php if( !$this->isSingleStoreMode() ): ?> page-actions-multiple-stores<?php endif;?>"><?php echo $this->getButtonsHtml() ?></div> <?php echo $this->getGridHtml() ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/labels.phtml index ea99e32e316245a0ee62734ac24d4b5b970f7320..4e04bf317c5348da9a3b53937919d34c4145f85f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/labels.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/labels.phtml @@ -47,7 +47,7 @@ <?php $_labels = $this->getLabelValues() ?> <?php foreach ($this->getStores() as $_store): ?> <td class="col-store-view"> - <input class="input-text<?php if ($_store->getId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/> + <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php echo $_store->getId() ?>]" value="<?php echo $this->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($this->getReadOnly()):?> disabled="disabled"<?php endif;?>/> </td> <?php endforeach; ?> </tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/options.phtml index b099620fbb72b9e5d087f00fbf6a4deb4452fcd6..26014d69f9de46ca3fd294323452d88b761f938c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/options.phtml @@ -70,7 +70,7 @@ <input class="input-radio" type="{{intype}}" name="default[]" value="{{id}}" {{checked}}<?php if ($this->getReadOnly()):?>disabled="disabled"<?php endif;?>/> </td> <?php foreach ($this->getStores() as $_store): ?> - <td class="col-{{id}}"><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if ($_store->getId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly() || $this->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> + <td class="col-{{id}}"><input name="option[value][{{id}}][<?php echo $_store->getId() ?>]" value="{{store<?php echo $_store->getId() ?>}}" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" <?php if ($this->getReadOnly() || $this->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> <?php endforeach; ?> <td id="delete_button_container_{{id}}" class="col-delete"> <input type="hidden" class="delete-flag" name="option[delete][{{id}}]" value="" /> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml index 57d8f38f40345061aebaf37a2b843e05562050d2..9f868ab9406fc3e7bf0d1d2d562089e5c4692ed6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/main.phtml @@ -24,12 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml() ?> - <?php echo $this->getResetButtonHtml() ?> - <?php echo $this->getDeleteButtonHtml() ?> - <?php echo $this->getSaveButtonHtml() ?> -</div> <div class="attribute-set"> <div class="edit-attribute-set attribute-set-col"> <?php echo $this->getSetFormHtml() ?> @@ -250,6 +244,9 @@ addGroup : function() { var group_name = prompt("<?php echo __('Please enter a new group name.') ?>",""); + if (!group_name) { + return; + } group_name = group_name.strip(); if( group_name == '' ) { this.addGroup(); diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/add.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/add.phtml index f7db8cc5961db3c50722d36633882abdb9ea5c02..8335f7ba672683e1692a8aca5afc0be471f4b406 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/add.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/add.phtml @@ -24,10 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml() ?> - <?php echo $this->getSaveButtonHtml() ?> -</div> <?php echo $this->getFormHtml() ?> <script type="text/javascript"> jQuery('#<?php echo $this->getFormId();?>').mage('form').mage('validation'); diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/main.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/main.phtml index b6513cfa3182d0cc2e7ae98dc5d07f703352bcac..bd50807cb4ad32cd77d09c2b3843d7ecdce28742 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/main.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/attribute/set/toolbar/main.phtml @@ -24,5 +24,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"><?php echo $this->getNewButtonHtml() ?></div> <?php echo $this->getChildHtml('grid') ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml index 9175dfe7518a06f6148c45590cd6f9f2537f8689..d727aa01f0bc31ab7a1242a3623d4cb44f71ef81 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml @@ -30,9 +30,9 @@ */ ?> -<div class="page-actions"> +<div class="product-actions"> <div id="product-template-suggest-container" class="suggest-expandable"> - <div class="actions-split"> + <div class="action-dropdown"> <button class="action-toggle" data-toggle="dropdown"> <span><?php echo $this->getAttributeSetName()?></span> </button> @@ -336,12 +336,12 @@ jQuery(function($) { }); }); }); + $('#product_info_tabs').tabs('refresh'); if (!$('#' + activeTabId).closest('li').hasClass(removedElementClass)) { $('#' + activeTabId).trigger('click'); } else { $('#product_info_tabs').tabs("option", "active", 0); } - $('#product_info_tabs').tabs('refresh'); }); }); diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml index e2bd96805d435c1ce95ffa8c82e46d691f8164ef..cd5994e4ee1b85e320c22b706fa3c2a668f6d926 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml @@ -56,9 +56,9 @@ $_exclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); $_inclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); ?> -<?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, null, null, $_website); ?> +<?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, $_website); ?> <?php if ($weeeHelper->typeOfDisplay($_product, array(1,2,4))): ?> - <?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, null, null, $_website); ?> + <?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, $_website); ?> <?php $_weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, $_website); ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml index 085de196ea6648ada9e4f84df794516565ca2aa2..30e85d2f16fdcdab405afd0a4a4eb6b36fd07341 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_category_edit.xml @@ -57,6 +57,17 @@ </arguments> </block> </referenceBlock> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" name="category.store.switcher" template="Magento_Backend::store/switcher.phtml"> + <!--<arguments>--> + <!--<argument name="switch_url" xsi:type="url" path="catalog/*/*">--> + <!--<param name="_current" xsi:type="boolean">true</param>--> + <!--<param name="_query" xsi:type="boolean">false</param>--> + <!--<param name="store" xsi:type="null" />--> + <!--</argument>--> + <!--</arguments>--> + </block> + </referenceContainer> <referenceContainer name="left"> <block class="Magento\Catalog\Block\Adminhtml\Category\Tree" name="category.tree" template="catalog/category/tree.phtml"/> </referenceContainer> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml index bb8fa78ca86f410c6ab6d886e027c46b12363f3b..a1477be7434fa30681c9480e46e1d0fb848b74ad 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_action_attribute_edit.xml @@ -24,8 +24,10 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="Magento_Backend::store/switcher.phtml"/> + </referenceContainer> <referenceContainer name="left"> - <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="store/switcher.phtml"/> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tabs" name="attributes_tabs"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Attributes" name="tab_attributes"/> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab\Inventory" name="tab_inventory" template="catalog/product/edit/action/inventory.phtml"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml index fa1640f79827a6091d096cb452a12b604ee7a9a1..c9a5dd5bd98fa5f18d0b9658d907971969c4c533 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_edit.xml @@ -26,13 +26,15 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="catalog_product_new"/> <referenceBlock name="page-title"> + <action method="setTitleClass"> + <argument name="class" xsi:type="string">complex</argument> + </action> + </referenceBlock> + <referenceContainer name="page.main.actions"> <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher"> <action method="setUseConfirm"> <argument name="params" xsi:type="string">1</argument> </action> </block> - <action method="setTitleClass"> - <argument name="class" xsi:type="string">complex</argument> - </action> - </referenceBlock> + </referenceContainer> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml index cd2973babc60238da0188ffbadd5f3cb52cd7f17..21ccfc803b1607ee6260ed125da230d7a2ba4d39 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_index.xml @@ -30,15 +30,17 @@ </action> </referenceBlock> <referenceBlock name="page-title"> + <action method="setTitleClass"> + <argument name="class" xsi:type="string">complex</argument> + </action> + </referenceBlock> + <referenceContainer name="page.main.actions"> <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher"> <action method="setUseConfirm"> <argument name="params" xsi:type="string">1</argument> </action> </block> - <action method="setTitleClass"> - <argument name="class" xsi:type="string">complex</argument> - </action> - </referenceBlock> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Catalog\Block\Adminhtml\Product" name="products_list"/> </referenceContainer> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/edit/attribute/search.phtml b/app/code/Magento/Catalog/view/adminhtml/product/edit/attribute/search.phtml index 1d139fc69bff6d5413cb7f39863923d2ac090fae..25b46113f1e3e91c0433101c34e11cf571ac43a4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/edit/attribute/search.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/product/edit/attribute/search.phtml @@ -27,7 +27,7 @@ /** @var $this \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Attributes\Search */ ?> <div id="product-attribute-search-container" class="suggest-expandable attribute-selector"> - <div class="actions-split"> + <div class="action-dropdown"> <button class="action-toggle action-choose" data-toggle="dropdown"> <span><?php echo __('Add Attribute') ?></span> </button> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/product.css b/app/code/Magento/Catalog/view/adminhtml/product/product.css index 0ae07eac6bc34305bf8837829b4257951b95af78..9751344b24caabe87ef16cd5f20d6ec41746a760 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/product/product.css @@ -24,7 +24,7 @@ */ /* Action "Back" as cross */ -[class^=" catalog-product-"] .page-actions .action-back, +/*[class^=" catalog-product-"] .page-actions .action-back, [class^=" catalog-product-"] .page-actions .action-back:hover, [class^=" catalog-product-"] .page-actions .action-back:active, [class^=" newsletter-"] .page-actions .action-back, @@ -54,7 +54,7 @@ speak: none; font-weight: normal; -webkit-font-smoothing: antialiased; - content: '\e07d'; /* close icon */ + content: '\e07d'; font-size: 16px; } @@ -63,9 +63,9 @@ display: inline-block; overflow: hidden; text-indent: -999em; -} +}*/ -.page-actions .switcher { +.product-actions .switcher { display: inline-block; vertical-align: top; margin: 6px 17px 6px 6px; @@ -503,39 +503,6 @@ border-radius: 4px; } -.actions-select .dropdown-menu { - margin-top: 1px; - min-width: 38px; -} - -.actions-select .dropdown-menu li { - padding: 5px; - text-align: center; -} - -.actions-select .action-toggle, -.actions-select .action-toggle:hover, -.actions-select .action-toggle:active, -.actions-select .action-toggle:focus, -.actions-select .action-toggle[disabled] { - background: #fff; - padding: 4px 4px 3px 7px; - color: #888; - filter: none; -} - -.actions-select .action-toggle > span { - display: inline-block; - font-family: Arial, Verdana, sans-serif; - margin-right: 3px; -} - -.actions-select .action-toggle:before { - display: inline-block; - float: right; - color: #888; -} - /* Advanced Pricing tab -------------------------------------- */ diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 481c94121c33dc1ee3c51fc87239e8e39a064da2..44dda4c57793d02f008202836e57142a18e38b63 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -66,8 +66,8 @@ <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument> </arguments> </block> - <block class="Magento\Catalog\Block\Product\View" name="product.price" template="product/view/price.phtml" after="product.info.rating"/> - <block class="Magento\Catalog\Block\Product\View" name="product.info.rating" template="product/view/rating.phtml" after="product.info.sku"/> + <block class="Magento\Catalog\Block\Product\View" name="product.price" template="product/view/price.phtml" after="product.info.review"/> + <block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="product/view/review.phtml" after="product.info.sku"/> <container name="alert.urls" as="alert_urls" label="Alert Urls" after="product.price"/> <block class="Magento\Catalog\Block\Product\View" name="product.tierprices" template="product/view/tierprices.phtml" before="product.info"/> <block class="Magento\Catalog\Block\Product\View" name="product.info" template="product/view/form.phtml"> diff --git a/app/code/Magento/Catalog/view/frontend/product/list.phtml b/app/code/Magento/Catalog/view/frontend/product/list.phtml index 5264ade8919ead97d5a7b045dd74c77717db6c11..ba8cd36f4259f2348aeca4b3f3e73dac94d98bc7 100644 --- a/app/code/Magento/Catalog/view/frontend/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/list.phtml @@ -43,12 +43,12 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im $viewMode ='grid'; $image = 'category_page_grid'; $showDescription = false; - $rating = 'short'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; } else { $viewMode ='list'; $image = 'category_page_list'; $showDescription = true; - $rating = 'full'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW; } /** * Position for actions regarding image size changing in vde if needed @@ -63,6 +63,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <div class="products wrapper <?php echo $viewMode; ?>"> <?php $iterator = 1; ?> <ol class="products list items"> + <?php /** @var $_product \Magento\Catalog\Model\Product */ ?> <?php foreach ($_productCollection as $_product): ?> <?php echo ($iterator++==1) ? '<li class="item product">' : '</li><li class="item product">' ?> <div class="product"> @@ -77,9 +78,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?> </a> </strong> - <?php if ($_product->getRatingSummary()): ?> - <?php echo $this->getReviewsSummaryHtml($_product,$rating) ?> - <?php endif; ?> + <?php echo $this->getReviewsSummaryHtml($_product, $templateType); ?> <?php echo $this->getPriceHtml($_product, true) ?> <div class="product actions"<?php echo strpos($pos, $viewMode . '-actions') ? $position : ''; ?>> <div class="primary"<?php echo strpos($pos, $viewMode . '-primary') ? $position: ''; ?>> diff --git a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml index 80ac0e3d62369abf84d43b3497effae7f3c84bd0..a7a8e684dbb5c4472139c9a8075034767c277ff7 100644 --- a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml @@ -42,7 +42,7 @@ switch($type = $this->getType()) { $showWishlist = true; $showCompare = true; $showCart = false; - $rating = false; + $templateType = null; $description = false; } break; @@ -63,7 +63,7 @@ switch($type = $this->getType()) { $showWishlist = true; $showCompare = true; $showCart = false; - $rating = false; + $templateType = null; $description = false; } break; @@ -83,7 +83,7 @@ switch($type = $this->getType()) { $showWishlist = false; $showCompare = false; $showCart = false; - $rating = false; + $templateType = null; $description = false; } break; @@ -104,7 +104,7 @@ switch($type = $this->getType()) { $showWishlist = false; $showCompare = false; $showCart = false; - $rating = false; + $templateType = null; $description = false; } break; @@ -123,7 +123,7 @@ switch($type = $this->getType()) { $showWishlist = true; $showCompare = true; $showCart = true; - $rating = 'short'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; $description = false; } break; @@ -142,7 +142,7 @@ switch($type = $this->getType()) { $showWishlist = true; $showCompare = true; $showCart = true; - $rating = 'short'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; $description = false; } break; @@ -163,7 +163,7 @@ switch($type = $this->getType()) { $showWishlist = true; $showCompare = true; $showCart = true; - $rating = 'short'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; $description = ($mode == 'list') ? true : false; } break; @@ -211,8 +211,8 @@ switch($type = $this->getType()) { <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($templateType): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> <?php if(!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/product/listing.phtml index 29ded60475a31afff0cb9f90b57c9ee437bd33c3..d3bcfe3f308b325d9143f1e205c3b658278bc4c1 100644 --- a/app/code/Magento/Catalog/view/frontend/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/listing.phtml @@ -45,12 +45,12 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im $viewMode ='grid'; $image = 'category_page_grid'; $showDescription = false; - $rating = 'short'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW; } else { $viewMode ='list'; $image = 'category_page_list'; $showDescription = true; - $rating = 'full'; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW; } ?> @@ -74,7 +74,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im . $_helper->productAttribute($_product, $_product->getName(), 'name') . '</a></strong>'; $info['price'] = $this->getPriceHtml($_product, true); - $info['rating'] = $_product->getRatingSummary() ? $this->getReviewsSummaryHtml($_product,$rating) : ''; + $info['review'] = $this->getReviewsSummaryHtml($_product, $templateType); if ($_product->isSaleable()) { $info['button'] = '<button type="button" title="' . __('Add to Cart') . '" class="action tocart"' @@ -101,7 +101,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im $info['description'] = ''; } - $details = $this->getInfoOrder() ? : array('name','price','rating','description','actions'); + $details = $this->getInfoOrder() ? : array('name','price','review','description','actions'); foreach ($details as $detail) { echo $info[$detail]; } @@ -117,4 +117,4 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <?php echo $this->getToolbarHtml() ?> </div> <?php endif; ?> -<?php echo $time_taken = microtime(true) - $start; ?> \ No newline at end of file +<?php echo $time_taken = microtime(true) - $start; ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/rating.phtml b/app/code/Magento/Catalog/view/frontend/product/view/review.phtml similarity index 93% rename from app/code/Magento/Catalog/view/frontend/product/view/rating.phtml rename to app/code/Magento/Catalog/view/frontend/product/view/review.phtml index fdc80d3e042fbb1393ab94403425b2afe8ce0873..831b7b9fac535d78e0ae862787e7adce6b1e2593 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/rating.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/review.phtml @@ -22,4 +22,5 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> +<?php /** @var $this \Magento\Catalog\Block\Product\AbstractProduct */ ?> <?php echo $this->getReviewsSummaryHtml($this->getProduct(), false, true)?> diff --git a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml index 5fe98c9c1ab714dfac17e995c9876e66b4251679..5c96304341c676587df39f8fbfe64d7dd8ccc19a 100644 --- a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml @@ -36,7 +36,7 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge $showWishlist = true; $showCompare = true; $showCart = true; - $rating = true; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::DEFAULT_VIEW; $description = false; } ?> @@ -67,8 +67,8 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($templateType): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml index 1449bf208b45f8061131a6a03ed3d442485fee8a..e9a9210f7f8bc53f46eebea06815acbc99ea7aae 100644 --- a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml @@ -36,7 +36,7 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge $showWishlist = true; $showCompare = true; $showCart = true; - $rating = true; + $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::DEFAULT_VIEW; $description = true; } ?> @@ -67,8 +67,8 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($templateType): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $templateType) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php index 93a805df467c817c28d97cfbcd7ff67ed8a76e43..222f9f10b728f19b98d5c6f40b6b884e52195653 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php @@ -45,27 +45,27 @@ class Customergroup extends \Magento\View\Element\Html\Select protected $_addGroupAllOption = true; /** - * Customer group collection factory + * Customer group service * - * @var \Magento\Customer\Model\Resource\Group\CollectionFactory + * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface */ - protected $_groupCollectionFactory; + protected $_groupService; /** * Construct * * @param \Magento\View\Element\Context $context - * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $groupCollectionFactory + * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService * @param array $data */ public function __construct( \Magento\View\Element\Context $context, - \Magento\Customer\Model\Resource\Group\CollectionFactory $groupCollectionFactory, + \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService, array $data = array() ) { parent::__construct($context, $data); - $this->_groupCollectionFactory = $groupCollectionFactory; + $this->_groupService = $groupService; } /** @@ -78,9 +78,9 @@ class Customergroup extends \Magento\View\Element\Html\Select { if (is_null($this->_customerGroups)) { $this->_customerGroups = array(); - foreach ($this->_groupCollectionFactory->create() as $item) { - /* @var $item \Magento\Customer\Model\Group */ - $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); + foreach ($this->_groupService->getGroups() as $item) { + /* @var $item \Magento\Customer\Service\V1\Data\CustomerGroup */ + $this->_customerGroups[$item->getId()] = $item->getCode(); } } if (!is_null($groupId)) { @@ -107,7 +107,10 @@ class Customergroup extends \Magento\View\Element\Html\Select { if (!$this->getOptions()) { if ($this->_addGroupAllOption) { - $this->addOption(\Magento\Customer\Model\Group::CUST_GROUP_ALL, __('ALL GROUPS')); + $this->addOption( + \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, + __('ALL GROUPS') + ); } foreach ($this->_getCustomerGroups() as $groupId => $groupLabel) { $this->addOption($groupId, addslashes($groupLabel)); diff --git a/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php b/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php index 9ea3b53a458bd45feb47d57bb6a9f058a2c44ba5..230d394606b1459b1b85530b6e047411853571a3 100644 --- a/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php +++ b/app/code/Magento/CatalogInventory/Block/Stockqty/AbstractStockqty.php @@ -95,7 +95,10 @@ abstract class AbstractStockqty extends \Magento\View\Element\Template public function getThresholdQty() { if (!$this->hasData('threshold_qty')) { - $qty = (double)$this->_storeConfig->getConfig(self::XML_PATH_STOCK_THRESHOLD_QTY); + $qty = (double)$this->_scopeConfig->getValue( + self::XML_PATH_STOCK_THRESHOLD_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->setData('threshold_qty', $qty); } return $this->getData('threshold_qty'); diff --git a/app/code/Magento/CatalogInventory/Helper/Data.php b/app/code/Magento/CatalogInventory/Helper/Data.php index c2d011e5d4838ac796e4eec5396921dc3ad7c91c..889fd0dae603dd4401bc32efcc9770de7402f73f 100644 --- a/app/code/Magento/CatalogInventory/Helper/Data.php +++ b/app/code/Magento/CatalogInventory/Helper/Data.php @@ -62,22 +62,22 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\ProductTypes\ConfigInterface $config ) { $this->_config = $config; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -150,7 +150,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isShowOutOfStock() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_SHOW_OUT_OF_STOCK); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_SHOW_OUT_OF_STOCK, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -160,7 +160,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isAutoReturnEnabled() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ITEM_AUTO_RETURN); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_ITEM_AUTO_RETURN, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -171,6 +171,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isDisplayProductStockStatus() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_DISPLAY_PRODUCT_STOCK_STATUS); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_DISPLAY_PRODUCT_STOCK_STATUS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php b/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php index 695263a30077da9c2e2c07e790071df776202949..a12cac9288775efc0c24b8343c1d58b610c74861 100644 --- a/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Helper/Minsaleqty.php @@ -29,16 +29,17 @@ */ namespace Magento\CatalogInventory\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface as CustomerGroupService; class Minsaleqty { /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Math\Random @@ -46,12 +47,14 @@ class Minsaleqty protected $mathRandom; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Math\Random $mathRandom */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Math\Random $mathRandom) - { - $this->_coreStoreConfig = $coreStoreConfig; + public function __construct( + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Math\Random $mathRandom + ) { + $this->_scopeConfig = $scopeConfig; $this->mathRandom = $mathRandom; } @@ -84,8 +87,8 @@ class Minsaleqty $data[$groupId] = $this->_fixQty($qty); } } - if (count($data) == 1 && array_key_exists(\Magento\Customer\Model\Group::CUST_GROUP_ALL, $data)) { - return (string)$data[\Magento\Customer\Model\Group::CUST_GROUP_ALL]; + if (count($data) == 1 && array_key_exists(CustomerGroupService::CUST_GROUP_ALL, $data)) { + return (string)$data[CustomerGroupService::CUST_GROUP_ALL]; } return serialize($data); } else { @@ -102,7 +105,7 @@ class Minsaleqty protected function _unserializeValue($value) { if (is_numeric($value)) { - return array(\Magento\Customer\Model\Group::CUST_GROUP_ALL => $this->_fixQty($value)); + return array(CustomerGroupService::CUST_GROUP_ALL => $this->_fixQty($value)); } elseif (is_string($value) && !empty($value)) { return unserialize($value); } else { @@ -194,8 +197,9 @@ class Minsaleqty */ public function getConfigValue($customerGroupId, $store = null) { - $value = $this->_coreStoreConfig->getConfig( + $value = $this->_scopeConfig->getValue( \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MIN_SALE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); $value = $this->_unserializeValue($value); @@ -207,7 +211,7 @@ class Minsaleqty if ($groupId == $customerGroupId) { $result = $qty; break; - } else if ($groupId == \Magento\Customer\Model\Group::CUST_GROUP_ALL) { + } else if ($groupId == CustomerGroupService::CUST_GROUP_ALL) { $result = $qty; } } diff --git a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php index ae88348536b6832d424a865773d680814431f268..5ad6d688019594c8c9d27e443659f9b63d5447bf 100644 --- a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php @@ -36,7 +36,7 @@ class Item extends \Magento\CatalogInventory\Model\Stock\Item public function getCustomerGroupId() { if ($this->_customerGroupId === null) { - return \Magento\Customer\Model\Group::CUST_GROUP_ALL; + return \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL; } return parent::getCustomerGroupId(); } diff --git a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php index 53192e05846ea268ce30bd00867e34335f3b94d7..619ae537c4334e9ce17cfb658ea6802dcb079be1 100644 --- a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php +++ b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogInventory\Model\Config\Backend; -class Managestock extends \Magento\Core\Model\Config\Value +class Managestock extends \Magento\App\Config\Value { /** * @var \Magento\CatalogInventory\Model\Stock\Status @@ -44,8 +44,7 @@ class Managestock extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\CatalogInventory\Model\Stock\Status $stockStatus * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,15 +53,14 @@ class Managestock extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\CatalogInventory\Model\Stock\Status $stockStatus, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_stockStatus = $stockStatus; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php index 41f5052a591e1218159403655555137d48ba8eed..15efe80a85ce044b1dba0adf800b6dd9b1e008b4 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php @@ -61,8 +61,8 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Index\Model\Event::TYPE_MASS_ACTION, \Magento\Index\Model\Event::TYPE_DELETE ), - \Magento\Core\Model\Store::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), - \Magento\Core\Model\Store\Group::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), + \Magento\Store\Model\Store::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), + \Magento\Store\Model\Group::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE), \Magento\App\Config\ValueInterface::ENTITY => array(\Magento\Index\Model\Event::TYPE_SAVE) ); @@ -167,31 +167,35 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer } $entity = $event->getEntity(); - if ($entity == \Magento\Core\Model\Store::ENTITY) { - /* @var $store \Magento\Core\Model\Store */ + if ($entity == \Magento\Store\Model\Store::ENTITY) { + /* @var $store \Magento\Store\Model\Store */ $store = $event->getDataObject(); if ($store && $store->isObjectNew()) { $result = true; } else { $result = false; } - } else if ($entity == \Magento\Core\Model\Store\Group::ENTITY) { - /* @var $storeGroup \Magento\Core\Model\Store\Group */ - $storeGroup = $event->getDataObject(); - if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) { - $result = true; - } else { - $result = false; - } - } else if ($entity == \Magento\App\Config\ValueInterface::ENTITY) { - $configData = $event->getDataObject(); - if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { - $result = $configData->isValueChanged(); + } else { + if ($entity == \Magento\Store\Model\Group::ENTITY) { + /* @var $storeGroup \Magento\Store\Model\Group */ + $storeGroup = $event->getDataObject(); + if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) { + $result = true; + } else { + $result = false; + } } else { - $result = false; + if ($entity == \Magento\App\Config\ValueInterface::ENTITY) { + $configData = $event->getDataObject(); + if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { + $result = $configData->isValueChanged(); + } else { + $result = false; + } + } else { + $result = parent::matchEvent($event); + } } - } else { - $result = parent::matchEvent($event); } $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result); @@ -217,8 +221,8 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer $this->_registerCatalogProductEvent($event); break; - case \Magento\Core\Model\Store::ENTITY: - case \Magento\Core\Model\Store\Group::ENTITY: + case \Magento\Store\Model\Store::ENTITY: + case \Magento\Store\Model\Group::ENTITY: case \Magento\App\Config\ValueInterface::ENTITY: $event->addNewData('cataloginventory_stock_skip_call_event_handler', true); $process = $event->getProcess(); diff --git a/app/code/Magento/CatalogInventory/Model/Plugin/Layer.php b/app/code/Magento/CatalogInventory/Model/Plugin/Layer.php index 60bb0197702c7c86a14d7f2ebca6f1144a10c935..de869582975b9a0a06b1fd57144e348dc88d8384 100644 --- a/app/code/Magento/CatalogInventory/Model/Plugin/Layer.php +++ b/app/code/Magento/CatalogInventory/Model/Plugin/Layer.php @@ -37,20 +37,20 @@ class Layer /** * Store config instance * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @param \Magento\CatalogInventory\Model\Stock\Status $stockStatus - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\CatalogInventory\Model\Stock\Status $stockStatus, - \Magento\Core\Model\Store\ConfigInterface $storeConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_stockStatus = $stockStatus; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -79,6 +79,6 @@ class Layer */ protected function _isEnabledShowOutOfStock() { - return $this->_storeConfig->getConfigFlag('cataloginventory/options/show_out_of_stock'); + return $this->_scopeConfig->isSetFlag('cataloginventory/options/show_out_of_stock', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php index fbbf8f751b4d943561176ce7409c44452bb60c2b..0e8dbba1668148c95506c9a9708d652e6f7b7ebe 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php @@ -53,23 +53,23 @@ class DefaultStock extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Class constructor * * @param \Magento\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Resource $resource, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($resource, $eavConfig); } @@ -170,8 +170,9 @@ class DefaultStock extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr */ protected function _isManageStock() { - return $this->_coreStoreConfig->getConfigFlag( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK + return $this->_scopeConfig->isSetFlag( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php index a5d61e1468e7ae3e9f2766e7a87a46e2db6c5bd0..0484d7cea316e9c6be42cb7b08e76b2fb70419f4 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php @@ -89,9 +89,9 @@ class Stock extends \Magento\Model\Resource\Db\AbstractDb /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Stock model factory @@ -110,20 +110,20 @@ class Stock extends \Magento\Model\Resource\Db\AbstractDb * * @param \Magento\App\Resource $resource * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\CatalogInventory\Model\StockFactory $stockFactory * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( \Magento\App\Resource $resource, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\CatalogInventory\Model\StockFactory $stockFactory, \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); $this->_catalogInventoryData = $catalogInventoryData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_stockFactory = $stockFactory; $this->dateTime = $dateTime; } @@ -240,8 +240,9 @@ class Stock extends \Magento\Model\Resource\Db\AbstractDb */ public function setInStockFilterToCollection($collection) { - $manageStock = $this->_coreStoreConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK + $manageStock = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $cond = array( '{{table}}.use_config_manage_stock = 0 AND {{table}}.manage_stock=1 AND {{table}}.is_in_stock=1', @@ -280,7 +281,10 @@ class Stock extends \Magento\Model\Resource\Db\AbstractDb ); foreach ($configMap as $field => $const) { - $this->{$field} = (int)$this->_coreStoreConfig->getConfig($const); + $this->{$field} = (int)$this->_scopeConfig->getValue( + $const, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } $this->_isConfig = true; diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php index d973619cae69895bd87c641bdc2616f6cc3d1783..42f487587d8b0fb78d200d15ca8f5946754b53ec 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php @@ -39,17 +39,19 @@ class Item extends \Magento\Model\Resource\Db\AbstractDb /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\App\Resource $resource, \Magento\Core\Model\Store\Config $coreStoreConfig) - { - $this->_coreStoreConfig = $coreStoreConfig; + public function __construct( + \Magento\App\Resource $resource, + \Magento\App\Config\ScopeConfigInterface $scopeConfig + ) { + $this->_scopeConfig = $scopeConfig; parent::__construct($resource); } @@ -114,8 +116,9 @@ class Item extends \Magento\Model\Resource\Db\AbstractDb { if ($columns === null) { $adapter = $this->_getReadAdapter(); - $isManageStock = (int)$this->_coreStoreConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK + $isManageStock = (int)$this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $stockExpr = $adapter->getCheckSql( 'cisi.use_config_manage_stock = 1', diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php index a72939cb30bdd04f3e2faa3ce83f75db0809e841..81a5af9f29b884907b8159d59f3dfe6192c0b142 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php @@ -32,7 +32,7 @@ use Magento\CatalogInventory\Model\Stock; class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -41,7 +41,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -50,7 +50,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php index 9b97b0064b4fe4a0b2f480d220fa927dbd16d40f..6c77aa002c65bb82ac2cabaf48f26e3e1a1d0a32 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php @@ -31,14 +31,14 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb /** * Store model manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Website model factory * - * @var \Magento\Core\Model\WebsiteFactory + * @var \Magento\Store\Model\WebsiteFactory */ protected $_websiteFactory; @@ -49,14 +49,14 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Config $eavConfig ) { parent::__construct($resource); @@ -202,7 +202,7 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb */ public function getWebsiteStores() { - /** @var \Magento\Core\Model\Website $website */ + /** @var \Magento\Store\Model\Website $website */ $website = $this->_websiteFactory->create(); return $this->_getReadAdapter()->fetchPairs($website->getDefaultStoresSelect(false)); } @@ -256,10 +256,10 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb * Add stock status to prepare index select * * @param \Magento\DB\Select $select - * @param \Magento\Core\Model\Website $website + * @param \Magento\Store\Model\Website $website * @return Status */ - public function addStockStatusToSelect(\Magento\DB\Select $select, \Magento\Core\Model\Website $website) + public function addStockStatusToSelect(\Magento\DB\Select $select, \Magento\Store\Model\Website $website) { $websiteId = $website->getId(); $select->joinLeft( @@ -340,7 +340,7 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb $adapter = $this->_getReadAdapter(); - if ($storeId === null || $storeId == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { + if ($storeId === null || $storeId == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { $select = $adapter->select()->from( $attributeTable, array('entity_id', 'value') @@ -352,7 +352,7 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb $attribute->getAttributeId() )->where( 'store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $rows = $adapter->fetchPairs($select); @@ -366,7 +366,7 @@ class Status extends \Magento\Model\Resource\Db\AbstractDb array('t1.entity_id') )->where( 't1.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->where( 't1.attribute_id = ?', $attribute->getAttributeId() diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php index 828dd89dc646f666945986a4d2cb109e00bb1d56..add452416e4f3d2726d2b50f15626ced4a275bb5 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Stock.php @@ -59,7 +59,7 @@ class Stock extends \Magento\Model\AbstractModel /** * Store model manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -80,7 +80,7 @@ class Stock extends \Magento\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\CatalogInventory\Model\Resource\Stock\Item\CollectionFactory $collectionFactory * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -91,7 +91,7 @@ class Stock extends \Magento\Model\AbstractModel \Magento\Registry $registry, \Magento\CatalogInventory\Model\Resource\Stock\Item\CollectionFactory $collectionFactory, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 39fdaec88c182a414ab959246034428510b3173b..0a588b62778d5e283a1d50306373818b0946b3e5 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -162,14 +162,14 @@ class Item extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Store model manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -211,8 +211,8 @@ class Item extends \Magento\Model\AbstractModel * @param Status $stockStatus * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Math\Division $mathDivision * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -228,8 +228,8 @@ class Item extends \Magento\Model\AbstractModel Status $stockStatus, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\FormatInterface $localeFormat, \Magento\Math\Division $mathDivision, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -244,7 +244,7 @@ class Item extends \Magento\Model\AbstractModel $this->_stockStatus = $stockStatus; $this->_catalogInventoryData = $catalogInventoryData; $this->_catalogInventoryMinsaleqty = $catalogInventoryMinsaleqty; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_localeFormat = $localeFormat; $this->mathDivision = $mathDivision; @@ -319,7 +319,10 @@ class Item extends \Magento\Model\AbstractModel */ public function canSubtractQty() { - return $this->getManageStock() && $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_CAN_SUBTRACT); + return $this->getManageStock() && $this->_scopeConfig->isSetFlag( + self::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -333,7 +336,10 @@ class Item extends \Magento\Model\AbstractModel if (!$this->getManageStock()) { return $this; } - $config = $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_CAN_SUBTRACT); + $config = $this->_scopeConfig->isSetFlag( + self::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!$config) { return $this; } @@ -387,8 +393,9 @@ class Item extends \Magento\Model\AbstractModel */ public function getMinQty() { - return (double)($this->getUseConfigMinQty() ? $this->_coreStoreConfig->getConfig( - self::XML_PATH_MIN_QTY + return (double)($this->getUseConfigMinQty() ? $this->_scopeConfig->getValue( + self::XML_PATH_MIN_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : $this->getData( 'min_qty' )); @@ -447,8 +454,9 @@ class Item extends \Magento\Model\AbstractModel */ public function getMaxSaleQty() { - return (double)($this->getUseConfigMaxSaleQty() ? $this->_coreStoreConfig->getConfig( - self::XML_PATH_MAX_SALE_QTY + return (double)($this->getUseConfigMaxSaleQty() ? $this->_scopeConfig->getValue( + self::XML_PATH_MAX_SALE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : $this->getData( 'max_sale_qty' )); @@ -462,7 +470,10 @@ class Item extends \Magento\Model\AbstractModel public function getNotifyStockQty() { if ($this->getUseConfigNotifyStockQty()) { - return (double)$this->_coreStoreConfig->getConfig(self::XML_PATH_NOTIFY_STOCK_QTY); + return (double)$this->_scopeConfig->getValue( + self::XML_PATH_NOTIFY_STOCK_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return (double)$this->getData('notify_stock_qty'); } @@ -475,7 +486,10 @@ class Item extends \Magento\Model\AbstractModel public function getEnableQtyIncrements() { if ($this->getUseConfigEnableQtyInc()) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ENABLE_QTY_INCREMENTS); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_ENABLE_QTY_INCREMENTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return (bool)$this->getData('enable_qty_increments'); } @@ -489,10 +503,12 @@ class Item extends \Magento\Model\AbstractModel { if ($this->_qtyIncrements === null) { if ($this->getEnableQtyIncrements()) { - $this->_qtyIncrements = (double)($this - ->getUseConfigQtyIncrements() ? $this - ->_coreStoreConfig - ->getConfig(self::XML_PATH_QTY_INCREMENTS) : $this->getData('qty_increments')); + $this->_qtyIncrements = (double)($this->getUseConfigQtyIncrements() ? $this->_scopeConfig->getValue( + self::XML_PATH_QTY_INCREMENTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) : $this->getData( + 'qty_increments' + )); if ($this->_qtyIncrements <= 0) { $this->_qtyIncrements = false; } @@ -511,10 +527,12 @@ class Item extends \Magento\Model\AbstractModel */ public function getDefaultQtyIncrements() { - return $this->_coreStoreConfig->getConfigFlag( - self::XML_PATH_ENABLE_QTY_INCREMENTS - ) ? (int)$this->_coreStoreConfig->getConfig( - self::XML_PATH_QTY_INCREMENTS + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_ENABLE_QTY_INCREMENTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ? (int)$this->_scopeConfig->getValue( + self::XML_PATH_QTY_INCREMENTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : false; } @@ -526,7 +544,10 @@ class Item extends \Magento\Model\AbstractModel public function getBackorders() { if ($this->getUseConfigBackorders()) { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_BACKORDERS); + return (int)$this->_scopeConfig->getValue( + self::XML_PATH_BACKORDERS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->getData('backorders'); } @@ -539,7 +560,10 @@ class Item extends \Magento\Model\AbstractModel public function getManageStock() { if ($this->getUseConfigManageStock()) { - return (int)$this->_coreStoreConfig->getConfigFlag(self::XML_PATH_MANAGE_STOCK); + return (int)$this->_scopeConfig->isSetFlag( + self::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->getData('manage_stock'); } @@ -551,7 +575,10 @@ class Item extends \Magento\Model\AbstractModel */ public function getCanBackInStock() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_CAN_BACK_IN_STOCK); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_CAN_BACK_IN_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -850,6 +877,7 @@ class Item extends \Magento\Model\AbstractModel */ protected function _beforeSave() { + parent::_beforeSave(); // see if quantity is defined for this item type $typeId = $this->getTypeId(); if ($productTypeId = $this->getProductTypeId()) { diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index a888e599be19e0aa2e12eaa9284f0049f262c92b..33dbfcb2904f1a98ce80ea38b5076b06eb236a0f 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -83,7 +83,7 @@ class Status extends \Magento\Model\AbstractModel /** * Store model manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -99,7 +99,7 @@ class Status extends \Magento\Model\AbstractModel * @param \Magento\Registry $registry * @param Type $productType * @param \Magento\Catalog\Model\Product\Website $productWebsite - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param ItemFactory $stockItemFactory * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Model\Resource\AbstractResource $resource @@ -111,7 +111,7 @@ class Status extends \Magento\Model\AbstractModel \Magento\Registry $registry, Type $productType, \Magento\Catalog\Model\Product\Website $productWebsite, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, ItemFactory $stockItemFactory, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Model\Resource\AbstractResource $resource = null, @@ -331,7 +331,7 @@ class Status extends \Magento\Model\AbstractModel $websites = $this->getWebsites($websiteId); foreach (array_keys($websites) as $websiteId) { - /* @var $website \Magento\Core\Model\Website */ + /* @var $website \Magento\Store\Model\Website */ $statuses[$websiteId] = $status; } @@ -549,10 +549,10 @@ class Status extends \Magento\Model\AbstractModel * Add stock status to prepare index select * * @param \Magento\DB\Select $select - * @param \Magento\Core\Model\Website $website + * @param \Magento\Store\Model\Website $website * @return $this */ - public function addStockStatusToSelect(\Magento\DB\Select $select, \Magento\Core\Model\Website $website) + public function addStockStatusToSelect(\Magento\DB\Select $select, \Magento\Store\Model\Website $website) { $this->_getResource()->addStockStatusToSelect($select, $website); return $this; diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minqty.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minqty.php index 497ed08c84852061178f9f61b3f7c04c6d308f01..beca37d818599299ba3677705d76cff25586939d 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minqty.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minqty.php @@ -33,7 +33,7 @@ */ namespace Magento\CatalogInventory\Model\System\Config\Backend; -class Minqty extends \Magento\Core\Model\Config\Value +class Minqty extends \Magento\App\Config\Value { /** * Validate minimum product qty value diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php index b9b50f88974f2c4a62beeaf6f86e3dfba52324f0..fe8aab0628b8296c706c5678926c4aadf5110eb3 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php @@ -30,7 +30,7 @@ */ namespace Magento\CatalogInventory\Model\System\Config\Backend; -class Minsaleqty extends \Magento\Core\Model\Config\Value +class Minsaleqty extends \Magento\App\Config\Value { /** * Catalog inventory minsaleqty @@ -42,8 +42,7 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,15 +51,14 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_catalogInventoryMinsaleqty = $catalogInventoryMinsaleqty; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php index 8610c625b05fe62c6a7379a1aefceaeb569c5ae4..400e29b21101b6a5d0c907425a656e59fae5f25d 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php @@ -32,7 +32,7 @@ namespace Magento\CatalogInventory\Model\System\Config\Backend; use Magento\Model\Exception; -class Qtyincrements extends \Magento\Core\Model\Config\Value +class Qtyincrements extends \Magento\App\Config\Value { /** * Validate data before save diff --git a/app/code/Magento/CatalogInventory/etc/di.xml b/app/code/Magento/CatalogInventory/etc/di.xml index c762ff1ca1212359d65d866807183a4e6056d5e8..e4cb6de8a2cbd8cbc92b5bb7fab3ca38561c1e96 100644 --- a/app/code/Magento/CatalogInventory/etc/di.xml +++ b/app/code/Magento/CatalogInventory/etc/di.xml @@ -44,4 +44,11 @@ <type name="Magento\Catalog\Model\Layer"> <plugin name="addStockStatusOnPrepareFrontCollection" type="Magento\CatalogInventory\Model\Plugin\Layer"/> </type> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="cataloginventory" xsi:type="string">Magento_CatalogInventory</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index ee7750327e9d149526c0d9dade3277200d5468d2..1b74199849fe14f3d45bd3044aca6d5e890ed7c5 100644 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php index 306496b70e2f869ccb17f8c4d6f3e9495cb8ba8f..5412f3c0f30f90491ee6e30cb2940f5cb736a918 100644 --- a/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php +++ b/app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php @@ -289,9 +289,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('cataloginventory_stock_status', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('cataloginventory_stock_status', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php index 07e8ad1971979bba4f00ab9c7cdc389da27764fa..46ddf450cfa3055c1486ccc5024b676ac1e9fb6a 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Main.php @@ -40,33 +40,41 @@ use Magento\Backend\Block\Widget\Tab\TabInterface; class Main extends Generic implements TabInterface { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** - * @var \Magento\Customer\Model\Resource\Group\CollectionFactory + * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface */ protected $_customerGroup; + /** + * @var \Magento\Convert\Object + */ + protected $_objectConverter; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroup + * @param \Magento\Convert\Object $objectConverter + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroup, + \Magento\Convert\Object $objectConverter, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; $this->_customerGroup = $customerGroup; + $this->_objectConverter = $objectConverter; parent::__construct($context, $registry, $formFactory, $data); } @@ -186,7 +194,7 @@ class Main extends Generic implements TabInterface 'label' => __('Customer Groups'), 'title' => __('Customer Groups'), 'required' => true, - 'values' => $this->_customerGroup->create()->toOptionArray() + 'values' => $this->_objectConverter->toOptionArray($this->_customerGroup->getGroups(), 'id', 'code') ) ); diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php index cea9816334d67d35194625c56296a138b79843e2..3be7d5ecce7bf1e892f7e2ebaefed11e3170ebe2 100644 --- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Widget.php @@ -151,7 +151,7 @@ class Widget extends Action $category->load($categoryId); if ($storeId) { $rootId = $this->_objectManager->get( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->getStore( $storeId )->getRootCategoryId(); diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php index 0e9722d756388fba2b9238b0d1f9e3a969d2c2a8..d9ce83295b2903240b4af740473200cc305d1bee 100644 --- a/app/code/Magento/CatalogRule/Model/Observer.php +++ b/app/code/Magento/CatalogRule/Model/Observer.php @@ -37,9 +37,9 @@ use Magento\CatalogRule\Model\Rule; use Magento\CatalogRule\Model\Resource\Rule\Collection; use Magento\CatalogRule\Model\Rule\Product\Price; use Magento\Registry; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Stdlib\DateTime\TimezoneInterface; -use Magento\Customer\Model\Group; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface as Group; use Magento\Customer\Model\Session as CustomerModelSession; use Magento\Event\Observer as EventObserver; use Magento\Message\ManagerInterface; diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php index 8cc6be2f141836c2147f643c95bb9ae88bd6de63..8aa56c26775bb1138998258275df18f055298494 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php @@ -99,7 +99,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource protected $_conditionFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -110,7 +110,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\ConditionFactory $conditionFactory * @param \Magento\Stdlib\DateTime\DateTime $coreDate * @param \Magento\Eav\Model\Config $eavConfig @@ -121,7 +121,7 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\ConditionFactory $conditionFactory, \Magento\Stdlib\DateTime\DateTime $coreDate, \Magento\Eav\Model\Config $eavConfig, @@ -420,17 +420,17 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource $select->join( array('pp_default' => $priceTable), - sprintf($joinCondition, 'pp_default', \Magento\Core\Model\Store::DEFAULT_STORE_ID), + sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID), array('default_price' => 'pp_default.value') ); if ($websiteId !== null) { $website = $this->_storeManager->getWebsite($websiteId); $defaultGroup = $website->getDefaultGroup(); - if ($defaultGroup instanceof \Magento\Core\Model\Store\Group) { + if ($defaultGroup instanceof \Magento\Store\Model\Group) { $storeId = $defaultGroup->getDefaultStoreId(); } else { - $storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } $select->joinInner( @@ -453,10 +453,10 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource foreach ($this->_storeManager->getWebsites() as $website) { $websiteId = $website->getId(); $defaultGroup = $website->getDefaultGroup(); - if ($defaultGroup instanceof \Magento\Core\Model\Store\Group) { + if ($defaultGroup instanceof \Magento\Store\Model\Group) { $storeId = $defaultGroup->getDefaultStoreId(); } else { - $storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } $tableAlias = 'pp' . $websiteId; diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index fc82c7cd4bbd2a316b40541e2abe3376292809f6..83bd31a07d3ab0cec627058af7fd21207a290ca3 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -152,7 +152,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel protected $_productFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -172,7 +172,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -193,7 +193,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\Data\FormFactory $formFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory, \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, diff --git a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/CatalogRule/data/catalogrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php index 503ffe8b22bd0b8350a550e028fde8acf6f9b56c..21950027ebc251c33e9afa68f02277c1ff8ef085 100644 --- a/app/code/Magento/CatalogRule/data/catalogrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/Magento/CatalogRule/data/catalogrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php @@ -24,22 +24,22 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $this \Magento\Core\Model\Resource\Setup\Generic */ -$installer = $this->createMigrationSetup(array('resourceName' => 'core_setup')); +/** @var $this \Magento\Module\Setup */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'catalogrule', 'conditions_serialized', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, array('rule_id') ); $installer->appendClassAliasReplace( 'catalogrule', 'actions_serialized', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, array('rule_id') ); diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml index 31ff95c341b8c5c8ef38e53f3c0f38b7ea131645..d1ccf7c4934bed87498aca68d3ff7a0c40de28fd 100644 --- a/app/code/Magento/CatalogRule/etc/di.xml +++ b/app/code/Magento/CatalogRule/etc/di.xml @@ -37,17 +37,17 @@ <argument name="backendSession" xsi:type="object">Magento\Backend\Model\Session\Proxy</argument> </arguments> </type> - <type name="Magento\Module\Updater\SetupFactory"> + <type name="Magento\Catalog\Model\Product\PriceModifier\Composite"> <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="catalogrule_setup" xsi:type="string">Magento\Core\Model\Resource\Setup\Generic</item> + <argument name="modifiers" xsi:type="array"> + <item name="catalog_rule" xsi:type="string">Magento\CatalogRule\Model\Product\PriceModifier</item> </argument> </arguments> </type> - <type name="Magento\Catalog\Model\Product\PriceModifier\Composite"> + <type name="Magento\Module\Setup\Migration"> <arguments> - <argument name="modifiers" xsi:type="array"> - <item name="catalog_rule" xsi:type="string">Magento\CatalogRule\Model\Product\PriceModifier</item> + <argument name="compositeModules" xsi:type="array"> + <item name="catalogrule" xsi:type="string">Magento_CatalogRule</item> </argument> </arguments> </type> diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml index 4ea28b908ebfc074a97d5b92a1b21b003d6c938b..c1fa7fbd64cab8f4c64d902477bc3302e527af1a 100644 --- a/app/code/Magento/CatalogRule/etc/module.xml +++ b/app/code/Magento/CatalogRule/etc/module.xml @@ -31,10 +31,10 @@ <module name="Magento_Customer"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Rule"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> - <module name="Magento_Core"/> <module name="Magento_Index"/> <module name="Magento_Backend"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php index ac9e47b35d4614b0b15e2704d8315a91aab93d8c..c71753a4bf8c73bfd6ff52faee9fdfb2674c2674 100644 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php +++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; @@ -247,9 +247,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalogrule_product', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalogrule_product', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -343,9 +343,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalogrule_product_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalogrule_product_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -418,9 +418,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalogrule_group_website', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalogrule_group_website', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.0-1.6.0.1.php index 3d458ab0dde0e6ad82a734f67e7401f2e5cedca7..32246faf54db4c3d1306b4ba73cc106a67827a02 100644 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.0-1.6.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $tableName = $installer->getTable('catalogrule'); diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php index 22eb8e4a170ec946a4afe68f347f9bb753ed28fc..e5cab5925dffc139c486424fb2072ed6ff1725d0 100644 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -24,12 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); $rulesTable = $installer->getTable('catalogrule'); -$websitesTable = $installer->getTable('core_website'); +$websitesTable = $installer->getTable('store_website'); $customerGroupsTable = $installer->getTable('customer_group'); $rulesWebsitesTable = $installer->getTable('catalogrule_website'); $rulesCustomerGroupsTable = $installer->getTable('catalogrule_customer_group'); @@ -68,7 +68,7 @@ if (!$connection->isTableExists($rulesWebsitesTable)) { \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalogrule_website', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalogrule_website', 'website_id', 'store_website', 'website_id'), 'website_id', $websitesTable, 'website_id', diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.2-1.6.0.3.php index 4636c6c0dff3d9b43ea4f6d2b5df725002c559e9..9ecd66c454525e15fc178baf1d2f0414d615e971 100644 --- a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/CatalogSearch/Controller/Result.php b/app/code/Magento/CatalogSearch/Controller/Result.php index dab9c836ff923d35b3017def0ec30ce1324b4b9e..8fd854ec4d5ab701aea0284a023d5e7c430059ba 100644 --- a/app/code/Magento/CatalogSearch/Controller/Result.php +++ b/app/code/Magento/CatalogSearch/Controller/Result.php @@ -28,7 +28,7 @@ namespace Magento\CatalogSearch\Controller; use Magento\App\Action\Action; use Magento\App\Action\Context; use Magento\Catalog\Model\Session; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; /** * Catalog Search Controller diff --git a/app/code/Magento/CatalogSearch/Controller/Term.php b/app/code/Magento/CatalogSearch/Controller/Term.php index 910458f4fdb601c83449a980b5ebc82d6d58b38b..1c5e0f34030919bbb5abb36493a3e036548970e7 100644 --- a/app/code/Magento/CatalogSearch/Controller/Term.php +++ b/app/code/Magento/CatalogSearch/Controller/Term.php @@ -40,7 +40,7 @@ class Term extends Action */ public function dispatch(RequestInterface $request) { - if (!$this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfig('catalog/seo/search_terms')) { + if (!$this->_objectManager->get('Magento\App\Config\ScopeConfigInterface')->getValue('catalog/seo/search_terms', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_redirect('noroute'); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } diff --git a/app/code/Magento/CatalogSearch/Helper/Data.php b/app/code/Magento/CatalogSearch/Helper/Data.php index 85b3274ff8e7b36523cf29c0c2acd321bc738b09..be00a67bafad44b171ab89093b8b21753a476527 100644 --- a/app/code/Magento/CatalogSearch/Helper/Data.php +++ b/app/code/Magento/CatalogSearch/Helper/Data.php @@ -32,7 +32,7 @@ use Magento\CatalogSearch\Model\Query; use Magento\CatalogSearch\Model\QueryFactory; use Magento\CatalogSearch\Model\Resource\Fulltext\Engine; use Magento\CatalogSearch\Model\Resource\Query\Collection; -use Magento\Core\Model\Store\ConfigInterface; +use Magento\App\Config\ScopeConfigInterface; use Magento\Escaper; use Magento\Filter\FilterManager; use Magento\Stdlib\String; @@ -97,9 +97,9 @@ class Data extends AbstractHelper /** * Core store config * - * @var ConfigInterface + * @var ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Query factory @@ -123,7 +123,7 @@ class Data extends AbstractHelper * * @param Context $context * @param String $string - * @param ConfigInterface $coreStoreConfig + * @param ScopeConfigInterface $scopeConfig * @param QueryFactory $queryFactory * @param Escaper $escaper * @param FilterManager $filter @@ -131,13 +131,13 @@ class Data extends AbstractHelper public function __construct( Context $context, String $string, - ConfigInterface $coreStoreConfig, + ScopeConfigInterface $scopeConfig, QueryFactory $queryFactory, Escaper $escaper, FilterManager $filter ) { $this->string = $string; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_queryFactory = $queryFactory; $this->_escaper = $escaper; $this->filter = $filter; @@ -283,7 +283,11 @@ class Data extends AbstractHelper */ public function getMinQueryLength($store = null) { - return $this->_coreStoreConfig->getConfig(Query::XML_PATH_MIN_QUERY_LENGTH, $store); + return $this->_scopeConfig->getValue( + Query::XML_PATH_MIN_QUERY_LENGTH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -294,7 +298,11 @@ class Data extends AbstractHelper */ public function getMaxQueryLength($store = null) { - return $this->_coreStoreConfig->getConfig(Query::XML_PATH_MAX_QUERY_LENGTH, $store); + return $this->_scopeConfig->getValue( + Query::XML_PATH_MAX_QUERY_LENGTH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -305,7 +313,11 @@ class Data extends AbstractHelper */ public function getMaxQueryWords($store = null) { - return $this->_coreStoreConfig->getConfig(Query::XML_PATH_MAX_QUERY_WORDS, $store); + return $this->_scopeConfig->getValue( + Query::XML_PATH_MAX_QUERY_WORDS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -359,7 +371,10 @@ class Data extends AbstractHelper ); } - $searchType = $this->_coreStoreConfig->getConfig(Fulltext::XML_PATH_CATALOG_SEARCH_TYPE); + $searchType = $this->_scopeConfig->getValue( + Fulltext::XML_PATH_CATALOG_SEARCH_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($searchType == Fulltext::SEARCH_TYPE_COMBINE || $searchType == Fulltext::SEARCH_TYPE_LIKE) { $wordsFull = $this->filter->splitWords($this->getQueryText(), array('uniqueOnly' => true)); $wordsLike = $this->filter->splitWords( diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php index 89f1f2b8bf24c9ba902c787e5f320936f1cce7a6..edee60f369d7ac3fc1ac1158cea3bfc3ca560c95 100644 --- a/app/code/Magento/CatalogSearch/Model/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Advanced.php @@ -66,7 +66,7 @@ use Magento\Model\Exception; use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Directory\Model\Currency; use Magento\Directory\Model\CurrencyFactory; use Magento\Eav\Model\Entity\Attribute as EntityAttribute; diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php index c0b1472238131992c24814c4c1a9e6de2c31706d..b8ee73fc44925dd55f8cf8e0a241ad7891842fe9 100644 --- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php +++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php @@ -34,13 +34,12 @@ */ namespace Magento\CatalogSearch\Model\Config\Backend\Search; -use Magento\App\ConfigInterface; +use Magento\App\Config\ScopeConfigInterface; use Magento\CatalogSearch\Model\Fulltext; -use Magento\Core\Model\Config\Value; +use Magento\App\Config\Value; use Magento\Model\Context; use Magento\Registry; use Magento\Model\Resource\AbstractResource; -use Magento\Core\Model\StoreManagerInterface; use Magento\Data\Collection\Db; class Type extends Value @@ -55,8 +54,7 @@ class Type extends Value /** * @param Context $context * @param Registry $registry - * @param StoreManagerInterface $storeManager - * @param ConfigInterface $config + * @param ScopeConfigInterface $config * @param Fulltext $catalogSearchFulltext * @param AbstractResource $resource * @param Db $resourceCollection @@ -65,15 +63,14 @@ class Type extends Value public function __construct( Context $context, Registry $registry, - StoreManagerInterface $storeManager, - ConfigInterface $config, + ScopeConfigInterface $config, Fulltext $catalogSearchFulltext, AbstractResource $resource = null, Db $resourceCollection = null, array $data = array() ) { $this->_catalogSearchFulltext = $catalogSearchFulltext; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Fulltext.php index cde051757589ea842d8650751b4cd7c9da280539..6c9faeed68d3aca6b7d4bcaef667b2b792023828 100644 --- a/app/code/Magento/CatalogSearch/Model/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Fulltext.php @@ -25,13 +25,13 @@ */ namespace Magento\CatalogSearch\Model; +use Magento\App\Config\ScopeConfigInterface; use Magento\CatalogSearch\Helper\Data; use Magento\CatalogSearch\Model\Query; use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; use Magento\Model\Resource\AbstractResource; -use Magento\Core\Model\Store\Config; use Magento\Data\Collection\Db; /** @@ -70,15 +70,15 @@ class Fulltext extends AbstractModel /** * Core store config * - * @var Config + * @var ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param Context $context * @param Registry $registry * @param Data $catalogSearchData - * @param Config $coreStoreConfig + * @param ScopeConfigInterface $scopeConfig * @param AbstractResource $resource * @param Db $resourceCollection * @param array $data @@ -87,13 +87,13 @@ class Fulltext extends AbstractModel Context $context, Registry $registry, Data $catalogSearchData, - Config $coreStoreConfig, + ScopeConfigInterface $scopeConfig, AbstractResource $resource = null, Db $resourceCollection = null, array $data = array() ) { $this->_catalogSearchData = $catalogSearchData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -182,7 +182,11 @@ class Fulltext extends AbstractModel */ public function getSearchType($storeId = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_CATALOG_SEARCH_TYPE, $storeId); + return $this->_scopeConfig->getValue( + self::XML_PATH_CATALOG_SEARCH_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } // Deprecated methods diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php b/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php index 83ae59fa0869dacdc9da1e2a42d98c7790281cf7..f9415f69a2e0c6409fa10fd26a38cd7bac04f14c 100644 --- a/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php +++ b/app/code/Magento/CatalogSearch/Model/Fulltext/Observer.php @@ -38,7 +38,7 @@ class Observer /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -82,7 +82,7 @@ class Observer * @param \Magento\Backend\Model\UrlInterface $backendUrl * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( @@ -90,7 +90,7 @@ class Observer \Magento\Backend\Model\UrlInterface $backendUrl, \Magento\Eav\Model\Config $eavConfig, \Magento\CatalogSearch\Model\Fulltext $catalogSearchFulltext, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Message\ManagerInterface $messageManager ) { $this->_backendSession = $backendSession; @@ -246,7 +246,7 @@ class Observer public function cleanStoreIndex(\Magento\Event\Observer $observer) { $store = $observer->getEvent()->getStore(); - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $this->_getFulltextModel()->cleanIndex($store->getId()); diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php index aa7fee2cd35563556e46a0231eb958c869b2428a..9060333a42b6923ad68218c0f94ac5ea7596571b 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php @@ -41,9 +41,9 @@ use Magento\CatalogSearch\Model\Resource\Indexer\Fulltext as IndexerFulltext; use Magento\Model\Context; use Magento\Registry; use Magento\Model\Resource\AbstractResource; -use Magento\Core\Model\Store; -use Magento\Core\Model\Store\Group; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\Group; +use Magento\Store\Model\StoreManagerInterface; use Magento\Data\Collection\Db; use Magento\Index\Model\Event; use Magento\Index\Model\Indexer\AbstractIndexer; @@ -222,35 +222,41 @@ class Fulltext extends AbstractIndexer } else { $result = false; } - } else if ($entity == Store::ENTITY) { - if ($event->getType() == Event::TYPE_DELETE) { - $result = true; - } else { - /* @var $store Store */ - $store = $event->getDataObject(); - if ($store && $store->isObjectNew()) { + } else { + if ($entity == Store::ENTITY) { + if ($event->getType() == Event::TYPE_DELETE) { $result = true; } else { - $result = false; + /* @var $store Store */ + $store = $event->getDataObject(); + if ($store && $store->isObjectNew()) { + $result = true; + } else { + $result = false; + } } - } - } else if ($entity == Group::ENTITY) { - /* @var $storeGroup Group */ - $storeGroup = $event->getDataObject(); - if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) { - $result = true; } else { - $result = false; - } - } else if ($entity == ValueInterface::ENTITY) { - $data = $event->getDataObject(); - if ($data && in_array($data->getPath(), $this->_relatedConfigSettings)) { - $result = $data->isValueChanged(); - } else { - $result = false; + if ($entity == Group::ENTITY) { + /* @var $storeGroup Group */ + $storeGroup = $event->getDataObject(); + if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) { + $result = true; + } else { + $result = false; + } + } else { + if ($entity == ValueInterface::ENTITY) { + $data = $event->getDataObject(); + if ($data && in_array($data->getPath(), $this->_relatedConfigSettings)) { + $result = $data->isValueChanged(); + } else { + $result = false; + } + } else { + $result = parent::matchEvent($event); + } + } } - } else { - $result = parent::matchEvent($event); } $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result); @@ -430,72 +436,87 @@ class Fulltext extends AbstractIndexer if (!empty($data['catalogsearch_fulltext_reindex_all'])) { $this->reindexAll(); - } else if (!empty($data['catalogsearch_delete_product_id'])) { - $productId = $data['catalogsearch_delete_product_id']; + } else { + if (!empty($data['catalogsearch_delete_product_id'])) { + $productId = $data['catalogsearch_delete_product_id']; - if (!$this->_isProductComposite($productId)) { - $parentIds = $this->_getResource()->getRelationsByChild($productId); - if (!empty($parentIds)) { - $this->_getIndexer()->rebuildIndex(null, $parentIds); + if (!$this->_isProductComposite($productId)) { + $parentIds = $this->_getResource()->getRelationsByChild($productId); + if (!empty($parentIds)) { + $this->_getIndexer()->rebuildIndex(null, $parentIds); + } } - } - $this->_getIndexer()->cleanIndex(null, $productId)->getResource()->resetSearchResults(null, $productId); - } elseif (!empty($data['catalogsearch_update_product_id'])) { - $productId = $data['catalogsearch_update_product_id']; - $productIds = array($productId); - - if (!$this->_isProductComposite($productId)) { - $parentIds = $this->_getResource()->getRelationsByChild($productId); - if (!empty($parentIds)) { - $productIds = array_merge($productIds, $parentIds); + $this->_getIndexer()->cleanIndex( + null, + $productId + )->getResource()->resetSearchResults( + null, + $productId + ); + } elseif (!empty($data['catalogsearch_update_product_id'])) { + $productId = $data['catalogsearch_update_product_id']; + $productIds = array($productId); + + if (!$this->_isProductComposite($productId)) { + $parentIds = $this->_getResource()->getRelationsByChild($productId); + if (!empty($parentIds)) { + $productIds = array_merge($productIds, $parentIds); + } } - } - $this->_getIndexer()->rebuildIndex(null, $productIds); - } else if (!empty($data['catalogsearch_product_ids'])) { - // mass action - $productIds = $data['catalogsearch_product_ids']; - - if (!empty($data['catalogsearch_website_ids'])) { - $websiteIds = $data['catalogsearch_website_ids']; - $actionType = $data['catalogsearch_action_type']; - - foreach ($websiteIds as $websiteId) { - foreach ($this->_storeManager->getWebsite($websiteId)->getStoreIds() as $storeId) { - if ($actionType == 'remove') { - $this->_getIndexer() - ->cleanIndex($storeId, $productIds) - ->getResource()->resetSearchResults($storeId, $productIds); - } elseif ($actionType == 'add') { - $this->_getIndexer() - ->rebuildIndex($storeId, $productIds); + $this->_getIndexer()->rebuildIndex(null, $productIds); + } else { + if (!empty($data['catalogsearch_product_ids'])) { + // mass action + $productIds = $data['catalogsearch_product_ids']; + + if (!empty($data['catalogsearch_website_ids'])) { + $websiteIds = $data['catalogsearch_website_ids']; + $actionType = $data['catalogsearch_action_type']; + + foreach ($websiteIds as $websiteId) { + foreach ($this->_storeManager->getWebsite($websiteId)->getStoreIds() as $storeId) { + if ($actionType == 'remove') { + $this->_getIndexer()->cleanIndex( + $storeId, + $productIds + )->getResource()->resetSearchResults( + $storeId, + $productIds + ); + } elseif ($actionType == 'add') { + $this->_getIndexer()->rebuildIndex($storeId, $productIds); + } + } } } - } - } - if (isset($data['catalogsearch_status'])) { - $status = $data['catalogsearch_status']; - if ($status == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) { - $this->_getIndexer()->rebuildIndex(null, $productIds); + if (isset($data['catalogsearch_status'])) { + $status = $data['catalogsearch_status']; + if ($status == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) { + $this->_getIndexer()->rebuildIndex(null, $productIds); + } else { + $this->_getIndexer()->cleanIndex( + null, + $productIds + )->getResource()->resetSearchResults( + null, + $productIds + ); + } + } + if (isset($data['catalogsearch_force_reindex'])) { + $this->_getIndexer()->rebuildIndex(null, $productIds)->resetSearchResults(); + } } else { - $this->_getIndexer()->cleanIndex( - null, - $productIds - )->getResource()->resetSearchResults( - null, - $productIds - ); + if (isset($data['catalogsearch_category_update_product_ids'])) { + $productIds = $data['catalogsearch_category_update_product_ids']; + $categoryIds = $data['catalogsearch_category_update_category_ids']; + + $this->_getIndexer()->updateCategoryIndex($productIds, $categoryIds); + } } } - if (isset($data['catalogsearch_force_reindex'])) { - $this->_getIndexer()->rebuildIndex(null, $productIds)->resetSearchResults(); - } - } else if (isset($data['catalogsearch_category_update_product_ids'])) { - $productIds = $data['catalogsearch_category_update_product_ids']; - $categoryIds = $data['catalogsearch_category_update_category_ids']; - - $this->_getIndexer()->updateCategoryIndex($productIds, $categoryIds); } } diff --git a/app/code/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/Plugin.php b/app/code/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/Plugin.php index 11e35246ba856451a79823ab00877f63a7954ba7..7a862eff9d872ebe47ef32f64adf8704a93258c3 100644 --- a/app/code/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/Plugin.php +++ b/app/code/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/Plugin.php @@ -31,9 +31,9 @@ class Plugin const XML_PATH_DISPLAY_LAYER_COUNT = 'catalog/search/use_layered_navigation_count'; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeManager; + protected $scopeConfig; /** * @var \Magento\CatalogSearch\Model\Resource\EngineProvider @@ -41,14 +41,14 @@ class Plugin protected $engineProvider; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param EngineProvider $engineProvider */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, EngineProvider $engineProvider ) { - $this->storeManager = $storeManager; + $this->scopeConfig = $scopeConfig; $this->engineProvider = $engineProvider; } @@ -70,7 +70,10 @@ class Plugin if (!$_isLNAllowedByEngine) { return false; } - $availableResCount = (int)$this->storeManager->getStore()->getConfig(self::XML_PATH_DISPLAY_LAYER_COUNT); + $availableResCount = (int)$this->scopeConfig->getValue( + self::XML_PATH_DISPLAY_LAYER_COUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!$availableResCount || ($availableResCount > $layer->getProductCollection()->getSize())) { return $proceed($layer, $filters); diff --git a/app/code/Magento/CatalogSearch/Model/Query.php b/app/code/Magento/CatalogSearch/Model/Query.php index 8388de6b683caafc16377648be963d4a441bbbb1..b3012dda51eef327cd21c4fe684171236772cfd4 100644 --- a/app/code/Magento/CatalogSearch/Model/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Query.php @@ -33,8 +33,8 @@ use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; use Magento\Model\Resource\AbstractResource; -use Magento\Core\Model\Store\Config; -use Magento\Core\Model\StoreManagerInterface; +use Magento\App\Config\ScopeConfigInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Data\Collection\Db; use Magento\Eav\Model\Entity\Collection\AbstractCollection; @@ -61,10 +61,6 @@ use Magento\Eav\Model\Entity\Collection\AbstractCollection; * @method \Magento\CatalogSearch\Model\Query setIsProcessed(int $value) * @method string getUpdatedAt() * @method \Magento\CatalogSearch\Model\Query setUpdatedAt(string $value) - * - * @category Magento - * @package Magento_CatalogSearch - * @author Magento Core Team <core@magentocommerce.com> */ class Query extends AbstractModel { @@ -93,9 +89,9 @@ class Query extends AbstractModel /** * Core store config * - * @var Config + * @var ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Store manager @@ -126,7 +122,7 @@ class Query extends AbstractModel * @param QueryCollectionFactory $queryCollectionFactory * @param CollectionFactory $searchCollectionFactory * @param StoreManagerInterface $storeManager - * @param Config $coreStoreConfig + * @param Config $scopeConfig * @param AbstractResource $resource * @param Db $resourceCollection * @param array $data @@ -137,7 +133,7 @@ class Query extends AbstractModel QueryCollectionFactory $queryCollectionFactory, CollectionFactory $searchCollectionFactory, StoreManagerInterface $storeManager, - Config $coreStoreConfig, + ScopeConfigInterface $scopeConfig, AbstractResource $resource = null, Db $resourceCollection = null, array $data = array() @@ -145,7 +141,7 @@ class Query extends AbstractModel $this->_queryCollectionFactory = $queryCollectionFactory; $this->_searchCollectionFactory = $searchCollectionFactory; $this->_storeManager = $storeManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -286,7 +282,11 @@ class Query extends AbstractModel */ public function getMinQueryLength() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MIN_QUERY_LENGTH, $this->getStoreId()); + return $this->_scopeConfig->getValue( + self::XML_PATH_MIN_QUERY_LENGTH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); } /** @@ -296,7 +296,11 @@ class Query extends AbstractModel */ public function getMaxQueryLength() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_QUERY_LENGTH, $this->getStoreId()); + return $this->_scopeConfig->getValue( + self::XML_PATH_MAX_QUERY_LENGTH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); } /** @@ -306,6 +310,10 @@ class Query extends AbstractModel */ public function getMaxQueryWords() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_QUERY_WORDS, $this->getStoreId()); + return $this->_scopeConfig->getValue( + self::XML_PATH_MAX_QUERY_WORDS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); } } diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php index 0c39976602b3fba5b32e95c7d0464b4021160485..119e7ba3b05daa4d6dc19603c736880b7e9eec69 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php @@ -44,7 +44,7 @@ class Advanced extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -52,12 +52,12 @@ class Advanced extends \Magento\Model\Resource\Db\AbstractDb * Construct * * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Event\ManagerInterface $eventManager */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php index 2889ca3019d92ea6966446d418ce172480f3cfbb..208661c59809f99ae462443f4e300cb2c78a1efc 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php @@ -53,10 +53,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -77,10 +77,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -103,7 +103,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/CatalogSearch/Model/Resource/EngineProvider.php b/app/code/Magento/CatalogSearch/Model/Resource/EngineProvider.php index ad1d1cff66b349631266b6c3eef03e2f21464b76..98077c51115af4d8a4cd26ef09005c7554391a0e 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/EngineProvider.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/EngineProvider.php @@ -42,20 +42,20 @@ class EngineProvider protected $_engineFactory; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @param \Magento\CatalogSearch\Model\Resource\EngineFactory $engineFactory - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\CatalogSearch\Model\Resource\EngineFactory $engineFactory, - \Magento\Core\Model\Store\ConfigInterface $storeConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_engineFactory = $engineFactory; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -66,7 +66,7 @@ class EngineProvider public function get() { if (!$this->_engine) { - $engineClassName = $this->_storeConfig->getConfig('catalog/search/engine'); + $engineClassName = $this->_scopeConfig->getValue('catalog/search/engine', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); /** * This needed if there already was saved in configuration some none-default engine diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index 6133ee36f181147d6d756f249557f5a659d50349..3ea19a0c9d110bbb8b236f0707d85131387a7322 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -115,14 +115,14 @@ class Fulltext extends \Magento\Model\Resource\Db\AbstractDb /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -163,8 +163,8 @@ class Fulltext extends \Magento\Model\Resource\Db\AbstractDb * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Filter\FilterManager $filter * @param \Magento\CatalogSearch\Helper\Data $catalogSearchData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Helper $resourceHelper * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Locale\ResolverInterface $localeResolver @@ -180,8 +180,8 @@ class Fulltext extends \Magento\Model\Resource\Db\AbstractDb \Magento\Event\ManagerInterface $eventManager, \Magento\Filter\FilterManager $filter, \Magento\CatalogSearch\Helper\Data $catalogSearchData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper, \Magento\Stdlib\DateTime $dateTime, \Magento\Locale\ResolverInterface $localeResolver, @@ -194,7 +194,7 @@ class Fulltext extends \Magento\Model\Resource\Db\AbstractDb $this->_eventManager = $eventManager; $this->filter = $filter; $this->_catalogSearchData = $catalogSearchData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; $this->_engineProvider = $engineProvider; @@ -925,8 +925,16 @@ class Fulltext extends \Magento\Model\Resource\Db\AbstractDb protected function _getStoreDate($storeId, $date = null) { if (!isset($this->_dates[$storeId])) { - $timezone = $this->_coreStoreConfig->getConfig($this->_localeDate->getDefaultTimezonePath(), $storeId); - $locale = $this->_coreStoreConfig->getConfig($this->_localeResolver->getDefaultLocalePath(), $storeId); + $timezone = $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + $locale = $this->_scopeConfig->getValue( + $this->_localeResolver->getDefaultLocalePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $locale = new \Zend_Locale($locale); $dateObj = new \Magento\Stdlib\DateTime\Date(null, null, $locale); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php index c75b734b22450706bd24a99d2b9be8b02ff35079..971c8b1cffd4950b0a226c45cd05c6700ca5f43c 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Collection.php @@ -58,10 +58,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -83,10 +83,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -111,7 +111,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php index c3999747761df91e970d4db3c6058135ce4ed02d..a22f8d629999475947b7d269a35d7e8bb73445c9 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogSearch\Model\Resource\Query; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * Catalog search query collection @@ -46,7 +46,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -62,7 +62,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource @@ -72,7 +72,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php index 53ee09d5bb438e82fed67d091496fdf097a76afb..4d25a5dc1acb1f569a02a2f971a51e5531366414 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Search/Collection.php @@ -65,10 +65,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -89,10 +89,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -115,7 +115,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..da57befb049ddcb66930d71adf8bc31ada30eca0 --- /dev/null +++ b/app/code/Magento/CatalogSearch/etc/di.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="catalogsearch" xsi:type="string">Magento_CatalogSearch</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/CatalogSearch/etc/module.xml b/app/code/Magento/CatalogSearch/etc/module.xml index dc3da62c87037790887c7727eb37815197639d3b..94c2f1b45ababd7c219b6c22f81ed44b10ccac09 100644 --- a/app/code/Magento/CatalogSearch/etc/module.xml +++ b/app/code/Magento/CatalogSearch/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-1.6.0.0.php b/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-1.6.0.0.php index e5f816731f9c8f9df351176513fd8675229c494f..ccf8da7fce48c2e1280e4fa8fcaf98d0e8531542 100644 --- a/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-1.6.0.0.php +++ b/app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); @@ -107,9 +107,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('catalogsearch_query', 'store_id'), 'store_id' )->addForeignKey( - $installer->getFkName('catalogsearch_query', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalogsearch_query', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Centinel/Model/Api.php b/app/code/Magento/Centinel/Model/Api.php index 1da15fc9f28a9d7c2f395d723dcbfc8603e2659a..76e549652218d72aaa3a69f7ba3191af12af125a 100644 --- a/app/code/Magento/Centinel/Model/Api.php +++ b/app/code/Magento/Centinel/Model/Api.php @@ -29,7 +29,7 @@ namespace Magento\Centinel\Model; /** * 3D Secure Validation Library for Payment */ -include_once '3Dsecure/CentinelClient.php'; +include_once 'CardinalCommerce/CentinelClient.php'; /** * 3D Secure Validation Api */ diff --git a/app/code/Magento/Centinel/Model/Config.php b/app/code/Magento/Centinel/Model/Config.php index 8c7da8cc06ff3fd74acf6e8f5e27f5ed85269d46..5c44d884098a6059d258c716ffbdeb72e7f04968 100644 --- a/app/code/Magento/Centinel/Model/Config.php +++ b/app/code/Magento/Centinel/Model/Config.php @@ -34,7 +34,7 @@ class Config /** * Store id or store model * - * @var int|\Magento\Core\Model\Store + * @var int|\Magento\Store\Model\Store */ protected $_store = false; @@ -48,14 +48,14 @@ class Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Core config interface * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -67,16 +67,16 @@ class Config protected $_encryptor; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Encryption\EncryptorInterface $encryptor */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Encryption\EncryptorInterface $encryptor ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_coreConfig = $coreConfig; $this->_encryptor = $encryptor; } @@ -84,7 +84,7 @@ class Config /** * Set store to congif model * - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @return $this */ public function setStore($store) @@ -96,7 +96,7 @@ class Config /** * Return store * - * @return int|\Magento\Core\Model\Store + * @return int|\Magento\Store\Model\Store */ public function getStore() { @@ -151,7 +151,7 @@ class Config */ private function _getServiceConfigValue($key) { - return $this->_coreStoreConfig->getConfig($this->_serviceConfigPath . '/' . $key, $this->getStore()); + return $this->_scopeConfig->getValue($this->_serviceConfigPath . '/' . $key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStore()); } /** diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml index 03f641fb76c8b77ad6f4616559ec60b5b9a0d71a..119ea26372580e4e0d5f1e9a8d8170ddaefc2c29 100644 --- a/app/code/Magento/Centinel/etc/module.xml +++ b/app/code/Magento/Centinel/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Checkout"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Checkout"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml index 93a2f2ef3c5168fa3bc38a5a9835ef39ec8f44bf..d792afc8a4641b7c5e858a39a4ee03fffe5d8d1d 100644 --- a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml +++ b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_index.xml @@ -32,7 +32,7 @@ </block> </referenceBlock> <referenceBlock name="data"> - <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="Magento_Sales::order/create/abstract.phtml"> + <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="order/create/abstract.phtml"> <block class="Magento\Centinel\Block\Adminhtml\Validation\Form" template="validation/form.phtml" name="centinel.validation.form" as="form"/> </block> </referenceBlock> diff --git a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_card_validation.xml b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_card_validation.xml index d1d431f45d351af0e889bf95cb4d404a0cee21fe..675d566dc2dc1934fb3a11a0aa9de232eeac9399 100644 --- a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_card_validation.xml +++ b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_card_validation.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <referenceContainer name="content"> - <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="Magento_Sales::order/create/abstract.phtml"> + <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="order/create/abstract.phtml"> <block class="Magento\Centinel\Block\Adminhtml\Validation\Form" template="validation/form.phtml" name="form"/> </block> </referenceContainer> diff --git a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_data.xml b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_data.xml index f081a50cf10905b21952772ef4bb6ebacb029396..6ee4f76a4480708544da118949e099b2a6388362 100644 --- a/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_data.xml +++ b/app/code/Magento/Centinel/view/adminhtml/layout/sales_order_create_load_block_data.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <referenceBlock name="data"> - <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="Magento_Sales::order/create/abstract.phtml"> + <block class="Magento\Centinel\Block\Adminhtml\Validation" as="card_validation" name="card_validation" template="order/create/abstract.phtml"> <block class="Magento\Centinel\Block\Adminhtml\Validation\Form" template="validation/form.phtml" name="form"/> </block> </referenceBlock> diff --git a/app/code/Magento/Centinel/view/adminhtml/order/create/abstract.phtml b/app/code/Magento/Centinel/view/adminhtml/order/create/abstract.phtml new file mode 100644 index 0000000000000000000000000000000000000000..f878b77323425ebff09ab66cf3e627695af163ab --- /dev/null +++ b/app/code/Magento/Centinel/view/adminhtml/order/create/abstract.phtml @@ -0,0 +1,35 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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 design + * @package default_default + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> + +<div class="fieldset-wrapper"> + <div class="fieldset-wrapper-title"> + <span class="title"><?php echo $this->getHeaderText() ?></span> + <div class="actions"><?php echo $this->getButtonsHtml() ?></div> + </div> + + <?php echo $this->getChildHtml('', true) ?> +</div> diff --git a/app/code/Magento/Centinel/view/adminhtml/validation/form.phtml b/app/code/Magento/Centinel/view/adminhtml/validation/form.phtml index a4459948b07eaf75667a31f6cc4e9707d9fe4173..832636012f83d2ba0cc8da05be4968d0ec5ddbd5 100644 --- a/app/code/Magento/Centinel/view/adminhtml/validation/form.phtml +++ b/app/code/Magento/Centinel/view/adminhtml/validation/form.phtml @@ -24,12 +24,19 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> + <div class="centinel"> <div class="authentication"> - <iframe frameborder="0" border="0" id="<?php echo $this->getContainerId() ?>" src="" style="display:none;" width="50%" height="350" title="<?php echo __('Card Verification')?>"></iframe> + <iframe frameborder="0" border="0" id="<?php echo $this->getContainerId() ?>" src="" style="display:none;" width="100%" height="390" title="<?php echo __('Card Verification')?>"></iframe> </div> </div> -<button onclick="cardValidator.validate()" class="scalable" type="button"><span><span><span><?php echo __('Start/Reset Validation...')?></span></span></span></button> + +<div class="actions"> + <button onclick="cardValidator.validate()" class="action- scalable" type="button"> + <span><?php echo __('Start/Reset Validation...')?></span> + </button> +</div> + <script type="text/javascript"> //<![CDATA[ cardValidator = new centinelValidator('<?php echo $this->getMethodCode() ?>', '<?php echo $this->getFrameUrl() ?>', '<?php echo $this->getContainerId() ?>'); diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php index 00f8b2965b163ecbc32e7ced714a80fb22b15a62..ec9739558f01a708f02ff8301b747eb3e436de7c 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php @@ -28,7 +28,7 @@ namespace Magento\Checkout\Block\Adminhtml\Agreement\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -36,14 +36,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; diff --git a/app/code/Magento/Checkout/Block/Agreements.php b/app/code/Magento/Checkout/Block/Agreements.php index de793b90926d3dbbd7fd242ddff5edcf5d723ef6..59813ea3a9f3c375a306d120708d6a1105898092 100644 --- a/app/code/Magento/Checkout/Block/Agreements.php +++ b/app/code/Magento/Checkout/Block/Agreements.php @@ -52,7 +52,7 @@ class Agreements extends \Magento\View\Element\Template public function getAgreements() { if (!$this->hasAgreements()) { - if (!$this->_storeConfig->getConfigFlag('checkout/options/enable_agreements')) { + if (!$this->_scopeConfig->isSetFlag('checkout/options/enable_agreements', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $agreements = array(); } else { /** @var \Magento\Checkout\Model\Resource\Agreement\Collection $agreements */ diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 0dd067767919a8c06ac043de815dd881c55879db..6d4d8077dbcb6d9405755f59cfa91c3f20da9451 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -145,9 +145,12 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart { $isActive = $this->_getData('is_wishlist_active'); if ($isActive === null) { - $isActive = $this->_storeConfig->getConfig( - 'wishlist/general/active' - ) && $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH); + $isActive = $this->_scopeConfig->getValue( + 'wishlist/general/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) && $this->httpContext->getValue( + \Magento\Customer\Helper\Data::CONTEXT_AUTH + ); $this->setIsWishlistActive($isActive); } return $isActive; diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 69a01ffb7a36385bd20656bf54382dc62615e36c..83d47f857f399f2dfc81c544640897514915c13a 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -67,17 +67,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct protected $_itemRelationsList; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\CatalogInventory\Model\Stock $stock @@ -85,8 +75,6 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Sales\Model\Quote\Item\RelatedProducts $itemRelationsList * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Block\Product\Context $context, diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index bc0e6202dbbaf158f3de542dfe2874b6f52a2105..8096dd0258ebdbba8ad992e5e0bc2be419f90daa 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -94,7 +94,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -140,7 +140,11 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ public function getCarrierName($carrierCode) { - if ($name = $this->_storeConfig->getConfig('carriers/' . $carrierCode . '/title')) { + if ($name = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $name; } return $carrierCode; diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index 32c8c3c32366f0b78b7b707678294bc0b609b494..fb40ceaa6231216036ddeef392b2edc7264d7749 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -109,7 +109,10 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart implements \Mage { $count = $this->getData('item_count'); if (is_null($count)) { - $count = $this->_storeConfig->getConfig(self::XML_PATH_CHECKOUT_SIDEBAR_COUNT); + $count = $this->_scopeConfig->getValue( + self::XML_PATH_CHECKOUT_SIDEBAR_COUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->setData('item_count', $count); } return $count; @@ -283,7 +286,10 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart implements \Mage */ public function getIsNeedToDisplaySideBar() { - return (bool)$this->_storeManager->getStore()->getConfig('checkout/sidebar/display'); + return (bool)$this->_scopeConfig->getValue( + 'checkout/sidebar/display', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -338,15 +344,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart implements \Mage $this->_getRendererList()->getNameInLayout() ) as $alias => $block) { /** @var $block \Magento\View\Element\Template */ - $result[] = implode( - '|', - array( - // skip $this->getNameInLayout() and '.' - $alias, - get_class($block), - $block->getTemplate() - ) - ); + $result[] = implode('|', array($alias, get_class($block), $block->getTemplate())); } return implode('|', $result); } diff --git a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php index 02e91344d9c6945af5edcb9a76af84f7628dffbe..a52561ed075b29865d1452946f185b7c968d1dd5 100644 --- a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php +++ b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php @@ -156,7 +156,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -274,8 +274,9 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template } else { $address = $this->_customerAddressService->getDefaultShippingAddress($customerId); } - - $addressId = $address->getId(); + if ($address) { + $addressId = $address->getId(); + } } catch (NoSuchEntityException $e) { // Do nothing } diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php index a85a2ad4217ba48f515cc3dc4da4af098c2185e6..a6cad8e5416e872338cb161025c567ea4b6c07e6 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php +++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php @@ -128,7 +128,11 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage */ public function getCarrierName($carrierCode) { - if ($name = $this->_storeConfig->getConfig('carriers/' . $carrierCode . '/title')) { + if ($name = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $name; } return $carrierCode; diff --git a/app/code/Magento/Checkout/Block/Total/DefaultTotal.php b/app/code/Magento/Checkout/Block/Total/DefaultTotal.php index 47fca28b2b371ff28d332e995530d1e4870a2c42..733b0df8a6d9454ec6ed8224fcedc750712cb90b 100644 --- a/app/code/Magento/Checkout/Block/Total/DefaultTotal.php +++ b/app/code/Magento/Checkout/Block/Total/DefaultTotal.php @@ -36,7 +36,7 @@ class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals protected $_template = 'Magento_Checkout::total/default.phtml'; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -73,7 +73,7 @@ class DefaultTotal extends \Magento\Checkout\Block\Cart\Totals } /** - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Checkout/Controller/Action.php b/app/code/Magento/Checkout/Controller/Action.php index e54d5e9f8671b1a65dd9f60e87b2d98ee5dd1ca0..4e861de57717730a9b35d0487376c2829657b549 100644 --- a/app/code/Magento/Checkout/Controller/Action.php +++ b/app/code/Magento/Checkout/Controller/Action.php @@ -88,9 +88,9 @@ abstract class Action extends \Magento\App\Action\Action $customer, $this->_customerMetadataService->getAllCustomerAttributeMetadata() ); - if (true !== $validationResult && is_array($validationResult)) { + if (!$validationResult->isValid()) { if ($addErrors) { - foreach ($validationResult as $error) { + foreach ($validationResult->getMessages() as $error) { $this->messageManager->addError($error); } } diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index 546398ee7ae813f6e69a5b3934963c83c6d8f09c..3d9c1a1e9ddeb56e74b88d1f2054e51fece67283 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -33,9 +33,9 @@ use Magento\Checkout\Model\Cart as CustomerCart; class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Controller\Product\View\ViewInterface { /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\Checkout\Model\Session @@ -43,7 +43,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro protected $_checkoutSession; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -59,22 +59,22 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro /** * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param CustomerCart $cart */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, CustomerCart $cart ) { $this->_formKeyValidator = $formKeyValidator; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_checkoutSession = $checkoutSession; $this->_storeManager = $storeManager; $this->cart = $cart; @@ -92,8 +92,9 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro if ($returnUrl && $this->_isInternalUrl($returnUrl)) { $this->messageManager->getMessages()->clear(); $this->getResponse()->setRedirect($returnUrl); - } elseif (!$this->_storeConfig->getConfig( - 'checkout/cart/redirect_to_cart' + } elseif (!$this->_scopeConfig->getValue( + 'checkout/cart/redirect_to_cart', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && !$this->getRequest()->getParam( 'in_cart' ) && ($backUrl = $this->_redirect->getRefererUrl()) @@ -117,7 +118,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro { $productId = (int)$this->getRequest()->getParam('product'); if ($productId) { - $storeId = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId(); + $storeId = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId(); $product = $this->_objectManager->create( 'Magento\Catalog\Model\Product' )->setStoreId( @@ -145,20 +146,25 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro if (!$this->cart->getQuote()->validateMinimumAmount()) { $currencyCode = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getCurrentCurrencyCode(); $minimumAmount = $this->_objectManager->get( 'Magento\Locale\CurrencyInterface' )->getCurrency( $currencyCode )->toCurrency( - $this->_storeConfig->getConfig('sales/minimum_order/amount') + $this->_scopeConfig->getValue( + 'sales/minimum_order/amount', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); - $warning = $this->_storeConfig->getConfig( - 'sales/minimum_order/description' - ) ? $this->_storeConfig->getConfig( - 'sales/minimum_order/description' + $warning = $this->_scopeConfig->getValue( + 'sales/minimum_order/description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ? $this->_scopeConfig->getValue( + 'sales/minimum_order/description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : __( 'Minimum order amount is %1', $minimumAmount @@ -573,7 +579,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro { $code = (string)$this->getRequest()->getParam('estimate_method'); if (!empty($code)) { - $this->cart->getQuote()->getShippingAddress()->setShippingMethod($code)/*->collectTotals()*/->save(); + $this->cart->getQuote()->getShippingAddress()->setShippingMethod($code)->save(); } $this->_goBack(); } @@ -656,7 +662,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro /** * Url must start from base secure or base unsecure url */ - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ $store = $this->_storeManager->getStore(); $unsecure = strpos($url, $store->getBaseUrl()) === 0; $secure = strpos($url, $store->getBaseUrl(\Magento\UrlInterface::URL_TYPE_LINK, true)) === 0; diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index b6e8ad545e79f2cb4a27dd979c3136f6feeaa966..b2125a86640b19f039770808ec6c8182ca7901d6 100755 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -233,13 +233,15 @@ class Onepage extends Action } if (!$quote->validateMinimumAmount()) { $error = $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( - 'sales/minimum_order/error_message' + 'Magento\App\Config\ScopeConfigInterface' + )->getValue( + 'sales/minimum_order/error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ? $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( - 'sales/minimum_order/error_message' + 'Magento\App\Config\ScopeConfigInterface' + )->getValue( + 'sales/minimum_order/error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : __( 'Subtotal must exceed minimum order amount' ); diff --git a/app/code/Magento/Checkout/Helper/Cart.php b/app/code/Magento/Checkout/Helper/Cart.php index f0d912aeafd0ae034b0ee269e06abef96f7e693e..63238a5a22cebeab9ff66d3d4f008f3c02c72889 100644 --- a/app/code/Magento/Checkout/Helper/Cart.php +++ b/app/code/Magento/Checkout/Helper/Cart.php @@ -49,9 +49,9 @@ class Cart extends \Magento\Core\Helper\Url /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Checkout\Model\Cart @@ -65,22 +65,22 @@ class Cart extends \Magento\Core\Helper\Url /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Checkout\Model\Cart $checkoutCart * @param \Magento\Checkout\Model\Session $checkoutSession */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Cart $checkoutCart, \Magento\Checkout\Model\Session $checkoutSession ) { $this->_coreData = $coreData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_checkoutCart = $checkoutCart; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $storeManager); @@ -205,11 +205,11 @@ class Cart extends \Magento\Core\Helper\Url /** * Checks if customer should be redirected to shopping cart after adding a product * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return bool */ public function getShouldRedirectToCart($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_REDIRECT_TO_CART, $store); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_REDIRECT_TO_CART, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } } diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 8f8cf1fdd3c920c08bdf503cce35d91749a70755..35802afde64894081076c03f262ffc868ba1f339 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -25,7 +25,7 @@ */ namespace Magento\Checkout\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Sales\Model\Quote\Item\AbstractItem; /** @@ -47,12 +47,12 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -83,8 +83,8 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory @@ -93,15 +93,15 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Translate\Inline\StateInterface $inlineTranslation ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_checkoutSession = $checkoutSession; $this->_localeDate = $localeDate; @@ -156,7 +156,11 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getRequiredAgreementIds() { if (is_null($this->_agreements)) { - if (!$this->_coreStoreConfig->getConfigFlag('checkout/options/enable_agreements')) { + if (!$this->_scopeConfig->isSetFlag( + 'checkout/options/enable_agreements', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { $this->_agreements = array(); } else { $this->_agreements = $this->_agreementCollectionFactory->create()->addStoreFilter( @@ -177,7 +181,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function canOnepageCheckout() { - return (bool)$this->_coreStoreConfig->getConfig('checkout/options/onepage_checkout_enabled'); + return (bool)$this->_scopeConfig->getValue( + 'checkout/options/onepage_checkout_enabled', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -246,11 +253,16 @@ class Data extends \Magento\App\Helper\AbstractHelper { $this->inlineTranslation->suspend(); - $template = $this->_coreStoreConfig->getConfig('checkout/payment_failed/template', $checkout->getStoreId()); + $template = $this->_scopeConfig->getValue( + 'checkout/payment_failed/template', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $checkout->getStoreId() + ); $copyTo = $this->_getEmails('checkout/payment_failed/copy_to', $checkout->getStoreId()); - $copyMethod = $this->_coreStoreConfig->getConfig( + $copyMethod = $this->_scopeConfig->getValue( 'checkout/payment_failed/copy_method', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId() ); $bcc = array(); @@ -258,15 +270,21 @@ class Data extends \Magento\App\Helper\AbstractHelper $bcc = $copyTo; } - $_receiver = $this->_coreStoreConfig->getConfig('checkout/payment_failed/receiver', $checkout->getStoreId()); + $_receiver = $this->_scopeConfig->getValue( + 'checkout/payment_failed/receiver', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $checkout->getStoreId() + ); $sendTo = array( array( - 'email' => $this->_coreStoreConfig->getConfig( + 'email' => $this->_scopeConfig->getValue( 'trans_email/ident_' . $_receiver . '/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId() ), - 'name' => $this->_coreStoreConfig->getConfig( + 'name' => $this->_scopeConfig->getValue( 'trans_email/ident_' . $_receiver . '/name', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId() ) ) @@ -291,13 +309,11 @@ class Data extends \Magento\App\Helper\AbstractHelper $items = ''; foreach ($checkout->getAllVisibleItems() as $_item) { /* @var $_item \Magento\Sales\Model\Quote\Item */ - $items .= $_item->getProduct()->getName() . - ' x ' . - $_item->getQty() . - ' ' . - $checkout->getStoreCurrencyCode() . - ' ' . - $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n"; + $items .= + $_item->getProduct()->getName() . ' x ' . $_item->getQty() . ' ' . $checkout->getStoreCurrencyCode() + . ' ' . $_item->getProduct()->getFinalPrice( + $_item->getQty() + ) . "\n"; } $total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal(); @@ -315,13 +331,23 @@ class Data extends \Magento\App\Helper\AbstractHelper 'customerEmail' => $checkout->getCustomerEmail(), 'billingAddress' => $checkout->getBillingAddress(), 'shippingAddress' => $checkout->getShippingAddress(), - 'shippingMethod' => $this->_coreStoreConfig->getConfig('carriers/' . $shippingMethod . '/title'), - 'paymentMethod' => $this->_coreStoreConfig->getConfig('payment/' . $paymentMethod . '/title'), + 'shippingMethod' => $this->_scopeConfig->getValue( + 'carriers/' . $shippingMethod . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), + 'paymentMethod' => $this->_scopeConfig->getValue( + 'payment/' . $paymentMethod . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), 'items' => nl2br($items), 'total' => $total ) )->setFrom( - $this->_coreStoreConfig->getConfig('checkout/payment_failed/identity', $checkout->getStoreId()) + $this->_scopeConfig->getValue( + 'checkout/payment_failed/identity', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $checkout->getStoreId() + ) )->addTo( $recipient['email'], $recipient['name'] @@ -344,7 +370,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected function _getEmails($configPath, $storeId) { - $data = $this->_coreStoreConfig->getConfig($configPath, $storeId); + $data = $this->_scopeConfig->getValue($configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); if (!empty($data)) { return explode(',', $data); } @@ -364,7 +390,11 @@ class Data extends \Magento\App\Helper\AbstractHelper if ($store === null) { $store = $quote->getStoreId(); } - $guestCheckout = $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_GUEST_CHECKOUT, $store); + $guestCheckout = $this->_scopeConfig->isSetFlag( + self::XML_PATH_GUEST_CHECKOUT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if ($guestCheckout == true) { $result = new \Magento\Object(); @@ -397,6 +427,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isCustomerMustBeLogged() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_CUSTOMER_MUST_BE_LOGGED); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_CUSTOMER_MUST_BE_LOGGED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index 174ca475a0b88d670f30cad3ef2da5512954338e..5c00b0024f622be398699f0910201759859a5156 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -60,12 +60,12 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -96,9 +96,9 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Checkout\Model\Resource\Cart $resourceCart * @param Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession @@ -107,9 +107,9 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Checkout\Model\Resource\Cart $resourceCart, Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, @@ -117,7 +117,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI array $data = array() ) { $this->_eventManager = $eventManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_productFactory = $productFactory; $this->_storeManager = $storeManager; $this->_resourceCart = $resourceCart; @@ -606,7 +606,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI } if ($quoteId && $this->_summaryQty === null) { - if ($this->_coreStoreConfig->getConfig('checkout/cart_link/use_qty')) { + if ($this->_scopeConfig->getValue('checkout/cart_link/use_qty', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_summaryQty = $this->getItemsQty(); } else { $this->_summaryQty = $this->getItemsCount(); diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php index 506fa2d9d0d872e14e03a399ceaeff2bb83754a1..de341d5258e9fa5edcc8daff52cdabc1b5084453 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php @@ -59,13 +59,13 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Filter collection by specified store ids * - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @return $this */ public function addStoreFilter($store) { // check and prepare data - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $store = array($store->getId()); } elseif (is_numeric($store)) { $store = array($store); diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php index ea340061fd69fc07d30001847bc9a24c683e68cb..d4889fa3426b111c198a6252c0ae4a7fb4a034d2 100644 --- a/app/code/Magento/Checkout/Model/Resource/Setup.php +++ b/app/code/Magento/Checkout/Model/Resource/Setup.php @@ -48,7 +48,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Customer\Helper\Address $customerAddress, $moduleName = 'Magento_Checkout', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_customerAddress = $customerAddress; parent::__construct( diff --git a/app/code/Magento/Checkout/Model/Session.php b/app/code/Magento/Checkout/Model/Session.php index f5d002ac8509041c0ae8ed905e0ac25eb0a88277..5f382b5da2e90e5bc66cd7cf07e98e9d8b4dcd60 100644 --- a/app/code/Magento/Checkout/Model/Session.php +++ b/app/code/Magento/Checkout/Model/Session.php @@ -97,12 +97,12 @@ class Session extends \Magento\Session\SessionManager protected $_eventManager; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -113,12 +113,12 @@ class Session extends \Magento\Session\SessionManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param CustomerBuilder $customerBuilder * @param null $sessionName */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, @@ -129,7 +129,7 @@ class Session extends \Magento\Session\SessionManager \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, CustomerBuilder $customerBuilder, $sessionName = null ) { diff --git a/app/code/Magento/Checkout/Model/Type/AbstractType.php b/app/code/Magento/Checkout/Model/Type/AbstractType.php deleted file mode 100644 index beb19d77487b2c08df7922eeb87f4e09448ff44b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Checkout/Model/Type/AbstractType.php +++ /dev/null @@ -1,173 +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 Magento - * @package Magento_Checkout - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Checkout\Model\Type; - -use Magento\Customer\Service\V1\CustomerAddressServiceInterface; -use Magento\Sales\Model\Order; -use Magento\Sales\Model\Quote\Item; - -/** - * Checkout type abstract class - * - * @category Magento - * @package Magento_Checkout - * @author Magento Core Team <core@magentocommerce.com> - */ -abstract class AbstractType extends \Magento\Object -{ - /** - * @var \Magento\Checkout\Model\Session - */ - protected $_checkoutSession; - - /** - * @var \Magento\Customer\Model\Session - */ - protected $_customerSession; - - /** - * @var \Magento\Sales\Model\OrderFactory - */ - protected $_orderFactory; - - /** - * @var CustomerAddressServiceInterface - */ - protected $_customerAddressService; - - /** - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param CustomerAddressServiceInterface $customerAddressService - * @param array $data - */ - public function __construct( - \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Customer\Model\Session $customerSession, - \Magento\Sales\Model\OrderFactory $orderFactory, - CustomerAddressServiceInterface $customerAddressService, - array $data = array() - ) { - parent::__construct($data); - $this->_checkoutSession = $checkoutSession; - $this->_customerSession = $customerSession; - $this->_orderFactory = $orderFactory; - $this->_customerAddressService = $customerAddressService; - } - - /** - * Retrieve checkout session model - * - * @return \Magento\Checkout\Model\Session - */ - public function getCheckoutSession() - { - return $this->_checkoutSession; - } - - /** - * Retrieve quote model - * - * @return \Magento\Sales\Model\Quote - */ - public function getQuote() - { - return $this->getCheckoutSession()->getQuote(); - } - - /** - * Retrieve quote items - * - * @return Item[] - */ - public function getQuoteItems() - { - return $this->getQuote()->getAllItems(); - } - - /** - * Retrieve customer session model - * - * @return \Magento\Customer\Model\Session - */ - public function getCustomerSession() - { - return $this->_customerSession; - } - - /** - * Retrieve customer object - * - * @return \Magento\Customer\Service\V1\Data\Customer - */ - public function getCustomer() - { - return $this->_customerSession->getCustomerDataObject(); - } - - /** - * Retrieve customer default shipping address - * - * @return \Magento\Customer\Service\V1\Data\Address|null - */ - public function getCustomerDefaultShippingAddress() - { - $address = $this->getData('customer_default_shipping_address'); - if (is_null($address)) { - $customerId = $this->getCustomer()->getId(); - $address = $this->_customerAddressService->getDefaultShippingAddress($customerId); - if (!$address) { - /** Default shipping address is not available, try to find any customer address */ - $allAddresses = $this->_customerAddressService->getAddresses($customerId); - $address = count($allAddresses) ? reset($allAddresses) : null; - } - $this->setData('customer_default_shipping_address', $address); - } - return $address; - } - - /** - * Retrieve customer default billing address - * - * @return \Magento\Customer\Service\V1\Data\Address|null - */ - public function getCustomerDefaultBillingAddress() - { - $address = $this->getData('customer_default_billing_address'); - if (is_null($address)) { - $customerId = $this->getCustomer()->getId(); - $address = $this->_customerAddressService->getDefaultBillingAddress($customerId); - if (!$address) { - /** Default billing address is not available, try to find any customer address */ - $allAddresses = $this->_customerAddressService->getAddresses($customerId); - $address = count($allAddresses) ? reset($allAddresses) : null; - } - $this->setData('customer_default_billing_address', $address); - } - return $address; - } -} diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index d96ff08318b6d3490c943fa30cda5279faabc9d5..23c620aa383e5afec436b6575b4e9e2691b86c83 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -44,10 +44,8 @@ class Onepage /** * Checkout types: Checkout as Guest, Register, Logged In Customer */ - const METHOD_GUEST = 'guest'; - + const METHOD_GUEST = 'guest'; const METHOD_REGISTER = 'register'; - const METHOD_CUSTOMER = 'customer'; /** @@ -90,7 +88,7 @@ class Onepage protected $_eventManager = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -159,7 +157,7 @@ class Onepage * @param \Magento\Logger $logger * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Customer\Model\AddressFactory $customrAddrFactory * @param \Magento\Customer\Model\FormFactory $customerFormFactory @@ -183,7 +181,7 @@ class Onepage \Magento\Logger $logger, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Customer\Model\AddressFactory $customrAddrFactory, \Magento\Customer\Model\FormFactory $customerFormFactory, @@ -367,7 +365,7 @@ class Onepage if (!empty($customerAddressId)) { try { $customerAddress = $this->_customerAddressService->getAddress($customerAddressId); - } catch (Exception $e) { + } catch (\Exception $e) { /** Address does not exist */ } if (isset($customerAddress)) { @@ -549,9 +547,14 @@ class Onepage if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) { // We always have $customerRequest here, otherwise we would have been kicked off the function several // lines above - if ($customerRequest->getParam('customer_password') != $customerRequest->getParam('confirm_password')) { - return array('error' => -1, 'message' => __('Password and password confirmation are not equal.')); + $password = $customerRequest->getParam('customer_password'); + if ($password != $customerRequest->getParam('confirm_password')) { + return [ + 'error' => -1, + 'message' => __('Password and password confirmation are not equal.') + ]; } + $quote->setPasswordHash($this->_customerAccountService->getPasswordHash($password)); } else { // set NOT LOGGED IN group id explicitly, // otherwise copyFieldsetToTarget('customer_account', 'to_quote') will fill it with default group id value @@ -563,8 +566,11 @@ class Onepage //validate customer $attributes = $customerForm->getAllowedAttributes(); $result = $this->_customerAccountService->validateCustomerData($customer, $attributes); - if (true !== $result && is_array($result)) { - return $result; + if (!$result->isValid()) { + return [ + 'error' => -1, + 'message' => implode(', ', $result->getMessages()) + ]; } // copy customer/guest email to address diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml index 759c5267eec84e99fee41dff0886d96caf2e0121..23678507e3696c92bb9fb75134609602b89df3de 100644 --- a/app/code/Magento/Checkout/etc/frontend/di.xml +++ b/app/code/Magento/Checkout/etc/frontend/di.xml @@ -36,7 +36,7 @@ </argument> </arguments> </type> - <type name="Magento\Core\Model\Layout"> + <type name="Magento\View\Layout"> <plugin name="checkout-session-depersonalize" type="Magento\Checkout\Model\Layout\DepersonalizePlugin" sortOrder="20"/> </type> diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 7d8b94585ac5e7b9d063d9cfef44142447692cc2..fff8168ea7e96e98f0d3d7f4a8e1806d7679e73a 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_CatalogInventory"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Sales"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Core"/> @@ -43,8 +44,8 @@ <module name="Magento_Wishlist"/> <module name="Magento_Weee"/> <module name="Magento_Backend"/> - <module name="Magento_Service"/> <module name="Magento_PageCache"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php b/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php index ae6a5a69f016b6112a02057057ecdfbf586b97fd..918879b0c94e1e63c3c5d5008adae0fec5ca0c71 100644 --- a/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php +++ b/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php @@ -24,8 +24,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$installer = $this; /* @var $installer \Magento\Checkout\Model\Resource\Setup */ +$installer = $this; $installer->startSetup(); /** @@ -105,9 +105,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('checkout_agreement_store', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('checkout_agreement_store', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php index 94365cfc74b7185c96076a7f83533ed76e14e257..2589265bc417410fd464ba0a43ea58e9186c0e43 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php @@ -36,7 +36,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_wysiwygConfig; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -45,7 +45,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( @@ -53,7 +53,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_wysiwygConfig = $wysiwygConfig; diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php index e716e8abacff3233a335aeaa9426e9e2a8c70181..158c86bd43882670e812895cbcc87e2023ffb204 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Main.php @@ -31,7 +31,7 @@ namespace Magento\Cms\Block\Adminhtml\Page\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -39,14 +39,14 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; diff --git a/app/code/Magento/Cms/Block/Block.php b/app/code/Magento/Cms/Block/Block.php index 2884e8c3d5eb9e8a582737a6951aa8d54269a661..570acb196672a31368a2f29624ecb256f227fd8c 100644 --- a/app/code/Magento/Cms/Block/Block.php +++ b/app/code/Magento/Cms/Block/Block.php @@ -38,7 +38,7 @@ class Block extends \Magento\View\Element\AbstractBlock implements \Magento\View /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -54,14 +54,14 @@ class Block extends \Magento\View\Element\AbstractBlock implements \Magento\View * * @param \Magento\View\Element\Context $context * @param \Magento\Cms\Model\Template\FilterProvider $filterProvider - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Cms\Model\BlockFactory $blockFactory * @param array $data */ public function __construct( \Magento\View\Element\Context $context, \Magento\Cms\Model\Template\FilterProvider $filterProvider, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Cms\Model\BlockFactory $blockFactory, array $data = array() ) { diff --git a/app/code/Magento/Cms/Block/Page.php b/app/code/Magento/Cms/Block/Page.php index 9bc47a8d7e7c4767d4ec2d9caa1744f8cf4f8a78..3b5469c4f9472811091aa3e17e7a60f0df9c9390 100644 --- a/app/code/Magento/Cms/Block/Page.php +++ b/app/code/Magento/Cms/Block/Page.php @@ -43,7 +43,7 @@ class Page extends \Magento\View\Element\AbstractBlock implements \Magento\View\ /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -60,7 +60,7 @@ class Page extends \Magento\View\Element\AbstractBlock implements \Magento\View\ * @param \Magento\View\Element\Context $context * @param \Magento\Cms\Model\Page $page * @param \Magento\Cms\Model\Template\FilterProvider $filterProvider - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Cms\Model\PageFactory $pageFactory * @param array $data */ @@ -68,7 +68,7 @@ class Page extends \Magento\View\Element\AbstractBlock implements \Magento\View\ \Magento\View\Element\Context $context, \Magento\Cms\Model\Page $page, \Magento\Cms\Model\Template\FilterProvider $filterProvider, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Cms\Model\PageFactory $pageFactory, array $data = array() ) { @@ -110,14 +110,17 @@ class Page extends \Magento\View\Element\AbstractBlock implements \Magento\View\ $page = $this->getPage(); // show breadcrumbs - if ($this->_storeConfig->getConfig( - 'web/default/show_cms_breadcrumbs' + if ($this->_scopeConfig->getValue( + 'web/default/show_cms_breadcrumbs', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && ($breadcrumbs = $this->getLayout()->getBlock( 'breadcrumbs' - )) && $page->getIdentifier() !== $this->_storeConfig->getConfig( - 'web/default/cms_home_page' - ) && $page->getIdentifier() !== $this->_storeConfig->getConfig( - 'web/default/cms_no_route' + )) && $page->getIdentifier() !== $this->_scopeConfig->getValue( + 'web/default/cms_home_page', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) && $page->getIdentifier() !== $this->_scopeConfig->getValue( + 'web/default/cms_no_route', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { $breadcrumbs->addCrumb( diff --git a/app/code/Magento/Cms/Controller/Index.php b/app/code/Magento/Cms/Controller/Index.php index 2ba8296d7792f372d4decf10e6ce3df392780275..05f9b02d635aca7dd1fc51cd925f682292b12753 100644 --- a/app/code/Magento/Cms/Controller/Index.php +++ b/app/code/Magento/Cms/Controller/Index.php @@ -43,9 +43,10 @@ class Index extends \Magento\App\Action\Action public function indexAction($coreRoute = null) { $pageId = $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( - \Magento\Cms\Helper\Page::XML_PATH_HOME_PAGE + 'Magento\App\Config\ScopeConfigInterface' + )->getValue( + \Magento\Cms\Helper\Page::XML_PATH_HOME_PAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!$this->_objectManager->get('Magento\Cms\Helper\Page')->renderPage($this, $pageId)) { $this->_forward('defaultIndex'); @@ -90,9 +91,11 @@ class Index extends \Magento\App\Action\Action public function noCookiesAction() { $pageId = $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( - \Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE + 'Magento\App\Config\ScopeConfigInterface', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )->getValue( + \Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!$this->_objectManager->get('Magento\Cms\Helper\Page')->renderPage($this, $pageId)) { $this->_forward('defaultNoCookies'); diff --git a/app/code/Magento/Cms/Controller/Noroute.php b/app/code/Magento/Cms/Controller/Noroute.php index b4030ca72521c6fe6b8f5570d80d481851a48dfc..c1878e36834c805930b262e2ddce5f50ef164ad2 100644 --- a/app/code/Magento/Cms/Controller/Noroute.php +++ b/app/code/Magento/Cms/Controller/Noroute.php @@ -37,9 +37,11 @@ class Noroute extends \Magento\App\Action\Action $this->getResponse()->setHeader('Status', '404 File not found'); $pageId = $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( - \Magento\Cms\Helper\Page::XML_PATH_NO_ROUTE_PAGE + 'Magento\App\Config\ScopeConfigInterface', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )->getValue( + \Magento\Cms\Helper\Page::XML_PATH_NO_ROUTE_PAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!$this->_objectManager->get('Magento\Cms\Helper\Page')->renderPage($this, $pageId)) { $this->_forward('defaultNoRoute'); diff --git a/app/code/Magento/Cms/Controller/Router.php b/app/code/Magento/Cms/Controller/Router.php index 5172c59e02fdb0002f23992ba6fd5b01362ae5df..6764f03ccbdf837f57cb197ffb347f4d0e7c5ae2 100644 --- a/app/code/Magento/Cms/Controller/Router.php +++ b/app/code/Magento/Cms/Controller/Router.php @@ -44,7 +44,7 @@ class Router extends \Magento\App\Router\AbstractRouter /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -84,7 +84,7 @@ class Router extends \Magento\App\Router\AbstractRouter * @param \Magento\UrlInterface $url * @param \Magento\App\State $appState * @param \Magento\Cms\Model\PageFactory $pageFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\ResponseInterface $response */ public function __construct( @@ -93,7 +93,7 @@ class Router extends \Magento\App\Router\AbstractRouter \Magento\UrlInterface $url, \Magento\App\State $appState, \Magento\Cms\Model\PageFactory $pageFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\ResponseInterface $response ) { parent::__construct($actionFactory); diff --git a/app/code/Magento/Cms/Helper/Page.php b/app/code/Magento/Cms/Helper/Page.php index 96381ed7610d8d85b08984d223ec942897c63fb4..8bbb2a8178bbae63053f6e4c58db0eb06d0817e6 100644 --- a/app/code/Magento/Cms/Helper/Page.php +++ b/app/code/Magento/Cms/Helper/Page.php @@ -74,7 +74,7 @@ class Page extends \Magento\App\Helper\AbstractHelper /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -102,7 +102,7 @@ class Page extends \Magento\App\Helper\AbstractHelper * @param \Magento\Theme\Helper\Layout $pageLayout * @param \Magento\View\DesignInterface $design * @param \Magento\Cms\Model\PageFactory $pageFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Escaper $escaper * @param \Magento\App\ViewInterface $view @@ -114,7 +114,7 @@ class Page extends \Magento\App\Helper\AbstractHelper \Magento\Theme\Helper\Layout $pageLayout, \Magento\View\DesignInterface $design, \Magento\Cms\Model\PageFactory $pageFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Escaper $escaper, \Magento\App\ViewInterface $view diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 2277e05a14d32b19423379d4bae9b324220019ec..a84842cf2a205913c177357ef58e9cc5b69f4b88 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -71,7 +71,7 @@ class Images extends \Magento\App\Helper\AbstractHelper /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -82,14 +82,14 @@ class Images extends \Magento\App\Helper\AbstractHelper * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Core\Helper\Data $coreData * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Backend\Helper\Data $backendData, \Magento\Core\Helper\Data $coreData, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { parent::__construct($context); $this->_backendData = $backendData; diff --git a/app/code/Magento/Cms/Model/Observer.php b/app/code/Magento/Cms/Model/Observer.php index 9f212bd39a2b5c22b4e5fd7adba8c0fe8b0b22e0..9742ae62036c856e006a32732df830abd433e3f2 100644 --- a/app/code/Magento/Cms/Model/Observer.php +++ b/app/code/Magento/Cms/Model/Observer.php @@ -40,18 +40,20 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Cms\Helper\Page $cmsPage - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Cms\Helper\Page $cmsPage, \Magento\Core\Model\Store\Config $coreStoreConfig) - { + public function __construct( + \Magento\Cms\Helper\Page $cmsPage, + \Magento\App\Config\ScopeConfigInterface $scopeConfig + ) { $this->_cmsPage = $cmsPage; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -84,7 +86,10 @@ class Observer { $redirect = $observer->getEvent()->getRedirect(); - $pageId = $this->_coreStoreConfig->getConfig(\Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE); + $pageId = $this->_scopeConfig->getValue( + \Magento\Cms\Helper\Page::XML_PATH_NO_COOKIES_PAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $pageUrl = $this->_cmsPage->getPageUrl($pageId); if ($pageUrl) { diff --git a/app/code/Magento/Cms/Model/Resource/Block.php b/app/code/Magento/Cms/Model/Resource/Block.php index 6e09e906d4833ccc8e295797ca401dced947722a..ce303c18fa8232bac57b3a3ddebeccc084fc838c 100644 --- a/app/code/Magento/Cms/Model/Resource/Block.php +++ b/app/code/Magento/Cms/Model/Resource/Block.php @@ -38,7 +38,7 @@ class Block extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -47,12 +47,12 @@ class Block extends \Magento\Model\Resource\Db\AbstractDb * * @param \Magento\App\Resource $resource * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { parent::__construct($resource); $this->_storeManager = $storeManager; @@ -187,7 +187,7 @@ class Block extends \Magento\Model\Resource\Db\AbstractDb $select = parent::_getLoadSelect($field, $value, $object); if ($object->getStoreId()) { - $stores = array((int)$object->getStoreId(), \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $stores = array((int)$object->getStoreId(), \Magento\Store\Model\Store::DEFAULT_STORE_ID); $select->join( array('cbs' => $this->getTable('cms_block_store')), @@ -218,7 +218,7 @@ class Block extends \Magento\Model\Resource\Db\AbstractDb public function getIsUniqueBlockToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore()) { - $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $stores = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID); } else { $stores = (array)$object->getData('stores'); } diff --git a/app/code/Magento/Cms/Model/Resource/Block/Collection.php b/app/code/Magento/Cms/Model/Resource/Block/Collection.php index 6c58d6661827e9cc1addd499dda082c89d9342e7..c1d13b4df71e5c7733541bdac266578deef028eb 100644 --- a/app/code/Magento/Cms/Model/Resource/Block/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Block/Collection.php @@ -54,13 +54,13 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Add filter by store * - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @param bool $withAdmin * @return $this */ public function addStoreFilter($store, $withAdmin = true) { - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $store = array($store->getId()); } @@ -69,7 +69,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio } if ($withAdmin) { - $store[] = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $store[] = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } $this->addFilter('store', array('in' => $store), 'public'); diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php index ee8cc0a11a99c11c74867270f6651d7d4d8c1c81..d2a2abb6931679a60c19ad6f82b2f1a410cd5730 100644 --- a/app/code/Magento/Cms/Model/Resource/Page.php +++ b/app/code/Magento/Cms/Model/Resource/Page.php @@ -33,7 +33,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb /** * Store model * - * @var null|\Magento\Core\Model\Store + * @var null|\Magento\Store\Model\Store */ protected $_store = null; @@ -45,7 +45,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -64,14 +64,14 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb * * @param \Magento\App\Resource $resource * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Filter\FilterManager $filter */ public function __construct( \Magento\App\Resource $resource, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime $dateTime, \Magento\Filter\FilterManager $filter ) { @@ -236,7 +236,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb $select = parent::_getLoadSelect($field, $value, $object); if ($object->getStoreId()) { - $storeIds = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID, (int)$object->getStoreId()); + $storeIds = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, (int)$object->getStoreId()); $select->join( array('cms_page_store' => $this->getTable('cms_page_store')), $this->getMainTable() . '.page_id = cms_page_store.page_id', @@ -297,7 +297,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb public function getIsUniquePageToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore() || !$object->hasStores()) { - $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $stores = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID); } else { $stores = (array)$object->getData('stores'); } @@ -347,7 +347,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb */ public function checkIdentifier($identifier, $storeId) { - $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID, $storeId); + $stores = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $storeId); $select = $this->_getLoadByIdentifierSelect($identifier, $stores, 1); $select->reset(\Zend_Db_Select::COLUMNS)->columns('cp.page_id')->order('cps.store_id DESC')->limit(1); @@ -362,7 +362,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb */ public function getCmsPageTitleByIdentifier($identifier) { - $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $stores = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID); if ($this->_store) { $stores[] = (int)$this->getStore()->getId(); } @@ -431,7 +431,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb /** * Set store model * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return $this */ public function setStore($store) @@ -443,7 +443,7 @@ class Page extends \Magento\Model\Resource\Db\AbstractDb /** * Retrieve store model * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Cms/Model/Resource/Page/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Collection.php index 82266142b42f47437aa325f548edf0da48a3dc27..c1c2d653cbb7fc265f096d3f5c9b7b7c3e0c3a28 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Collection.php @@ -40,7 +40,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -49,7 +49,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -58,7 +58,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -162,14 +162,14 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Add filter by store * - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @param bool $withAdmin * @return $this */ public function addStoreFilter($store, $withAdmin = true) { if (!$this->getFlag('store_filter_added')) { - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $store = array($store->getId()); } @@ -178,7 +178,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio } if ($withAdmin) { - $store[] = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $store[] = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } $this->addFilter('store', array('in' => $store), 'public'); diff --git a/app/code/Magento/Cms/Model/Resource/Setup.php b/app/code/Magento/Cms/Model/Resource/Setup.php index 865e3b9298010467a603441e8d851457a6c9aed0..64fffceac501c3ef483ab2a542e26aa397ba174a 100644 --- a/app/code/Magento/Cms/Model/Resource/Setup.php +++ b/app/code/Magento/Cms/Model/Resource/Setup.php @@ -26,7 +26,7 @@ namespace Magento\Cms\Model\Resource; /** * Cms resource setup */ -class Setup extends \Magento\Core\Model\Resource\Setup\Generic +class Setup extends \Magento\Module\Setup { /** * Block factory @@ -43,7 +43,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup\Generic protected $_pageFactory; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Cms\Model\BlockFactory $blockFactory * @param \Magento\Cms\Model\PageFactory $pageFactory @@ -51,12 +51,12 @@ class Setup extends \Magento\Core\Model\Resource\Setup\Generic * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\Cms\Model\BlockFactory $blockFactory, \Magento\Cms\Model\PageFactory $pageFactory, $moduleName = 'Magento_Cms', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_blockFactory = $blockFactory; $this->_pageFactory = $pageFactory; diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Config.php b/app/code/Magento/Cms/Model/Wysiwyg/Config.php index a09e0bade5d00732567ab02761470b772d59b38b..ebbfc78c52410ec39677b4a455ff45365afe66d9 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Config.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Config.php @@ -81,9 +81,9 @@ class Config extends \Magento\Object /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var array @@ -103,7 +103,7 @@ class Config extends \Magento\Object * @param \Magento\View\Url $viewUrl * @param \Magento\Core\Model\Variable\Config $variableConfig * @param \Magento\Widget\Model\Widget\Config $widgetConfig - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $windowSize * @param array $data */ @@ -115,14 +115,14 @@ class Config extends \Magento\Object \Magento\View\Url $viewUrl, \Magento\Core\Model\Variable\Config $variableConfig, \Magento\Widget\Model\Widget\Config $widgetConfig, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $windowSize = array(), array $data = array() ) { $this->_backendUrl = $backendUrl; $this->_eventManager = $eventManager; $this->_cmsData = $cmsData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_authorization = $authorization; $this->_viewUrl = $viewUrl; $this->_variableConfig = $variableConfig; @@ -220,7 +220,7 @@ class Config extends \Magento\Object */ public function isEnabled() { - $wysiwygState = $this->_coreStoreConfig->getConfig('cms/wysiwyg/enabled', $this->getStoreId()); + $wysiwygState = $this->_scopeConfig->getValue('cms/wysiwyg/enabled', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStoreId()); return in_array($wysiwygState, array(self::WYSIWYG_ENABLED, self::WYSIWYG_HIDDEN)); } @@ -231,6 +231,6 @@ class Config extends \Magento\Object */ public function isHidden() { - return $this->_coreStoreConfig->getConfig('cms/wysiwyg/enabled') == self::WYSIWYG_HIDDEN; + return $this->_scopeConfig->getValue('cms/wysiwyg/enabled', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) == self::WYSIWYG_HIDDEN; } } diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 8f5cad2c4fe1086e851d0005f182c349ab8eaa54..d05054aa378dc0d712f9718929eca7e4bafeb9ed 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -43,7 +43,7 @@ class Storage extends \Magento\Object /** * Config object * - * @var \Magento\Core\Model\Config\Element + * @var \Magento\App\Config\Element */ protected $_config; diff --git a/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.2-1.6.0.0.3.php b/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.2-1.6.0.0.3.php index e84817a31f8dc3ffe18a9ee2ad42325676c40d03..924322b7b1086774f269ff71db0b5d3075690ded 100644 --- a/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.2-1.6.0.0.3.php +++ b/app/code/Magento/Cms/data/cms_setup/data-upgrade-1.6.0.0.2-1.6.0.0.3.php @@ -24,36 +24,36 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'cms_block', 'content', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, array('block_id') ); $installer->appendClassAliasReplace( 'cms_page', 'content', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, array('page_id') ); $installer->appendClassAliasReplace( 'cms_page', 'layout_update_xml', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, array('page_id') ); $installer->appendClassAliasReplace( 'cms_page', 'custom_layout_update_xml', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, array('page_id') ); diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index 892237ac4f7aa2db57bbe6817976c27ed71f47f1..86e1e610ed0693ac3e1d7e196eac13d034e89350 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -27,10 +27,12 @@ <module name="Magento_Cms" version="2.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_UrlRewrite" /> <module name="Magento_Theme"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Theme"/> <module name="Magento_Widget"/> diff --git a/app/code/Magento/Cms/sql/cms_setup/install-1.6.0.0.php b/app/code/Magento/Cms/sql/cms_setup/install-1.6.0.0.php index 16c5f61473319296fc9fdef6afa4406489ffdfd2..0dffa5b6d9951acb911f6e19b988cd58cb0d98af 100644 --- a/app/code/Magento/Cms/sql/cms_setup/install-1.6.0.0.php +++ b/app/code/Magento/Cms/sql/cms_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -110,9 +110,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('cms_block_store', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('cms_block_store', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -270,9 +270,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('cms_page_store', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('cms_page_store', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Composite/Fieldset/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Composite/Fieldset/Configurable.php index fc7e60a756bbfef063a77ee248715d0e2fe08998..c1c4227c93de7615b8e3fea7f779ba9aa8c89072 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Composite/Fieldset/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Composite/Fieldset/Configurable.php @@ -51,7 +51,7 @@ class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\ /** * Retrieve current store * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getCurrentStore() { diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php index 671ad98033cd57eb8c0a8ab3b6b006ceb8aac68f..945f90ec461d46db70633aa989d9109a42b2544a 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config.php @@ -69,18 +69,12 @@ class Config extends Widget implements TabInterface */ protected $_jsonEncoder; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_config; - /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder * @param Configurable $configurableType * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Registry $coreRegistry - * @param \Magento\App\ConfigInterface $config * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param array $data */ @@ -90,7 +84,6 @@ class Config extends Widget implements TabInterface Configurable $configurableType, \Magento\Catalog\Helper\Data $catalogData, \Magento\Registry $coreRegistry, - \Magento\App\ConfigInterface $config, \Magento\Locale\CurrencyInterface $localeCurrency, array $data = array() ) { @@ -98,7 +91,6 @@ class Config extends Widget implements TabInterface $this->_coreRegistry = $coreRegistry; $this->_catalogData = $catalogData; $this->_jsonEncoder = $jsonEncoder; - $this->_config = $config; $this->_localeCurrency = $localeCurrency; parent::__construct($context, $data); } @@ -427,7 +419,7 @@ class Config extends Widget implements TabInterface public function getBaseCurrency() { return $this->_localeCurrency->getCurrency( - $this->_config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default') + $this->_scopeConfig->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default') ); } } diff --git a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php index 48b47ffaa1078ea235c6498d5c4b88ae6b12bfd4..57077d22a1995c8401a2a48aa103c83dc5df43e2 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php +++ b/app/code/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/Matrix.php @@ -51,12 +51,7 @@ class Matrix extends \Magento\Backend\Block\Template protected $_productFactory; /** - * @var \Magento\Catalog\Model\Config - */ - protected $_config; - - /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_applicationConfig; @@ -71,7 +66,6 @@ class Matrix extends \Magento\Backend\Block\Template * @param \Magento\Catalog\Model\Config $config * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Registry $coreRegistry - * @param \Magento\App\ConfigInterface $applicationConfig * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param array $data */ @@ -81,7 +75,6 @@ class Matrix extends \Magento\Backend\Block\Template \Magento\Catalog\Model\Config $config, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Registry $coreRegistry, - \Magento\App\ConfigInterface $applicationConfig, \Magento\Locale\CurrencyInterface $localeCurrency, array $data = array() ) { @@ -89,7 +82,6 @@ class Matrix extends \Magento\Backend\Block\Template $this->_productFactory = $productFactory; $this->_config = $config; $this->_coreRegistry = $coreRegistry; - $this->_applicationConfig = $applicationConfig; $this->_localeCurrency = $localeCurrency; parent::__construct($context, $data); } @@ -103,7 +95,7 @@ class Matrix extends \Magento\Backend\Block\Template public function renderPrice($price) { return $this->_localeCurrency->getCurrency( - $this->_applicationConfig->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default') + $this->_scopeConfig->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default') )->toCurrency( sprintf('%f', $price) ); @@ -169,8 +161,8 @@ class Matrix extends \Magento\Backend\Block\Template $filledVariation = array(); for ($attributeIndex = $attributesCount; $attributeIndex--;) { $currentAttribute = $variationalAttributes[$attributeIndex]; - $filledVariation[$currentAttribute['id']] = - $currentAttribute['values'][$currentVariation[$attributeIndex]]; + $currentVariationValue = $currentVariation[$attributeIndex]; + $filledVariation[$currentAttribute['id']] = $currentAttribute['values'][$currentVariationValue]; } $variations[] = $filledVariation; diff --git a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php index cc5dcdcb8158aad2128ec5ade999a2ed0578bb25..a75a250a573f971a8aa18ce67ba73f16758f6840 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php @@ -107,8 +107,9 @@ class Configurable extends \Magento\Checkout\Block\Cart\Item\Renderer implements * Show parent product thumbnail if it must be always shown according to the related setting in system config * or if child thumbnail is not available */ - if ($this->_storeConfig->getConfig( - self::CONFIG_THUMBNAIL_SOURCE + if ($this->_scopeConfig->getValue( + self::CONFIG_THUMBNAIL_SOURCE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == ThumbnailSource::OPTION_USE_PARENT_IMAGE || !($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection') ) { diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index f3b9038865694c4f01c9677259729f25e4ef48e6..07112dbe5bfb7942c8f98972801a1b39d360231b 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -175,7 +175,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView /** * Retrieve current store * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getCurrentStore() { diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index c11a465980070527dd259099d14cb5337998d583..476c2d534290bd75beb895e83aed516b7eb2db7e 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -93,11 +93,9 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType protected $_canConfigure = true; /** - * Store manager - * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeManager; + protected $_scopeConfig; /** * Catalog product type configurable @@ -178,7 +176,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Product\CollectionFactory $productCollectionFactory * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable $catalogProductTypeConfigurable - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -202,7 +200,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Product\CollectionFactory $productCollectionFactory, \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable $catalogProductTypeConfigurable, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $data = array() ) { $this->_typeConfigurableFactory = $typeConfigurableFactory; @@ -213,7 +211,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $this->_productCollectionFactory = $productCollectionFactory; $this->_attributeCollectionFactory = $attributeCollectionFactory; $this->_catalogProductTypeConfigurable = $catalogProductTypeConfigurable; - $this->_storeManager = $storeManager; + $this->_scopeConfig = $scopeConfig; parent::__construct( $productFactory, $catalogProductOption, @@ -780,17 +778,21 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType } } - $_result[0]->setParentProductId($product->getId()) - // add custom option to simple product for protection of process - //when we add simple product separately - ->addCustomOption('parent_product_id', $product->getId()); + $_result[0]->setParentProductId( + $product->getId() + )->addCustomOption( + 'parent_product_id', + $product->getId() + ); if ($this->_isStrictProcessMode($processMode)) { $_result[0]->setCartQty(1); } $result[] = $_result[0]; return $result; - } else if (!$this->_isStrictProcessMode($processMode)) { - return $result; + } else { + if (!$this->_isStrictProcessMode($processMode)) { + return $result; + } } } } @@ -1135,7 +1137,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $postData ) { $product->setStoreId( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID )->setTypeId( $postData['weight'] ? \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE : \Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL )->setAttributeSetId( @@ -1157,8 +1159,9 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $postData['stock_data'] = $parentProduct->getStockData(); $postData['stock_data']['manage_stock'] = $postData['quantity_and_stock_status']['qty'] === '' ? 0 : 1; - $configDefaultValue = $this->_storeManager->getStore()->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK + $configDefaultValue = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $postData['stock_data']['use_config_manage_stock'] = $postData['stock_data']['manage_stock'] == $configDefaultValue ? 1 : 0; diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php index 288872fdda670c3b860eb8e1442760356f578598..ecc1a91ca9ed25f0c194676523d313eb007aa2b1 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php @@ -36,7 +36,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price /** * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Event\ManagerInterface $eventManager @@ -44,7 +44,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Event\ManagerInterface $eventManager, diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php index f1e604d38b7f1b3eb0b08acae28811fff31f1c43..353ceaba472f9f5cff7dcf9651f10de59c01a666 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Collection/AssociatedProduct.php @@ -65,10 +65,10 @@ class AssociatedProduct extends \Magento\Catalog\Model\Resource\Product\Collecti * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -91,10 +91,10 @@ class AssociatedProduct extends \Magento\Catalog\Model\Resource\Product\Collecti \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -121,7 +121,7 @@ class AssociatedProduct extends \Magento\Catalog\Model\Resource\Product\Collecti $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php index 4eb75a09e5bcd3aca63e0448969ae20f5e136469..266748ff6aa93b2b090f382e2c2008769f204e2a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php @@ -209,7 +209,7 @@ class Configurable extends \Magento\Model\Resource\Db\AbstractDb ' AND ', array( 'option_value.option_id = entity_value.value', - 'option_value.store_id = ' . \Magento\Core\Model\Store::DEFAULT_STORE_ID + 'option_value.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ), array() diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php index 26baad63213b611c9f7ade26a30fdff26aa00cc0..d1b5025c2e8e46e643bb943abdb955086e64bb1c 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php @@ -51,18 +51,18 @@ class Attribute extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php index 3d77f0eec6be87d9fce88ef5a38be881f4871eb7..084589a80215e6976859488e43bbf5594011feae 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php @@ -68,7 +68,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -77,7 +77,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ConfigurableProduct\Model\Product\Type\Configurable $catalogProductTypeConfigurable * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute $resource @@ -88,7 +88,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ConfigurableProduct\Model\Product\Type\Configurable $catalogProductTypeConfigurable, \Magento\Catalog\Helper\Data $catalogData, \Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute $resource, diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index 1536277354743fdc6954567ea7cdc56057b5b868..f2d8d3a89f3b383072ad0d54e9096b30b5c040d0 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -28,11 +28,12 @@ <sequence> <module name="Magento_Catalog"/> <module name="Magento_CatalogInventory"/> - <module name="Magento_Sales" /> - <module name="Magento_Checkout" /> - <module name="Magento_ImportExport" /> + <module name="Magento_Sales"/> + <module name="Magento_Checkout"/> + <module name="Magento_ImportExport"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog" /> <module name="Magento_CatalogInventory" /> <module name="Magento_Sales" /> diff --git a/app/code/Magento/ConfigurableProduct/etc/product_types.xml b/app/code/Magento/ConfigurableProduct/etc/product_types.xml index d2c43fc6d40a8c277f0cfb2c6c854510324ae002..212315bef91207ddfb499652d7e56271c5d7c6cf 100644 --- a/app/code/Magento/ConfigurableProduct/etc/product_types.xml +++ b/app/code/Magento/ConfigurableProduct/etc/product_types.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Catalog/etc/product_types.xsd"> - <type name="configurable" label="Configurable Product" modelInstance="Magento\ConfigurableProduct\Model\Product\Type\Configurable" composite='true' indexPriority="30"> + <type name="configurable" label="Configurable Product" modelInstance="Magento\ConfigurableProduct\Model\Product\Type\Configurable" composite='true' indexPriority="30" sortOrder="20"> <priceModel instance="Magento\ConfigurableProduct\Model\Product\Type\Configurable\Price" /> <indexerModel instance="Magento\ConfigurableProduct\Model\Resource\Product\Indexer\Price\Configurable" /> <stockIndexerModel instance="Magento\ConfigurableProduct\Model\Resource\Indexer\Stock\Configurable" /> diff --git a/app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php b/app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php index 416730566ab90146d678b828078468d433c8fa54..6ae02dd6e4b4cee6a61339b6dcad92bd414da260 100644 --- a/app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php +++ b/app/code/Magento/ConfigurableProduct/sql/configurable_setup/install-1.0.0.0.php @@ -142,9 +142,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('catalog_product_super_attribute_label', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -209,9 +209,9 @@ $table = $installer->getConnection()->newTable( array('product_super_attribute_id', 'value_index', 'website_id'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) )->addForeignKey( - $installer->getFkName('catalog_product_super_attribute_pricing', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('catalog_product_super_attribute_pricing', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-js-template.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-js-template.phtml index 5e9891b3ac850bee93a8e64d133e0a99dbff0459..1a040012b7230351c8b308356b08b4eac3fbfb1d 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-js-template.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-js-template.phtml @@ -102,12 +102,12 @@ </div> </div> <div class="field field-pricing-measure"> - <div class="actions-split actions-select"> + <div class="actions dropdown actions-select"> <input name="product[configurable_attributes_data][${attribute.id}][values][${option.value}][is_percent]" type="hidden" value="0"/> - <button type="button" class="action-toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> + <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo $this->getBaseCurrency()->getSymbol() ?></span> </button> - <ul class="dropdown-menu" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> + <ul class="dropdown" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> <li data-value="0"><a class="item"><?php echo $this->getBaseCurrency()->getSymbol() ?></a></li> <li data-value="1"><a class="item"><?php echo __('%')?></a></li> </ul> @@ -171,13 +171,12 @@ </div> </div> <div class="field field-pricing-measure"> - <div class="actions-split actions-select"> - <input type="hidden" value="0" - name="product[configurable_attributes_data][${attribute.id}][values][${option.id}][is_percent]"/> - <button type="button" class="action-toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> + <div class="actions dropdown actions-select"> + <input type="hidden" value="0" name="product[configurable_attributes_data][${attribute.id}][values][${option.id}][is_percent]"/> + <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo $this->getBaseCurrency()->getSymbol() ?></span> </button> - <ul class="dropdown-menu" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> + <ul class="dropdown" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> <li data-value="0"><a class="item"><?php echo $this->getBaseCurrency()->getSymbol() ?></a></li> <li data-value="1"><a class="item"><?php echo __('%')?></a></li> </ul> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-template.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-template.phtml index 9ea5db6549bdda3cd8b61f485ed087e563901a90..22cceedd69877850fed936790080748ac76db1f9 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-template.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/attribute-template.phtml @@ -139,12 +139,12 @@ $id = $this->escapeHtml($attribute['attribute_id']); </div> </div> <div class="field field-pricing-measure"> - <div class="actions-split actions-select"> + <div class="actions dropdown actions-select"> <input name="<?php echo $namePrefix ?>[<?php echo $valueIndex ?>][is_percent]" type="hidden" value="<?php echo $isPercent ? 1 : 0; ?>"/> - <button type="button" class="action-toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> + <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo $isPercent ? __('%') : $this->getBaseCurrency()->getSymbol() ?></span> </button> - <ul class="dropdown-menu" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> + <ul class="dropdown" data-role="dropdown-menu" data-mage-init='{"menu":{}}'> <li data-value="0"><a class="item"><?php echo $this->getBaseCurrency()->getSymbol() ?></a></li> <li data-value="1"><a class="item"><?php echo __('%')?></a></li> </ul> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml index 7edc4d883099434018abf562bf4140fb83dd20a4..08cf74a8938fa3231c92ce9a4fa8c4acff96a4e0 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml @@ -169,8 +169,8 @@ $productByUsedAttributes = $this->getAssociatedProducts(); class="checkbox" data-column="entity_id" <?php echo $checked?> /> </td> <td class="col-image" data-column="image"> - <div class="actions-split actions-image-uploader"> - <div class="action-upload" data-action="upload-image"> + <div class="actions split actions-image-uploader"> + <div class="action-upload action split" data-action="upload-image"> <span><?php echo __('Upload Image'); ?></span> <input name="image" type="file" <?php echo $disabled;?> data-url="<?php echo $this->escapeHtml($this->getImageUploadUrl()) ?>" @@ -179,10 +179,10 @@ $productByUsedAttributes = $this->getAssociatedProducts(); name="variations-matrix[<?php echo $key?>][image]" type="hidden" <?php echo $disabled;?>/> </div> - <button type="button" class="action-toggle no-display" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> + <button type="button" class="action toggle no-display" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo __('Select'); ?></span> </button> - <ul class="dropdown-menu"> + <ul class="dropdown"> <li> <a class="item" data-action="no-image"><?php echo __('No Image'); ?></a> </li> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/affected-attribute-set-selector/form.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/affected-attribute-set-selector/form.phtml index 7216aa21d1787de61c0eac06f5e1f51b52e0bf60..6e5957027a27bbdddd227518db2aaa6dbb6172bf 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/affected-attribute-set-selector/form.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/affected-attribute-set-selector/form.phtml @@ -26,30 +26,42 @@ ?> <div id="<?php echo $this->getNameInLayout() ?>" style="display:none" data-role="dialog" data-id="affected-attribute-set-selector"> <form action=""> + <div class="messages"> <div class="message notice"> <div><?php echo __("Attribute set comprising all selected configurable attributes need to be in order to save generated variations.") ?></div> </div> <div class="message error" style="display:none"></div> </div> - <div id="affected-attribute-set-current-container" data-role="container" data-id="current-attribute-set"> - <label> - <input type="radio" name="affected-attribute-set" value="current" checked="checked" /> - <?php echo __('Add configurable attributes to the current set ("<span data-role="name-container">%1</span>")', $this->getLayout()->getBlock('product_edit')->getAttributeSetName())?> - </label> - </div> - <div id="affected-attribute-set-new-container"> - <label> - <input type="radio" name="affected-attribute-set" value="new" /> - <?php echo __('Add configurable attributes to the new set based on current')?> - </label> - </div> - <div id="affected-attribute-set-new-name-container" style="display:none"> - <label> - <?php echo __('New attribute set name')?> - <span class="required">*</span><br /> - <input name="new-attribute-set-name" type="text" class="input-text required-entry validate-no-html-tags" /> - </label> - </div> + + <fieldset class="fieldset"> + <div class="field" id="affected-attribute-set-current-container" data-role="container" data-id="current-attribute-set"> + <div class="control"> + <input type="radio" id="affected-attribute-set-current" name="affected-attribute-set" value="current" checked="checked" /> + <label class="label" for="affected-attribute-set-current"> + <span><?php echo __('Add configurable attributes to the current set ("<span data-role="name-container">%1</span>")', $this->getLayout()->getBlock('product_edit')->getAttributeSetName())?></span> + </label> + </div> + </div> + + <div class="field" id="affected-attribute-set-new-container"> + <div class="control"> + <input type="radio" id="affected-attribute-set-new" name="affected-attribute-set" value="new" /> + <label class="label" for="affected-attribute-set-new"> + <span><?php echo __('Add configurable attributes to the new set based on current')?></span> + </label> + </div> + </div> + + <div class="field required" id="affected-attribute-set-new-name-container" style="display:none"> + <label class="label" for="new-attribute-set-name"> + <span><?php echo __('New attribute set name')?></span> + </label> + + <div class="control"> + <input id="new-attribute-set-name" name="new-attribute-set-name" type="text" class="input-text required-entry validate-no-html-tags" /> + </div> + </div> + </fieldset> </form> </div> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/product.css b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/product.css index 4cd33c03aafb35bcdb09bd41a74ab884acfbcba4..c8130fb80f35cce04ec63bb262af45c1c3e2e082 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/product.css +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/product.css @@ -47,10 +47,6 @@ margin-bottom: 23px; } -#configurable-attributes-container .col-name { - width: 65%; -} - #configurable-attributes-container .col-include { width: 80px; } @@ -60,7 +56,7 @@ } #configurable-attributes-container .col-change-price { - width: 150px; + width: 120px; } #configurable-attributes-container .field-change-pricing .field { @@ -68,11 +64,12 @@ } #configurable-attributes-container .field-change-pricing .field-pricing-value { - width: 75px; + width: 60px !important; + margin-bottom: 0 !important; } -#configurable-attributes-container .field-change-pricing .action-toggle { - min-width: 40px; +#configurable-attributes-container .field-change-pricing .field-pricing-measure { + margin-bottom: 0 !important; } @media screen and (max-width: 960px) { @@ -81,10 +78,6 @@ } } -#configurable-attributes-container .field-pricing-value .control { - width: 75px; -} - #configurable-attributes-container .field-pricing-value .pricing-value { width: 100%; padding: 4px; @@ -92,10 +85,6 @@ border-radius: 4px 0 0 4px; } -#configurable-attributes-container .field-pricing-measure select { - border-radius: 0 4px 4px 0; -} - /* "Generate Variations" button */ .generate { margin-bottom: 18px; @@ -105,45 +94,6 @@ margin-bottom: 10px; } -/* Variations Image Uploader */ -.eq-ie8 .actions-image-uploader .action-upload { - filter: none; -} - -.actions-image-uploader .action-toggle, -.actions-image-uploader .action-toggle:hover, -.actions-image-uploader .action-toggle:active, -.actions-image-uploader .action-toggle:focus, -.actions-image-uploader .action-toggle[disabled] { - position: relative; - height: 33px; - padding-left: 2px; - padding-right: 2px; - background: #fff; - filter: none; - color: #888; -} - -.actions-image-uploader.active .action-toggle { - border-radius: 0 5px 0 0; -} - -.actions-image-uploader.active .action-toggle:after { - position: absolute; - left: 0; - right: 0; - bottom: -1px; - height: 1px; - background: #fff; - z-index: 991; - content: ''; -} - -.actions-image-uploader .dropdown-menu { - margin-top: -1px; - border-radius: 3px 0 3px 3px; -} - #product-variations-matrix img.variation { position: relative; border: 0; @@ -257,7 +207,7 @@ } #product-variations-matrix .col-name { - width: 30%; + width: 29%; } #product-variations-matrix .col-sku { diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local.php index 8850e5f11c68dcd2255ca2e4cd51702ddaf4ee7e..61004ba22bfbbdf8c2b889d4d56ff96558e54e2b 100644 --- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local.php +++ b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Local.php @@ -43,7 +43,7 @@ class Local extends \Magento\Backend\App\Action public function indexAction() { $url = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getBaseUrl( 'web' ) . 'downloader/?return=' . urlencode( diff --git a/app/code/Magento/Connect/Helper/Data.php b/app/code/Magento/Connect/Helper/Data.php index b226ff00de3a194692178f8e91bb35c8d6d9178f..b88e9b5c27945132101a598ef9ed211fd91233a1 100644 --- a/app/code/Magento/Connect/Helper/Data.php +++ b/app/code/Magento/Connect/Helper/Data.php @@ -47,8 +47,8 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\App\Filesystem $filesystem * @param \Magento\Convert\Xml $xmlConverter @@ -56,8 +56,8 @@ class Data extends \Magento\Core\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\App\Filesystem $filesystem, \Magento\Convert\Xml $xmlConverter, @@ -66,7 +66,7 @@ class Data extends \Magento\Core\Helper\Data $this->filesystem = $filesystem; $this->readDirectory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::VAR_DIR); $this->_xmlConverter = $xmlConverter; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** diff --git a/app/code/Magento/Connect/Model/Session.php b/app/code/Magento/Connect/Model/Session.php index e1c6d346bc61b10754eba7e59a826e4e89e13620..b3b74e27985fddcd47e40b6889980fffabb50779 100644 --- a/app/code/Magento/Connect/Model/Session.php +++ b/app/code/Magento/Connect/Model/Session.php @@ -38,7 +38,7 @@ class Session extends \Magento\Session\SessionManager protected $_connectData; /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -47,7 +47,7 @@ class Session extends \Magento\Session\SessionManager * @param \Magento\Connect\Helper\Data $connectData */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, diff --git a/app/code/Magento/Connect/etc/module.xml b/app/code/Magento/Connect/etc/module.xml index 5ee0fcdb77e70457370081b04c962cc264f68db9..7dbab3d6b9641b37b77ae78f1b74b481ba698436 100644 --- a/app/code/Magento/Connect/etc/module.xml +++ b/app/code/Magento/Connect/etc/module.xml @@ -26,6 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Connect" version="1.6.0.0" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Contacts/Controller/Index.php b/app/code/Magento/Contact/Controller/Index.php similarity index 79% rename from app/code/Magento/Contacts/Controller/Index.php rename to app/code/Magento/Contact/Controller/Index.php index 3797bee1694e0d7faa98e5413b7befae13efa6d0..0ea8142e10a2c35629fe1364b49f84f822d2fad7 100644 --- a/app/code/Magento/Contacts/Controller/Index.php +++ b/app/code/Magento/Contact/Controller/Index.php @@ -18,33 +18,26 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Contacts index controller - * - * @category Magento - * @package Magento_Contacts - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Contacts\Controller; +namespace Magento\Contact\Controller; use Magento\App\Action\NotFoundException; use Magento\App\RequestInterface; +/** + * Contact index controller + */ class Index extends \Magento\App\Action\Action { - const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email'; + const XML_PATH_EMAIL_RECIPIENT = 'contact/email/recipient_email'; - const XML_PATH_EMAIL_SENDER = 'contacts/email/sender_email_identity'; + const XML_PATH_EMAIL_SENDER = 'contact/email/sender_email_identity'; - const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template'; + const XML_PATH_EMAIL_TEMPLATE = 'contact/email/email_template'; - const XML_PATH_ENABLED = 'contacts/contacts/enabled'; + const XML_PATH_ENABLED = 'contact/contact/enabled'; /** * @var \Magento\Mail\Template\TransportBuilder @@ -80,7 +73,13 @@ class Index extends \Magento\App\Action\Action */ public function dispatch(RequestInterface $request) { - if (!$this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfigFlag(self::XML_PATH_ENABLED)) { + if (!$this->_objectManager->get( + 'Magento\App\Config\ScopeConfigInterface' + )->isSetFlag( + self::XML_PATH_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { throw new NotFoundException(); } return parent::dispatch($request); @@ -145,10 +144,13 @@ class Index extends \Magento\App\Action\Action throw new \Exception(); } - $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config'); - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + $scopeConfig = $this->_objectManager->get('Magento\App\Config\ScopeConfigInterface'); + $storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface'); $transport = $this->_transportBuilder->setTemplateIdentifier( - $storeConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE) + $scopeConfig->getValue( + self::XML_PATH_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, @@ -157,9 +159,15 @@ class Index extends \Magento\App\Action\Action )->setTemplateVars( array('data' => $postObject) )->setFrom( - $storeConfig->getConfig(self::XML_PATH_EMAIL_SENDER) + $scopeConfig->getValue( + self::XML_PATH_EMAIL_SENDER, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( - $storeConfig->getConfig(self::XML_PATH_EMAIL_RECIPIENT) + $scopeConfig->getValue( + self::XML_PATH_EMAIL_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setReplyTo( $post['email'] )->getTransport(); diff --git a/app/code/Magento/Contacts/Helper/Data.php b/app/code/Magento/Contact/Helper/Data.php similarity index 78% rename from app/code/Magento/Contacts/Helper/Data.php rename to app/code/Magento/Contact/Helper/Data.php index e804a06140d32efb57d15cda06536c945e228635..324360785309baaadeceb5d674840024d1950a43 100644 --- a/app/code/Magento/Contacts/Helper/Data.php +++ b/app/code/Magento/Contact/Helper/Data.php @@ -18,31 +18,24 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Contact\Helper; /** - * Contacts base helper - * - * @category Magento - * @package Magento_Contacts - * @author Magento Core Team <core@magentocommerce.com> + * Contact base helper */ -namespace Magento\Contacts\Helper; - class Data extends \Magento\App\Helper\AbstractHelper { - const XML_PATH_ENABLED = 'contacts/contacts/enabled'; + const XML_PATH_ENABLED = 'contact/contact/enabled'; /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Customer session @@ -53,15 +46,15 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $customerSession ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_customerSession = $customerSession; parent::__construct($context); } @@ -73,7 +66,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isEnabled() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_ENABLED); + return $this->_scopeConfig->getValue(self::XML_PATH_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Contacts/Model/System/Config/Backend/Links.php b/app/code/Magento/Contact/Model/System/Config/Backend/Links.php similarity index 79% rename from app/code/Magento/Contacts/Model/System/Config/Backend/Links.php rename to app/code/Magento/Contact/Model/System/Config/Backend/Links.php index 652b446194d28bb37c6d484a6565634c905d54b2..dfa18fa0b49c0d8f5dc258ae2283e231f4a11d7e 100644 --- a/app/code/Magento/Contacts/Model/System/Config/Backend/Links.php +++ b/app/code/Magento/Contact/Model/System/Config/Backend/Links.php @@ -18,18 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Contact\Model\System\Config\Backend; /** * Cache cleaner backend model - * */ -namespace Magento\Contacts\Model\System\Config\Backend; - class Links extends \Magento\Backend\Model\Config\Backend\Cache implements \Magento\Object\IdentityInterface { /** @@ -37,7 +33,7 @@ class Links extends \Magento\Backend\Model\Config\Backend\Cache implements \Mage * * @var string[] */ - protected $_cacheTags = array(\Magento\Core\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); + protected $_cacheTags = array(\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); /** * Get identities @@ -46,6 +42,6 @@ class Links extends \Magento\Backend\Model\Config\Backend\Cache implements \Mage */ public function getIdentities() { - return array(\Magento\Core\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); + return array(\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); } } diff --git a/app/code/Magento/Contacts/etc/adminhtml/acl.xml b/app/code/Magento/Contact/etc/adminhtml/acl.xml similarity index 90% rename from app/code/Magento/Contacts/etc/adminhtml/acl.xml rename to app/code/Magento/Contact/etc/adminhtml/acl.xml index ab484b8fcdbf1abb345f388a5c7e4c7a46aff3fb..ea500824b6f9760eefcb7ad0dd1b0823963ae5e9 100644 --- a/app/code/Magento/Contacts/etc/adminhtml/acl.xml +++ b/app/code/Magento/Contact/etc/adminhtml/acl.xml @@ -19,8 +19,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -32,7 +30,7 @@ <resource id="Magento_Adminhtml::stores"> <resource id="Magento_Adminhtml::stores_settings"> <resource id="Magento_Adminhtml::config"> - <resource id="Magento_Contacts::contacts" title="Contacts Section" /> + <resource id="Magento_Contact::contact" title="Contacts Section" /> </resource> </resource> </resource> diff --git a/app/code/Magento/Contacts/etc/adminhtml/system.xml b/app/code/Magento/Contact/etc/adminhtml/system.xml similarity index 84% rename from app/code/Magento/Contacts/etc/adminhtml/system.xml rename to app/code/Magento/Contact/etc/adminhtml/system.xml index 7ca83190aa92eb32577d66ee6e3d8899001eb801..f334f2da312d3da8f510b610732404eb25e481ef 100644 --- a/app/code/Magento/Contacts/etc/adminhtml/system.xml +++ b/app/code/Magento/Contact/etc/adminhtml/system.xml @@ -19,24 +19,22 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/system_file.xsd"> <system> - <section id="contacts" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> + <section id="contact" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Contacts</label> <tab>general</tab> - <resource>Magento_Contacts::contacts</resource> - <group id="contacts" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <resource>Magento_Contact::contact</resource> + <group id="contact" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Contact Us</label> <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Enable Contact Us</label> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - <backend_model>Magento\Contacts\Model\System\Config\Backend\Links</backend_model> + <backend_model>Magento\Contact\Model\System\Config\Backend\Links</backend_model> </field> </group> <group id="email" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> diff --git a/app/code/Magento/Contacts/etc/config.xml b/app/code/Magento/Contact/etc/config.xml similarity index 84% rename from app/code/Magento/Contacts/etc/config.xml rename to app/code/Magento/Contact/etc/config.xml index 067da8eed12c60019ffb0f17560db796f30caa58..bd574c7726dfff22c8bada6e32a9809108a86cc6 100644 --- a/app/code/Magento/Contacts/etc/config.xml +++ b/app/code/Magento/Contact/etc/config.xml @@ -19,25 +19,23 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> <default> - <contacts> - <contacts> + <contact> + <contact> <enabled>1</enabled> - </contacts> + </contact> <email> <recipient_email> <![CDATA[hello@example.com]]> -</recipient_email> + </recipient_email> <sender_email_identity>custom2</sender_email_identity> - <email_template>contacts_email_email_template</email_template> + <email_template>contact_email_email_template</email_template> </email> - </contacts> + </contact> </default> </config> diff --git a/app/code/Magento/Contacts/etc/email_templates.xml b/app/code/Magento/Contact/etc/email_templates.xml similarity index 88% rename from app/code/Magento/Contacts/etc/email_templates.xml rename to app/code/Magento/Contact/etc/email_templates.xml index f90c6a1829f074e40a14da1a76ade45719ade260..9cbaf5589f16464afb2f38720a9a8e3d3c1de4a9 100644 --- a/app/code/Magento/Contacts/etc/email_templates.xml +++ b/app/code/Magento/Contact/etc/email_templates.xml @@ -24,5 +24,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Email/etc/email_templates.xsd"> - <template id="contacts_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contacts"/> + <template id="contact_email_email_template" label="Contact Form" file="submitted_form.html" type="text" module="Magento_Contact"/> </config> diff --git a/app/code/Magento/Contacts/etc/frontend/di.xml b/app/code/Magento/Contact/etc/frontend/di.xml similarity index 94% rename from app/code/Magento/Contacts/etc/frontend/di.xml rename to app/code/Magento/Contact/etc/frontend/di.xml index 3a1a45e99d3e293b7ed6e2052132c458a64f69ad..69b7ee53eb37cbaa525540425f4343fcb536eb57 100644 --- a/app/code/Magento/Contacts/etc/frontend/di.xml +++ b/app/code/Magento/Contact/etc/frontend/di.xml @@ -27,7 +27,7 @@ <type name="Magento\Core\Model\Url\SecurityInfo"> <arguments> <argument name="secureUrlList" xsi:type="array"> - <item name="contacts" xsi:type="string">/contacts/</item> + <item name="contact" xsi:type="string">/contact/</item> </argument> </arguments> </type> diff --git a/app/code/Magento/Contacts/etc/frontend/page_types.xml b/app/code/Magento/Contact/etc/frontend/page_types.xml similarity index 94% rename from app/code/Magento/Contacts/etc/frontend/page_types.xml rename to app/code/Magento/Contact/etc/frontend/page_types.xml index 426623a969318bdc7b61ce7118b22bf80330c77c..a9d308e497fc870ac2943d86c10523e3ddb9c790 100644 --- a/app/code/Magento/Contacts/etc/frontend/page_types.xml +++ b/app/code/Magento/Contact/etc/frontend/page_types.xml @@ -24,5 +24,5 @@ */ --> <page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> - <type id="contacts_index_index" label="Contact Us Form"/> + <type id="contact_index_index" label="Contact Us Form"/> </page_types> diff --git a/app/code/Magento/Contacts/etc/frontend/routes.xml b/app/code/Magento/Contact/etc/frontend/routes.xml similarity index 92% rename from app/code/Magento/Contacts/etc/frontend/routes.xml rename to app/code/Magento/Contact/etc/frontend/routes.xml index 9e74a47d7f3e22d2321049527d5fa2c087749f35..07dc1ef76958f5124ead60692de138aafd378a37 100644 --- a/app/code/Magento/Contacts/etc/frontend/routes.xml +++ b/app/code/Magento/Contact/etc/frontend/routes.xml @@ -25,8 +25,8 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> <router id="standard"> - <route id="contacts" frontName="contacts"> - <module name="Magento_Contacts" /> + <route id="contact" frontName="contact"> + <module name="Magento_Contact" /> </route> </router> </config> \ No newline at end of file diff --git a/app/code/Magento/Contacts/etc/module.xml b/app/code/Magento/Contact/etc/module.xml similarity index 89% rename from app/code/Magento/Contacts/etc/module.xml rename to app/code/Magento/Contact/etc/module.xml index 7f863aa2bbc1235db28dc5db697cd1f33a2b6631..f3844763169b50f7f3979ef64a2f475e007e1eaa 100644 --- a/app/code/Magento/Contacts/etc/module.xml +++ b/app/code/Magento/Contact/etc/module.xml @@ -24,12 +24,13 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> - <module name="Magento_Contacts" version="1.6.0.0" active="true"> + <module name="Magento_Contact" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_Cms"/> diff --git a/app/code/Magento/Contacts/i18n/de_DE.csv b/app/code/Magento/Contact/i18n/de_DE.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/de_DE.csv rename to app/code/Magento/Contact/i18n/de_DE.csv diff --git a/app/code/Magento/Contacts/i18n/en_US.csv b/app/code/Magento/Contact/i18n/en_US.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/en_US.csv rename to app/code/Magento/Contact/i18n/en_US.csv diff --git a/app/code/Magento/Contacts/i18n/es_ES.csv b/app/code/Magento/Contact/i18n/es_ES.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/es_ES.csv rename to app/code/Magento/Contact/i18n/es_ES.csv diff --git a/app/code/Magento/Contacts/i18n/fr_FR.csv b/app/code/Magento/Contact/i18n/fr_FR.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/fr_FR.csv rename to app/code/Magento/Contact/i18n/fr_FR.csv diff --git a/app/code/Magento/Contacts/i18n/nl_NL.csv b/app/code/Magento/Contact/i18n/nl_NL.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/nl_NL.csv rename to app/code/Magento/Contact/i18n/nl_NL.csv diff --git a/app/code/Magento/Contacts/i18n/pt_BR.csv b/app/code/Magento/Contact/i18n/pt_BR.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/pt_BR.csv rename to app/code/Magento/Contact/i18n/pt_BR.csv diff --git a/app/code/Magento/Contacts/i18n/zh_CN.csv b/app/code/Magento/Contact/i18n/zh_CN.csv similarity index 100% rename from app/code/Magento/Contacts/i18n/zh_CN.csv rename to app/code/Magento/Contact/i18n/zh_CN.csv diff --git a/app/code/Magento/Contacts/sql/contacts_setup/install-1.6.0.0.php b/app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php similarity index 94% rename from app/code/Magento/Contacts/sql/contacts_setup/install-1.6.0.0.php rename to app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php index 06d4f5324f1a22d32287be8bf94a61a6502b85bd..72f724d02c26972f7be2e0228f14eb939cc69d6e 100644 --- a/app/code/Magento/Contacts/sql/contacts_setup/install-1.6.0.0.php +++ b/app/code/Magento/Contact/sql/contact_setup/install-1.6.0.0.php @@ -18,13 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Contacts * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /* @var $installer \Magento\Core\Model\Resource\Setup */ - $installer = $this; diff --git a/app/code/Magento/Contacts/view/email/submitted_form.html b/app/code/Magento/Contact/view/email/submitted_form.html similarity index 100% rename from app/code/Magento/Contacts/view/email/submitted_form.html rename to app/code/Magento/Contact/view/email/submitted_form.html diff --git a/app/code/Magento/Contacts/view/frontend/form.phtml b/app/code/Magento/Contact/view/frontend/form.phtml similarity index 93% rename from app/code/Magento/Contacts/view/frontend/form.phtml rename to app/code/Magento/Contact/view/frontend/form.phtml index 75b0121e1ef18142b999ac01097d589d882ac50d..e9a8e7369a977193acb827f803065918a4282fde 100644 --- a/app/code/Magento/Contacts/view/frontend/form.phtml +++ b/app/code/Magento/Contact/view/frontend/form.phtml @@ -29,13 +29,13 @@ <div class="field name required"> <label class="label" for="name"><span><?php echo __('Name') ?></span></label> <div class="control"> - <input name="name" id="name" title="<?php echo __('Name') ?>" value="<?php echo $this->escapeHtml($this->helper('Magento\Contacts\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> + <input name="name" id="name" title="<?php echo __('Name') ?>" value="<?php echo $this->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserName()) ?>" class="input-text" type="text" data-validate="{required:true}"/> </div> </div> <div class="field email required"> <label class="label" for="email"><span><?php echo __('Email') ?></span></label> <div class="control"> - <input name="email" id="email" title="<?php echo __('Email') ?>" value="<?php echo $this->escapeHtml($this->helper('Magento\Contacts\Helper\Data')->getUserEmail()) ?>" class="input-text" type="text" data-validate="{required:true, 'validate-email':true}"/> + <input name="email" id="email" title="<?php echo __('Email') ?>" value="<?php echo $this->escapeHtml($this->helper('Magento\Contact\Helper\Data')->getUserEmail()) ?>" class="input-text" type="text" data-validate="{required:true, 'validate-email':true}"/> </div> </div> <div class="field telephone"> diff --git a/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml similarity index 96% rename from app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml rename to app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml index 48a748057341c2e89ad3948d210d3955500c3119..145038b752ff70b840a0aa2d74d5ce9f0aaee281 100644 --- a/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml +++ b/app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml @@ -31,7 +31,7 @@ </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\View\Element\Template" name="contactForm" template="Magento_Contacts::form.phtml"> + <block class="Magento\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml"> <container name="form.additional.info" label="Form Additional Info"/> </block> </referenceContainer> diff --git a/app/code/Magento/Contacts/view/frontend/layout/default.xml b/app/code/Magento/Contact/view/frontend/layout/default.xml similarity index 92% rename from app/code/Magento/Contacts/view/frontend/layout/default.xml rename to app/code/Magento/Contact/view/frontend/layout/default.xml index 1d546989a09a6e974289f9998840c20f89753027..bbc1a25b66a5a9c593f8fda7e8319a7fb6c13958 100644 --- a/app/code/Magento/Contacts/view/frontend/layout/default.xml +++ b/app/code/Magento/Contact/view/frontend/layout/default.xml @@ -25,11 +25,11 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <referenceBlock name="footer_links"> - <block class="Magento\View\Element\Html\Link\Current" ifconfig="contacts/contacts/enabled" + <block class="Magento\View\Element\Html\Link\Current" ifconfig="contact/contact/enabled" name="contact-us-link"> <arguments> <argument name="label" xsi:type="string">Contact Us</argument> - <argument name="path" xsi:type="string">contacts</argument> + <argument name="path" xsi:type="string">contact</argument> </arguments> </block> </referenceBlock> diff --git a/app/code/Magento/Core/App/Action/Plugin/LastUrl.php b/app/code/Magento/Core/App/Action/Plugin/LastUrl.php index 389d3cc455b1b25912c13fa4d4d7569a73c752ac..d95ee3fe1c2b27afffcc5ba2b1606bb92b765d81 100644 --- a/app/code/Magento/Core/App/Action/Plugin/LastUrl.php +++ b/app/code/Magento/Core/App/Action/Plugin/LastUrl.php @@ -35,7 +35,7 @@ class LastUrl const SESSION_NAMESPACE = 'frontend'; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $_session; @@ -52,10 +52,10 @@ class LastUrl protected $_sessionNamespace = self::SESSION_NAMESPACE; /** - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\Generic $session * @param \Magento\UrlInterface $url */ - public function __construct(\Magento\Core\Model\Session $session, \Magento\UrlInterface $url) + public function __construct(\Magento\Session\Generic $session, \Magento\UrlInterface $url) { $this->_session = $session; $this->_url = $url; diff --git a/app/code/Magento/Core/App/FrontController/Plugin/MessageBox.php b/app/code/Magento/Core/App/FrontController/Plugin/MessageBox.php index be03ba0abfc95bbdd7f7dbe0babce6bb4608ee2a..e5567a88203fa057071dc0bd8965033c40bc078a 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/MessageBox.php +++ b/app/code/Magento/Core/App/FrontController/Plugin/MessageBox.php @@ -52,7 +52,7 @@ class MessageBox protected $request; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; diff --git a/app/code/Magento/Core/App/Media.php b/app/code/Magento/Core/App/Media.php index 0e6ee61c19262736a0ebc223cacf901fb6d6720b..8cc95c6d5176b71e20f21d581e9743b1671d350c 100644 --- a/app/code/Magento/Core/App/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -181,7 +181,7 @@ class Media implements AppInterface $this->_response->setHttpResponseCode(404); } return $this->_response; - } catch (\Magento\Core\Model\Store\Exception $e) { + } catch (\Exception $e) { $this->_response->setHttpResponseCode(404); return $this->_response; } diff --git a/app/code/Magento/Core/App/Router/Base.php b/app/code/Magento/Core/App/Router/Base.php index 3c09990799153120829ece0834900673f3592f7f..9cb27f0a25e117445b887c08984947dd0f76c6c0 100644 --- a/app/code/Magento/Core/App/Router/Base.php +++ b/app/code/Magento/Core/App/Router/Base.php @@ -59,9 +59,9 @@ class Base extends \Magento\App\Router\AbstractRouter /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\UrlInterface @@ -69,7 +69,7 @@ class Base extends \Magento\App\Router\AbstractRouter protected $_url; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -100,8 +100,8 @@ class Base extends \Magento\App\Router\AbstractRouter * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\State $appState * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\StoreManagerInterface|\Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoreManagerInterface|\Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo * @param string $routerId * @param \Magento\Code\NameBuilder $nameBuilder @@ -114,19 +114,18 @@ class Base extends \Magento\App\Router\AbstractRouter \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\State $appState, \Magento\UrlInterface $url, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Url\SecurityInfoInterface $urlSecurityInfo, $routerId, \Magento\Code\NameBuilder $nameBuilder ) { parent::__construct($actionFactory); - $this->_responseFactory = $responseFactory; $this->_defaultPath = $defaultPath; $this->_routeConfig = $routeConfig; $this->_urlSecurityInfo = $urlSecurityInfo; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_url = $url; $this->_storeManager = $storeManager; $this->_appState = $appState; @@ -332,7 +331,7 @@ class Base extends \Magento\App\Router\AbstractRouter */ protected function _getDefaultPath() { - return $this->_storeConfig->getConfig('web/default/front'); + return $this->_scopeConfig->getValue('web/default/front', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -418,12 +417,13 @@ class Base extends \Magento\App\Router\AbstractRouter protected function _shouldBeSecure($path) { return parse_url( - $this->_storeConfig->getConfig('web/unsecure/base_url'), + $this->_scopeConfig->getValue('web/unsecure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME - ) === 'https' || $this->_storeConfig->getConfigFlag( - \Magento\Core\Model\Store::XML_PATH_SECURE_IN_FRONTEND + ) === 'https' || $this->_scopeConfig->isSetFlag( + \Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && parse_url( - $this->_storeConfig->getConfig('web/secure/base_url'), + $this->_scopeConfig->getValue('web/secure/base_url', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), PHP_URL_SCHEME ) == 'https' && $this->_urlSecurityInfo->isSecure( $path diff --git a/app/code/Magento/Core/App/Router/NoRouteHandler.php b/app/code/Magento/Core/App/Router/NoRouteHandler.php index 69059242f41de1e7bd21eef9f49b99811ef36cbf..a727207e3607b709e2ad4039376a9713612c2693 100644 --- a/app/code/Magento/Core/App/Router/NoRouteHandler.php +++ b/app/code/Magento/Core/App/Router/NoRouteHandler.php @@ -28,14 +28,14 @@ namespace Magento\Core\App\Router; class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface { /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; /** - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ - public function __construct(\Magento\App\ConfigInterface $config) + public function __construct(\Magento\App\Config\ScopeConfigInterface $config) { $this->_config = $config; } diff --git a/app/code/Magento/Core/Helper/Data.php b/app/code/Magento/Core/Helper/Data.php index f057e775345a1b6cc3f8a8a8fbb722de98384c2e..7a2036d3767487ead2789fcaea6702ff2dd70fbf 100644 --- a/app/code/Magento/Core/Helper/Data.php +++ b/app/code/Magento/Core/Helper/Data.php @@ -38,7 +38,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Store cache context */ - const CONTEXT_STORE = 'core_store'; + const CONTEXT_STORE = 'store'; const XML_PATH_DEFAULT_COUNTRY = 'general/country/default'; @@ -73,12 +73,12 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -94,20 +94,20 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, $dbCompatibleMode = true ) { parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_appState = $appState; $this->_dbCompatibleMode = $dbCompatibleMode; @@ -130,7 +130,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * Convert and format price value for specified store * * @param float $value - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @param bool $format * @param bool $includeContainer * @return float|string @@ -138,7 +138,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function currencyByStore($value, $store = null, $format = true, $includeContainer = true) { try { - if (!$store instanceof \Magento\Core\Model\Store) { + if (!$store instanceof \Magento\Store\Model\Store) { $store = $this->_storeManager->getStore($store); } @@ -182,7 +182,11 @@ class Data extends \Magento\App\Helper\AbstractHelper { $allow = true; - $allowedIps = $this->_coreStoreConfig->getConfig(self::XML_PATH_DEV_ALLOW_IPS, $storeId); + $allowedIps = $this->_scopeConfig->getValue( + self::XML_PATH_DEV_ALLOW_IPS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $remoteAddr = $this->_remoteAddress->getRemoteAddress(); if (!empty($allowedIps) && !empty($remoteAddr)) { $allowedIps = preg_split('#\s*,\s*#', $allowedIps, null, PREG_SPLIT_NO_EMPTY); @@ -246,12 +250,16 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Return default country code * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return string */ public function getDefaultCountry($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_DEFAULT_COUNTRY, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_DEFAULT_COUNTRY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -274,6 +282,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isSingleStoreModeEnabled() { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_SINGLE_STORE_MODE_ENABLED); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_SINGLE_STORE_MODE_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Core/Helper/File/Storage.php b/app/code/Magento/Core/Helper/File/Storage.php index fa0fe188804e959b1d095dab5a8e0e07c968f277..0eb2a3d13e5f910971b7c4f0103d8125c2510cd8 100644 --- a/app/code/Magento/Core/Helper/File/Storage.php +++ b/app/code/Magento/Core/Helper/File/Storage.php @@ -69,7 +69,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper protected $_filesystemStorage; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; @@ -78,14 +78,14 @@ class Storage extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\File\Storage $storage * @param \Magento\Core\Model\File\Storage\File $filesystemStorage - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Core\Model\File\Storage $storage, \Magento\Core\Model\File\Storage\File $filesystemStorage, - \Magento\App\ConfigInterface $config + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_filesystemStorage = $filesystemStorage; $this->_coreFileStorageDb = $coreFileStorageDb; diff --git a/app/code/Magento/Core/Helper/File/Storage/Database.php b/app/code/Magento/Core/Helper/File/Storage/Database.php index 438c163a80f12dbbc8687b93e9bdf4850df8632f..fd58a7dcd13c4d3486862f6a143eb81bdf6f1eff 100644 --- a/app/code/Magento/Core/Helper/File/Storage/Database.php +++ b/app/code/Magento/Core/Helper/File/Storage/Database.php @@ -77,7 +77,7 @@ class Database extends \Magento\App\Helper\AbstractHelper protected $_fileStorage; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; @@ -86,14 +86,14 @@ class Database extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory * @param \Magento\Core\Model\File\Storage\File $fileStorage * @param \Magento\App\Filesystem $filesystem - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory, \Magento\Core\Model\File\Storage\File $fileStorage, \Magento\App\Filesystem $filesystem, - \Magento\App\ConfigInterface $config + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_filesystem = $filesystem; $this->_dbStorageFactory = $dbStorageFactory; diff --git a/app/code/Magento/Core/Helper/Url.php b/app/code/Magento/Core/Helper/Url.php index 2b17e1a1c781c7f4b45d32907939bfc959b574ce..5e607b34b4cb205908cdcf1ee5a0c6e5bf517995 100644 --- a/app/code/Magento/Core/Helper/Url.php +++ b/app/code/Magento/Core/Helper/Url.php @@ -36,17 +36,17 @@ namespace Magento\Core\Helper; class Url extends \Magento\App\Helper\AbstractHelper { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { parent::__construct($context); $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Core/Model/App/Action/ContextPlugin.php b/app/code/Magento/Core/Model/App/Action/ContextPlugin.php index 1ab742da867a1d1a7f86d9a81fb2bf162f959310..924f595da88a38a152ed50604822d87196d0d089 100644 --- a/app/code/Magento/Core/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Core/Model/App/Action/ContextPlugin.php @@ -45,7 +45,7 @@ class ContextPlugin protected $httpRequest; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -53,13 +53,13 @@ class ContextPlugin * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\App\Http\Context $httpContext * @param \Magento\App\Request\Http $httpRequest - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Session\SessionManagerInterface $session, \Magento\App\Http\Context $httpContext, \Magento\App\Request\Http $httpRequest, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->session = $session; $this->httpContext = $httpContext; @@ -88,7 +88,7 @@ class ContextPlugin \Magento\Core\Helper\Data::CONTEXT_STORE, $this->httpRequest->getParam( '___store', - $this->httpRequest->getCookie(\Magento\Core\Model\Store::COOKIE_NAME) + $this->httpRequest->getCookie(\Magento\Store\Model\Store::COOKIE_NAME) ), $this->storeManager->getWebsite()->getDefaultStore()->getCode() ); diff --git a/app/code/Magento/Core/Model/App/Area.php b/app/code/Magento/Core/Model/App/Area.php index 7460dae9e79ce4cb87309dcade9d4ce7663c8fb1..ddfe510387f0c1a063ca92f6f6a2d65ffe8ffffa 100644 --- a/app/code/Magento/Core/Model/App/Area.php +++ b/app/code/Magento/Core/Model/App/Area.php @@ -75,7 +75,7 @@ class Area implements \Magento\App\AreaInterface /** * Application config * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -94,9 +94,9 @@ class Area implements \Magento\App\AreaInterface /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Logger @@ -111,7 +111,7 @@ class Area implements \Magento\App\AreaInterface protected $_design; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -124,12 +124,12 @@ class Area implements \Magento\App\AreaInterface * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\TranslateInterface $translator - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\ObjectManager $objectManager * @param \Magento\App\ObjectManager\ConfigLoader $diConfigLoader - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Model\Design $design - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Area\DesignExceptions $designExceptions * @param string $areaCode */ @@ -137,16 +137,16 @@ class Area implements \Magento\App\AreaInterface \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, \Magento\TranslateInterface $translator, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\ObjectManager $objectManager, \Magento\App\ObjectManager\ConfigLoader $diConfigLoader, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Model\Design $design, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, Area\DesignExceptions $designExceptions, $areaCode ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_code = $areaCode; $this->_config = $config; $this->_objectManager = $objectManager; diff --git a/app/code/Magento/Core/Model/App/Area/DesignExceptions.php b/app/code/Magento/Core/Model/App/Area/DesignExceptions.php index c5d2a44ba0d39d42a20066916b5c9260b86083fd..8f27b1d5ec97b798654ab15341124bb49e8705f2 100644 --- a/app/code/Magento/Core/Model/App/Area/DesignExceptions.php +++ b/app/code/Magento/Core/Model/App/Area/DesignExceptions.php @@ -39,16 +39,16 @@ class DesignExceptions /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $coreStoreConfig; + protected $scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->coreStoreConfig = $coreStoreConfig; + $this->scopeConfig = $scopeConfig; } /** @@ -63,7 +63,7 @@ class DesignExceptions if (empty($userAgent)) { return false; } - $expressions = $this->coreStoreConfig->getConfig(self::XML_PATH_DESIGN_EXCEPTION); + $expressions = $this->scopeConfig->getValue(self::XML_PATH_DESIGN_EXCEPTION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if (!$expressions) { return false; } diff --git a/app/code/Magento/Core/Model/App/Emulation.php b/app/code/Magento/Core/Model/App/Emulation.php index 68341b83b7c1d5f4af33cd8b13c0b72354eb6716..aa4ec7c1498641a3b1531b9661860d72081efa66 100644 --- a/app/code/Magento/Core/Model/App/Emulation.php +++ b/app/code/Magento/Core/Model/App/Emulation.php @@ -33,10 +33,12 @@ */ namespace Magento\Core\Model\App; +use Magento\Translate\Inline\ConfigInterface; + class Emulation extends \Magento\Object { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -46,9 +48,11 @@ class Emulation extends \Magento\Object protected $_translate; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * Core store config + * + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Locale\ResolverInterface @@ -61,7 +65,7 @@ class Emulation extends \Magento\Object protected $_design; /** - * @var \Magento\Translate\Inline\ConfigInterface + * @var ConfigInterface */ protected $inlineConfig; @@ -71,23 +75,23 @@ class Emulation extends \Magento\Object protected $inlineTranslation; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Core\Model\Design $design * @param \Magento\TranslateInterface $translate - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Translate\Inline\ConfigInterface $inlineConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param ConfigInterface $inlineConfig * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\DesignInterface $viewDesign, \Magento\Core\Model\Design $design, \Magento\TranslateInterface $translate, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Translate\Inline\ConfigInterface $inlineConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + ConfigInterface $inlineConfig, \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -98,7 +102,7 @@ class Emulation extends \Magento\Object $this->_viewDesign = $viewDesign; $this->_design = $design; $this->_translate = $translate; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->inlineConfig = $inlineConfig; $this->inlineTranslation = $inlineTranslation; } @@ -220,10 +224,13 @@ class Emulation extends \Magento\Object protected function _emulateLocale($storeId, $area = \Magento\Core\Model\App\Area::AREA_FRONTEND) { $initialLocaleCode = $this->_localeResolver->getLocaleCode(); - $newLocaleCode = $this->_coreStoreConfig->getConfig($this->_localeResolver->getDefaultLocalePath(), $storeId); + $newLocaleCode = $this->_scopeConfig->getValue( + $this->_localeResolver->getDefaultLocalePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $this->_localeResolver->setLocaleCode($newLocaleCode); - $this->_translate->setLocale($newLocaleCode) - ->loadData($area, true); + $this->_translate->setLocale($newLocaleCode)->loadData($area, true); return $initialLocaleCode; } @@ -264,8 +271,7 @@ class Emulation extends \Magento\Object $initialArea = \Magento\Core\Model\App\Area::AREA_ADMIN ) { $this->_localeResolver->setLocaleCode($initialLocaleCode); - $this->_translate->setLocale($initialLocaleCode) - ->loadData($initialArea, true); + $this->_translate->setLocale($initialLocaleCode)->loadData($initialArea, true); return $this; } diff --git a/app/code/Magento/Core/Model/Asset/Config.php b/app/code/Magento/Core/Model/Asset/Config.php index 76530507482525a2b9499e6d1fd69891762104e7..6b668bb058718d68ced295bb883c92a7517c28df 100644 --- a/app/code/Magento/Core/Model/Asset/Config.php +++ b/app/code/Magento/Core/Model/Asset/Config.php @@ -51,16 +51,16 @@ class Config implements \Magento\View\Asset\ConfigInterface const XML_PATH_MINIFICATION_ADAPTER = 'dev/%s/minify_adapter'; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeConfig; + protected $scopeConfig; /** - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\ConfigInterface $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; } /** @@ -70,7 +70,7 @@ class Config implements \Magento\View\Asset\ConfigInterface */ public function isMergeCssFiles() { - return (bool)$this->storeConfig->getConfigFlag(self::XML_PATH_MERGE_CSS_FILES); + return (bool)$this->scopeConfig->isSetFlag(self::XML_PATH_MERGE_CSS_FILES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -80,7 +80,7 @@ class Config implements \Magento\View\Asset\ConfigInterface */ public function isMergeJsFiles() { - return (bool)$this->storeConfig->getConfigFlag(self::XML_PATH_MERGE_JS_FILES); + return (bool)$this->scopeConfig->isSetFlag(self::XML_PATH_MERGE_JS_FILES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -91,7 +91,10 @@ class Config implements \Magento\View\Asset\ConfigInterface */ public function isAssetMinification($contentType) { - return (bool)$this->storeConfig->getConfigFlag(sprintf(self::XML_PATH_MINIFICATION_ENABLED, $contentType)); + return (bool)$this->scopeConfig->isSetFlag( + sprintf(self::XML_PATH_MINIFICATION_ENABLED, $contentType), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -102,6 +105,9 @@ class Config implements \Magento\View\Asset\ConfigInterface */ public function getAssetMinificationAdapter($contentType) { - return (string)$this->storeConfig->getConfig(sprintf(self::XML_PATH_MINIFICATION_ADAPTER, $contentType)); + return (string)$this->scopeConfig->getValue( + sprintf(self::XML_PATH_MINIFICATION_ADAPTER, $contentType), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Core/Model/Config/Cache.php b/app/code/Magento/Core/Model/Config/Cache.php deleted file mode 100644 index 4f54d6f4077b1f7bbc926da874b07d4b8324c66c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Config/Cache.php +++ /dev/null @@ -1,134 +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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class Cache -{ - /** - * Config cache id - * - * @var string - */ - protected $_cacheId = 'config_global'; - - /** - * Container factory model - * - * @var \Magento\Core\Model\Config\BaseFactory - */ - protected $_containerFactory; - - /** - * @var \Magento\App\Cache\Type\Config - */ - protected $_configCacheType; - - /** - * Cache lifetime in seconds - * - * @var int - */ - protected $_cacheLifetime; - - /** - * Config container - * - * @var \Magento\Core\Model\Config\Base - */ - protected $_loadedConfig = null; - - /** - * @param \Magento\App\Cache\Type\Config $configCacheType - * @param \Magento\Core\Model\Config\BaseFactory $containerFactory - */ - public function __construct( - \Magento\App\Cache\Type\Config $configCacheType, - \Magento\Core\Model\Config\BaseFactory $containerFactory - ) { - $this->_containerFactory = $containerFactory; - $this->_configCacheType = $configCacheType; - } - - /** - * Set cache lifetime - * - * @param int $lifetime - * @return void - */ - public function setCacheLifetime($lifetime) - { - $this->_cacheLifetime = $lifetime; - } - - /** - * Retrieve cache lifetime - * - * @return int - */ - public function getCacheLifeTime() - { - return $this->_cacheLifetime; - } - - /** - * @return \Magento\App\ConfigInterface|bool - */ - public function load() - { - if (!$this->_loadedConfig) { - $config = $this->_configCacheType->load($this->_cacheId); - if ($config) { - $this->_loadedConfig = $this->_containerFactory->create($config); - } - } - return $this->_loadedConfig ?: false; - } - - /** - * Save config cache - * - * @param \Magento\Core\Model\Config\Base $config - * @return void - */ - public function save(\Magento\Core\Model\Config\Base $config) - { - $this->_configCacheType->save( - $config->getNode()->asNiceXml('', false), - $this->_cacheId, - array(), - $this->_cacheLifetime - ); - } - - /** - * Clean cached data - * - * @return bool - */ - public function clean() - { - $this->_loadedConfig = null; - return $this->_configCacheType->clean(); - } -} diff --git a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php index b20dc5c4ae46973eecfe2825b3472211e6edc911..4ac800a744f3f7e868127347a561d36dfe4278d6 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php +++ b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php @@ -37,8 +37,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\View\DesignInterface $design * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -47,15 +46,14 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\View\DesignInterface $design, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_design = $design; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Core/Model/Design/Backend/Theme.php b/app/code/Magento/Core/Model/Design/Backend/Theme.php index 3f0521e866ad670afbd3f7803a576be6798b90e4..50a31701b3b5053ba825ce96ed09375a6ee1b0f0 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Theme.php +++ b/app/code/Magento/Core/Model/Design/Backend/Theme.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Design\Backend; -class Theme extends \Magento\Core\Model\Config\Value +class Theme extends \Magento\App\Config\Value { /** * Design package instance @@ -37,8 +37,7 @@ class Theme extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\View\DesignInterface $design * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -47,15 +46,14 @@ class Theme extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\View\DesignInterface $design, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_design = $design; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index 0702e2fa593800d4ee742f6c177a7ce44eb06cc6..27fdb9f1b910568bb523cb770fd5eff9a4e787dd 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -68,12 +68,12 @@ class Storage extends AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -107,8 +107,8 @@ class Storage extends AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage $coreFileStorage - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Core\Model\File\Storage\Flag $fileFlag * @param \Magento\Core\Model\File\Storage\FileFactory $fileFactory * @param \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory @@ -121,8 +121,8 @@ class Storage extends AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Helper\File\Storage $coreFileStorage, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Core\Model\File\Storage\Flag $fileFlag, \Magento\Core\Model\File\Storage\FileFactory $fileFactory, \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory, @@ -132,7 +132,7 @@ class Storage extends AbstractModel array $data = array() ) { $this->_coreFileStorage = $coreFileStorage; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_coreConfig = $coreConfig; $this->_fileFlag = $fileFlag; $this->_fileFactory = $fileFactory; @@ -304,7 +304,7 @@ class Storage extends AbstractModel $config['allowed_resources'][] = $allowedResource; } - $config['update_time'] = $this->_coreStoreConfig->getConfig(self::XML_PATH_MEDIA_UPDATE_TIME); + $config['update_time'] = $this->_scopeConfig->getValue(self::XML_PATH_MEDIA_UPDATE_TIME, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); return $config; } diff --git a/app/code/Magento/Core/Model/File/Storage/Database.php b/app/code/Magento/Core/Model/File/Storage/Database.php index b97f8ba0b04dc1c6e190f3b9927d81099dfd2834..e37b5befd4cf2af33d1780080a323ca80b7d63b9 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Database.php @@ -66,7 +66,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\App\Config\ScopeConfigInterface $configuration * @param \Magento\Core\Helper\File\Media $mediaHelper * @param \Magento\Core\Model\Resource\File\Storage\Database $resource * @param Directory\DatabaseFactory $directoryFactory @@ -79,7 +79,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\App\ConfigInterface $configuration, + \Magento\App\Config\ScopeConfigInterface $configuration, \Magento\Core\Helper\File\Media $mediaHelper, \Magento\Core\Model\Resource\File\Storage\Database $resource, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, diff --git a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php index f96210a33d6fc3fa899a46c817a48dc62f64e210..ff21e4aeffcb8904d69afde41a914e9797c6c77d 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php +++ b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php @@ -52,7 +52,7 @@ abstract class AbstractDatabase extends \Magento\Model\AbstractModel protected $_date; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_configuration; @@ -61,7 +61,7 @@ abstract class AbstractDatabase extends \Magento\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\App\Config\ScopeConfigInterface $configuration * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string|null $connectionName @@ -72,7 +72,7 @@ abstract class AbstractDatabase extends \Magento\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\App\ConfigInterface $configuration, + \Magento\App\Config\ScopeConfigInterface $configuration, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $connectionName = null, diff --git a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php index cae83fec58b2303d01322d41562fb30c0ed80f87..6fe64d67f3a8fd212932b3347c49b6c40db0767f 100644 --- a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php @@ -54,7 +54,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\App\Config\ScopeConfigInterface $configuration * @param DatabaseFactory $directoryFactory * @param \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -66,7 +66,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\App\ConfigInterface $configuration, + \Magento\App\Config\ScopeConfigInterface $configuration, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php b/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php index 3855c14c9f0628b682ae3a59792ac559c1e720d6..d0a21713705291af15c4524a894c96485de415ff 100644 --- a/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php +++ b/app/code/Magento/Core/Model/File/Validator/NotProtectedExtension.php @@ -57,18 +57,18 @@ class NotProtectedExtension extends \Zend_Validate_Abstract /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Init validator * - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_initMessageTemplates(); $this->_initProtectedFileExtensions(); } @@ -111,12 +111,12 @@ class NotProtectedExtension extends \Zend_Validate_Abstract /** * Return list with protected file extensions * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return string|string[] */ public function getProtectedFileExtensions($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_PROTECTED_FILE_EXTENSIONS, $store); + return $this->_scopeConfig->getValue(self::XML_PATH_PROTECTED_FILE_EXTENSIONS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index 770db4c80b62450d7bf7868d532a82d0064cc611..eadca388746b8c86c6931781181adbb61dd80743 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -60,7 +60,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface private $_theme; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ private $_store; @@ -138,7 +138,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface * Init merge model * * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\Layout\File\SourceInterface $fileSource * @param \Magento\Core\Model\Resource\Layout\Update $resource * @param \Magento\App\State $appState @@ -150,7 +150,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface */ public function __construct( \Magento\View\DesignInterface $design, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\Layout\File\SourceInterface $fileSource, \Magento\Core\Model\Resource\Layout\Update $resource, \Magento\App\State $appState, diff --git a/app/code/Magento/Core/Model/Observer.php b/app/code/Magento/Core/Model/Observer.php index c78b282a6a841b5f67af6c857ddfd39471d35a37..2fc56254ad7eb853f21c288c036cbb3d3df1b258 100644 --- a/app/code/Magento/Core/Model/Observer.php +++ b/app/code/Magento/Core/Model/Observer.php @@ -47,6 +47,11 @@ class Observer */ private $_pageAssets; + /** + * @var \Magento\App\Config\ReinitableConfigInterface + */ + protected $_config; + /** * @var \Magento\View\Asset\PublicFileFactory */ @@ -66,6 +71,7 @@ class Observer * @param \Magento\App\Cache\Frontend\Pool $cacheFrontendPool * @param \Magento\View\DesignInterface $design * @param \Magento\View\Asset\GroupedCollection $assets + * @param \Magento\App\Config\ReinitableConfigInterface $config * @param \Magento\View\Asset\PublicFileFactory $assetFileFactory * @param Theme\Registration $registration * @param \Magento\Logger $logger @@ -74,6 +80,7 @@ class Observer \Magento\App\Cache\Frontend\Pool $cacheFrontendPool, \Magento\View\DesignInterface $design, \Magento\View\Asset\GroupedCollection $assets, + \Magento\App\Config\ReinitableConfigInterface $config, \Magento\View\Asset\PublicFileFactory $assetFileFactory, \Magento\Core\Model\Theme\Registration $registration, \Magento\Logger $logger diff --git a/app/code/Magento/Core/Model/Resource/Config.php b/app/code/Magento/Core/Model/Resource/Config.php index f82a708d0a3c1466cd70672e372c3be86e166829..20288967ad029d42651d6c610ac22dc986d6c58b 100644 --- a/app/code/Magento/Core/Model/Resource/Config.php +++ b/app/code/Magento/Core/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\App\Config\Resource\ConfigInterface { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Config/Data.php b/app/code/Magento/Core/Model/Resource/Config/Data.php index 9827293ed222b7808236e564a4fe5ca1c6aaa1f0..4eae96069e4865f42330e1099534dbf46ce8262a 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data.php @@ -25,8 +25,6 @@ */ namespace Magento\Core\Model\Resource\Config; -use Magento\Core\Model\Website; - /** * Core config data resource model * @@ -98,31 +96,20 @@ class Data extends \Magento\Model\Resource\Db\AbstractDb } /** - * Clear website data - * - * @param Website $website - * @return void - */ - public function clearWebsiteData(Website $website) - { - $this->_getWriteAdapter()->delete( - $this->getMainTable(), - array('scope = ?' => 'websites', 'scope_id' => $website->getId()) - ); - $this->clearStoreData($website->getStoreIds()); - } - - /** - * Clear store data + * Clear Scope data * - * @param array $storeIds + * @param string $scopeCode + * @param int|array $scopeIds * @return void */ - public function clearStoreData(array $storeIds) + public function clearScopeData($scopeCode, $scopeIds) { + if (!is_array($scopeIds)) { + $scopeIds = array($scopeIds); + } $this->_getWriteAdapter()->delete( $this->getMainTable(), - array('scope = ?' => 'stores', 'scope_id IN (?)' => $storeIds) + array('scope = ?' => $scopeCode, 'scope_id IN (?)' => $scopeIds) ); } } diff --git a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php index 9f89d809ab7fe0b8a1b6216e12e9af9bda25195b..33e55895a84c65d8de99226c6f0aa0a4cd727223 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php @@ -41,7 +41,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ protected function _construct() { - $this->_init('Magento\Core\Model\Config\Value', 'Magento\Core\Model\Resource\Config\Data'); + $this->_init('Magento\App\Config\Value', 'Magento\Core\Model\Resource\Config\Data'); } /** diff --git a/app/code/Magento/Core/Model/Resource/Design/Collection.php b/app/code/Magento/Core/Model/Resource/Design/Collection.php index fd141975a4eb7a52517829653cef9cddc27e1280..b35dcd8d0912abf8fa4bad680f2fd49d2da3f06d 100644 --- a/app/code/Magento/Core/Model/Resource/Design/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Design/Collection.php @@ -74,7 +74,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ public function joinStore() { - return $this->join(array('cs' => 'core_store'), 'cs.store_id = main_table.store_id', array('cs.name')); + return $this->join(array('cs' => 'store'), 'cs.store_id = main_table.store_id', array('cs.name')); } /** diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update.php b/app/code/Magento/Core/Model/Resource/Layout/Update.php index 7fb8c32062f15013643fde51c2c6014557fe1fcb..d739dc53799a06fb75989c6edc7006c869c736ad 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update.php @@ -60,13 +60,13 @@ class Update extends \Magento\Model\Resource\Db\AbstractDb * * @param string $handle * @param \Magento\View\Design\ThemeInterface $theme - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return string */ public function fetchUpdatesByHandle( $handle, \Magento\View\Design\ThemeInterface $theme, - \Magento\Core\Model\Store $store + \Magento\Store\Model\Store $store ) { $bind = array('layout_update_handle' => $handle, 'theme_id' => $theme->getId(), 'store_id' => $store->getId()); $result = ''; @@ -87,7 +87,7 @@ class Update extends \Magento\Model\Resource\Db\AbstractDb protected function _getFetchUpdatesByHandleSelect($loadAllUpdates = false) { //@todo Why it also loads layout updates for store_id=0, isn't it Admin Store View? - //If 0 means 'all stores' why it then refers by foreign key to Admin in `core_store` and not to something named + //If 0 means 'all stores' why it then refers by foreign key to Admin in `store` and not to something named // 'All Stores'? $select = $this->_getReadAdapter()->select()->from( diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 3b44ad4407c2b548a2bdffdfc8df009278fa9637..115f155e273d03743c09df18f31f18a97b9e9f6a 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -1,7 +1,5 @@ <?php /** - * Resource Setup Model - * * Magento * * NOTICE OF LICENSE @@ -25,78 +23,11 @@ */ namespace Magento\Core\Model\Resource; -class Setup implements \Magento\Module\Updater\SetupInterface +/** + * Core resource setup + */ +class Setup extends \Magento\Module\Setup { - /** - * Setup resource name - * @var string - */ - protected $_resourceName; - - /** - * Setup module configuration object - * - * @var array - */ - protected $_moduleConfig; - - /** - * Call afterApplyAllUpdates method flag - * - * @var boolean - */ - protected $_callAfterApplyAllUpdates = false; - - /** - * Setup Connection - * - * @var \Magento\DB\Adapter\Pdo\Mysql - */ - protected $_connection = null; - - /** - * Tables cache array - * - * @var array - */ - protected $_tables = array(); - - /** - * Tables data cache array - * - * @var array - */ - protected $_setupCache = array(); - - /** - * Modules configuration - * - * @var \Magento\App\Resource - */ - protected $_resourceModel; - - /** - * Modules configuration reader - * - * @var \Magento\Module\Dir\Reader - */ - protected $_modulesReader; - - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Logger - */ - protected $_logger; - - /** - * @var \Magento\Module\ResourceInterface - */ - protected $_resourceResource; - /** * @var \Magento\Core\Model\Resource\Theme\CollectionFactory */ @@ -108,734 +39,39 @@ class Setup implements \Magento\Module\Updater\SetupInterface protected $_themeFactory; /** - * @var \Magento\Core\Model\Resource\Setup\MigrationFactory - */ - protected $_migrationFactory; - - /** - * Connection instance name - * - * @var string - */ - protected $_connectionName = 'core_setup'; - - /** - * Filesystem instance - * - * @var \Magento\App\Filesystem - */ - protected $filesystem; - - /** - * @var \Magento\Filesystem\Directory\ReadInterface - */ - protected $modulesDir; - - /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName + * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory + * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory * @param string $moduleName * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, - $moduleName, - $connectionName = '' + \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, + \Magento\Core\Model\Theme\CollectionFactory $themeFactory, + $moduleName = 'Magento_Core', + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { - $this->_eventManager = $context->getEventManager(); - $this->_resourceModel = $context->getResourceModel(); - $this->_logger = $context->getLogger(); - $this->_modulesReader = $context->getModulesReader(); - $this->_resourceName = $resourceName; - $this->_resourceResource = $context->getResourceResource(); - $this->_migrationFactory = $context->getMigrationFactory(); - $this->_themeFactory = $context->getThemeFactory(); - $this->_themeResourceFactory = $context->getThemeResourceFactory(); - $this->_moduleConfig = $context->getModuleList()->getModule($moduleName); - $this->filesystem = $context->getFilesystem(); - $this->modulesDir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); - $this->_connectionName = $connectionName ?: $this->_connectionName; - } - - /** - * Get connection object - * - * @return \Magento\DB\Adapter\AdapterInterface - */ - public function getConnection() - { - if (null === $this->_connection) { - $this->_connection = $this->_resourceModel->getConnection($this->_connectionName); - } - return $this->_connection; - } - - /** - * Add table placeholder/table name relation - * - * @param string $tableName - * @param string $realTableName - * @return $this - */ - public function setTable($tableName, $realTableName) - { - $this->_tables[$tableName] = $realTableName; - return $this; - } - - /** - * Get table name (validated by db adapter) by table placeholder - * - * @param string|array $tableName - * @return string - */ - public function getTable($tableName) - { - $cacheKey = $this->_getTableCacheName($tableName); - if (!isset($this->_tables[$cacheKey])) { - $this->_tables[$cacheKey] = $this->_resourceModel->getTableName($tableName); - } - return $this->_tables[$cacheKey]; - } - - /** - * Retrieve table name for cache - * - * @param string|array $tableName - * @return string - */ - protected function _getTableCacheName($tableName) - { - if (is_array($tableName)) { - return join('_', $tableName); - } - return $tableName; - } - - /** - * Apply data updates to the system after upgrading. - * - * @return $this - */ - public function applyDataUpdates() - { - $dataVer = $this->_resourceResource->getDataVersion($this->_resourceName); - $configVer = $this->_moduleConfig['version']; - if ($dataVer !== false) { - $status = version_compare($configVer, $dataVer); - if ($status == self::VERSION_COMPARE_GREATER) { - $this->_upgradeData($dataVer, $configVer); - } - } elseif ($configVer) { - $this->_installData($configVer); - } - return $this; - } - - /** - * Apply module resource install, upgrade and data scripts - * - * @return $this|true - */ - public function applyUpdates() - { - $dbVer = $this->_resourceResource->getDbVersion($this->_resourceName); - $configVer = $this->_moduleConfig['version']; - - // Module is installed - if ($dbVer !== false) { - $status = version_compare($configVer, $dbVer); - switch ($status) { - case self::VERSION_COMPARE_LOWER: - $this->_rollbackResourceDb($configVer, $dbVer); - break; - case self::VERSION_COMPARE_GREATER: - $this->_upgradeResourceDb($dbVer, $configVer); - break; - default: - return true; - break; - } - } elseif ($configVer) { - $this->_installResourceDb($configVer); - } - - return $this; - } - - /** - * Run data install scripts - * - * @param string $newVersion - * @return $this - */ - protected function _installData($newVersion) - { - $oldVersion = $this->_modifyResourceDb(self::TYPE_DATA_INSTALL, '', $newVersion); - $this->_modifyResourceDb(self::TYPE_DATA_UPGRADE, $oldVersion, $newVersion); - $this->_resourceResource->setDataVersion($this->_resourceName, $newVersion); - - return $this; - } - - /** - * Run data upgrade scripts - * - * @param string $oldVersion - * @param string $newVersion - * @return $this - */ - protected function _upgradeData($oldVersion, $newVersion) - { - $this->_modifyResourceDb('data-upgrade', $oldVersion, $newVersion); - $this->_resourceResource->setDataVersion($this->_resourceName, $newVersion); - - return $this; - } - - /** - * Run resource installation file - * - * @param string $newVersion - * @return $this - */ - protected function _installResourceDb($newVersion) - { - $oldVersion = $this->_modifyResourceDb(self::TYPE_DB_INSTALL, '', $newVersion); - $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion); - $this->_resourceResource->setDbVersion($this->_resourceName, $newVersion); - - return $this; - } - - /** - * Run resource upgrade files from $oldVersion to $newVersion - * - * @param string $oldVersion - * @param string $newVersion - * @return $this - */ - protected function _upgradeResourceDb($oldVersion, $newVersion) - { - $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion); - $this->_resourceResource->setDbVersion($this->_resourceName, $newVersion); - - return $this; - } - - /** - * Roll back resource - * - * @param string $newVersion - * @param string $oldVersion - * @return $this - */ - protected function _rollbackResourceDb($newVersion, $oldVersion) - { - $this->_modifyResourceDb(self::TYPE_DB_ROLLBACK, $newVersion, $oldVersion); - return $this; - } - - /** - * Uninstall resource - * - * @param string $version existing resource version - * @return $this - */ - protected function _uninstallResourceDb($version) - { - $this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, ''); - return $this; - } - - /** - * Retrieve available Database install/upgrade files for current module - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return array - */ - protected function _getAvailableDbFiles($actionType, $fromVersion, $toVersion) - { - $modName = (string)$this->_moduleConfig['name']; - - $filesDir = $this->_modulesReader->getModuleDir('sql', $modName) . '/' . $this->_resourceName; - $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); - if (!$this->modulesDir->isDirectory($modulesDirPath) || !$this->modulesDir->isReadable($modulesDirPath)) { - return array(); - } - - $dbFiles = array(); - $typeFiles = array(); - $regExpDb = sprintf('#%s-(.*)\.(php|sql)$#i', $actionType); - $regExpType = sprintf('#%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType); - foreach ($this->modulesDir->read($modulesDirPath) as $file) { - $matches = array(); - if (preg_match($regExpDb, $file, $matches)) { - $dbFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); - } else if (preg_match($regExpType, $file, $matches)) { - $typeFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); - } - } - - if (empty($typeFiles) && empty($dbFiles)) { - return array(); - } - - foreach ($typeFiles as $version => $file) { - $dbFiles[$version] = $file; - } - - return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $dbFiles); - } - - /** - * Retrieve available Data install/upgrade files for current module - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return array - */ - protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) - { - $modName = (string)$this->_moduleConfig['name']; - $files = array(); - - $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . '/' . $this->_resourceName; - $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); - if ($this->modulesDir->isDirectory($modulesDirPath) && $this->modulesDir->isReadable($modulesDirPath)) { - $regExp = sprintf('#%s-(.*)\.php$#i', $actionType); - foreach ($this->modulesDir->read($modulesDirPath) as $file) { - $matches = array(); - if (preg_match($regExp, $file, $matches)) { - $files[$matches[1]] = $this->modulesDir->getAbsolutePath($file); - } - } - } - - if (empty($files)) { - return array(); - } - - return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $files); - } - - /** - * Save resource version - * - * @param string $actionType - * @param string $version - * @return $this - */ - protected function _setResourceVersion($actionType, $version) - { - switch ($actionType) { - case self::TYPE_DB_INSTALL: - case self::TYPE_DB_UPGRADE: - $this->_resourceResource->setDbVersion($this->_resourceName, $version); - break; - case self::TYPE_DATA_INSTALL: - case self::TYPE_DATA_UPGRADE: - $this->_resourceResource->setDataVersion($this->_resourceName, $version); - break; - default: - break; - } - - return $this; - } - - /** - * Run module modification files. Return version of last applied upgrade (false if no upgrades applied) - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @return false|string - * @throws \Magento\Exception - */ - protected function _modifyResourceDb($actionType, $fromVersion, $toVersion) - { - switch ($actionType) { - case self::TYPE_DB_INSTALL: - case self::TYPE_DB_UPGRADE: - $files = $this->_getAvailableDbFiles($actionType, $fromVersion, $toVersion); - break; - case self::TYPE_DATA_INSTALL: - case self::TYPE_DATA_UPGRADE: - $files = $this->_getAvailableDataFiles($actionType, $fromVersion, $toVersion); - break; - default: - $files = array(); - break; - } - if (empty($files) || !$this->getConnection()) { - return false; - } - - $version = false; - - foreach ($files as $file) { - $fileName = $file['fileName']; - $fileType = pathinfo($fileName, PATHINFO_EXTENSION); - $this->getConnection()->disallowDdlCache(); - try { - switch ($fileType) { - case 'php': - $result = $this->_includeFile($fileName); - break; - case 'sql': - $sql = $this->modulesDir->readFile($this->modulesDir->getRelativePath($fileName)); - if (!empty($sql)) { - - $result = $this->run($sql); - } else { - $result = true; - } - break; - default: - $result = false; - break; - } - - if ($result) { - $this->_setResourceVersion($actionType, $file['toVersion']); - $this->_logger->log($fileName); - } else { - $this->_logger->log("Failed resource setup: {$fileName}"); - } - } catch (\Exception $e) { - throw new \Magento\Exception(sprintf('Error in file: "%s" - %s', $fileName, $e->getMessage()), 0, $e); - } - $version = $file['toVersion']; - $this->getConnection()->allowDdlCache(); - } - return $version; - } - - /** - * Include file by path - * This method should perform only file inclusion. - * Implemented to prevent possibility of changing important and used variables - * inside the setup model while installing - * - * @param string $fileName - * @return mixed - */ - protected function _includeFile($fileName) - { - return include $fileName; - } - - /** - * Get data files for modifications - * - * @param string $actionType - * @param string $fromVersion - * @param string $toVersion - * @param array $arrFiles - * @return array - */ - protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) - { - $arrRes = []; - switch ($actionType) { - case self::TYPE_DB_INSTALL: - case self::TYPE_DATA_INSTALL: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { - $arrRes[0] = [ - 'toVersion' => $version, - 'fileName' => $file - ]; - } - } - break; - - case self::TYPE_DB_UPGRADE: - case self::TYPE_DATA_UPGRADE: - uksort($arrFiles, 'version_compare'); - foreach ($arrFiles as $version => $file) { - $versionInfo = explode('-', $version); - - // In array must be 2 elements: 0 => version from, 1 => version to - if (count($versionInfo) !== 2) { - break; - } - $infoFrom = $versionInfo[0]; - $infoTo = $versionInfo[1]; - if (version_compare($infoFrom, $fromVersion, '>=') - && version_compare($infoTo, $fromVersion, '>') - && version_compare($infoTo, $toVersion, '<=') - && version_compare($infoFrom, $toVersion, '<') - ) { - $arrRes[] = [ - 'toVersion' => $infoTo, - 'fileName' => $file - ]; - } - } - break; - - case self::TYPE_DB_ROLLBACK: - case self::TYPE_DB_UNINSTALL: - default: - break; - } - return $arrRes; - } - - /******************* UTILITY METHODS *****************/ - - /** - * Retrieve row or field from table by id or string and parent id - * - * @param string $table - * @param string $idField - * @param string|integer $rowId - * @param string|null $field - * @param string|null $parentField - * @param string|integer $parentId - * @return mixed - */ - public function getTableRow($table, $idField, $rowId, $field = null, $parentField = null, $parentId = 0) - { - $table = $this->getTable($table); - if (empty($this->_setupCache[$table][$parentId][$rowId])) { - $adapter = $this->getConnection(); - $bind = array('id_field' => $rowId); - $select = $adapter->select()->from($table)->where($adapter->quoteIdentifier($idField) . '= :id_field'); - if (null !== $parentField) { - $select->where($adapter->quoteIdentifier($parentField) . '= :parent_id'); - $bind['parent_id'] = $parentId; - } - $this->_setupCache[$table][$parentId][$rowId] = $adapter->fetchRow($select, $bind); - } - - if (null === $field) { - return $this->_setupCache[$table][$parentId][$rowId]; - } - return isset( - $this->_setupCache[$table][$parentId][$rowId][$field] - ) ? $this->_setupCache[$table][$parentId][$rowId][$field] : false; - } - - /** - * Delete table row - * - * @param string $table - * @param string $idField - * @param string|int $rowId - * @param null|string $parentField - * @param int|string $parentId - * @return $this - */ - public function deleteTableRow($table, $idField, $rowId, $parentField = null, $parentId = 0) - { - $table = $this->getTable($table); - $adapter = $this->getConnection(); - $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId); - if (!is_null($parentField)) { - $where[$adapter->quoteIdentifier($parentField) . '=?'] = $parentId; - } - - $adapter->delete($table, $where); - - if (isset($this->_setupCache[$table][$parentId][$rowId])) { - unset($this->_setupCache[$table][$parentId][$rowId]); - } - - return $this; - } - - /** - * Update one or more fields of table row - * - * @param string $table - * @param string $idField - * @param string|integer $rowId - * @param string|array $field - * @param mixed|null $value - * @param string $parentField - * @param string|integer $parentId - * @return $this - */ - public function updateTableRow($table, $idField, $rowId, $field, $value = null, $parentField = null, $parentId = 0) - { - $table = $this->getTable($table); - if (is_array($field)) { - $data = $field; - } else { - $data = array($field => $value); - } - - $adapter = $this->getConnection(); - $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId); - $adapter->update($table, $data, $where); - - if (isset($this->_setupCache[$table][$parentId][$rowId])) { - if (is_array($field)) { - $this->_setupCache[$table][$parentId][$rowId] = array_merge( - $this->_setupCache[$table][$parentId][$rowId], - $field - ); - } else { - $this->_setupCache[$table][$parentId][$rowId][$field] = $value; - } - } - - return $this; - } - - /** - * Check is table exists - * - * @param string $table - * @return bool - */ - public function tableExists($table) - { - $table = $this->getTable($table); - return $this->getConnection()->isTableExists($table); - } - - /******************* CONFIG *****************/ - - /** - * Save configuration data - * - * @param string $path - * @param string $value - * @param int|string $scope - * @param int $scopeId - * @return $this - */ - public function setConfigData($path, $value, $scope = \Magento\Core\Model\Store::DEFAULT_CODE, $scopeId = 0) - { - $table = $this->getTable('core_config_data'); - // this is a fix for mysql 4.1 - $this->getConnection()->showTableStatus($table); - - $data = array('scope' => $scope, 'scope_id' => $scopeId, 'path' => $path, 'value' => $value); - $this->getConnection()->insertOnDuplicate($table, $data, array('value')); - return $this; - } - - /** - * Delete config field values - * - * @param string $path - * @param string $scope (default|stores|websites|config) - * @return $this - */ - public function deleteConfigData($path, $scope = null) - { - $where = array('path = ?' => $path); - if (null !== $scope) { - $where['scope = ?'] = $scope; - } - $this->getConnection()->delete($this->getTable('core_config_data'), $where); - return $this; - } - - /** - * Run plain SQL query(ies) - * - * @param string $sql - * @return $this - */ - public function run($sql) - { - $this->getConnection()->multiQuery($sql); - return $this; - } - - /** - * Prepare database before install/upgrade - * - * @return $this - */ - public function startSetup() - { - $this->getConnection()->startSetup(); - return $this; - } - - /** - * Prepare database after install/upgrade - * - * @return $this - */ - public function endSetup() - { - $this->getConnection()->endSetup(); - return $this; - } - - /** - * Retrieve 32bit UNIQUE HASH for a Table index - * - * @param string $tableName - * @param array|string $fields - * @param string $indexType - * @return string - */ - public function getIdxName($tableName, $fields, $indexType = '') - { - return $this->_resourceModel->getIdxName($tableName, $fields, $indexType); - } - - /** - * Retrieve 32bit UNIQUE HASH for a Table foreign key - * - * @param string $priTableName the target table name - * @param string $priColumnName the target table column name - * @param string $refTableName the reference table name - * @param string $refColumnName the reference table column name - * @return string - */ - public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) - { - return $this->_resourceModel->getFkName($priTableName, $priColumnName, $refTableName, $refColumnName); - } - - /** - * Check call afterApplyAllUpdates method for setup class - * - * @return bool - */ - public function getCallAfterApplyAllUpdates() - { - return $this->_callAfterApplyAllUpdates; - } - - /** - * Run each time after applying of all updates, - * if setup model setted $_callAfterApplyAllUpdates flag to true - * - * @return $this - */ - public function afterApplyAllUpdates() - { - return $this; + $this->_themeResourceFactory = $themeResourceFactory; + $this->_themeFactory = $themeFactory; + parent::__construct($context, $resourceName, $moduleName, $connectionName); } /** - * @return \Magento\Event\ManagerInterface + * @return \Magento\Core\Model\Resource\Theme\CollectionFactory */ - public function getEventManager() + public function createThemeResourceFactory() { - return $this->_eventManager; + return $this->_themeResourceFactory->create(); } /** - * @return \Magento\App\Filesystem + * @return \Magento\Core\Model\Theme\CollectionFactory */ - public function getFilesystem() + public function createThemeFactory() { - return $this->filesystem; + return $this->_themeFactory->create(); } } diff --git a/app/code/Magento/Core/Model/Resource/Variable.php b/app/code/Magento/Core/Model/Resource/Variable.php index fc0b783e6b1967988baec25bb6db2e784b6ac3a7..2fd6dd24231335d913813cd60ca326de52c9f89a 100644 --- a/app/code/Magento/Core/Model/Resource/Variable.php +++ b/app/code/Magento/Core/Model/Resource/Variable.php @@ -139,7 +139,7 @@ class Variable extends \Magento\Model\Resource\Db\AbstractDb */ protected function _addValueToSelect( \Zend_Db_Select $select, - $storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID ) { $adapter = $this->_getReadAdapter(); $ifNullPlainValue = $adapter->getCheckSql('store.plain_value IS NULL', 'def.plain_value', 'store.plain_value'); diff --git a/app/code/Magento/Core/Model/Session.php b/app/code/Magento/Core/Model/Session.php deleted file mode 100644 index 3a2cc85e3b7dc2db3e2126cc866cf5ebf4d0a226..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Session.php +++ /dev/null @@ -1,37 +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 Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -/** - * Core session model - * - * @method null|bool getCookieShouldBeReceived() - * @method \Magento\Core\Model\Session setCookieShouldBeReceived(bool $flag) - * @method \Magento\Core\Model\Session unsCookieShouldBeReceived() - */ -class Session extends \Magento\Session\Generic -{ -} diff --git a/app/code/Magento/Core/Model/Store/Config.php b/app/code/Magento/Core/Model/Store/Config.php deleted file mode 100644 index 4651cb5264d09ed517a78d90c3024a4b6b9703a1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Store/Config.php +++ /dev/null @@ -1,136 +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 Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Store; - -class Config implements \Magento\Core\Model\Store\ConfigInterface -{ - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * @var \Magento\App\ConfigInterface - */ - protected $_config; - - /** - * @var \Magento\Core\Model\Resource\Store\Collection - */ - protected $_storeCollection; - - /** - * @var \Magento\Core\Model\Resource\Store\CollectionFactory - */ - protected $_factory; - - /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $factory - */ - public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Resource\Store\CollectionFactory $factory - ) { - $this->_storeManager = $storeManager; - $this->_config = $config; - $this->_factory = $factory; - } - - /** - * Retrieve store config value - * - * @param string $path - * @param null|string|bool|int|\Magento\Core\Model\Store $store - * @return string|null - */ - public function getConfig($path, $store = null) - { - return $this->_storeManager->getStore($store)->getConfig($path); - } - - /** - * Retrieve store config flag - * - * @param string $path - * @param null|string|bool|int|\Magento\Core\Model\Store $store - * @return bool - */ - public function getConfigFlag($path, $store = null) - { - $flag = strtolower($this->getConfig($path, $store)); - return !empty($flag) && 'false' !== $flag; - } - - /** - * Retrieve store Ids for $path with checking - * - * If empty $allowValues then retrieve all stores values - * - * return array($storeId => $pathValue) - * - * @param string $path - * @param array $allowedValues - * @param string $keyAttribute - * @return array - * @throws \InvalidArgumentException - */ - public function getStoresConfigByPath($path, $allowedValues = array(), $keyAttribute = 'id') - { - if (is_null($this->_storeCollection)) { - $this->_storeCollection = $this->_factory->create(); - $this->_storeCollection->setLoadDefault(true); - } - $storeValues = array(); - /** @var $store \Magento\Core\Model\Store */ - foreach ($this->_storeCollection as $store) { - switch ($keyAttribute) { - case 'id': - $key = $store->getId(); - break; - case 'code': - $key = $store->getCode(); - break; - case 'name': - $key = $store->getName(); - break; - default: - throw new \InvalidArgumentException("'{$keyAttribute}' cannot be used as a key."); - break; - } - - $value = $this->_config->getValue($path, 'store', $store->getCode()); - if (empty($allowedValues)) { - $storeValues[$key] = $value; - } elseif (in_array($value, $allowedValues)) { - $storeValues[$key] = $value; - } - } - return $storeValues; - } -} diff --git a/app/code/Magento/Core/Model/Store/ConfigInterface.php b/app/code/Magento/Core/Model/Store/ConfigInterface.php deleted file mode 100644 index e2d47cd4fccb671481ddf379025ebea0eec72bf2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Store/ConfigInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * Store Config Interface - * - * 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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Store; - -interface ConfigInterface extends \Magento\Locale\ScopeConfigInterface -{ -} diff --git a/app/code/Magento/Core/Model/Store/StorageFactory.php b/app/code/Magento/Core/Model/Store/StorageFactory.php deleted file mode 100644 index 5290628b0f0abce45399ad2230a4ac5ddc506f2d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Store/StorageFactory.php +++ /dev/null @@ -1,159 +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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Store; - -class StorageFactory -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Default storage class name - * - * @var string - */ - protected $_defaultStorageClassName; - - /** - * Installed storage class name - * - * @var string - */ - protected $_installedStoreClassName; - - /** - * @var \Magento\Core\Model\Store\StorageInterface[] - */ - protected $_cache = array(); - - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Logger - */ - protected $_log; - - /** - * @var \Magento\Session\SidResolverInterface - */ - protected $_sidResolver; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var string - */ - protected $_writerModel; - - /** - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Logger $logger - * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\App\State $appState - * @param string $defaultStorageClassName - * @param string $installedStoreClassName - * @param string $writerModel - */ - public function __construct( - \Magento\ObjectManager $objectManager, - \Magento\Event\ManagerInterface $eventManager, - \Magento\Logger $logger, - \Magento\Session\SidResolverInterface $sidResolver, - \Magento\App\State $appState, - $defaultStorageClassName = 'Magento\Core\Model\Store\Storage\DefaultStorage', - $installedStoreClassName = 'Magento\Core\Model\Store\Storage\Db', - $writerModel = '' - ) { - $this->_objectManager = $objectManager; - $this->_defaultStorageClassName = $defaultStorageClassName; - $this->_installedStoreClassName = $installedStoreClassName; - $this->_eventManager = $eventManager; - $this->_log = $logger; - $this->_appState = $appState; - $this->_sidResolver = $sidResolver; - $this->_writerModel = $writerModel; - } - - /** - * Get storage instance - * - * @param array $arguments - * @return \Magento\Core\Model\Store\StorageInterface - * @throws \InvalidArgumentException - */ - public function get(array $arguments = array()) - { - $className = $this->_appState - ->isInstalled() ? $this - ->_installedStoreClassName : $this - ->_defaultStorageClassName; - - if (false == isset($this->_cache[$className])) { - /** @var $instance \Magento\Core\Model\Store\StorageInterface */ - $instance = $this->_objectManager->create($className, $arguments); - - if (false === $instance instanceof \Magento\Core\Model\Store\StorageInterface) { - throw new \InvalidArgumentException( - $className . ' doesn\'t implement \Magento\Core\Model\Store\StorageInterface' - ); - } - $this->_cache[$className] = $instance; - $instance->initCurrentStore(); - if ($className === $this->_installedStoreClassName) { - $useSid = $instance->getStore()->getConfig( - \Magento\Core\Model\Session\SidResolver::XML_PATH_USE_FRONTEND_SID - ); - $this->_sidResolver->setUseSessionInUrl($useSid); - - $this->_eventManager->dispatch('core_app_init_current_store_after'); - - $store = $instance->getStore(true); - if ($store->getConfig('dev/log/active')) { - - $this->_log->unsetLoggers(); - $this->_log->addStreamLog( - \Magento\Logger::LOGGER_SYSTEM, - $store->getConfig('dev/log/file'), - $this->_writerModel - ); - $this->_log->addStreamLog( - \Magento\Logger::LOGGER_EXCEPTION, - $store->getConfig('dev/log/exception_file'), - $this->_writerModel - ); - } - } - } - return $this->_cache[$className]; - } -} diff --git a/app/code/Magento/Core/Model/TemplateEngine/Plugin/DebugHints.php b/app/code/Magento/Core/Model/TemplateEngine/Plugin/DebugHints.php index af17d30e45511894d8dafa7c5fd216734d953773..8b1655a457734165f0f1412dd960f76b882d2324 100644 --- a/app/code/Magento/Core/Model/TemplateEngine/Plugin/DebugHints.php +++ b/app/code/Magento/Core/Model/TemplateEngine/Plugin/DebugHints.php @@ -42,9 +42,9 @@ class DebugHints private $_objectManager; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - private $_storeConfig; + private $_scopeConfig; /** * @var \Magento\Core\Helper\Data @@ -53,16 +53,16 @@ class DebugHints /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Helper\Data $coreData */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Helper\Data $coreData ) { $this->_objectManager = $objectManager; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_coreData = $coreData; } @@ -79,8 +79,8 @@ class DebugHints \Magento\View\TemplateEngineFactory $subject, \Magento\View\TemplateEngineInterface $invocationResult ) { - if ($this->_storeConfig->getConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS) && $this->_coreData->isDevAllowed()) { - $showBlockHints = $this->_storeConfig->getConfig(self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS); + if ($this->_scopeConfig->getValue(self::XML_PATH_DEBUG_TEMPLATE_HINTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && $this->_coreData->isDevAllowed()) { + $showBlockHints = $this->_scopeConfig->getValue(self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); return $this->_objectManager->create( 'Magento\Core\Model\TemplateEngine\Decorator\DebugHints', array('subject' => $invocationResult, 'showBlockHints' => $showBlockHints) diff --git a/app/code/Magento/Core/Model/Theme/Collection.php b/app/code/Magento/Core/Model/Theme/Collection.php index 820f0d1e3690e320450631d76e9d1447853bfac3..de5099d2c4cfcdcb302eaecd9fd2cad3802f8f76 100644 --- a/app/code/Magento/Core/Model/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Theme/Collection.php @@ -69,7 +69,7 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig */ public function addDefaultPattern($area = \Magento\Core\Model\App\Area::AREA_FRONTEND) { - $this->addTargetPattern(implode('/', array($area, '*', 'theme.xml'))); + $this->addTargetPattern(implode('/', array($area, '*/*', 'theme.xml'))); return $this; } diff --git a/app/code/Magento/Core/Model/Theme/Customization/Config.php b/app/code/Magento/Core/Model/Theme/Customization/Config.php index a87a1e7d620e8d5749256d299c2338bf8fa70c64..b3e5b8b37a37e91157018413d79ffac552f5dd7b 100644 --- a/app/code/Magento/Core/Model/Theme/Customization/Config.php +++ b/app/code/Magento/Core/Model/Theme/Customization/Config.php @@ -37,14 +37,14 @@ class Config implements \Magento\View\Design\Theme\Customization\ConfigInterface const XML_PATH_CUSTOM_FILES = 'theme/customization'; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; /** - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ - public function __construct(\Magento\App\ConfigInterface $config) + public function __construct(\Magento\App\Config\ScopeConfigInterface $config) { $this->config = $config; } diff --git a/app/code/Magento/Core/Model/Theme/Image/Path.php b/app/code/Magento/Core/Model/Theme/Image/Path.php index 785d4cc2db755d78cc355eb44ac142b5ddb87b32..eb3eff4c2745bc5a75030972477ab695c4c48cdd 100644 --- a/app/code/Magento/Core/Model/Theme/Image/Path.php +++ b/app/code/Magento/Core/Model/Theme/Image/Path.php @@ -47,7 +47,7 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface protected $viewUrl; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -56,12 +56,12 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface * * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->filesystem = $filesystem; $this->viewUrl = $viewUrl; diff --git a/app/code/Magento/Core/Model/Theme/Resolver.php b/app/code/Magento/Core/Model/Theme/Resolver.php new file mode 100644 index 0000000000000000000000000000000000000000..446e4b48ac91f046e56ab07c13ad0aeecfbd48a6 --- /dev/null +++ b/app/code/Magento/Core/Model/Theme/Resolver.php @@ -0,0 +1,84 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\Theme; + +/** + * Theme resolver model + */ +class Resolver implements \Magento\View\Design\Theme\ResolverInterface +{ + /** + * @var \Magento\View\DesignInterface + */ + protected $design; + + /** + * @var \Magento\Core\Model\Resource\Theme\CollectionFactory + */ + protected $themeFactory; + + /** + * @var \Magento\App\State + */ + protected $appState; + + /** + * @param \Magento\App\State $appState + * @param \Magento\View\DesignInterface $design + * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory + */ + public function __construct( + \Magento\App\State $appState, + \Magento\View\DesignInterface $design, + \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory + ) { + $this->design = $design; + $this->themeFactory = $themeFactory; + $this->appState = $appState; + } + + /** + * Retrieve instance of a theme currently used in an area + * + * @return \Magento\View\Design\ThemeInterface + */ + public function get() + { + $area = $this->appState->getAreaCode(); + if ($this->design->getDesignTheme()->getArea() == $area || $this->design->getArea() == $area) { + return $this->design->getDesignTheme(); + } + + /** @var \Magento\Core\Model\Resource\Theme\Collection $themeCollection */ + $themeCollection = $this->themeFactory->create(); + $themeIdentifier = $this->design->getConfigurationDesignTheme($area); + if (is_numeric($themeIdentifier)) { + $result = $themeCollection->getItemById($themeIdentifier); + } else { + $themeFullPath = $area . \Magento\View\Design\ThemeInterface::PATH_SEPARATOR . $themeIdentifier; + $result = $themeCollection->getThemeByFullPath($themeFullPath); + } + return $result; + } +} diff --git a/app/code/Magento/Core/Model/Url/RouteParamsResolver.php b/app/code/Magento/Core/Model/Url/RouteParamsResolver.php index 2f89cd69e8202f0a64fdbb4e41258a5554f6282b..2db8bd4ed6b28920a42884737da261d8d6e64f41 100644 --- a/app/code/Magento/Core/Model/Url/RouteParamsResolver.php +++ b/app/code/Magento/Core/Model/Url/RouteParamsResolver.php @@ -31,12 +31,12 @@ class RouteParamsResolver extends \Magento\Object implements \Magento\Url\RouteP protected $_request; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -47,21 +47,21 @@ class RouteParamsResolver extends \Magento\Object implements \Magento\Url\RouteP /** * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\Store\Config $storeConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Url\QueryParamsResolverInterface $queryParamsResolver * @param array $data */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\Store\Config $storeConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Url\QueryParamsResolverInterface $queryParamsResolver, array $data = array() ) { parent::__construct($data); $this->_request = $request; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_queryParamsResolver = $queryParamsResolver; } @@ -125,8 +125,9 @@ class RouteParamsResolver extends \Magento\Object implements \Magento\Url\RouteP } if (isset($data['_scope_to_url']) && (bool)$data['_scope_to_url'] === true) { - if (!$this->_storeConfig->getConfig( - \Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, + if (!$this->_scopeConfig->getValue( + \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getScope() ) && !$this->_storeManager->hasSingleStore() ) { diff --git a/app/code/Magento/Core/Model/Url/ScopeResolver.php b/app/code/Magento/Core/Model/Url/ScopeResolver.php index 442d8da129decd0c4eb0731350793182509778b0..591a4885692929b9b6a1d6b8f028ff677965e2b2 100644 --- a/app/code/Magento/Core/Model/Url/ScopeResolver.php +++ b/app/code/Magento/Core/Model/Url/ScopeResolver.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\Url; class ScopeResolver implements \Magento\Url\ScopeResolverInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -36,10 +36,10 @@ class ScopeResolver implements \Magento\Url\ScopeResolverInterface protected $_areaCode; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param string|null $areaCode */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager, $areaCode = null) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager, $areaCode = null) { $this->_storeManager = $storeManager; $this->_areaCode = $areaCode; diff --git a/app/code/Magento/Core/Model/Url/SecurityInfo.php b/app/code/Magento/Core/Model/Url/SecurityInfo.php index 12ca5b298efc322c4e98156b4d6fd4954f3eacac..5f179368c313f92a00f11e5c68f6d78d870312c7 100644 --- a/app/code/Magento/Core/Model/Url/SecurityInfo.php +++ b/app/code/Magento/Core/Model/Url/SecurityInfo.php @@ -28,11 +28,9 @@ namespace Magento\Core\Model\Url; class SecurityInfo implements \Magento\Url\SecurityInfoInterface { /** - * Store manager - * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeManager; + protected $_scopeConfig; /** * List of secure url patterns @@ -49,14 +47,12 @@ class SecurityInfo implements \Magento\Url\SecurityInfoInterface protected $_secureUrlCache = array(); /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $secureUrlList */ - public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - array $secureUrlList = array() - ) { - $this->_storeManager = $storeManager; + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig, array $secureUrlList = array()) + { + $this->_scopeConfig = $scopeConfig; $this->_secureUrlList = $secureUrlList; } @@ -68,7 +64,11 @@ class SecurityInfo implements \Magento\Url\SecurityInfoInterface */ public function isSecure($url) { - if (!$this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_SECURE_IN_FRONTEND)) { + if (!$this->_scopeConfig->getValue( + \Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return false; } diff --git a/app/code/Magento/Core/Model/Variable.php b/app/code/Magento/Core/Model/Variable.php index 643ee7d791c2b4beeedda8324d569389ebf4fda8..8caf06b53fce94cc5cb3eaa9371786ba38065db8 100644 --- a/app/code/Magento/Core/Model/Variable.php +++ b/app/code/Magento/Core/Model/Variable.php @@ -161,7 +161,7 @@ class Variable extends \Magento\Model\AbstractModel /** * Retrieve variables option array - * + * @todo: extract method as separate class * @param bool $withGroup * @return array */ diff --git a/app/code/Magento/Core/Model/View/Design.php b/app/code/Magento/Core/Model/View/Design.php index 74b9f922c5ae39bca5c044356f631c7153601ac2..ee35b8b9c7e3ad6d4484c77f9215f409e6616aa9 100644 --- a/app/code/Magento/Core/Model/View/Design.php +++ b/app/code/Magento/Core/Model/View/Design.php @@ -56,7 +56,7 @@ class Design implements \Magento\View\DesignInterface /** * Store list manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -71,14 +71,9 @@ class Design implements \Magento\View\DesignInterface protected $_themeFactory; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_config; - - /** - * @var \Magento\Core\Model\Store\Config - */ - private $_storeConfig; + private $_scopeConfig; /** * @var \Magento\Locale\ResolverInterface @@ -91,20 +86,18 @@ class Design implements \Magento\View\DesignInterface protected $_appState; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\Design\Theme\FlyweightFactory $flyweightFactory - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Model\ThemeFactory $themeFactory * @param \Magento\Locale\ResolverInterface $locale * @param \Magento\App\State $appState * @param array $themes */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\Design\Theme\FlyweightFactory $flyweightFactory, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Model\ThemeFactory $themeFactory, \Magento\Locale\ResolverInterface $locale, \Magento\App\State $appState, @@ -113,8 +106,7 @@ class Design implements \Magento\View\DesignInterface $this->_storeManager = $storeManager; $this->_flyweightFactory = $flyweightFactory; $this->_themeFactory = $themeFactory; - $this->_config = $config; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_appState = $appState; $this->_themes = $themes; $this->_locale = $locale; @@ -187,11 +179,12 @@ class Design implements \Magento\View\DesignInterface $store = isset($params['store']) ? $params['store'] : null; if ($this->_isThemePerStoveView($area)) { - $theme = $this->_storeManager->isSingleStoreMode() ? $this->_config->getValue( + $theme = $this->_storeManager->isSingleStoreMode() ? $this->_scopeConfig->getValue( self::XML_PATH_THEME_ID, - 'default' - ) : (string)$this->_storeConfig->getConfig( + \Magento\App\ScopeInterface::SCOPE_DEFAULT + ) : (string)$this->_scopeConfig->getValue( self::XML_PATH_THEME_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } diff --git a/app/code/Magento/Core/Model/View/Url/Config.php b/app/code/Magento/Core/Model/View/Url/Config.php index c8d18d279b236ce6b1c9282a3ae91145ddd1efa3..c0e6bcc622851d9bdb46853efa2bf8faf2713f0c 100644 --- a/app/code/Magento/Core/Model/View/Url/Config.php +++ b/app/code/Magento/Core/Model/View/Url/Config.php @@ -28,18 +28,18 @@ namespace Magento\Core\Model\View\Url; class Config implements \Magento\View\Url\ConfigInterface { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * View url config model * - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -50,6 +50,6 @@ class Config implements \Magento\View\Url\ConfigInterface */ public function getValue($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.10-1.6.0.11.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.10-1.6.0.11.php index 0b75d9686d08d375117bab8f7be0489b70dc4b89..a474650f2b18241cf0cfb6b9b253af5eadbfbc64 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.10-1.6.0.11.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.10-1.6.0.11.php @@ -25,11 +25,11 @@ */ /** @var $filesystemCollection \Magento\Core\Model\Theme\Collection */ -$filesystemCollection = $this->_themeFactory->create(); +$filesystemCollection = $this->createThemeFactory(); $filesystemCollection->addDefaultPattern('*'); /** @var $theme \Magento\View\Design\ThemeInterface */ -foreach ($this->_themeResourceFactory->create() as $theme) { +foreach ($this->createThemeResourceFactory() as $theme) { $themeType = $filesystemCollection->hasTheme( $theme ) ? \Magento\View\Design\ThemeInterface::TYPE_PHYSICAL : \Magento\View\Design\ThemeInterface::TYPE_VIRTUAL; diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.12-1.6.0.13.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.12-1.6.0.13.php index 0aa2431fa0838554f65960aeed8c62b8ac3067a5..48ce474a1ae32e7afca7a41907ae9928f818dfd3 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.12-1.6.0.13.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.12-1.6.0.13.php @@ -25,10 +25,10 @@ */ /** @var $themeDbCollection \Magento\Core\Model\Resource\Theme\Collection */ -$themeDbCollection = $this->_themeResourceFactory->create(); +$themeDbCollection = $this->createThemeResourceFactory(); /** @var $theme \Magento\View\Design\ThemeInterface */ -foreach ($this->_themeFactory->create()->addDefaultPattern('*') as $theme) { +foreach ($this->createThemeFactory()->addDefaultPattern('*') as $theme) { $dbTheme = $themeDbCollection->getThemeByFullPath($theme->getFullPath()); $dbTheme->setCode($theme->getCode()); $dbTheme->save(); diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.2-1.6.0.3.php index d04fc085260d04569e6896b11deff1efba14fe9c..e9a09d7eab227a338773b08797008d2a822a9e92 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); $connection->update( diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.3-1.6.0.4.php index 46a6968b404170f2806fd238e21f720ee62e7df2..596fe82cb740dd18ae5426e6137d77f8e9077925 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.3-1.6.0.4.php @@ -24,22 +24,22 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'core_config_data', 'value', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('config_id') ); $installer->appendClassAliasReplace( 'core_layout_update', 'xml', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, array('layout_update_id') ); $installer->doUpdateClassAliases(); diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php index eb9ac60ddec877dfce96f321b3c4824a1b26f95e..bc00e4c4f6e2f6d154b4b2d42fbd5761bb38f1ab 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.4-1.6.0.5.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.5-1.6.0.6.php b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.5-1.6.0.6.php index a2a2a57950f5bba5aa25de2e5b32cda67fedbe68..044124f878dc8a262f7925d537448d258dfb9f13 100644 --- a/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.5-1.6.0.6.php +++ b/app/code/Magento/Core/data/core_setup/data-upgrade-1.6.0.5-1.6.0.6.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index ad2b39457f71c7395db4f14cdd3b5162bc134f91..c72d6272ad9d872ff372c037d82323647cffd474 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -26,17 +26,17 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\Acl\CacheInterface" type="Magento\Acl\Cache" /> <preference for="Magento\App\AreaInterface" type="Magento\Core\Model\App\Area" /> - <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" /> + <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Module\Setup" /> <preference for="Magento\Module\ResourceResolverInterface" type="Magento\Module\ResourceResolver" /> <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" /> <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\DefaultPolicy" /> <preference for="Magento\Authorization\RoleLocator" type="Magento\Authorization\RoleLocator\DefaultRoleLocator" /> - <preference for="Magento\Session\SessionManagerInterface" type="Magento\Core\Model\Session" /> + <preference for="Magento\Session\SessionManagerInterface" type="Magento\Session\Generic" /> <preference for="Magento\Core\Model\DataService\ConfigInterface" type="Magento\Core\Model\DataService\Config" /> - <preference for="Magento\App\ConfigInterface" type="Magento\App\Config" /> - <preference for="Magento\App\ReinitableConfigInterface" type="Magento\App\ReinitableConfig" /> - <preference for="Magento\App\Config\Scope\ReaderPoolInterface" type="Magento\Core\Model\Config\Scope\ReaderPool" /> - <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\Core\Model\Config\Storage\Db" /> + <preference for="Magento\App\Config\ScopeConfigInterface" type="Magento\App\Config" /> + <preference for="Magento\App\Config\ReinitableConfigInterface" type="Magento\App\ReinitableConfig" /> + <preference for="Magento\App\Config\MutableScopeConfigInterface" type="Magento\App\MutableScopeConfig" /> + <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\App\Config\Storage\Writer" /> <preference for="Magento\View\Design\Theme\FileInterface" type="Magento\Core\Model\Theme\File" /> <preference for="Magento\Config\ConverterInterface" type="Magento\Config\Converter\Dom"/> <preference for="Magento\Core\Model\Url\SecurityInfoInterface" type="Magento\Core\Model\Url\SecurityInfo\Proxy" /> @@ -50,9 +50,13 @@ <preference for="Magento\View\Asset\ConfigInterface" type="Magento\Core\Model\Asset\Config" /> <preference for="Magento\View\Asset\MergeStrategyInterface" type="Magento\View\Asset\MergeStrategy\Direct" /> <preference for="Magento\App\ViewInterface" type="Magento\App\View" /> - <preference for="Magento\App\Response\RedirectInterface" type="Magento\Core\App\Response\Redirect" /> + <preference for="Magento\TranslateInterface" type="Magento\Translate" /> + <preference for="Magento\App\Response\RedirectInterface" type="Magento\Store\App\Response\Redirect" /> <preference for="Magento\Data\Collection\EntityFactoryInterface" type="Magento\Core\Model\EntityFactory" /> - <preference for="Magento\Session\ValidatorInterface" type="Magento\Core\Model\Session\Validator" /> + <preference for="Magento\Translate\InlineInterface" type="Magento\Translate\Inline" /> + <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Translation\Model\Inline\Config" /> + <preference for="Magento\Translate\Inline\ParserInterface" type="Magento\Translation\Model\Inline\Parser" /> + <preference for="Magento\Session\ValidatorInterface" type="Magento\Session\Validator" /> <preference for="Magento\Session\StorageInterface" type="Magento\Session\Storage" /> <preference for="Magento\Url\RouteParamsResolverInterface" type="Magento\Core\Model\Url\RouteParamsResolver" /> <preference for="Magento\Url\QueryParamsResolverInterface" type="Magento\Url\QueryParamsResolver" /> @@ -65,7 +69,7 @@ <preference for="Magento\Mview\View\SubscriptionInterface" type="Magento\Mview\View\Subscription" /> <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> <preference for="Magento\Css\PreProcessor\AdapterInterface" type="Magento\Css\PreProcessor\Adapter\Oyejorge" /> - <preference for="Magento\BaseScopeResolverInterface" type="Magento\Core\Model\BaseScopeResolver" /> + <preference for="Magento\Translate\ResourceInterface" type="Magento\Translation\Model\Resource\Translate" /> <preference for="Magento\LocaleInterface" type="Magento\Locale" /> <preference for="Magento\Locale\CurrencyInterface" type="Magento\Locale\Currency" /> <preference for="Magento\CurrencyInterface" type="Magento\Currency" /> @@ -73,8 +77,9 @@ <preference for="Magento\Locale\ResolverInterface" type="Magento\Locale\Resolver" /> <preference for="Magento\Stdlib\DateTime\TimezoneInterface" type="Magento\Stdlib\DateTime\Timezone" /> <preference for="Magento\Stdlib\DateTime\DateInterface" type="Magento\Stdlib\DateTime\Date" /> - <preference for="Magento\Locale\ScopeConfigInterface" type="Magento\Core\Model\Store\Config" /> <preference for="Magento\Less\PreProcessor\ErrorHandlerInterface" type="Magento\Less\PreProcessor\ErrorHandler" /> + <preference for="Magento\Module\ResourceInterface" type="Magento\Install\Model\Resource\Resource" /> + <preference for="Magento\App\Config\Resource\ConfigInterface" type="Magento\Core\Model\Resource\Config" /> <type name="Magento\App\DefaultPath\DefaultPath"> <arguments> <argument name="parts" xsi:type="array"> @@ -103,62 +108,11 @@ <argument name="cacheLifetime" xsi:type="string">86400</argument> </arguments> </type> - <type name="Magento\Core\Model\Store"> - <arguments> - <argument name="isCustomEntryPoint" xsi:type="init_parameter">Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM</argument> - <argument name="url" xsi:type="object" shared="false">Magento\UrlInterface</argument> - </arguments> - </type> <type name="Magento\Acl\Cache"> <arguments> <argument name="cacheKey" xsi:type="string">global_acl_resources</argument> </arguments> </type> - <virtualType name="Magento\Core\Model\Resource\Website\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> - <arguments> - <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> - <argument name="cacheIdPrefix" xsi:type="string">app_</argument> - <argument name="cacheTags" xsi:type="array"> - <item name="storeTag" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</item> - </argument> - <argument name="cacheLifetime" xsi:type="boolean">false</argument> - </arguments> - </virtualType> - <virtualType name="Magento\Core\Model\Resource\Store\Group\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> - <arguments> - <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> - <argument name="cacheIdPrefix" xsi:type="string">app_</argument> - <argument name="cacheTags" xsi:type="array"> - <item name="storeTag" xsi:type="const">Magento\Core\Model\Store\Group::CACHE_TAG</item> - </argument> - <argument name="cacheLifetime" xsi:type="boolean">false</argument> - </arguments> - </virtualType> - <virtualType name="Magento\Core\Model\Resource\Store\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> - <arguments> - <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> - <argument name="cacheIdPrefix" xsi:type="string">app_</argument> - <argument name="cacheTags" xsi:type="array"> - <item name="storeTag" xsi:type="const">Magento\Core\Model\Store::CACHE_TAG</item> - </argument> - <argument name="cacheLifetime" xsi:type="boolean">false</argument> - </arguments> - </virtualType> - <type name="Magento\Core\Model\Resource\Website\Collection"> - <arguments> - <argument name="fetchStrategy" xsi:type="object">Magento\Core\Model\Resource\Website\Collection\FetchStrategy</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Resource\Store\Group\Collection"> - <arguments> - <argument name="fetchStrategy" xsi:type="object">Magento\Core\Model\Resource\Store\Group\Collection\FetchStrategy</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Resource\Store\Collection"> - <arguments> - <argument name="fetchStrategy" xsi:type="object">Magento\Core\Model\Resource\Store\Collection\FetchStrategy</argument> - </arguments> - </type> <type name="Magento\View\Asset\Collection" shared="false" /> <type name="Magento\Core\Model\Theme\Collection" shared="false" /> <type name="Magento\Core\Model\Layout\Merge"> @@ -230,16 +184,6 @@ <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Config</argument> </arguments> </type> - <type name="Magento\Core\Model\Config\Scope\Reader\Website"> - <arguments> - <argument name="scopePool" xsi:type="object">Magento\App\Config\ScopePool\Proxy</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Config\Scope\Reader\Store"> - <arguments> - <argument name="scopePool" xsi:type="object">Magento\App\Config\ScopePool\Proxy</argument> - </arguments> - </type> <type name="Magento\App\Config\Initial\SchemaLocator"> <arguments> <argument name="moduleName" xsi:type="string">Magento_Core</argument> @@ -250,13 +194,6 @@ <argument name="converter" xsi:type="object">Magento\App\Config\Initial\Converter</argument> </arguments> </type> - <type name="Magento\Core\Model\Config\Scope\ReaderPool"> - <arguments> - <argument name="default" xsi:type="object">Magento\Core\Model\Config\Scope\Reader\DefaultReader</argument> - <argument name="website" xsi:type="object">Magento\Core\Model\Config\Scope\Reader\Website</argument> - <argument name="store" xsi:type="object">Magento\Core\Model\Config\Scope\Reader\Store</argument> - </arguments> - </type> <type name="Magento\Core\App\Router\Base"> <arguments> <argument name="routerId" xsi:type="string">standard</argument> @@ -272,7 +209,7 @@ </argument> </arguments> </type> - <type name="Magento\Core\Model\Session\Validator"> + <type name="Magento\Session\Validator"> <arguments> <argument name="skippedUserAgentList" xsi:type="array"> <item name="flash" xsi:type="string">Shockwave Flash</item> @@ -283,9 +220,9 @@ <type name="Magento\Core\Model\View\Design"> <arguments> <argument name="themes" xsi:type="array"> - <item name="frontend" xsi:type="string">magento_blank</item> - <item name="adminhtml" xsi:type="string">magento_backend</item> - <item name="install" xsi:type="string">magento_basic</item> + <item name="frontend" xsi:type="string">Magento/blank</item> + <item name="adminhtml" xsi:type="string">Magento/backend</item> + <item name="install" xsi:type="string">Magento/basic</item> </argument> </arguments> </type> @@ -350,9 +287,12 @@ <argument name="modulePrefix" xsi:type="string">core</argument> </arguments> </type> - <type name="Magento\Core\Model\Resource\Setup\Migration"> + <type name="Magento\Module\Setup\Migration"> <arguments> <argument name="confPathToMapFile" xsi:type="string">app/etc/aliases_to_classes_map.json</argument> + <argument name="resourceName" xsi:type="string">core_setup</argument> + <argument name="moduleName" xsi:type="string">Magento_Core</argument> + <argument name="connectionName" xsi:type="string">\Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION</argument> </arguments> </type> <type name="Magento\Encryption\Encryptor"> @@ -360,22 +300,11 @@ <argument name="cryptKey" xsi:type="init_parameter">Magento\Encryption\Encryptor::PARAM_CRYPT_KEY</argument> </arguments> </type> - <type name="Magento\Core\Model\Session\Config"> - <arguments> - <argument name="savePath" xsi:type="init_parameter">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH</argument> - <argument name="cacheLimiter" xsi:type="init_parameter">Magento\Core\Model\Session\Config::PARAM_SESSION_CACHE_LIMITER</argument> - <argument name="saveMethod" xsi:type="init_parameter">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD</argument> - </arguments> - </type> - <type name="Magento\Core\Model\StoreManager"> - <arguments> - <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> - <argument name="helper" xsi:type="object">Magento\Core\Helper\Data\Proxy</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Config\Scope\Processor\Placeholder"> + <type name="Magento\Session\Config"> <arguments> - <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> + <argument name="savePath" xsi:type="init_parameter">Magento\Session\Config::PARAM_SESSION_SAVE_PATH</argument> + <argument name="cacheLimiter" xsi:type="init_parameter">Magento\Session\Config::PARAM_SESSION_CACHE_LIMITER</argument> + <argument name="saveMethod" xsi:type="init_parameter">Magento\Session\Config::PARAM_SESSION_SAVE_METHOD</argument> </arguments> </type> <type name="Magento\App\Helper\Context"> @@ -426,11 +355,6 @@ <argument name="dataStorage" xsi:type="object">Magento\View\Layout\PageType\Config\Data</argument> </arguments> </type> - <type name="Magento\Core\Model\Store\Storage\Db"> - <arguments> - <argument name="url" xsi:type="object">Magento\Backend\Model\UrlInterface\Proxy</argument> - </arguments> - </type> <type name="Magento\Core\Model\App\Area"> <arguments> <argument name="translator" xsi:type="object">Magento\Translate</argument> @@ -439,12 +363,11 @@ </type> <type name="Magento\App\FrontController"> <plugin name="install" type="Magento\Module\FrontController\Plugin\Install" sortOrder="40"/> - <plugin name="dispatchExceptionHandler" type="Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler" sortOrder="30"/> <plugin name="clickjacking" type="Magento\App\FrontController\Plugin\Clickjacking" sortOrder="0"/> <plugin name="messageBox" type="Magento\Core\App\FrontController\Plugin\MessageBox" sortOrder="0"/> </type> <type name="Magento\App\Action\Action"> - <plugin name="storeCheck" type="Magento\Core\App\Action\Plugin\StoreCheck" sortOrder="10"/> + <plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck" sortOrder="10"/> <plugin name="designLoader" type="Magento\Core\App\Action\Plugin\Design" sortOrder="30"/> </type> <virtualType name="Magento\Core\Model\Session\Storage" type="Magento\Session\Storage"> @@ -452,7 +375,7 @@ <argument name="namespace" xsi:type="string">core</argument> </arguments> </virtualType> - <type name="Magento\Core\Model\Session"> + <type name="Magento\Session\Generic"> <arguments> <argument name="storage" xsi:type="object">Magento\Core\Model\Session\Storage</argument> </arguments> @@ -521,20 +444,37 @@ <type name="Magento\Stdlib\DateTime\Timezone"> <arguments> <argument name="defaultTimezonePath" xsi:type="string">general/locale/timezone</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Url"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> </arguments> </type> <type name="Magento\Locale\Resolver"> <plugin name="initLocale" type="Magento\Translate\Locale\Resolver\Plugin" sortOrder="10"/> <arguments> <argument name="defaultLocalePath" xsi:type="string">general/locale/code</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\App\ScopeResolverPool"> + <arguments> + <argument name="scopeResolvers" xsi:type="array"> + <item name="store" xsi:type="object">Magento\Store\Model\Resolver\Store</item> + <item name="stores" xsi:type="object">Magento\Store\Model\Resolver\Store</item> + <item name="website" xsi:type="object">Magento\Store\Model\Resolver\Website</item> + <item name="websites" xsi:type="object">Magento\Store\Model\Resolver\Website</item> + </argument> </arguments> </type> <type name="Magento\Model\ActionValidator\RemoveAction"> <arguments> <argument name="protectedModels" xsi:type="array"> - <item name="store" xsi:type="string">Magento\Core\Model\Store</item> - <item name="website" xsi:type="string">Magento\Core\Model\Website</item> - <item name="storeGroup" xsi:type="string">Magento\Core\Model\Store\Group</item> + <item name="store" xsi:type="string">Magento\Store\Model\Store</item> + <item name="website" xsi:type="string">Magento\Store\Model\Website</item> + <item name="storeGroup" xsi:type="string">Magento\Store\Model\Group</item> </argument> </arguments> </type> @@ -542,4 +482,33 @@ <plugin name="core-app-area-design-exception-plugin" type="Magento\Core\Model\App\Area\CacheIdentifierPlugin" sortOrder="10"/> </type> + <type name="Magento\Module\Setup\MigrationData"> + <arguments> + <argument name="data" xsi:type="array"> + <item name="plain" xsi:type="string"><![CDATA[/^(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)::.*?$/sui]]></item> + <item name="wiki" xsi:type="string"><![CDATA[/{{(block|widget).*?(class|type)=\"(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)\".*?}}/sui]]></item> + <item name="xml" xsi:type="string"><![CDATA[/<block.*?class=\"(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)\".*?>/sui]]></item> + <item name="serialized" xsi:type="string"><![CDATA[#(?P<string>s:\d+:"(?P<alias>[a-z]+[_a-z\d]*?/[a-z]+[_a-z\d]*?)")#sui]]></item> + </argument> + </arguments> + </type> + <type name="Magento\Module\Updater\SetupFactory"> + <arguments> + <argument name="resourceTypes" xsi:type="array"> + <item name="core_setup" xsi:type="string">Magento\Core\Model\Resource\Setup</item> + </argument> + </arguments> + </type> + <type name="Magento\Module\Setup"> + <arguments> + <argument name="resourceName" xsi:type="string">core_setup</argument> + <argument name="connectionName" xsi:type="string">Magento\Module\Updater::DEFAULT_SETUP_CONNECTION</argument> + </arguments> + </type> + <type name="Magento\App\Config\Value"> + <arguments> + <argument name="resource" xsi:type="object">Magento\Core\Model\Resource\Config\Data</argument> + <argument name="resourceCollection" xsi:type="object">Magento\Core\Model\Resource\Config\Data\Collection\Proxy</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Core/etc/frontend/di.xml b/app/code/Magento/Core/etc/frontend/di.xml index 95377dec5279ffa54eb7e565f5c55e7d58371eb1..dabd05bff61667dcb34b82871d3d8998e838e4a7 100644 --- a/app/code/Magento/Core/etc/frontend/di.xml +++ b/app/code/Magento/Core/etc/frontend/di.xml @@ -24,15 +24,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <type name="Magento\Core\Model\Session"> + <type name="Magento\Session\Generic"> <arguments> <argument name="sessionName" xsi:type="string">frontend</argument> </arguments> </type> - <type name="Magento\Core\Model\Layout"> - <arguments> - <argument name="area" xsi:type="string">frontend</argument> - </arguments> + <type name="Magento\View\Layout"> <plugin name="core-session-depersonalize" type="Magento\Core\Model\Layout\DepersonalizePlugin" sortOrder="1"/> </type> diff --git a/app/code/Magento/Core/etc/module.xml b/app/code/Magento/Core/etc/module.xml index 1c2d659e2c3fe252cc8cf75aec40f079cc6ec5ae..7ad28cf0786122091817dc81572bdbd6a507e6e5 100644 --- a/app/code/Magento/Core/etc/module.xml +++ b/app/code/Magento/Core/etc/module.xml @@ -26,21 +26,10 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Core" version="1.6.0.16" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Backend"/> - <module name="Magento_Directory"/> - <module name="Magento_Index"/> <module name="Magento_Cron"/> <module name="Magento_Theme"/> - <module name="Magento_AdminNotification"/> - <module name="Magento_CatalogInventory"/> - <module name="Magento_CatalogRule"/> - <module name="Magento_CatalogSearch"/> - <module name="Magento_CurrencySymbol"/> - <module name="Magento_GiftMessage"/> - <module name="Magento_GoogleAnalytics"/> - <module name="Magento_ImportExport"/> - <module name="Magento_ProductAlert"/> - <module name="Magento_SalesRule"/> <module name="Magento_Eav"/> <module name="Magento_PageCache"/> <extension name="spl"/> diff --git a/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php b/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php index d169d08af6b761128a4fc537b4c5392af686ed3a..a760275ca6118026a729e91529084f90731c4f98 100644 --- a/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php +++ b/app/code/Magento/Core/sql/core_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -58,194 +58,6 @@ $table = $installer->getConnection()->newTable( ); $installer->getConnection()->createTable($table); -/** - * Create table 'core_website' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('core_website') -)->addColumn( - 'website_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website Id' -)->addColumn( - 'code', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 32, - array(), - 'Code' -)->addColumn( - 'name', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 64, - array(), - 'Website Name' -)->addColumn( - 'sort_order', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Sort Order' -)->addColumn( - 'default_group_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Default Group Id' -)->addColumn( - 'is_default', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Defines Is Website Default' -)->addIndex( - $installer->getIdxName('core_website', array('code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - array('code'), - array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('core_website', array('sort_order')), - array('sort_order') -)->addIndex( - $installer->getIdxName('core_website', array('default_group_id')), - array('default_group_id') -)->setComment( - 'Websites' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'core_store_group' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('core_store_group') -)->addColumn( - 'group_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Group Id' -)->addColumn( - 'website_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Website Id' -)->addColumn( - 'name', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => false), - 'Store Group Name' -)->addColumn( - 'root_category_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Root Category Id' -)->addColumn( - 'default_store_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Default Store Id' -)->addIndex( - $installer->getIdxName('core_store_group', array('website_id')), - array('website_id') -)->addIndex( - $installer->getIdxName('core_store_group', array('default_store_id')), - array('default_store_id') -)->addForeignKey( - $installer->getFkName('core_store_group', 'website_id', 'core_website', 'website_id'), - 'website_id', - $installer->getTable('core_website'), - 'website_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Store Groups' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'core_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('core_store') -)->addColumn( - 'store_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store Id' -)->addColumn( - 'code', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 32, - array(), - 'Code' -)->addColumn( - 'website_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Website Id' -)->addColumn( - 'group_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Group Id' -)->addColumn( - 'name', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => false), - 'Store Name' -)->addColumn( - 'sort_order', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store Sort Order' -)->addColumn( - 'is_active', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store Activity' -)->addIndex( - $installer->getIdxName('core_store', array('code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - array('code'), - array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('core_store', array('website_id')), - array('website_id') -)->addIndex( - $installer->getIdxName('core_store', array('is_active', 'sort_order')), - array('is_active', 'sort_order') -)->addIndex( - $installer->getIdxName('core_store', array('group_id')), - array('group_id') -)->addForeignKey( - $installer->getFkName('core_store', 'group_id', 'core_store_group', 'group_id'), - 'group_id', - $installer->getTable('core_store_group'), - 'group_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('core_store', 'website_id', 'core_website', 'website_id'), - 'website_id', - $installer->getTable('core_website'), - 'website_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Stores' -); -$installer->getConnection()->createTable($table); - /** * Create table 'core_config_data' */ @@ -384,9 +196,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('core_layout_link', array('layout_update_id')), array('layout_update_id') )->addForeignKey( - $installer->getFkName('core_layout_link', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -477,9 +289,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('core_translate', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('core_translate', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('core_translate', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -527,9 +339,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('design_change', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('design_change', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -620,9 +432,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('core_variable_value', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('core_variable_value', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('core_variable_value', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -771,77 +583,4 @@ $table = $installer->getConnection()->newTable( ); $installer->getConnection()->createTable($table); - -/** - * Insert core websites - */ -$installer->getConnection()->insertForce( - $installer->getTable('core_website'), - array( - 'website_id' => 0, - 'code' => 'admin', - 'name' => 'Admin', - 'sort_order' => 0, - 'default_group_id' => 0, - 'is_default' => 0 - ) -); -$installer->getConnection()->insertForce( - $installer->getTable('core_website'), - array( - 'website_id' => 1, - 'code' => 'base', - 'name' => 'Main Website', - 'sort_order' => 0, - 'default_group_id' => 1, - 'is_default' => 1 - ) -); - -/** - * Insert core store groups - */ -$installer->getConnection()->insertForce( - $installer->getTable('core_store_group'), - array('group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0) -); -$installer->getConnection()->insertForce( - $installer->getTable('core_store_group'), - array( - 'group_id' => 1, - 'website_id' => 1, - 'name' => 'Main Website Store', - 'root_category_id' => 2, - 'default_store_id' => 1 - ) -); - -/** - * Insert core stores - */ -$installer->getConnection()->insertForce( - $installer->getTable('core_store'), - array( - 'store_id' => 0, - 'code' => 'admin', - 'website_id' => 0, - 'group_id' => 0, - 'name' => 'Admin', - 'sort_order' => 0, - 'is_active' => 1 - ) -); -$installer->getConnection()->insertForce( - $installer->getTable('core_store'), - array( - 'store_id' => 1, - 'code' => 'default', - 'website_id' => 1, - 'group_id' => 1, - 'name' => 'Default Store View', - 'sort_order' => 0, - 'is_active' => 1 - ) -); - $installer->endSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/oracle-upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Core/sql/core_setup/oracle-upgrade-1.6.0.0-1.6.0.1.php deleted file mode 100644 index 9ebd714e9eabf1669a68e8aa4bf48cf32c474ca6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/sql/core_setup/oracle-upgrade-1.6.0.0-1.6.0.1.php +++ /dev/null @@ -1,51 +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 Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; - -$connection = $installer->getConnection(); - -$fileStorageTable = $installer->getTable('core_file_storage'); -if ($installer->tableExists($fileStorageTable)) { - $temporaryColumnName = 'newcontent'; - $originColumnName = 'content'; - $connection->addColumn( - $fileStorageTable, - $temporaryColumnName, - array( - 'type' => \Magento\DB\Ddl\Table::TYPE_VARBINARY, - 'size' => \Magento\DB\Ddl\Table::MAX_VARBINARY_SIZE, - 'nullable' => true, - 'comment' => 'File Content' - ) - ); - $queryString = "\n DECLARE\n v_clob Clob;\n v_blob Blob;\n v_in Pls_Integer := 1;\n v_out Pls_Integer := 1;\n v_lang Pls_Integer := 0;\n v_warning Pls_Integer := 0;\n BEGIN\n FOR row IN (SELECT file_id, {$originColumnName} from {$fileStorageTable})\n LOOP\n if row.{$originColumnName} is null then v_blob:=null;\n else\n v_clob:=row.{$originColumnName};\n v_in:=1;\n v_out:=1;\n dbms_lob.createtemporary(v_blob,TRUE);\n dbms_lob.convertToBlob(\n v_blob,\n v_clob,\n DBMS_lob.getlength(v_clob),\n v_in,\n v_out,\n DBMS_LOB.default_csid,\n v_lang,\n v_warning\n );\n end if;\n update {$fileStorageTable} set {$temporaryColumnName}=v_blob where file_id=row.file_id;\n END LOOP;\n commit;\n END;"; - $connection->query(trim($queryString)); - $connection->dropColumn($fileStorageTable, $originColumnName); - $connection->query("ALTER TABLE {$fileStorageTable} RENAME COLUMN {$temporaryColumnName} TO {$originColumnName}"); -} diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php index dba0afad1a4bcb833df92e575a941d779dd0fd4b..696c2298afe2f764f9fdbdb3f22e18f4fc3fc132 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php index a75ecb3d1b70a54570b387748a430b55d407b894..6e82db8b8931b73b8f8b2ae9f169c98f9c7e7f14 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php index 40ad9ba8bb9477eaf1e6a6200c521c0b39e8f51b..00dab1e5506139863d20ca95aacd6c4dbee47b08 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.11-1.6.0.12.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.12-1.6.0.13.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.12-1.6.0.13.php index 1802ab7a29a997679a8c18951b4bba03f12e1264..c6a3d27bc561c982ea34245963eeadd94f45d44a 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.12-1.6.0.13.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.12-1.6.0.13.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.13-1.6.0.14.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.13-1.6.0.14.php index f1e7f350a013d076ae1cca00004d7400041a6d66..70ab78b9df8f5d2402b43a264d094eb7a68bbfea 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.13-1.6.0.14.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.13-1.6.0.14.php @@ -24,6 +24,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $this \Magento\Core\Model\Resource\Setup */ +/* @var $this \Magento\Module\Setup */ $connection = $this->getConnection(); $connection->dropTable('core_theme_file_update'); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.14-1.6.0.15.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.14-1.6.0.15.php index be263527266ad66edfc9542d4c9e62cf72b7995a..86fbe841d2092e55699f1c4b1cb043e7fe300fd8 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.14-1.6.0.15.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.14-1.6.0.15.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php index d4304d0a0e2693a1231b2dcd32200e98d9864387..e4699d98b7f1914343fa6b2d8e7859736a048a4c 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php index 0c6a3d0fa025878d0c5dce53fb24ff42d7ccca6c..314bf5fdcb2c58bf70162e2c90ac302e4e94e24c 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.3-1.6.0.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php index 49b4f7aa5fa1c98f613307a79e7f73ab0b041405..082099606f8f5d1dc6f47d2aa4d39c523eab784d 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.5-1.6.0.6.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -37,7 +37,7 @@ $tableCoreLayoutLink = $installer->getTable('core_layout_link'); $connection->dropForeignKey( $tableCoreLayoutLink, - $installer->getFkName('core_layout_link', 'store_id', 'core_store', 'store_id') + $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id') ); $connection->dropIndex( @@ -77,10 +77,10 @@ $connection->addIndex( ); $connection->addForeignKey( - $installer->getFkName('core_layout_link', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('core_layout_link', 'store_id', 'store', 'store_id'), $tableCoreLayoutLink, 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php index 30f95fd9d7a255265c358b79dcb0487d3f5bd871..34336a16fbd01b00295331934ea8e9b1fb1b34bb 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.6-1.6.0.7.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -49,7 +49,7 @@ $connection->addColumn( // we must drop next 2 foreign keys to have an ability to drop index $connection->dropForeignKey( $tableCoreLayoutLink, - $installer->getFkName($tableCoreLayoutLink, 'store_id', 'core_store', 'store_id') + $installer->getFkName($tableCoreLayoutLink, 'store_id', 'store', 'store_id') ); $connection->dropForeignKey( $tableCoreLayoutLink, @@ -78,10 +78,10 @@ $connection->addIndex( // recreate 2 dropped foreign keys to have an ability to drop index $connection->addForeignKey( - $installer->getFkName($tableCoreLayoutLink, 'store_id', 'core_store', 'store_id'), + $installer->getFkName($tableCoreLayoutLink, 'store_id', 'store', 'store_id'), $tableCoreLayoutLink, 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php index a4295d624bf631b60f2e92bb5859edd614b5efed..1f626e1a40a083e0e2d3b07e8f71f3ae72462b2f 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.7-1.6.0.8.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.8-1.6.0.9.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.8-1.6.0.9.php index f1798caab5f4852075a03315aa2e6087baa0f54c..9b52b9e7058816d4eaa8b552bc8f0e67e53ac064 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.8-1.6.0.9.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.8-1.6.0.9.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.9-1.6.0.10.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.9-1.6.0.10.php index 7004dee973b901971aece0069b3d6ae13b18c0d4..622cecbc2b8505090543a190c105a6ba2f87f364 100644 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.9-1.6.0.10.php +++ b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.9-1.6.0.10.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php index 316e7ffc89178d45ed9503b20c12cd1f3b4a428c..5bc8a8a6e220dae803ce9fd574ca704921becb40 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php @@ -33,7 +33,7 @@ */ namespace Magento\Cron\Model\Config\Backend\Product; -class Alert extends \Magento\Core\Model\Config\Value +class Alert extends \Magento\App\Config\Value { /** * Cron string path @@ -46,7 +46,7 @@ class Alert extends \Magento\Core\Model\Config\Value const CRON_MODEL_PATH = 'crontab/default/jobs/catalog_product_alert/run/model'; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; @@ -58,9 +58,8 @@ class Alert extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath @@ -69,9 +68,8 @@ class Alert extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', @@ -79,7 +77,7 @@ class Alert extends \Magento\Core\Model\Config\Value ) { $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php index ffed40eed62d3033ced46c6ae39b38edfe9b5f16..8b641ccb7eca7945399fed3905150846e6581bc4 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php @@ -33,7 +33,7 @@ */ namespace Magento\Cron\Model\Config\Backend; -class Sitemap extends \Magento\Core\Model\Config\Value +class Sitemap extends \Magento\App\Config\Value { /** * Cron string path @@ -46,7 +46,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value const CRON_MODEL_PATH = 'crontab/default/jobs/sitemap_generate/run/model'; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; @@ -58,9 +58,8 @@ class Sitemap extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath @@ -69,9 +68,8 @@ class Sitemap extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', @@ -79,7 +77,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value ) { $this->_runModelPath = $runModelPath; $this->_configValueFactory = $configValueFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index e19a27fcafb2173ae1ef2027faeaed48806dcca9..d6cee7b45cc17662dee4f3f1dec748f505b19776 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -83,9 +83,9 @@ class Observer protected $_cache; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var ScheduleFactory @@ -98,7 +98,7 @@ class Observer protected $_request; /** - * @var \Magento\Shell + * @var \Magento\ShellInterface */ protected $_shell; @@ -107,24 +107,24 @@ class Observer * @param ScheduleFactory $scheduleFactory * @param \Magento\App\CacheInterface $cache * @param ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Console\Request $request - * @param \Magento\Shell $shell + * @param \Magento\ShellInterface $shell */ public function __construct( \Magento\ObjectManager $objectManager, \Magento\Cron\Model\ScheduleFactory $scheduleFactory, \Magento\App\CacheInterface $cache, \Magento\Cron\Model\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Console\Request $request, - \Magento\Shell $shell + \Magento\ShellInterface $shell ) { $this->_objectManager = $objectManager; $this->_scheduleFactory = $scheduleFactory; $this->_cache = $cache; $this->_config = $config; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_request = $request; $this->_shell = $shell; } @@ -146,20 +146,18 @@ class Observer foreach ($jobGroupsRoot as $groupId => $jobsRoot) { if ($this->_request->getParam( 'group' - ) === null && $this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/use_separate_process' + ) === null && $this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/use_separate_process', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == 1 ) { - $this->_shell->executeInBackground( - '"' . - PHP_BINARY . - '" -f ' . - BP . - DIRECTORY_SEPARATOR . - \Magento\App\Filesystem::PUB_DIR . - DIRECTORY_SEPARATOR . - 'cron.php -- --group=' . - $groupId + $this->_shell->execute( + '%s -f %s -- --group=%s', + array( + PHP_BINARY, + BP . DIRECTORY_SEPARATOR . \Magento\App\Filesystem::PUB_DIR . DIRECTORY_SEPARATOR . 'cron.php', + $groupId + ) ); continue; } @@ -204,8 +202,9 @@ class Observer */ protected function _runJob($scheduledTime, $currentTime, $jobConfig, $schedule, $groupId) { - $scheduleLifetime = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_LIFETIME + $scheduleLifetime = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_LIFETIME, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $scheduleLifetime = $scheduleLifetime * self::SECONDS_IN_MINUTE; if ($scheduledTime < $currentTime - $scheduleLifetime) { @@ -265,8 +264,9 @@ class Observer * check if schedule generation is needed */ $lastRun = (int)$this->_cache->load(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT); - $rawSchedulePeriod = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_GENERATE_EVERY + $rawSchedulePeriod = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_GENERATE_EVERY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $schedulePeriod = $rawSchedulePeriod * self::SECONDS_IN_MINUTE; if ($lastRun > time() - $schedulePeriod) { @@ -304,8 +304,9 @@ class Observer */ protected function _generateJobs($jobs, $exists, $groupId) { - $scheduleAheadFor = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_AHEAD_FOR + $scheduleAheadFor = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_AHEAD_FOR, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $scheduleAheadFor = $scheduleAheadFor * self::SECONDS_IN_MINUTE; /** @@ -316,7 +317,10 @@ class Observer foreach ($jobs as $jobCode => $jobConfig) { $cronExpr = null; if (isset($jobConfig['config_path'])) { - $cronExpr = $this->_coreStoreConfig->getConfig($jobConfig['config_path']); + $cronExpr = $this->_scopeConfig->getValue( + $jobConfig['config_path'], + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } elseif (empty($cronExpr) && isset($jobConfig['schedule'])) { $cronExpr = $jobConfig['schedule']; } @@ -355,8 +359,9 @@ class Observer { // check if history cleanup is needed $lastCleanup = (int)$this->_cache->load(self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT); - $historyCleanUp = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_CLEANUP_EVERY + $historyCleanUp = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_CLEANUP_EVERY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if ($lastCleanup > time() - $historyCleanUp * self::SECONDS_IN_MINUTE) { return $this; @@ -370,11 +375,13 @@ class Observer array('in' => array(Schedule::STATUS_SUCCESS, Schedule::STATUS_MISSED, Schedule::STATUS_ERROR)) )->load(); - $historySuccess = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_SUCCESS + $historySuccess = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_SUCCESS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - $historyFailure = (int)$this->_coreStoreConfig->getConfig( - 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_FAILURE + $historyFailure = (int)$this->_scopeConfig->getValue( + 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_FAILURE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $historyLifetimes = array( Schedule::STATUS_SUCCESS => $historySuccess * self::SECONDS_IN_MINUTE, diff --git a/app/code/Magento/Cron/etc/cron_groups.xml b/app/code/Magento/Cron/etc/cron_groups.xml index 3eb95394e52d33a4adbbea54676140849bf044c0..492eaa42869c756ddba1ca7608b7cc8e39781144 100644 --- a/app/code/Magento/Cron/etc/cron_groups.xml +++ b/app/code/Magento/Cron/etc/cron_groups.xml @@ -33,6 +33,6 @@ <history_cleanup_every>10</history_cleanup_every> <history_success_lifetime>60</history_success_lifetime> <history_failure_lifetime>600</history_failure_lifetime> - <use_separate_process>false</use_separate_process> + <use_separate_process>0</use_separate_process> </group> </config> \ No newline at end of file diff --git a/app/code/Magento/Cron/etc/di.xml b/app/code/Magento/Cron/etc/di.xml index 9242e6812cf8917d7d2fdc7fcc1d2adcb5a54aad..e0ec113086763d814bca36392e4a68503d82813b 100644 --- a/app/code/Magento/Cron/etc/di.xml +++ b/app/code/Magento/Cron/etc/di.xml @@ -25,9 +25,10 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\Cron\Model\ConfigInterface" type="Magento\Cron\Model\Config" /> + <preference for="Magento\Shell\CommandRendererInterface" type="Magento\Shell\CommandRenderer" /> <type name="Magento\Cron\Model\Config\Reader\Db"> <arguments> - <argument name="defaultReader" xsi:type="object">Magento\Core\Model\Config\Scope\Reader\DefaultReader</argument> + <argument name="defaultReader" xsi:type="object">Magento\Store\Model\Config\Reader\DefaultReader</argument> </arguments> </type> <type name="Magento\App\Cron"> @@ -39,4 +40,14 @@ <type name="Magento\App\Config\Initial\Converter"> <plugin name="cron_system_config_initial_converter_plugin" type="Magento\Cron\Model\System\Config\Initial\Converter" /> </type> + <virtualType name="shellBackground" type="Magento\Shell"> + <arguments> + <argument name="commandRenderer" xsi:type="object">Magento\Shell\CommandRendererBackground</argument> + </arguments> + </virtualType> + <type name="Magento\Cron\Model\Observer"> + <arguments> + <argument name="shell" xsi:type="object">shellBackground</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Cron/etc/module.xml b/app/code/Magento/Cron/etc/module.xml index 31e7a40304979609dff3b71469e6154162ebdba9..10187f0e8312e68aa55b666d549d71ba74323ad0 100644 --- a/app/code/Magento/Cron/etc/module.xml +++ b/app/code/Magento/Cron/etc/module.xml @@ -26,10 +26,10 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Cron" version="1.6.0.0" active="true"> <sequence> - <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Backend"/> </depends> </module> diff --git a/app/code/Magento/Cron/sql/cron_setup/install-1.6.0.0.php b/app/code/Magento/Cron/sql/cron_setup/install-1.6.0.0.php index d24238f5dd623b7b7859aea1d7c8bbc547d3d7c9..b71d71b1ee20e38b465d5e01afdb8f5a57a43a75 100644 --- a/app/code/Magento/Cron/sql/cron_setup/install-1.6.0.0.php +++ b/app/code/Magento/Cron/sql/cron_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php index db4e46b6b0b40e2f933c034d49845a47f8b9009d..6b86b5d6b0a89d55eded17c424bb0b8b97168843 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency.php @@ -48,19 +48,19 @@ class Currency extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'save_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Currency Rates'), - 'class' => 'save', + 'class' => 'save primary save-currency-rates', 'data_attribute' => array( 'mage-init' => array('button' => array('event' => 'save', 'target' => '#rate-form')) ) ) ); - $this->addChild( + $this->getToolbar()->addChild( 'reset_button', 'Magento\Backend\Block\Widget\Button', array('label' => __('Reset'), 'onclick' => 'document.location.reload()', 'class' => 'reset') diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php index 44933e296d3fd4720a46c0f41da191eed82e5cb6..b5ce9e7b30b99ada3a84c9abfdda7d9ec91607dd 100644 --- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currencysymbol.php @@ -80,6 +80,18 @@ class Currencysymbol extends \Magento\Backend\Block\Widget\Form */ protected function _prepareLayout() { + $this->getToolbar()->addChild( + 'save_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Save Currency Symbols'), + 'class' => 'save primary save-currency-symbols', + 'data_attribute' => array( + 'mage-init' => array('button' => array('event' => 'save', 'target' => '#currency-symbols-form')) + ) + ) + ); + return parent::_prepareLayout(); } @@ -93,28 +105,6 @@ class Currencysymbol extends \Magento\Backend\Block\Widget\Form return __('Currency Symbols'); } - /** - * Returns 'Save Currency Symbol' button's HTML code - * - * @return string - */ - public function getSaveButtonHtml() - { - /** @var $block \Magento\View\Element\AbstractBlock */ - $block = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button'); - $block->setData( - array( - 'label' => __('Save Currency Symbols'), - 'class' => 'save', - 'data_attribute' => array( - 'mage-init' => array('button' => array('event' => 'save', 'target' => '#currency-symbols-form')) - ) - ) - ); - - return $block->toHtml(); - } - /** * Returns URL for save action * diff --git a/app/code/Magento/CurrencySymbol/Helper/Data.php b/app/code/Magento/CurrencySymbol/Helper/Data.php index 50e17d6c58c61834a72122dd26066a9aca489f2f..40c34526d56d9afdf12b462c7d1215c75be1c0c2 100644 --- a/app/code/Magento/CurrencySymbol/Helper/Data.php +++ b/app/code/Magento/CurrencySymbol/Helper/Data.php @@ -42,22 +42,22 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\CurrencySymbol\Model\System\CurrencysymbolFactory $symbolFactory, $dbCompatibleMode = true ) { $this->_symbolFactory = $symbolFactory; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** diff --git a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php index 3b7e17752b19ce2f7ad88e24b268a55927ef29f9..dea344335dd69bef0e76e3c0fced1a0946e738ed 100644 --- a/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php +++ b/app/code/Magento/CurrencySymbol/Model/System/Currencysymbol.php @@ -65,7 +65,7 @@ class Currencysymbol \Magento\App\Cache\Type\Config::TYPE_IDENTIFIER, \Magento\App\Cache\Type\Block::TYPE_IDENTIFIER, \Magento\App\Cache\Type\Layout::TYPE_IDENTIFIER, - \Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER, + \Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER ); /** @@ -103,12 +103,12 @@ class Currencysymbol protected $_configFactory; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -118,35 +118,35 @@ class Currencysymbol protected $_locale; /** - * @var \Magento\App\ReinitableConfigInterface + * @var \Magento\App\Config\ReinitableConfigInterface */ protected $_coreConfig; /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ReinitableConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ReinitableConfigInterface $coreConfig * @param \Magento\Backend\Model\Config\Factory $configFactory * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Event\ManagerInterface $eventManager */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ReinitableConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ReinitableConfigInterface $coreConfig, \Magento\Backend\Model\Config\Factory $configFactory, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Event\ManagerInterface $eventManager ) { $this->_coreConfig = $coreConfig; @@ -156,7 +156,7 @@ class Currencysymbol $this->_locale = $localeResolver->getLocale(); $this->_systemStore = $systemStore; $this->_eventManager = $eventManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -202,10 +202,14 @@ class Currencysymbol $allowedCurrencies = explode( self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, - $this->_coreStoreConfig->getConfig(self::XML_PATH_ALLOWED_CURRENCIES, null) + $this->_scopeConfig->getValue( + self::XML_PATH_ALLOWED_CURRENCIES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null + ) ); - /* @var $storeModel \Magento\Core\Model\System\Store */ + /* @var $storeModel \Magento\Store\Model\System\Store */ $storeModel = $this->_systemStore; foreach ($storeModel->getWebsiteCollection() as $website) { $websiteShow = false; @@ -225,7 +229,11 @@ class Currencysymbol explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $websiteSymbols) ); } - $storeSymbols = $this->_coreStoreConfig->getConfig(self::XML_PATH_ALLOWED_CURRENCIES, $store); + $storeSymbols = $this->_scopeConfig->getValue( + self::XML_PATH_ALLOWED_CURRENCIES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); $allowedCurrencies = array_merge( $allowedCurrencies, explode(self::ALLOWED_CURRENCIES_CONFIG_SEPARATOR, $storeSymbols) @@ -352,7 +360,11 @@ class Currencysymbol protected function _unserializeStoreConfig($configPath, $storeId = null) { $result = array(); - $configData = (string)$this->_coreStoreConfig->getConfig($configPath, $storeId); + $configData = (string)$this->_scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); if ($configData) { $result = unserialize($configData); } diff --git a/app/code/Magento/CurrencySymbol/etc/di.xml b/app/code/Magento/CurrencySymbol/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..db3747967f84fb1c497fc0b7a22d938d19ae0e57 --- /dev/null +++ b/app/code/Magento/CurrencySymbol/etc/di.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="currencysymbol" xsi:type="string">Magento_CurrencySymbol</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/CurrencySymbol/etc/module.xml b/app/code/Magento/CurrencySymbol/etc/module.xml index fd6f7c0d3c7545866710de6be01df060210e5b81..4a2b655a91227defdc631f78b5e03bf925bf9985 100644 --- a/app/code/Magento/CurrencySymbol/etc/module.xml +++ b/app/code/Magento/CurrencySymbol/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Widget"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_PageCache"/> <module name="Magento_Directory"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml b/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml index 3bd1c2ffe04cd0679c49792ecff71fc1be54a6ce..4d8e770c8f5cb585d9bbb6413755631ba2f57f1e 100644 --- a/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml +++ b/app/code/Magento/CurrencySymbol/view/adminhtml/grid.phtml @@ -29,7 +29,6 @@ * @var $this \Magento\CurrencySymbol\Block\Adminhtml\System\Currencysymbol */ ?> -<div class="page-actions"><?php echo $this->getSaveButtonHtml(); ?></div> <?php $this->getCurrencySymbolsData();?> diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php index 5d2788ecbb67d7423b88239693a15bb0279c3210..a105b9e380acedb4bf45a8b2b2dac4dfd1824040 100644 --- a/app/code/Magento/Customer/Block/Address/Edit.php +++ b/app/code/Magento/Customer/Block/Address/Edit.php @@ -40,11 +40,6 @@ class Edit extends \Magento\Directory\Block\Data */ protected $_address = null; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_config; - /** * @var \Magento\Customer\Model\Session */ @@ -74,7 +69,6 @@ class Edit extends \Magento\Directory\Block\Data * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory - * @param \Magento\App\ConfigInterface $config * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService * @param \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder @@ -90,14 +84,12 @@ class Edit extends \Magento\Directory\Block\Data \Magento\App\Cache\Type\Config $configCacheType, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, - \Magento\App\ConfigInterface $config, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService, \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder, \Magento\Customer\Service\V1\CustomerCurrentServiceInterface $customerCurrentService, array $data = array() ) { - $this->_config = $config; $this->_customerSession = $customerSession; $this->_addressService = $addressService; $this->_addressBuilder = $addressBuilder; @@ -128,7 +120,6 @@ class Edit extends \Magento\Directory\Block\Data try { $this->_address = $this->_addressService->getAddress($addressId); } catch (NoSuchEntityException $e) { - // something went wrong, but we are ignore it for now } } @@ -373,6 +364,6 @@ class Edit extends \Magento\Directory\Block\Data */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit.php b/app/code/Magento/Customer/Block/Adminhtml/Edit.php index 4bfbcb6482efc95e5dcd22fae5e4bfe5f66e3773..4a811786cfa71e7b57ce8d8ebaa956c942acc17e 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit.php @@ -114,7 +114,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container array( 'label' => __('Reset Password'), 'onclick' => 'setLocation(\'' . $url . '\')', - 'class' => 'save' + 'class' => 'reset reset-password' ), 0 ); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index ebb405afbb76749e81dcde87f3bc1f5b0c74c6fc..78bd2c78fd7affde8909c5e3f915df6404e92513 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -44,7 +44,7 @@ class Account extends GenericMetadata protected $_customerFormFactory; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -79,7 +79,7 @@ class Account extends GenericMetadata * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Customer\Helper\Data $customerHelper * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $customerMetadataService @@ -94,7 +94,7 @@ class Account extends GenericMetadata \Magento\Data\FormFactory $formFactory, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\Metadata\FormFactory $customerFormFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Customer\Helper\Data $customerHelper, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $customerMetadataService, diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php index 7a2616c41ec90c020cc2a5644f63691e150e7edd..984e70394e3279138ab9d70d2978b88d50d97384 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php @@ -90,7 +90,7 @@ class Addresses extends GenericMetadata * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Customer\Model\Renderer\RegionFactory $regionFactory @@ -111,7 +111,7 @@ class Addresses extends GenericMetadata \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Customer\Model\Renderer\RegionFactory $regionFactory, diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php index fd5e1671e2b2ba686137088a0cb419b20f09196f..f5a6250c19220c7c55da256194cdf35546dffea1 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php @@ -154,7 +154,10 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended 'header' => __('Price'), 'index' => 'price', 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig(Currency::XML_PATH_CURRENCY_BASE) + 'currency_code' => (string)$this->_scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) ); @@ -164,7 +167,10 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended 'header' => __('Total'), 'index' => 'row_total', 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig(Currency::XML_PATH_CURRENCY_BASE) + 'currency_code' => (string)$this->_scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) ); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php index 51f4874307e7ec6b2ddf556007b69575bcda48c5..a261d25dbd2eb601d7c34a6f8ca9257987c53c0d 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View.php @@ -230,8 +230,9 @@ class View extends \Magento\Backend\Block\Template implements \Magento\Backend\B */ public function getStoreCreateDateTimezone() { - return $this->_storeConfig->getConfig( + return $this->_scopeConfig->getValue( $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getCustomer()->getStoreId() ); } @@ -268,8 +269,9 @@ class View extends \Magento\Backend\Block\Template implements \Magento\Backend\B */ public function getStoreLastLoginDateTimezone() { - return $this->_storeConfig->getConfig( + return $this->_scopeConfig->getValue( $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getCustomer()->getStoreId() ); } @@ -281,11 +283,12 @@ class View extends \Magento\Backend\Block\Template implements \Magento\Backend\B { $log = $this->getCustomerLog(); $interval = $this->_modelVisitor->getOnlineMinutesInterval(); - if ($log->getLogoutAt() || strtotime( - $this->dateTime->now() - ) - strtotime( - $log->getLastVisitAt() - ) > $interval * 60 + if ($log->getLogoutAt() + || strtotime( + $this->dateTime->now() + ) - strtotime( + $log->getLastVisitAt() + ) > $interval * 60 ) { return __('Offline'); } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php index bbf09c3b08e423d3284e65af53bf07ef0fca2ca9..b9a163f5cd855b9ed810eda95aacd7ce74b94c32 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Cart.php @@ -137,7 +137,10 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended 'header' => __('Price'), 'index' => 'price', 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig(Currency::XML_PATH_CURRENCY_BASE) + 'currency_code' => (string)$this->_scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) ); @@ -147,7 +150,10 @@ class Cart extends \Magento\Backend\Block\Widget\Grid\Extended 'header' => __('Total'), 'index' => 'row_total', 'type' => 'currency', - 'currency_code' => (string)$this->_storeConfig->getConfig(Currency::XML_PATH_CURRENCY_BASE) + 'currency_code' => (string)$this->_scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) ); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php index bdb808a8703b8507759e6e49b07f96ce74619ad9..855823d79f99b3d9b1cdc93d4faf3bcc584efcfa 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Sales.php @@ -114,7 +114,10 @@ class Sales extends \Magento\Backend\Block\Template public function _beforeToHtml() { $this->_currency = $this->_currencyFactory->create()->load( - $this->_storeConfig->getConfig(Currency::XML_PATH_CURRENCY_BASE) + $this->_scopeConfig->getValue( + Currency::XML_PATH_CURRENCY_BASE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); $this->_collection = $this->_collectionFactory->create()->setCustomerIdFilter( diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php index 6fbb110b344fdde3496ebbab81da0203afbee71d..fd8c41a63196aae0507eb4f6b7a09d20cb447ac7 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php @@ -141,7 +141,8 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs ); } - if ($this->_authorization->isAllowed('Magento_Review::reviews_all')) { + $reviewOutput = $this->isOutputEnabled('Magento_Review'); + if ($this->_authorization->isAllowed('Magento_Review::reviews_all') && $reviewOutput) { $this->addTab( 'reviews', array( diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index cd5d2b5a0e15f7c346547e371ce97c3942064aea..f0ad21feca214769fd11636ff5268ba724e0b6b0 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -92,7 +92,7 @@ class Register extends \Magento\Directory\Block\Data */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Customer/Block/Widget/Dob.php b/app/code/Magento/Customer/Block/Widget/Dob.php index 518855209cd1109c09f354d70a50f3bf181bdeef..b9a38717b5a33e6b2a3a32eeecf760cdf42af447 100644 --- a/app/code/Magento/Customer/Block/Widget/Dob.php +++ b/app/code/Magento/Customer/Block/Widget/Dob.php @@ -128,17 +128,20 @@ class Dob extends AbstractWidget /** * Sort date inputs by dateformat order of current locale * + * @param bool $stripNonInputChars + * * @return string */ - public function getSortedDateInputs() + public function getSortedDateInputs($stripNonInputChars = true) { - $mapping = array( - '/[^medy]/i' => '\\1', - '/m{1,5}/i' => '%1$s', - '/e{1,5}/i' => '%2$s', - '/d{1,5}/i' => '%2$s', - '/y{1,5}/i' => '%3$s' - ); + $mapping = array(); + if ($stripNonInputChars) { + $mapping['/[^medy]/i'] = '\\1'; + } + $mapping['/m{1,5}/i'] = '%1$s'; + $mapping['/e{1,5}/i'] = '%2$s'; + $mapping['/d{1,5}/i'] = '%2$s'; + $mapping['/y{1,5}/i'] = '%3$s'; $dateFormat = preg_replace(array_keys($mapping), array_values($mapping), $this->getDateFormat()); diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php index 20f7713c4d94556f24d34f34a29c6e13c69e29fe..1586e8f86092f60ff0b38c02b463be585d9dda5f 100644 --- a/app/code/Magento/Customer/Block/Widget/Name.php +++ b/app/code/Magento/Customer/Block/Widget/Name.php @@ -34,8 +34,8 @@ use Magento\Customer\Helper\Data as CustomerHelper; /** * Widget for showing customer name. * - * @method \Magento\Customer\Service\V1\Data\Customer getObject() - * @method Name setObject(\Magento\Customer\Service\V1\Data\Customer $customer) + * @method Customer|\Magento\Customer\Model\Customer|\Magento\Sales\Model\Quote\Address getObject() + * @method Name setObject($object) */ class Name extends AbstractWidget { @@ -213,9 +213,9 @@ class Name extends AbstractWidget */ protected function _getAttribute($attributeCode) { - if ($this->getForceUseCustomerAttributes() || - $this->getObject() instanceof \Magento\Customer\Model\Customer || - $this->getObject() instanceof Customer + if ($this->getForceUseCustomerAttributes() + || $this->getObject() instanceof \Magento\Customer\Model\Customer + || $this->getObject() instanceof Customer ) { return parent::_getAttribute($attributeCode); } diff --git a/app/code/Magento/Customer/Controller/Account.php b/app/code/Magento/Customer/Controller/Account.php index 61c80a239abfe05da6093b988ceb0c5e23487576..eaf05a5c04ae5f73d35f9c908e8dc0100cdd757f 100644 --- a/app/code/Magento/Customer/Controller/Account.php +++ b/app/code/Magento/Customer/Controller/Account.php @@ -86,11 +86,11 @@ class Account extends \Magento\App\Action\Action /** @var \Magento\Newsletter\Model\SubscriberFactory */ protected $_subscriberFactory; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; - /** @var \Magento\Core\Model\Store\Config */ - protected $_storeConfig; + /** @var \Magento\App\Config\ScopeConfigInterface */ + protected $_scopeConfig; /** @var \Magento\Core\Helper\Data */ protected $coreHelperData; @@ -129,8 +129,8 @@ class Account extends \Magento\App\Action\Action * @param \Magento\Stdlib\String $string * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Helper\Data $coreHelperData * @param \Magento\Escaper $escaper * @param \Magento\App\State $appState @@ -153,8 +153,8 @@ class Account extends \Magento\App\Action\Action \Magento\Stdlib\String $string, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Helper\Data $coreHelperData, \Magento\Escaper $escaper, \Magento\App\State $appState, @@ -174,7 +174,7 @@ class Account extends \Magento\App\Action\Action $this->_formKeyValidator = $formKeyValidator; $this->_subscriberFactory = $subscriberFactory; $this->_storeManager = $storeManager; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->coreHelperData = $coreHelperData; $this->escaper = $escaper; $this->appState = $appState; @@ -340,8 +340,9 @@ class Account extends \Magento\App\Action\Action $this->_getSession()->setBeforeAuthUrl($this->_customerHelperData->getAccountUrl()); // Redirect customer to the last page visited after logging in if ($this->_getSession()->isLoggedIn()) { - if (!$this->_storeConfig->getConfigFlag( - \Magento\Customer\Helper\Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD + if (!$this->_scopeConfig->isSetFlag( + \Magento\Customer\Helper\Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { $referer = $this->getRequest()->getParam(\Magento\Customer\Helper\Data::REFERER_QUERY_PARAM_NAME); @@ -440,12 +441,11 @@ class Account extends \Magento\App\Action\Action $addresses = is_null($address) ? array() : array($address); $password = $this->getRequest()->getParam('password'); $redirectUrl = $this->_getSession()->getBeforeAuthUrl(); - $customerDetails = $this->_customerDetailsBuilder->setCustomer( - $customer - )->setAddresses( - $addresses - )->create(); - $customer = $this->_customerAccountService->createAccount($customerDetails, $password, $redirectUrl); + $customerDetails = $this->_customerDetailsBuilder + ->setCustomer($customer) + ->setAddresses($addresses) + ->create(); + $customer = $this->_customerAccountService->createAccount($customerDetails, $password, null, $redirectUrl); if ($this->getRequest()->getParam('is_subscribed', false)) { $this->_subscriberFactory->create()->subscribeCustomerById($customer->getId()); @@ -587,8 +587,9 @@ class Account extends \Magento\App\Action\Action $this->_addWelcomeMessage(); $successUrl = $this->_createUrl()->getUrl('*/*/index', array('_secure' => true)); - if (!$this->_storeConfig->getConfigFlag( - \Magento\Customer\Helper\Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD + if (!$this->_scopeConfig->isSetFlag( + \Magento\Customer\Helper\Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && $this->_getSession()->getBeforeAuthUrl() ) { $successUrl = $this->_getSession()->getBeforeAuthUrl(true); @@ -791,7 +792,6 @@ class Account extends \Magento\App\Action\Action CustomerAccountServiceInterface::EMAIL_RESET ); } catch (NoSuchEntityException $e) { - // Do nothing, we don't want anyone to use this action to determine which email accounts are registered. } catch (\Exception $exception) { $this->messageManager->addException($exception, __('Unable to send password reset email.')); $this->_redirect('*/*/forgotpassword'); @@ -995,7 +995,7 @@ class Account extends \Magento\App\Action\Action /** * Check whether VAT ID validation is enabled * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return bool */ protected function _isVatValidationEnabled($store = null) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php index 843982e380cae1b620f15ab412ef79159618fa0d..5ac497f454b3051f721acad8b93cb86f3790f23a 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php @@ -76,7 +76,7 @@ class Cart extends \Magento\Backend\App\Action $this->_quote = $this->_objectManager->create( 'Magento\Sales\Model\Quote' )->setWebsite( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getWebsite($websiteId) + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getWebsite($websiteId) )->loadByCustomer( $this->_customerId ); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index 73b50fcc95f776555a270438059195a2ed678ab4..7030d55dfd6e38175b822189217c107616554ac3 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -738,12 +738,13 @@ class Index extends \Magento\Backend\App\Action // delete an item from cart $deleteItemId = $this->getRequest()->getPost('delete'); if ($deleteItemId) { - $quote = $this->_objectManager - ->create('Magento\Sales\Model\Quote') - ->setWebsite( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getWebsite($websiteId) - ) - ->loadByCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)); + $quote = $this->_objectManager->create( + 'Magento\Sales\Model\Quote' + )->setWebsite( + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getWebsite($websiteId) + )->loadByCustomer( + $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) + ); $item = $quote->getItemById($deleteItemId); if ($item && $item->getId()) { $quote->removeItem($deleteItemId); @@ -860,8 +861,8 @@ class Index extends \Magento\Backend\App\Action } } - if ($errors !== true && !empty($errors)) { - foreach ($errors as $error) { + if (!$errors->isValid()) { + foreach ($errors->getMessages() as $error) { $this->messageManager->addError($error); } $response->setError(1); @@ -1028,8 +1029,11 @@ class Index extends \Magento\Backend\App\Action $plain = false; if ($this->getRequest()->getParam('file')) { // download file - $file = $this->_objectManager->get('Magento\Core\Helper\Data') - ->urlDecode($this->getRequest()->getParam('file')); + $file = $this->_objectManager->get( + 'Magento\Core\Helper\Data' + )->urlDecode( + $this->getRequest()->getParam('file') + ); } elseif ($this->getRequest()->getParam('image')) { // show plain image $file = $this->_objectManager->get('Magento\Core\Helper\Data')->urlDecode( diff --git a/app/code/Magento/Customer/Helper/Address.php b/app/code/Magento/Customer/Helper/Address.php index 43d7817bf2414660e327f644e5d4e59237494ab5..9b3ce17608e58cbfecb94f4dc1ac36e891424397 100755 --- a/app/code/Magento/Customer/Helper/Address.php +++ b/app/code/Magento/Customer/Helper/Address.php @@ -84,11 +84,11 @@ class Address extends \Magento\App\Helper\AbstractHelper /** @var \Magento\View\Element\BlockFactory */ protected $_blockFactory; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; - /** @var \Magento\Core\Model\Store\Config */ - protected $_coreStoreConfig; + /** @var \Magento\App\Config\ScopeConfigInterface */ + protected $_scopeConfig; /** @var \Magento\Customer\Service\V1\CustomerMetadataServiceInterface */ protected $_customerMetadataService; @@ -99,22 +99,22 @@ class Address extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context * @param \Magento\View\Element\BlockFactory $blockFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $customerMetadataService * @param \Magento\Customer\Model\Address\Config $addressConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\View\Element\BlockFactory $blockFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $customerMetadataService, \Magento\Customer\Model\Address\Config $addressConfig ) { $this->_blockFactory = $blockFactory; $this->_storeManager = $storeManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_customerMetadataService = $customerMetadataService; $this->_addressConfig = $addressConfig; parent::__construct($context); @@ -167,7 +167,7 @@ class Address extends \Magento\App\Helper\AbstractHelper * Return customer address config value by key and store * * @param string $key - * @param \Magento\Core\Model\Store|int|string $store + * @param \Magento\Store\Model\Store|int|string $store * @return string|null */ public function getConfig($key, $store = null) @@ -175,7 +175,11 @@ class Address extends \Magento\App\Helper\AbstractHelper $store = $this->_storeManager->getStore($store); $websiteId = $store->getWebsiteId(); if (!isset($this->_config[$websiteId])) { - $this->_config[$websiteId] = $store->getConfig('customer/address', $store); + $this->_config[$websiteId] = $this->_scopeConfig->getValue( + 'customer/address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } return isset($this->_config[$websiteId][$key]) ? (string)$this->_config[$websiteId][$key] : null; } @@ -183,7 +187,7 @@ class Address extends \Magento\App\Helper\AbstractHelper /** * Return Number of Lines in a Street Address for store * - * @param \Magento\Core\Model\Store|int|string $store + * @param \Magento\Store\Model\Store|int|string $store * @return int */ public function getStreetLines($store = null) @@ -315,12 +319,16 @@ class Address extends \Magento\App\Helper\AbstractHelper /** * Check whether VAT ID validation is enabled * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return bool */ public function isVatValidationEnabled($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_VAT_VALIDATION_ENABLED, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_VAT_VALIDATION_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -330,29 +338,40 @@ class Address extends \Magento\App\Helper\AbstractHelper */ public function isDisableAutoGroupAssignDefaultValue() { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_VIV_DISABLE_AUTO_ASSIGN_DEFAULT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** * Retrieve 'validate on each transaction' value * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return bool */ public function hasValidateOnEachTransaction($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_VIV_ON_EACH_TRANSACTION, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_VIV_ON_EACH_TRANSACTION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Retrieve customer address type on which tax calculation must be based * - * @param \Magento\Core\Model\Store|string|int|null $store + * @param \Magento\Store\Model\Store|string|int|null $store * @return string */ public function getTaxCalculationAddressType($store = null) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_VIV_TAX_CALCULATION_ADDRESS_TYPE, $store); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_VIV_TAX_CALCULATION_ADDRESS_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -362,6 +381,9 @@ class Address extends \Magento\App\Helper\AbstractHelper */ public function isVatAttributeVisible() { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_VAT_FRONTEND_VISIBILITY); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_VAT_FRONTEND_VISIBILITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index a02b517057a4758b165ffc8eb39683364b63bee9..40cc7fd42f8abcd2f161c1ec5a3570e2273b6b62 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -131,45 +131,15 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_customerAddress = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeManager; - - /** - * @var \Magento\Customer\Model\Config\Share - */ - protected $_configShare; - - /** - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - - /** - * @var \Magento\App\ConfigInterface - */ - protected $_coreConfig; + protected $_scopeConfig; /** * @var \Magento\Customer\Model\Session */ protected $_customerSession; - /** - * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface - */ - protected $_accountService; - - /** - * @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface - */ - protected $_addressService; - - /** - * @var \Magento\Customer\Service\V1\CustomerMetadataServiceInterface - */ - protected $_metadataService; - /** * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface */ @@ -190,21 +160,12 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $mathRandom; - /** @var \Magento\Customer\Service\V1\Data\Customer */ - protected $customerData; - /** * @param \Magento\App\Helper\Context $context * @param Address $customerAddress * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Customer\Model\Config\Share $configShare - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService - * @param \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $metadataService - * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService * @param \Magento\Customer\Model\Metadata\FormFactory $formFactory * @param \Magento\Escaper $escaper @@ -216,14 +177,8 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\App\Helper\Context $context, Address $customerAddress, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Customer\Model\Config\Share $configShare, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $customerSession, - \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService, - \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $metadataService, - \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService, \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService, \Magento\Customer\Model\Metadata\FormFactory $formFactory, \Magento\Escaper $escaper, @@ -231,14 +186,8 @@ class Data extends \Magento\App\Helper\AbstractHelper ) { $this->_customerAddress = $customerAddress; $this->_coreData = $coreData; - $this->_storeManager = $storeManager; - $this->_configShare = $configShare; - $this->_coreStoreConfig = $coreStoreConfig; - $this->_coreConfig = $coreConfig; + $this->_scopeConfig = $scopeConfig; $this->_customerSession = $customerSession; - $this->_accountService = $accountService; - $this->_metadataService = $metadataService; - $this->_addressService = $addressService; $this->_groupService = $groupService; $this->_formFactory = $formFactory; $this->_escaper = $escaper; @@ -249,23 +198,31 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Retrieve merchant country code * - * @param \Magento\Core\Model\Store|string|int|null $store + * @param \Magento\Store\Model\Store|string|int|null $store * @return string */ public function getMerchantCountryCode($store = null) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_COUNTRY_CODE, $store); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_MERCHANT_COUNTRY_CODE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Retrieve merchant VAT number * - * @param \Magento\Core\Model\Store|string|int|null $store + * @param \Magento\Store\Model\Store|string|int|null $store * @return string */ public function getMerchantVatNumber($store = null) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_MERCHANT_VAT_NUMBER, $store); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_MERCHANT_VAT_NUMBER, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -277,7 +234,14 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isCountryInEU($countryCode, $storeId = null) { - $euCountries = explode(',', $this->_coreStoreConfig->getConfig(self::XML_PATH_EU_COUNTRIES_LIST, $storeId)); + $euCountries = explode( + ',', + $this->_scopeConfig->getValue( + self::XML_PATH_EU_COUNTRIES_LIST, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) + ); return in_array($countryCode, $euCountries); } @@ -291,46 +255,6 @@ class Data extends \Magento\App\Helper\AbstractHelper return $this->_customerSession->isLoggedIn(); } - /** - * Retrieve logged in customer - * - * @return \Magento\Customer\Model\Customer - * @deprecated use getCustomerData() instead - */ - public function getCustomer() - { - if (empty($this->_customer)) { - $this->_customer = $this->_customerSession->getCustomer(); - } - return $this->_customer; - } - - /** - * @return \Magento\Customer\Service\V1\Data\Customer|null - * @throws \Magento\Exception\NoSuchEntityException - */ - public function getCustomerData() - { - if (empty($this->customerData)) { - $customerId = $this->_customerSession->getCustomerId(); - $this->customerData = $this->_accountService->getCustomer($customerId); - } - return $this->customerData; - } - - /** - * Check customer has address - * - * @return bool - * - * @throws \Magento\Exception\NoSuchEntityException If the customer Id is invalid - */ - public function customerHasAddresses() - { - $customerId = $this->_customerSession->getCustomerId(); - return count($this->_addressService->getAddresses($customerId)) > 0; - } - /************************************************************************** * Customer urls */ @@ -356,8 +280,9 @@ class Data extends \Magento\App\Helper\AbstractHelper $referer = $this->_getRequest()->getParam(self::REFERER_QUERY_PARAM_NAME); - if (!$referer && !$this->_coreStoreConfig->getConfigFlag( - self::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD + if (!$referer && !$this->_scopeConfig->isSetFlag( + self::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && !$this->_customerSession->getNoReferer() ) { $referer = $this->_getUrl('*/*/*', array('_current' => true, '_use_rewrite' => true)); @@ -467,20 +392,6 @@ class Data extends \Magento\App\Helper\AbstractHelper return $this->_getUrl('customer/account/forgotpassword'); } - /** - * Check is confirmation required - * - * @return bool - */ - public function isConfirmationRequired() - { - $customerId = $this->_customerSession->getCustomerId(); - return \Magento\Customer\Service\V1\CustomerAccountServiceInterface::ACCOUNT_CONFIRMATION_REQUIRED == - $this->_accountService->getConfirmationStatus( - $customerId - ); - } - /** * Retrieve confirmation URL for Email * @@ -562,16 +473,16 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getResetPasswordLinkExpirationPeriod() { - return (int)$this->_coreConfig->getValue( + return (int)$this->_scopeConfig->getValue( self::XML_PATH_CUSTOMER_RESET_PASSWORD_LINK_EXPIRATION_PERIOD, - 'default' + \Magento\App\ScopeInterface::SCOPE_DEFAULT ); } /** * Get default customer group id * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return int */ public function getDefaultCustomerGroupId($store = null) @@ -584,7 +495,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * * @param string $customerCountryCode * @param \Magento\Object $vatValidationResult - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return null|int */ public function getCustomerGroupIdBasedOnVatNumber($customerCountryCode, $vatValidationResult, $store = null) @@ -601,7 +512,11 @@ class Data extends \Magento\App\Helper\AbstractHelper ); if (isset($vatClassToGroupXmlPathMap[$vatClass])) { - $groupId = (int)$this->_coreStoreConfig->getConfig($vatClassToGroupXmlPathMap[$vatClass], $store); + $groupId = (int)$this->_scopeConfig->getValue( + $vatClassToGroupXmlPathMap[$vatClass], + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } return $groupId; @@ -687,9 +602,7 @@ class Data extends \Magento\App\Helper\AbstractHelper empty($vatNumber) || empty($requesterCountryCode) && !empty($requesterVatNumber) || !empty($requesterCountryCode) && empty($requesterVatNumber) || - !empty($requesterCountryCode) && !$this->isCountryInEU( - $requesterCountryCode - ) + !empty($requesterCountryCode) && !$this->isCountryInEU($requesterCountryCode) ) { $result = false; } @@ -702,7 +615,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * * @param string $customerCountryCode * @param \Magento\Object $vatValidationResult - * @param \Magento\Core\Model\Store|string|int|null $store + * @param \Magento\Store\Model\Store|string|int|null $store * @return null|string */ public function getCustomerVatClass($customerCountryCode, $vatValidationResult, $store = null) @@ -788,36 +701,4 @@ class Data extends \Magento\App\Helper\AbstractHelper return $filteredData; } - - /** - * Check store availability for customer given the customerId - * - * @param int $customerWebsiteId - * @param int $storeId - * @return bool - */ - public function isCustomerInStore($customerWebsiteId, $storeId) - { - $ids = $this->getSharedStoreIds($customerWebsiteId); - return in_array($storeId, $ids); - } - - /** - * Retrieve shared store ids - * - * @param int $customerWebsiteId - * @return array - */ - public function getSharedStoreIds($customerWebsiteId) - { - $ids = array(); - if ((bool)$this->_configShare->isWebsiteScope()) { - $ids = $this->_storeManager->getWebsite($customerWebsiteId)->getStoreIds(); - } else { - foreach ($this->_storeManager->getStores() as $store) { - $ids[] = $store->getId(); - } - } - return $ids; - } } diff --git a/app/code/Magento/Customer/Model/Address/Config.php b/app/code/Magento/Customer/Model/Address/Config.php index 1b5bf7a1617e74f3c0a71648a6454827a0a5e3cb..62033b2537965360445a70c87852ca53d76c4948 100644 --- a/app/code/Magento/Customer/Model/Address/Config.php +++ b/app/code/Magento/Customer/Model/Address/Config.php @@ -50,7 +50,7 @@ class Config extends \Magento\Config\Data /** * Current store instance * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store = null; @@ -63,7 +63,7 @@ class Config extends \Magento\Config\Data protected $_defaultTypes = array(); /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -72,29 +72,37 @@ class Config extends \Magento\Config\Data */ protected $_addressHelper; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * @param \Magento\Customer\Model\Address\Config\Reader $reader * @param \Magento\Config\CacheInterface $cache - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Helper\Address $addressHelper + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param string $cacheId */ public function __construct( \Magento\Customer\Model\Address\Config\Reader $reader, \Magento\Config\CacheInterface $cache, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Helper\Address $addressHelper, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, $cacheId = 'address_format' ) { parent::__construct($reader, $cache, $cacheId); $this->_storeManager = $storeManager; $this->_addressHelper = $addressHelper; + $this->_scopeConfig = $scopeConfig; } /** * Set store * - * @param null|string|bool|int|\Magento\Core\Model\Store $store + * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return $this */ public function setStore($store) @@ -106,7 +114,7 @@ class Config extends \Magento\Config\Data /** * Retrieve store * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -144,7 +152,7 @@ class Config extends \Magento\Config\Data )->setTitle( (string)$typeConfig['title'] )->setDefaultFormat( - $store->getConfig($path) + $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store) )->setEscapeHtml( $escapeHtml ); diff --git a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php index 45ceee4f1c16ae315fa37163f4ce6ce623ef81d0..26fbc9c2a83c77ee1af93ccbbf34b4b5fa781fa8 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php @@ -30,18 +30,21 @@ namespace Magento\Customer\Model\Config\Backend\Address; * * @method string getWebsiteCode */ -class Street extends \Magento\Core\Model\Config\Value +class Street extends \Magento\App\Config\Value { /** * @var \Magento\Eav\Model\Config */ protected $_eavConfig; + /** @var \Magento\Store\Model\StoreManagerInterface */ + protected $_storeManager; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -50,15 +53,16 @@ class Street extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_eavConfig = $eavConfig; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + $this->_storeManager = $storeManager; } /** @@ -71,8 +75,8 @@ class Street extends \Magento\Core\Model\Config\Value $attribute = $this->_eavConfig->getAttribute('customer_address', 'street'); $value = $this->getValue(); switch ($this->getScope()) { - case 'websites': - $website = $this->_storeManager->getWebsite($this->getWebsiteCode()); + case \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES: + $website = $this->_storeManager->getWebsite($this->getScopeCode()); $attribute->setWebsite($website); $attribute->load($attribute->getId()); if ($attribute->getData('multiline_count') != $value) { @@ -80,7 +84,7 @@ class Street extends \Magento\Core\Model\Config\Value } break; - case 'default': + case \Magento\App\ScopeInterface::SCOPE_DEFAULT: $attribute->setData('multiline_count', $value); break; } @@ -97,9 +101,9 @@ class Street extends \Magento\Core\Model\Config\Value { $result = parent::_afterDelete(); - if ($this->getScope() == 'websites') { + if ($this->getScope() == \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES) { $attribute = $this->_eavConfig->getAttribute('customer_address', 'street'); - $website = $this->_storeManager->getWebsite($this->getWebsiteCode()); + $website = $this->_storeManager->getWebsite($this->getScopeCode()); $attribute->setWebsite($website); $attribute->load($attribute->getId()); $attribute->setData('scope_multiline_count', null); diff --git a/app/code/Magento/Customer/Model/Config/Backend/Password/Link/Expirationperiod.php b/app/code/Magento/Customer/Model/Config/Backend/Password/Link/Expirationperiod.php index b49db8cf035583437a6b27540995a31019fdb3fa..0555df0da0e99ff2680c28bdedb8cc536fba2837 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Password/Link/Expirationperiod.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Password/Link/Expirationperiod.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Config\Backend\Password\Link; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Expirationperiod extends \Magento\Core\Model\Config\Value +class Expirationperiod extends \Magento\App\Config\Value { /** * Validate expiration period value before saving diff --git a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php index 7c10a970c40ae4061ef05398fbd520fdf45c92c9..96eb01c5b304839a0cca04e71d4c8367aa95b169 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php @@ -34,18 +34,21 @@ use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\Config\Value +class Customer extends \Magento\App\Config\Value { /** * @var \Magento\Eav\Model\Config */ protected $_eavConfig; + /** @var \Magento\Store\Model\StoreManagerInterface */ + protected $storeManager; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,15 +57,16 @@ class Customer extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_eavConfig = $eavConfig; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + $this->storeManager = $storeManager; } /** @@ -109,7 +113,7 @@ class Customer extends \Magento\Core\Model\Config\Value } if ($this->getScope() == 'websites') { - $website = $this->_storeManager->getWebsite($this->getWebsiteCode()); + $website = $this->storeManager->getWebsite($this->getScopeCode()); $dataFieldPrefix = 'scope_'; } else { $website = null; @@ -139,7 +143,7 @@ class Customer extends \Magento\Core\Model\Config\Value $result = parent::_afterDelete(); if ($this->getScope() == 'websites') { - $website = $this->_storeManager->getWebsite($this->getWebsiteCode()); + $website = $this->storeManager->getWebsite($this->getScopeCode()); foreach ($this->_getAttributeObjects() as $attributeObject) { $attributeObject->setWebsite($website); $attributeObject->load($attributeObject->getId()); diff --git a/app/code/Magento/Customer/Model/Config/Share.php b/app/code/Magento/Customer/Model/Config/Share.php index 8b87015f59d02f1e5850af1fe93d0e31087ff5cf..30f798338f31cf95e2b7c70c765b9a8ae0377730 100644 --- a/app/code/Magento/Customer/Model/Config/Share.php +++ b/app/code/Magento/Customer/Model/Config/Share.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Config; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ArrayInterface +class Share extends \Magento\App\Config\Value implements \Magento\Option\ArrayInterface { /** * Xml config path to customers sharing scope value @@ -48,26 +48,21 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ const SHARE_WEBSITE = 1; - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - /** * @var \Magento\Customer\Model\Resource\Customer */ protected $_customerResource; + /** @var \Magento\Store\Model\StoreManagerInterface */ + protected $_storeManager; + /** * Constructor * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -76,17 +71,16 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Resource\Customer $customerResource, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_storeManager = $storeManager; $this->_customerResource = $customerResource; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** @@ -106,7 +100,10 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ */ public function isWebsiteScope() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_CUSTOMER_ACCOUNT_SHARE) == self::SHARE_WEBSITE; + return $this->_config->getValue( + self::XML_PATH_CUSTOMER_ACCOUNT_SHARE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) == self::SHARE_WEBSITE; } /** diff --git a/app/code/Magento/Customer/Model/Converter.php b/app/code/Magento/Customer/Model/Converter.php index faf75ff4ccec405be9363ba36701367bb758da18..7964ad9baae2851114c88305daafd629f7f7535d 100644 --- a/app/code/Magento/Customer/Model/Converter.php +++ b/app/code/Magento/Customer/Model/Converter.php @@ -107,6 +107,7 @@ class Converter * @param string $customerEmail * @param int $websiteId * @throws NoSuchEntityException If customer with the specified customer email not found. + * @throws \Magento\Model\Exception If website was not specified * @return Customer */ public function getCustomerModelByEmail($customerEmail, $websiteId = null) diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 533f0d015f32cf3fb540a3917b2c06ff2501d119..c4c5e325befee01d3385f7c9b4b1b0e1ac745a34 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -35,15 +35,17 @@ use Magento\Customer\Service\V1\Data\Customer as CustomerData; * Customer model * * @method int getWebsiteId() getWebsiteId() - * @method \Magento\Customer\Model\Customer setWebsiteId(int) + * @method Customer setWebsiteId(int) * @method int getStoreId() getStoreId() * @method string getEmail() getEmail() * @method ResourceCustomer _getResource() * @method mixed getDisableAutoGroupChange() - * @method \Magento\Customer\Model\Customer setDisableAutoGroupChange($value) - * @method \Magento\Customer\Model\Customer setGroupId($value) - * @method \Magento\Customer\Model\Customer setDefaultBilling($value) - * @method \Magento\Customer\Model\Customer setDefaultShipping($value) + * @method Customer setDisableAutoGroupChange($value) + * @method Customer setGroupId($value) + * @method Customer setDefaultBilling($value) + * @method Customer setDefaultShipping($value) + * @method Customer setPasswordHash($string) + * @method string getPasswordHash() */ class Customer extends \Magento\Model\AbstractModel { @@ -137,7 +139,7 @@ class Customer extends \Magento\Model\AbstractModel protected $_isReadonly = false; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -154,9 +156,9 @@ class Customer extends \Magento\Model\AbstractModel protected $_customerData = null; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var Share @@ -212,13 +214,13 @@ class Customer extends \Magento\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Customer\Helper\Data $customerData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $config - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param ResourceCustomer $resource - * @param Share $configShare - * @param \Magento\Customer\Model\AddressFactory $addressFactory - * @param \Magento\Customer\Model\Resource\Address\CollectionFactory $addressesFactory + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param Resource\Customer $resource + * @param Config\Share $configShare + * @param AddressFactory $addressFactory + * @param Resource\Address\CollectionFactory $addressesFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService * @param AttributeFactory $attributeFactory @@ -233,11 +235,11 @@ class Customer extends \Magento\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Customer\Helper\Data $customerData, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $config, - \Magento\Core\Model\Store\Config $coreStoreConfig, - ResourceCustomer $resource, - Share $configShare, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Customer\Model\Resource\Customer $resource, + \Magento\Customer\Model\Config\Share $configShare, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Customer\Model\Resource\Address\CollectionFactory $addressesFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, @@ -251,7 +253,7 @@ class Customer extends \Magento\Model\AbstractModel array $data = array() ) { $this->_customerData = $customerData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_config = $config; $this->_configShare = $configShare; @@ -755,7 +757,11 @@ class Customer extends \Magento\Model\AbstractModel } $storeId = $this->getStoreId() ? $this->getStoreId() : null; - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_IS_CONFIRM, $storeId); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_IS_CONFIRM, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -798,13 +804,13 @@ class Customer extends \Magento\Model\AbstractModel { /** @var \Magento\Mail\TransportInterface $transport */ $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig($template, $storeId) + $this->_scopeConfig->getValue($template, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId) )->setTemplateOptions( array('area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, 'store' => $storeId) )->setTemplateVars( $templateParams )->setFrom( - $this->_coreStoreConfig->getConfig($sender, $storeId) + $this->_scopeConfig->getValue($sender, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId) )->addTo( $this->getEmail(), $this->getName() @@ -850,13 +856,21 @@ class Customer extends \Magento\Model\AbstractModel /** @var \Magento\Mail\TransportInterface $transport */ $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_RESET_PASSWORD_TEMPLATE, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_RESET_PASSWORD_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->setTemplateOptions( array('area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, 'store' => $storeId) )->setTemplateVars( array('customer' => $this, 'store' => $this->getStore()) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_FORGOT_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_FORGOT_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $this->getEmail(), $this->getName() @@ -898,7 +912,7 @@ class Customer extends \Magento\Model\AbstractModel /** * Retrieve store where customer was created * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -954,10 +968,10 @@ class Customer extends \Magento\Model\AbstractModel /** * Set store to customer * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return $this */ - public function setStore(\Magento\Core\Model\Store $store) + public function setStore(\Magento\Store\Model\Store $store) { $this->setStoreId($store->getId()); $this->setWebsiteId($store->getWebsite()->getId()); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php index 351045fe50609af3e625ed05ee65369e8d3af6ac..1bbb5f2d1c140493cbd8833c16eeac926e3ac6d0 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php @@ -35,15 +35,15 @@ namespace Magento\Customer\Model\Customer\Attribute\Backend; class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Logger $logger, \Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; parent::__construct($logger); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php index 73b9fad7e8f16d9dc9d0169cfe9b48951c0d0eb1..3ecb41be6d333558bdcf91090c9eb56bbe69e380 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php @@ -35,15 +35,15 @@ namespace Magento\Customer\Model\Customer\Attribute\Backend; class Website extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Logger $logger, \Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; parent::__construct($logger); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php index 62a791df54e5f32202a2b05542c80e80b7ed9049..9bf918adcd117988c19b3e9a701672d6a41676e6 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php @@ -35,12 +35,12 @@ namespace Magento\Customer\Model\Customer\Attribute\Source; class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_store; /** - * @var \Magento\Core\Model\Resource\Store\CollectionFactory + * @var \Magento\Store\Model\Resource\Store\CollectionFactory */ protected $_storesFactory; @@ -48,15 +48,15 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory - * @param \Magento\Core\Model\System\Store $store - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory + * @param \Magento\Store\Model\System\Store $store + * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storesFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, - \Magento\Core\Model\System\Store $store, - \Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory + \Magento\Store\Model\System\Store $store, + \Magento\Store\Model\Resource\Store\CollectionFactory $storesFactory ) { parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); $this->_store = $store; @@ -119,7 +119,7 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table } /** - * @return \Magento\Core\Model\Resource\Store\Collection + * @return \Magento\Store\Model\Resource\Store\Collection */ protected function _createStoresCollection() { diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php index c3c75f161d3d0e88e61ca6d2adc923ab45830672..75c56a495785a19158b9dfdf12b87e46ed3db5fe 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php @@ -35,7 +35,7 @@ namespace Magento\Customer\Model\Customer\Attribute\Source; class Website extends \Magento\Eav\Model\Entity\Attribute\Source\Table { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_store; @@ -43,13 +43,13 @@ class Website extends \Magento\Eav\Model\Entity\Attribute\Source\Table * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory - * @param \Magento\Core\Model\System\Store $store + * @param \Magento\Store\Model\System\Store $store */ public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, - \Magento\Core\Model\System\Store $store + \Magento\Store\Model\System\Store $store ) { parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); $this->_store = $store; diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index dff1b59c1ef3d250aca6223d8cc921c07afa0232..ce3a9d7c7c8cf33a35586d17c1a49a62003ba4d0 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -69,9 +69,9 @@ class Group extends \Magento\Model\AbstractModel protected static $_taxClassIds = array(); /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Store\Model\StoresConfig */ - protected $_storeConfig; + protected $_storesConfig; /** * @var \Magento\Index\Model\Indexer @@ -83,7 +83,7 @@ class Group extends \Magento\Model\AbstractModel * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoresConfig $storesConfig * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -92,13 +92,13 @@ class Group extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoresConfig $storesConfig, \Magento\Index\Model\Indexer $indexer, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_storeConfig = $storeConfig; + $this->_storesConfig = $storesConfig; $this->_indexer = $indexer; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -157,7 +157,7 @@ class Group extends \Magento\Model\AbstractModel */ public function usesAsDefault() { - $data = $this->_storeConfig->getStoresConfigByPath(self::XML_PATH_DEFAULT_ID); + $data = $this->_storesConfig->getStoresConfigByPath(self::XML_PATH_DEFAULT_ID); if (in_array($this->getId(), $data)) { return true; } diff --git a/app/code/Magento/Customer/Model/Resource/AbstractServiceCollection.php b/app/code/Magento/Customer/Model/Resource/AbstractServiceCollection.php index fda22f1983d96128965a0d235b579ddb9f6db961..2fe891b26ff960f791b912c555a57d50d91c9e54 100644 --- a/app/code/Magento/Customer/Model/Resource/AbstractServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/AbstractServiceCollection.php @@ -24,8 +24,8 @@ namespace Magento\Customer\Model\Resource; use Magento\Core\Model\EntityFactory; -use Magento\Customer\Service\V1\Data\Filter; -use Magento\Customer\Service\V1\Data\FilterBuilder; +use Magento\Service\V1\Data\Filter; +use Magento\Service\V1\Data\FilterBuilder; use Magento\Customer\Service\V1\Data\SearchCriteria; use Magento\Customer\Service\V1\Data\SearchCriteriaBuilder; use Magento\Exception; diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index d904f9b976b1cff64c1d2dee60a675e73344dc90..8c03b9de2cdd9f1c394d984c0e87571f5fc5d710 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -36,9 +36,9 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Stdlib\DateTime @@ -52,7 +52,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Model\Validator\Factory $validatorFactory * @param \Magento\Stdlib\DateTime $dateTime * @param array $data @@ -64,7 +64,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity \Magento\Locale\FormatInterface $localeFormat, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Model\Validator\Factory $validatorFactory, \Magento\Stdlib\DateTime $dateTime, $data = array() @@ -78,7 +78,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity $universalFactory, $data ); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_validatorFactory = $validatorFactory; $this->dateTime = $dateTime; $this->setType('customer'); @@ -392,7 +392,10 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity */ public function setNewIncrementId(\Magento\Object $object) { - if ($this->_coreStoreConfig->getConfig(\Magento\Customer\Model\Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID) + if ($this->_scopeConfig->getValue( + \Magento\Customer\Model\Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) { parent::setNewIncrementId($object); } diff --git a/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php index 9c7a1fe568c4fd57c42e2fb637e163a28ba4d870..cb85cc3b394b827abc757d9375189b3018ed5f68 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/Customer/Grid/ServiceCollection.php @@ -28,7 +28,7 @@ use Magento\Customer\Helper\View; use Magento\Customer\Model\Resource\AbstractServiceCollection; use Magento\Customer\Service\V1\CustomerAccountServiceInterface; use Magento\Customer\Service\V1\Data\CustomerDetails; -use Magento\Customer\Service\V1\Data\FilterBuilder; +use Magento\Service\V1\Data\FilterBuilder; use Magento\Customer\Service\V1\Data\SearchCriteriaBuilder; /** diff --git a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php index 6bdae205960e087b6596ed9fde6b47d750ab6ccb..3e42049c7fcfc8a558c8a2ac01f953ad6a84c6c9 100644 --- a/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php +++ b/app/code/Magento/Customer/Model/Resource/Group/Grid/ServiceCollection.php @@ -27,7 +27,7 @@ use Magento\Core\Model\EntityFactory; use Magento\Customer\Model\Resource\AbstractServiceCollection; use Magento\Customer\Service\V1\CustomerGroupServiceInterface; use Magento\Customer\Service\V1\Data\CustomerGroup; -use Magento\Customer\Service\V1\Data\FilterBuilder; +use Magento\Service\V1\Data\FilterBuilder; use Magento\Customer\Service\V1\Data\SearchCriteriaBuilder; /** diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php index f4fc519f23d5389de609b818d688b927e4402117..a71a2f9db0aa661730ad722ff42c8caf3f0878f7 100644 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ b/app/code/Magento/Customer/Model/Resource/Setup.php @@ -48,7 +48,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Eav\Model\Config $eavConfig, $moduleName = 'Magento_Customer', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_eavConfig = $eavConfig; parent::__construct( diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index 8a18cfed8b6d2ba95576a7c915920c39863718c8..52eb63cd23d8f4a01d844c9a132de7962cd446a3 100755 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -76,7 +76,7 @@ class Session extends \Magento\Session\SessionManager protected $_configShare; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $_session; @@ -98,11 +98,6 @@ class Session extends \Magento\Session\SessionManager */ protected $_eventManager; - /** - * @var \Magento\Core\Model\Store\StorageInterface - */ - protected $_storeManager; - /** * @var \Magento\App\Http\Context */ @@ -114,7 +109,7 @@ class Session extends \Magento\Session\SessionManager protected $_converter; /** - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Session\SaveHandlerInterface $saveHandler @@ -126,16 +121,15 @@ class Session extends \Magento\Session\SessionManager * @param ResourceCustomer $customerResource * @param CustomerFactory $customerFactory * @param \Magento\UrlFactory $urlFactory - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\Generic $session * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\Http\Context $httpContext * @param Converter $converter * @param CustomerAccountServiceInterface $customerAccountService * @param null $sessionName */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Session\SaveHandlerInterface $saveHandler, @@ -147,9 +141,8 @@ class Session extends \Magento\Session\SessionManager Resource\Customer $customerResource, CustomerFactory $customerFactory, \Magento\UrlFactory $urlFactory, - \Magento\Core\Model\Session $session, + \Magento\Session\Generic $session, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\Http\Context $httpContext, \Magento\Customer\Model\Converter $converter, CustomerAccountServiceInterface $customerAccountService, @@ -164,7 +157,6 @@ class Session extends \Magento\Session\SessionManager $this->_session = $session; $this->_customerAccountService = $customerAccountService; $this->_eventManager = $eventManager; - $this->_storeManager = $storeManager; $this->_httpContext = $httpContext; parent::__construct($request, $sidResolver, $sessionConfig, $saveHandler, $validator, $storage); $this->start($sessionName); @@ -416,6 +408,7 @@ class Session extends \Magento\Session\SessionManager { $this->setCustomer($customer); $this->_eventManager->dispatch('customer_login', array('customer' => $customer)); + $this->_eventManager->dispatch('customer_data_object_login', ['customer' => $this->getCustomerDataObject()]); $this->regenerateId(); return $this; } @@ -433,6 +426,7 @@ class Session extends \Magento\Session\SessionManager $this->setCustomer($customerModel); $this->_eventManager->dispatch('customer_login', array('customer' => $customerModel)); + $this->_eventManager->dispatch('customer_data_object_login', ['customer' => $customer]); return $this; } diff --git a/app/code/Magento/Customer/Model/Session/Storage.php b/app/code/Magento/Customer/Model/Session/Storage.php index ceedc45b22abfcfbaf91f7a6161eb9d3fada5266..a6621d589266f6bab4a7bb100fa655ca37e0c782 100644 --- a/app/code/Magento/Customer/Model/Session/Storage.php +++ b/app/code/Magento/Customer/Model/Session/Storage.php @@ -31,13 +31,13 @@ class Storage extends \Magento\Session\Storage { /** * @param \Magento\Customer\Model\Config\Share $configShare - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param string $namespace * @param array $data */ public function __construct( \Magento\Customer\Model\Config\Share $configShare, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $namespace = 'customer', array $data = array() ) { diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index ff23fc03068b75760722f2aa91857b65831891d4..6622f324c85dd8d11df156c9f8fdd7fa08c49f73 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -23,7 +23,7 @@ */ namespace Magento\Customer\Service\V1; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Customer\Model\Converter; use Magento\Customer\Model\Customer as CustomerModel; use Magento\Customer\Model\CustomerFactory; @@ -38,11 +38,15 @@ use Magento\Mail\Exception as MailException; use Magento\Math\Random; use Magento\UrlInterface; use Magento\Logger; +use Magento\Encryption\EncryptorInterface as Encryptor; +use Magento\Customer\Model\Config\Share as ConfigShare; +use Magento\Service\V1\Data\Filter; /** * Handle various customer account actions * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.TooManyFields) */ class CustomerAccountService implements CustomerAccountServiceInterface { @@ -60,6 +64,9 @@ class CustomerAccountService implements CustomerAccountServiceInterface /** @var Data\SearchResultsBuilder */ private $_searchResultsBuilder; + /** @var Data\CustomerValidationResultsBuilder */ + private $_customerValidationResultsBuilder; + /** * Core event manager proxy * @@ -107,6 +114,16 @@ class CustomerAccountService implements CustomerAccountServiceInterface */ protected $_logger; + /** + * @var Encryptor + */ + private $_encryptor; + + /** + * @var ConfigShare + */ + private $_configShare; + /** * Constructor * @@ -118,12 +135,14 @@ class CustomerAccountService implements CustomerAccountServiceInterface * @param Validator $validator * @param Data\CustomerBuilder $customerBuilder * @param Data\CustomerDetailsBuilder $customerDetailsBuilder - * @param Data\SearchResultsBuilder $searchResultsBuilder, + * @param Data\SearchResultsBuilder $searchResultsBuilder + * @param Data\CustomerValidationResultsBuilder $customerValidationResultsBuilder * @param CustomerAddressServiceInterface $customerAddressService * @param CustomerMetadataServiceInterface $customerMetadataService * @param UrlInterface $url * @param Logger $logger - * + * @param Encryptor $encryptor + * @param ConfigShare $configShare * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -136,10 +155,13 @@ class CustomerAccountService implements CustomerAccountServiceInterface Data\CustomerBuilder $customerBuilder, Data\CustomerDetailsBuilder $customerDetailsBuilder, Data\SearchResultsBuilder $searchResultsBuilder, + Data\CustomerValidationResultsBuilder $customerValidationResultsBuilder, CustomerAddressServiceInterface $customerAddressService, CustomerMetadataServiceInterface $customerMetadataService, UrlInterface $url, - Logger $logger + Logger $logger, + Encryptor $encryptor, + ConfigShare $configShare ) { $this->_customerFactory = $customerFactory; $this->_eventManager = $eventManager; @@ -150,10 +172,13 @@ class CustomerAccountService implements CustomerAccountServiceInterface $this->_customerBuilder = $customerBuilder; $this->_customerDetailsBuilder = $customerDetailsBuilder; $this->_searchResultsBuilder = $searchResultsBuilder; + $this->_customerValidationResultsBuilder = $customerValidationResultsBuilder; $this->_customerAddressService = $customerAddressService; $this->_customerMetadataService = $customerMetadataService; $this->_url = $url; $this->_logger = $logger; + $this->_encryptor = $encryptor; + $this->_configShare = $configShare; } /** @@ -231,7 +256,10 @@ class CustomerAccountService implements CustomerAccountServiceInterface $this->_eventManager->dispatch('customer_login', array('customer' => $customerModel)); - return $this->_converter->createCustomerFromModel($customerModel); + $customerDto = $this->_converter->createCustomerFromModel($customerModel); + $this->_eventManager->dispatch('customer_data_object_login', array('customer' => $customerDto)); + + return $customerDto; } /** @@ -288,7 +316,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface $customerModel = $this->_validateResetPasswordToken($customerId, $resetToken); $customerModel->setRpToken(null); $customerModel->setRpTokenCreatedAt(null); - $customerModel->setPassword($newPassword); + $customerModel->setPasswordHash($this->getPasswordHash($newPassword)); $customerModel->save(); } @@ -310,17 +338,27 @@ class CustomerAccountService implements CustomerAccountServiceInterface /** * {@inheritdoc} */ - public function createAccount(Data\CustomerDetails $customerDetails, $password = null, $redirectUrl = '') - { + public function createAccount( + Data\CustomerDetails $customerDetails, + $password = null, + $hash = null, + $redirectUrl = '' + ) { $customer = $customerDetails->getCustomer(); // This logic allows an existing customer to be added to a different store. No new account is created. // The plan is to move this logic into a new method called something like 'registerAccountWithStore' if ($customer->getId()) { - $customerModel = $this->_converter->getCustomerModel($customer->getId()); - if ($customerModel->isInStore($customer->getStoreId())) { + $websiteId = $this->_converter->getCustomerModel($customer->getId())->getWebsiteId(); + + if ($this->isCustomerInStore($websiteId, $customer->getStoreId())) { throw new InputException(__('Customer already exists in this store.')); } + + if (empty($password) && empty($hash)) { + // Reuse existing password + $hash = $this->_converter->getCustomerModel($customer->getId())->getPasswordHash(); + } } // Make sure we have a storeId to associate this customer with. if (!$customer->getStoreId()) { @@ -333,7 +371,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface } try { - $customerId = $this->saveCustomer($customer, $password); + $customerId = $this->saveCustomer($customer, $password, $hash); } catch (\Magento\Customer\Exception $e) { if ($e->getCode() === CustomerModel::EXCEPTION_EMAIL_EXISTS) { throw new StateException( @@ -345,12 +383,24 @@ class CustomerAccountService implements CustomerAccountServiceInterface } $this->_customerAddressService->saveAddresses($customerId, $customerDetails->getAddresses()); - $customerModel = $this->_converter->getCustomerModel($customerId); - $newLinkToken = $this->_mathRandom->getUniqueHash(); $customerModel->changeResetPasswordLinkToken($newLinkToken); + $this->_sendEmailConfirmation($customerModel, $customer, $redirectUrl); + return $this->_converter->createCustomerFromModel($customerModel); + } + + /** + * Send either confirmation or welcome email after an account creation + * + * @param CustomerModel $customerModel + * @param Data\Customer $customer + * @param string $redirectUrl + * @return void + */ + protected function _sendEmailConfirmation(CustomerModel $customerModel, Data\Customer $customer, $redirectUrl) + { try { if ($customerModel->isConfirmationRequired()) { $customerModel->sendNewAccountEmail( @@ -369,7 +419,6 @@ class CustomerAccountService implements CustomerAccountServiceInterface // If we are not able to send a new account email, this should be ignored $this->_logger->logException($e); } - return $this->_converter->createCustomerFromModel($customerModel); } /** @@ -380,7 +429,12 @@ class CustomerAccountService implements CustomerAccountServiceInterface $customer = $customerDetails->getCustomer(); // Making this call first will ensure the customer already exists. $this->getCustomer($customer->getId()); - $this->saveCustomer($customer); + + $this->saveCustomer( + $customer, + null, + $this->_converter->getCustomerModel($customer->getId())->getPasswordHash() + ); $addresses = $customerDetails->getAddresses(); // If $address is null, no changes must made to the list of addresses @@ -403,6 +457,8 @@ class CustomerAccountService implements CustomerAccountServiceInterface } $this->_customerAddressService->saveAddresses($customer->getId(), $addresses); } + + return true; } /** @@ -421,38 +477,12 @@ class CustomerAccountService implements CustomerAccountServiceInterface // Needed to enable filtering on name as a whole $collection->addNameToSelect(); // Needed to enable filtering based on billing address attributes - $collection->joinAttribute( - 'billing_postcode', - 'customer_address/postcode', - 'default_billing', - null, - 'left' - )->joinAttribute( - 'billing_city', - 'customer_address/city', - 'default_billing', - null, - 'left' - )->joinAttribute( - 'billing_telephone', - 'customer_address/telephone', - 'default_billing', - null, - 'left' - )->joinAttribute( - 'billing_region', - 'customer_address/region', - 'default_billing', - null, - 'left' - )->joinAttribute( - 'billing_country_id', - 'customer_address/country_id', - 'default_billing', - null, - 'left' - ); - $this->addFiltersToCollection($searchCriteria->getFilters(), $collection); + $collection->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left') + ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left') + ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left') + ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left') + ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left'); + $this->addFiltersFromRootToCollection($searchCriteria->getAndGroup(), $collection); $this->_searchResultsBuilder->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); if ($sortOrders) { @@ -481,25 +511,25 @@ class CustomerAccountService implements CustomerAccountServiceInterface } /** - * Adds some filters from a filter group to a collection. + * Adds some filters from the root filter group to a collection. * - * @param Data\Search\FilterGroupInterface $filterGroup + * @param Data\Search\AndGroup $rootAndGroup * @param Collection $collection * @return void * @throws \Magento\Exception\InputException */ - protected function addFiltersToCollection(Data\Search\FilterGroupInterface $filterGroup, Collection $collection) + protected function addFiltersFromRootToCollection(Data\Search\AndGroup $rootAndGroup, Collection $collection) { - if (strcasecmp($filterGroup->getGroupType(), 'AND')) { - throw new InputException('Only AND grouping is currently supported for filters.'); + if (count($rootAndGroup->getAndGroups())) { + throw new InputException('Only OR groups are supported as nested groups.'); } - foreach ($filterGroup->getFilters() as $filter) { + foreach ($rootAndGroup->getFilters() as $filter) { $this->addFilterToCollection($collection, $filter); } - foreach ($filterGroup->getGroups() as $group) { - $this->addFilterGroupToCollection($collection, $group); + foreach ($rootAndGroup->getOrGroups() as $group) { + $this->addFilterOrGroupToCollection($collection, $group); } } @@ -507,10 +537,10 @@ class CustomerAccountService implements CustomerAccountServiceInterface * Helper function that adds a filter to the collection * * @param Collection $collection - * @param Data\Filter $filter + * @param Filter $filter * @return void */ - protected function addFilterToCollection(Collection $collection, Data\Filter $filter) + protected function addFilterToCollection(Collection $collection, Filter $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $collection->addFieldToFilter($filter->getField(), array($condition => $filter->getValue())); @@ -520,18 +550,15 @@ class CustomerAccountService implements CustomerAccountServiceInterface * Helper function that adds a FilterGroup to the collection. * * @param Collection $collection - * @param Data\Search\FilterGroupInterface $group + * @param Data\Search\OrGroup $orGroup * @return void * @throws \Magento\Exception\InputException */ - protected function addFilterGroupToCollection(Collection $collection, Data\Search\FilterGroupInterface $group) + protected function addFilterOrGroupToCollection(Collection $collection, Data\Search\OrGroup $orGroup) { - if (strcasecmp($group->getGroupType(), 'OR')) { - throw new InputException('The only nested groups currently supported for filters are of type OR.'); - } - $fields = array(); - $conditions = array(); - foreach ($group->getFilters() as $filter) { + $fields = []; + $conditions = []; + foreach ($orGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $fields[] = array('attribute' => $filter->getField(), $condition => $filter->getValue()); } @@ -543,19 +570,23 @@ class CustomerAccountService implements CustomerAccountServiceInterface /** * {@inheritdoc} */ - public function saveCustomer(Data\Customer $customer, $password = null) + public function saveCustomer(Data\Customer $customer, $password = null, $hash = null) { $customerModel = $this->_converter->createCustomerModel($customer); - if ($password) { - $customerModel->setPassword($password); + // Priority: hash, password, auto generated password + if ($hash) { + $customerModel->setPasswordHash($hash); + } elseif ($password) { + $passwordHash = $this->getPasswordHash($password); + $customerModel->setPasswordHash($passwordHash); } elseif (!$customerModel->getId()) { - $customerModel->setPassword($customerModel->generatePassword()); + $passwordHash = $this->getPasswordHash($customerModel->generatePassword()); + $customerModel->setPasswordHash($passwordHash); } // Shouldn't we be calling validateCustomerData/Details here? $this->_validate($customerModel); - $customerModel->save(); return $customerModel->getId(); @@ -584,12 +615,20 @@ class CustomerAccountService implements CustomerAccountServiceInterface } $customerModel->setRpToken(null); $customerModel->setRpTokenCreatedAt(null); - $customerModel->setPassword($newPassword); + $customerModel->setPasswordHash($this->getPasswordHash($newPassword)); $customerModel->save(); // FIXME: Are we using the proper template here? $customerModel->sendPasswordResetNotificationEmail(); } + /** + * {@inheritDoc} + */ + public function getPasswordHash($password) + { + return $this->_encryptor->getHash($password, true); + } + /** * {@inheritdoc} */ @@ -602,16 +641,25 @@ class CustomerAccountService implements CustomerAccountServiceInterface ); if ($customerErrors !== true) { - return array('error' => -1, 'message' => implode(', ', $this->_validator->getMessages())); + return $this->_customerValidationResultsBuilder + ->setIsValid(false) + ->setMessages($this->_validator->getMessages()) + ->create(); } $customerModel = $this->_converter->createCustomerModel($customer); $result = $customerModel->validate(); if (true !== $result && is_array($result)) { - return array('error' => -1, 'message' => implode(', ', $result)); - } - return true; + return $this->_customerValidationResultsBuilder + ->setIsValid(false) + ->setMessages($result) + ->create(); + } + return $this->_customerValidationResultsBuilder + ->setIsValid(true) + ->setMessages([]) + ->create(); } /** @@ -744,6 +792,8 @@ class CustomerAccountService implements CustomerAccountServiceInterface { $customerModel = $this->_converter->getCustomerModel($customerId); $customerModel->delete(); + + return true; } /** @@ -758,4 +808,21 @@ class CustomerAccountService implements CustomerAccountServiceInterface return true; } } + + /** + * {@inheritDoc} + */ + public function isCustomerInStore($customerWebsiteId, $storeId) + { + $ids = []; + if ((bool)$this->_configShare->isWebsiteScope()) { + $ids = $this->_storeManager->getWebsite($customerWebsiteId)->getStoreIds(); + } else { + foreach ($this->_storeManager->getStores() as $store) { + $ids[] = $store->getId(); + } + } + + return in_array($storeId, $ids); + } } diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php index 817dc6574af23450ff8d47d56625988b1401b037..c316570d251125b86c7cf84d5c5014b1df1b0c1a 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountServiceInterface.php @@ -64,7 +64,8 @@ interface CustomerAccountServiceInterface * Create Customer Account * * @param \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails - * @param string $password If null then a random password will be assigned + * @param string $password If null then a random password will be assigned. Disregard if $hash is not empty. + * @param string $hash Password hash that we can save directly * @param string $redirectUrl URL fed to welcome email templates. Can be used by templates to, for example, direct * the customer to a product they were looking at after pressing confirmation link. * @return \Magento\Customer\Service\V1\Data\Customer @@ -75,6 +76,7 @@ interface CustomerAccountServiceInterface public function createAccount( \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails, $password = null, + $hash = null, $redirectUrl = '' ); @@ -84,7 +86,8 @@ interface CustomerAccountServiceInterface * the array must be null. * * @param \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails - * @return void + * @throws \Magento\Exception\NoSuchEntityException If customer with customerDetails is not found. + * @return bool True if this customer was updated */ public function updateCustomer(\Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails); @@ -92,13 +95,14 @@ interface CustomerAccountServiceInterface * Create or update customer information * * @param \Magento\Customer\Service\V1\Data\Customer $customer - * @param string $password + * @param string $password Plain text password + * @param string $hash Hashed password ready to be saved * @throws \Magento\Customer\Exception If something goes wrong during save * @throws \Magento\Exception\InputException If bad input is provided * @return int customer ID - * @deprecated use createCustomer or updateCustomer instead + * @deprecated use createAccount or updateCustomer instead */ - public function saveCustomer(\Magento\Customer\Service\V1\Data\Customer $customer, $password = null); + public function saveCustomer(\Magento\Customer\Service\V1\Data\Customer $customer, $password = null, $hash = null); /** * Retrieve Customer @@ -153,6 +157,16 @@ interface CustomerAccountServiceInterface */ public function changePassword($customerId, $currentPassword, $newPassword); + /** + * Return hashed password, which can be directly saved to database. + * + * @param string $password + * @return string + * @todo this method has to be removed when the checkout process refactored in the way it won't require to pass + * a password through requests + */ + public function getPasswordHash($password); + /** * Check if password reset token is valid * @@ -217,7 +231,7 @@ interface CustomerAccountServiceInterface * * @param \Magento\Customer\Service\V1\Data\Customer $customer * @param \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata[] $attributes - * @return array|bool + * @return \Magento\Customer\Service\V1\Data\CustomerValidationResults */ public function validateCustomerData( \Magento\Customer\Service\V1\Data\Customer $customer, @@ -259,7 +273,7 @@ interface CustomerAccountServiceInterface * @param int $customerId * @throws \Magento\Customer\Exception If something goes wrong during delete * @throws \Magento\Exception\NoSuchEntityException If customer with customerId is not found. - * @return void + * @return bool True if the customer was deleted */ public function deleteCustomer($customerId); @@ -269,6 +283,17 @@ interface CustomerAccountServiceInterface * @param string $customerEmail * @param int $websiteId * @return bool true if the email is not associated with a customer account in given website + * @throws \Magento\Exception\NoSuchEntityException If customer with email is not found + * @throws \Magento\Model\Exception If website was not specified */ public function isEmailAvailable($customerEmail, $websiteId); + + /** + * Check store availability for customer given the customerId + * + * @param int $customerWebsiteId + * @param int $storeId + * @return bool + */ + public function isCustomerInStore($customerWebsiteId, $storeId); } diff --git a/app/code/Magento/Customer/Service/V1/CustomerAddressService.php b/app/code/Magento/Customer/Service/V1/CustomerAddressService.php index 5722050d560c0956c9422d6e8deddf1fc8443603..af184d3a5432ef1ac0f5fa1630444addd37bb4a1 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAddressService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAddressService.php @@ -170,6 +170,7 @@ class CustomerAddressService implements CustomerAddressServiceInterface } $address->delete(); + return true; } /** diff --git a/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php index 832160fdeb65f9cf956c8071dba2417797fd8cba..98ba323a1d880e86e276369dd29915390cd788f7 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAddressServiceInterface.php @@ -68,7 +68,7 @@ interface CustomerAddressServiceInterface * Removes an address by id. * * @param int $addressId - * @return void + * @return bool True if the address was deleted * @throws \Magento\Exception\NoSuchEntityException If no address can be found for the provided id. */ public function deleteAddress($addressId); diff --git a/app/code/Magento/Customer/Service/V1/CustomerGroupService.php b/app/code/Magento/Customer/Service/V1/CustomerGroupService.php index b87075935dd93f81c9dfabf3fcdae652595ad70e..6d72cf418a7e9b2b6c74b6b2147ca2853c64bea6 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerGroupService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerGroupService.php @@ -25,12 +25,15 @@ */ namespace Magento\Customer\Service\V1; -use Magento\Core\Model\Store\Config as StoreConfig; use Magento\Customer\Model\Group as CustomerGroupModel; use Magento\Customer\Model\GroupFactory; use Magento\Customer\Model\Resource\Group\Collection; use Magento\Exception\InputException; use Magento\Exception\NoSuchEntityException; +use Magento\Exception\StateException; +use Magento\Service\V1\Data\Filter; +use Magento\Tax\Model\ClassModel as TaxClassModel; +use Magento\Tax\Model\ClassModelFactory as TaxClassModelFactory; /** * Class CustomerGroupService @@ -45,9 +48,9 @@ class CustomerGroupService implements CustomerGroupServiceInterface private $_groupFactory; /** - * @var StoreConfig + * @var Scope Config */ - private $_storeConfig; + private $_scopeConfig; /** * @var Data\SearchResultsBuilder @@ -59,22 +62,35 @@ class CustomerGroupService implements CustomerGroupServiceInterface */ private $_customerGroupBuilder; + /** + * @var TaxClassModelFactory + */ + private $_taxClassModelFactory; + + /** + * The default tax class id if no tax class id is specified + */ + const DEFAULT_TAX_CLASS_ID = 3; + /** * @param GroupFactory $groupFactory - * @param StoreConfig $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param Data\SearchResultsBuilder $searchResultsBuilder * @param Data\CustomerGroupBuilder $customerGroupBuilder + * @param TaxClassModelFactory $taxClassModel */ public function __construct( GroupFactory $groupFactory, - StoreConfig $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, Data\SearchResultsBuilder $searchResultsBuilder, - Data\CustomerGroupBuilder $customerGroupBuilder + Data\CustomerGroupBuilder $customerGroupBuilder, + TaxClassModelFactory $taxClassModelFactory ) { $this->_groupFactory = $groupFactory; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_searchResultsBuilder = $searchResultsBuilder; $this->_customerGroupBuilder = $customerGroupBuilder; + $this->_taxClassModelFactory = $taxClassModelFactory; } /** @@ -93,13 +109,9 @@ class CustomerGroupService implements CustomerGroupServiceInterface } /** @var CustomerGroupModel $group */ foreach ($collection as $group) { - $this->_customerGroupBuilder->setId( - $group->getId() - )->setCode( - $group->getCode() - )->setTaxClassId( - $group->getTaxClassId() - ); + $this->_customerGroupBuilder->setId($group->getId()) + ->setCode($group->getCode()) + ->setTaxClassId($group->getTaxClassId()); $groups[] = $this->_customerGroupBuilder->create(); } return $groups; @@ -115,7 +127,7 @@ class CustomerGroupService implements CustomerGroupServiceInterface $groups = array(); /** @var Collection $collection */ $collection = $this->_groupFactory->create()->getCollection(); - $this->addFiltersToCollection($searchCriteria->getFilters(), $collection); + $this->addFiltersFromRootToCollection($searchCriteria->getAndGroup(), $collection); $this->_searchResultsBuilder->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); if ($sortOrders) { @@ -143,25 +155,25 @@ class CustomerGroupService implements CustomerGroupServiceInterface } /** - * Adds some filters from a filter group to a collection. + * Adds some filters from a root filter group to a collection. * - * @param Data\Search\FilterGroupInterface $filterGroup + * @param Data\Search\AndGroup $rootAndGroup * @param Collection $collection * @return void * @throws \Magento\Exception\InputException */ - protected function addFiltersToCollection(Data\Search\FilterGroupInterface $filterGroup, Collection $collection) + protected function addFiltersFromRootToCollection(Data\Search\AndGroup $rootAndGroup, Collection $collection) { - if (strcasecmp($filterGroup->getGroupType(), 'AND')) { - throw new InputException('Only AND grouping is currently supported for filters.'); + if (count($rootAndGroup->getAndGroups())) { + throw new InputException('Only OR groups are supported as nested groups.'); } - foreach ($filterGroup->getFilters() as $filter) { + foreach ($rootAndGroup->getFilters() as $filter) { $this->addFilterToCollection($collection, $filter); } - foreach ($filterGroup->getGroups() as $group) { - $this->addFilterGroupToCollection($collection, $group); + foreach ($rootAndGroup->getOrGroups() as $group) { + $this->addOrFilterGroupToCollection($collection, $group); } } @@ -169,35 +181,32 @@ class CustomerGroupService implements CustomerGroupServiceInterface * Helper function that adds a filter to the collection * * @param Collection $collection - * @param Data\Filter $filter + * @param Filter $filter * @return void */ - protected function addFilterToCollection(Collection $collection, Data\Filter $filter) + protected function addFilterToCollection(Collection $collection, Filter $filter) { $field = $this->translateField($filter->getField()); $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; - $collection->addFieldToFilter($field, array($condition => $filter->getValue())); + $collection->addFieldToFilter($field, [$condition => $filter->getValue()]); } /** - * Helper function that adds a FilterGroup to the collection. + * Helper function that adds a OrGroup to the collection. * * @param Collection $collection - * @param Data\Search\FilterGroupInterface $group + * @param Data\Search\OrGroup $orGroup * @return void * @throws \Magento\Exception\InputException */ - protected function addFilterGroupToCollection(Collection $collection, Data\Search\FilterGroupInterface $group) + protected function addOrFilterGroupToCollection(Collection $collection, Data\Search\OrGroup $orGroup) { - if (strcasecmp($group->getGroupType(), 'OR')) { - throw new InputException('The only nested groups currently supported for filters are of type OR.'); - } - $fields = array(); - $conditions = array(); - foreach ($group->getFilters() as $filter) { + $fields = []; + $conditions = []; + foreach ($orGroup->getFilters() as $filter) { $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; $fields[] = $this->translateField($filter->getField()); - $conditions[] = array($condition => $filter->getValue()); + $conditions[] = [$condition => $filter->getValue()]; } if ($fields) { $collection->addFieldToFilter($fields, $conditions); @@ -233,13 +242,9 @@ class CustomerGroupService implements CustomerGroupServiceInterface if (is_null($customerGroup->getId())) { throw new NoSuchEntityException('groupId', $groupId); } - $this->_customerGroupBuilder->setId( - $customerGroup->getId() - )->setCode( - $customerGroup->getCode() - )->setTaxClassId( - $customerGroup->getTaxClassId() - ); + $this->_customerGroupBuilder->setId($customerGroup->getId()) + ->setCode($customerGroup->getCode()) + ->setTaxClassId($customerGroup->getTaxClassId()); return $this->_customerGroupBuilder->create(); } @@ -248,7 +253,15 @@ class CustomerGroupService implements CustomerGroupServiceInterface */ public function getDefaultGroup($storeId) { - $groupId = $this->_storeConfig->getConfig(CustomerGroupModel::XML_PATH_DEFAULT_ID, $storeId); + try { + $groupId = $this->_scopeConfig->getValue( + CustomerGroupModel::XML_PATH_DEFAULT_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + } catch (\Magento\Model\Exception $e) { + throw new NoSuchEntityException('storeId', $storeId); + } try { return $this->getGroup($groupId); } catch (NoSuchEntityException $e) { @@ -264,6 +277,12 @@ class CustomerGroupService implements CustomerGroupServiceInterface { $customerGroup = $this->_groupFactory->create(); $customerGroup->load($groupId); + + // Throw exception if a customer group does not exist + if (is_null($customerGroup->getId())) { + throw new NoSuchEntityException('groupId', $groupId); + } + return $groupId > 0 && !$customerGroup->usesAsDefault(); } @@ -272,21 +291,74 @@ class CustomerGroupService implements CustomerGroupServiceInterface */ public function saveGroup(Data\CustomerGroup $group) { + if (!$group->getCode()) { + throw InputException::create(InputException::INVALID_FIELD_VALUE, 'code', $group->getCode()); + } + $customerGroup = $this->_groupFactory->create(); if ($group->getId()) { $customerGroup->load($group->getId()); + + // Throw exception if the customer group does not exist + if (is_null($customerGroup->getId())) { + throw new NoSuchEntityException('id', $group->getId()); + } } $customerGroup->setCode($group->getCode()); - $customerGroup->setTaxClassId($group->getTaxClassId()); - $customerGroup->save(); + + $taxClassId = $group->getTaxClassId(); + if (!$taxClassId) { + $taxClassId = self::DEFAULT_TAX_CLASS_ID; + } + $this->_verifyTaxClassModel($taxClassId, $group); + + $customerGroup->setTaxClassId($taxClassId); + try { + $customerGroup->save(); + } catch (\Magento\Model\Exception $e) { + /* Would like a better way to determine this error condition but + difficult to do without imposing more database calls + */ + if ($e->getMessage() === __('Customer Group already exists.')) { + $e = new InputException($e->getMessage()); + $e->addError(InputException::INVALID_FIELD_VALUE, 'code', $group->getCode()); + throw $e; + } + throw $e; + } + return $customerGroup->getId(); } + /** + * Verifies that the tax class model exists and is a customer tax class type. + * + * @param int $taxClassId The id of the tax class model to check + * @param \Magento\Customer\Service\V1\Data\CustomerGroup $group The original group parameters + * @return void + * @throws InputException Thrown if the tax class model is invalid + */ + protected function _verifyTaxClassModel($taxClassId, $group) + { + /* Doing this until a Tax Service API is available */ + $taxClassModel = $this->_taxClassModelFactory->create(); + $taxClassModel->load($taxClassId); + if (is_null($taxClassModel->getId()) + || $taxClassModel->getClassType() !== TaxClassModel::TAX_CLASS_TYPE_CUSTOMER + ) { + throw InputException::create(InputException::INVALID_FIELD_VALUE, 'taxClassId', $group->getTaxClassId()); + } + } + /** * {@inheritdoc} */ public function deleteGroup($groupId) { + if (!$this->canDelete($groupId)) { + throw new StateException(__("Cannot delete group.")); + } + // Get group so we can throw an exception if it doesn't exist $this->getGroup($groupId); $customerGroup = $this->_groupFactory->create(); diff --git a/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php b/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php index 0274b6f5ad5ad49478b4e747455640b9b640f9f8..d4c6fc48c939a7f6ac97f76a4ae7d31e63c8547a 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php +++ b/app/code/Magento/Customer/Service/V1/CustomerGroupServiceInterface.php @@ -78,6 +78,7 @@ interface CustomerGroupServiceInterface * Check if the group can be deleted * * @param int $groupId + * @throws \Magento\Exception\NoSuchEntityException If $groupId is not found * @return bool True, if this group can be deleted */ public function canDelete($groupId); @@ -86,6 +87,8 @@ interface CustomerGroupServiceInterface * Save group * * @param \Magento\Customer\Service\V1\Data\CustomerGroup $group + * @throws \Magento\Exception\InputException If there is a problem with the input + * @throws \Magento\Exception\NoSuchEntityException If a group ID is sent but the group does not exist * @throws \Exception If something goes wrong during save * @return int customer group ID */ @@ -96,6 +99,7 @@ interface CustomerGroupServiceInterface * * @param int $groupId * @throws \Magento\Exception\NoSuchEntityException If $groupId is not found + * @throws \Magento\Exception\StateException Thrown if cannot delete group * @throws \Exception If something goes wrong during delete * @return bool True if the group was deleted */ diff --git a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php index 7638cd487e284d2aead1477cf7d06056ce067992..34b876c7be639bff80d9f9277e4e651f8c49761a 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerMetadataService.php @@ -44,7 +44,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface private $_attrFormCollectionFactory; /** - * @var \Magento\Core\Model\StoreManager + * @var \Magento\Store\Model\StoreManager */ private $_storeManager; @@ -66,7 +66,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface /** * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory $attrFormCollectionFactory - * @param \Magento\Core\Model\StoreManager $storeManager + * @param \Magento\Store\Model\StoreManager $storeManager * @param Data\Eav\OptionBuilder $optionBuilder * @param Data\Eav\ValidationRuleBuilder $validationRuleBuilder * @param Data\Eav\AttributeMetadataBuilder $attributeMetadataBuilder @@ -74,7 +74,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface public function __construct( \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory $attrFormCollectionFactory, - \Magento\Core\Model\StoreManager $storeManager, + \Magento\Store\Model\StoreManager $storeManager, Data\Eav\OptionBuilder $optionBuilder, Data\Eav\ValidationRuleBuilder $validationRuleBuilder, Data\Eav\AttributeMetadataBuilder $attributeMetadataBuilder @@ -98,7 +98,8 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface $attributeMetadata = $this->_createMetadataAttribute($attribute); return $attributeMetadata; } else { - throw (new NoSuchEntityException('entityType', $entityType))->addField('attributeCode', $attributeCode); + throw (new NoSuchEntityException('entityType', $entityType)) + ->addField('attributeCode', $attributeCode); } } @@ -110,10 +111,15 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface if (null === $storeId) { $storeId = $this->_storeManager->getStore()->getId(); } - $object = new \Magento\Object(array('store_id' => $storeId, 'attribute_set_id' => $attributeSetId)); + $object = new \Magento\Object( + [ + 'store_id' => $storeId, + 'attribute_set_id' => $attributeSetId, + ] + ); $attributeCodes = $this->_eavConfig->getEntityAttributeCodes($entityType, $object); - $attributesMetadata = array(); + $attributesMetadata = []; foreach ($attributeCodes as $attributeCode) { try { $attributesMetadata[] = $this->getAttributeMetadata($entityType, $attributeCode); @@ -129,7 +135,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface */ public function getAttributes($entityType, $formCode) { - $attributes = array(); + $attributes = []; $attributesFormCollection = $this->_loadAttributesCollection($entityType, $formCode); foreach ($attributesFormCollection as $attribute) { $attributes[$attribute->getAttributeCode()] = $this->_createMetadataAttribute($attribute); @@ -179,13 +185,10 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface private function _loadAttributesCollection($entityType, $formCode) { $attributesFormCollection = $this->_attrFormCollectionFactory->create(); - $attributesFormCollection->setStore( - $this->_storeManager->getStore() - )->setEntityType( - $entityType - )->addFormCodeFilter( - $formCode - )->setSortOrder(); + $attributesFormCollection->setStore($this->_storeManager->getStore()) + ->setEntityType($entityType) + ->addFormCodeFilter($formCode) + ->setSortOrder(); return $attributesFormCollection; } @@ -196,54 +199,37 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface */ private function _createMetadataAttribute($attribute) { - $options = array(); + $options = []; if ($attribute->usesSource()) { foreach ($attribute->getSource()->getAllOptions() as $option) { - $options[$option['label']] = $this->_optionBuilder->setLabel( - $option['label'] - )->setValue( - $option['value'] - )->create(); + $options[] = $this->_optionBuilder->setLabel($option['label']) + ->setValue($option['value']) + ->create(); } } - $validationRules = array(); + $validationRules = []; foreach ($attribute->getValidateRules() as $name => $value) { - $validationRules[$name] = $this->_validationRuleBuilder->setName($name)->setValue($value)->create(); + $validationRules[$name] = $this->_validationRuleBuilder->setName($name) + ->setValue($value) + ->create(); } - $this->_attributeMetadataBuilder->setAttributeCode( - $attribute->getAttributeCode() - )->setFrontendInput( - $attribute->getFrontendInput() - )->setInputFilter( - $attribute->getInputFilter() - )->setStoreLabel( - $attribute->getStoreLabel() - )->setValidationRules( - $validationRules - )->setVisible( - $attribute->getIsVisible() - )->setRequired( - $attribute->getIsRequired() - )->setMultilineCount( - $attribute->getMultilineCount() - )->setDataModel( - $attribute->getDataModel() - )->setOptions( - $options - )->setFrontendClass( - $attribute->getFrontend()->getClass() - )->setFrontendLabel( - $attribute->getFrontendLabel() - )->setNote( - $attribute->getNote() - )->setIsSystem( - $attribute->getIsSystem() - )->setIsUserDefined( - $attribute->getIsUserDefined() - )->setSortOrder( - $attribute->getSortOrder() - ); + $this->_attributeMetadataBuilder->setAttributeCode($attribute->getAttributeCode()) + ->setFrontendInput($attribute->getFrontendInput()) + ->setInputFilter($attribute->getInputFilter()) + ->setStoreLabel($attribute->getStoreLabel()) + ->setValidationRules($validationRules) + ->setVisible($attribute->getIsVisible()) + ->setRequired($attribute->getIsRequired()) + ->setMultilineCount($attribute->getMultilineCount()) + ->setDataModel($attribute->getDataModel()) + ->setOptions($options) + ->setFrontendClass($attribute->getFrontend()->getClass()) + ->setFrontendLabel($attribute->getFrontendLabel()) + ->setNote($attribute->getNote()) + ->setIsSystem($attribute->getIsSystem()) + ->setIsUserDefined($attribute->getIsUserDefined()) + ->setSortOrder($attribute->getSortOrder()); return $this->_attributeMetadataBuilder->create(); } @@ -253,10 +239,11 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface */ public function getCustomCustomerAttributeMetadata() { - $customAttributes = array(); + $customAttributes = []; foreach ($this->getAllCustomerAttributeMetadata() as $attributeMetadata) { - if (!$attributeMetadata->isSystem() || - $attributeMetadata->getAttributeCode() == 'disable_auto_group_change' + if (!$attributeMetadata->isSystem() + /** Even though disable_auto_group_change is system attribute, it should be available to the clients */ + || $attributeMetadata->getAttributeCode() == 'disable_auto_group_change' ) { $customAttributes[] = $attributeMetadata; } @@ -269,7 +256,7 @@ class CustomerMetadataService implements CustomerMetadataServiceInterface */ public function getCustomAddressAttributeMetadata() { - $customAttributes = array(); + $customAttributes = []; foreach ($this->getAllAddressAttributeMetadata() as $attributeMetadata) { if (!$attributeMetadata->isSystem()) { $customAttributes[] = $attributeMetadata; diff --git a/app/code/Magento/Customer/Service/V1/Data/Customer.php b/app/code/Magento/Customer/Service/V1/Data/Customer.php index 2a571b458365693b10afc5e8eacda7654410ba9f..d0dea07e983fbefe963946b94583bea9b8f6593d 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Customer.php +++ b/app/code/Magento/Customer/Service/V1/Data/Customer.php @@ -70,7 +70,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /**#@-*/ /** - * @return string + * @return string|null */ public function getDefaultBilling() { @@ -80,7 +80,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get default shipping address id * - * @return string + * @return string|null */ public function getDefaultShipping() { @@ -90,7 +90,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get confirmation * - * @return string + * @return string|null */ public function getConfirmation() { @@ -100,7 +100,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get created at time * - * @return string + * @return string|null */ public function getCreatedAt() { @@ -110,7 +110,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get created in area * - * @return string + * @return string|null */ public function getCreatedIn() { @@ -120,7 +120,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get date of birth * - * @return string + * @return string|null */ public function getDob() { @@ -150,7 +150,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get gender * - * @return string + * @return string|null */ public function getGender() { @@ -160,7 +160,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get group id * - * @return string + * @return string|null */ public function getGroupId() { @@ -170,7 +170,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get customer id * - * @return int + * @return int|null */ public function getId() { @@ -190,7 +190,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get middle name * - * @return string + * @return string|null */ public function getMiddlename() { @@ -200,7 +200,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get prefix * - * @return string + * @return string|null */ public function getPrefix() { @@ -210,7 +210,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get store id * - * @return int + * @return int|null */ public function getStoreId() { @@ -220,7 +220,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get suffix * - * @return string + * @return string|null */ public function getSuffix() { @@ -230,7 +230,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get tax Vat. * - * @return string + * @return string|null */ public function getTaxvat() { @@ -240,7 +240,7 @@ class Customer extends \Magento\Service\Data\EAV\AbstractObject /** * Get website id * - * @return int + * @return int|null */ public function getWebsiteId() { diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php new file mode 100644 index 0000000000000000000000000000000000000000..36585badf9d99e2e11d39a08a30a00dc250ff04e --- /dev/null +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResults.php @@ -0,0 +1,56 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Customer\Service\V1\Data; + +/** + * CustomerAccountService Data Object used for validateCustomerData api + */ +class CustomerValidationResults extends \Magento\Service\Data\AbstractObject +{ + /**#@+ + * Constants used as keys into $_data + */ + const VALID = 'valid'; + const MESSAGES = 'messages'; + + /** + * Whether the data used is valid customer data. + * + * @return bool + */ + public function isValid() + { + return $this->_get(self::VALID); + } + + /** + * Error messages as array in case of validation errors else empty array + * + * @return string[] + */ + public function getMessages() + { + return $this->_get(self::MESSAGES); + } +} diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php new file mode 100644 index 0000000000000000000000000000000000000000..d82aae7d4d71b080043eb9c5207b4a3326e62d75 --- /dev/null +++ b/app/code/Magento/Customer/Service/V1/Data/CustomerValidationResultsBuilder.php @@ -0,0 +1,52 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Customer\Service\V1\Data; + +/** + * Builder for CustomerValidationResults + */ +class CustomerValidationResultsBuilder extends \Magento\Service\Data\AbstractObjectBuilder +{ + /** + * Set if customer data is valid + * + * @param bool $isValid + * @return $this + */ + public function setIsValid($isValid) + { + return $this->_set(CustomerValidationResults::VALID, $isValid); + } + + /** + * Set error messages + * + * @param string[] $messages + * @return $this + */ + public function setMessages($messages) + { + return $this->_set(CustomerValidationResults::MESSAGES, $messages); + } +} diff --git a/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroup.php b/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroup.php index 059745f79c39958e7932ec73ea43158c55d4bde0..589e74824061a7e573d245748443969292b70ed6 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroup.php +++ b/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroup.php @@ -28,47 +28,42 @@ use Magento\Service\Data\AbstractObject; /** * Groups two or more filters together using a logical group type */ -abstract class AbstractFilterGroup extends AbstractObject implements FilterGroupInterface +abstract class AbstractFilterGroup extends AbstractObject { const FILTERS = 'filters'; - - const GROUPS = 'groups'; - - /** - * {@inheritdoc} - */ - public function __construct(AbstractFilterGroupBuilder $builder) - { - parent::__construct($builder); - $this->_data['group_type'] = $this->getGroupType(); - } + const AND_GROUPS = 'andGroups'; + const OR_GROUPS = 'orGroups'; /** * Returns a list of filters in this group * - * @return \Magento\Customer\Service\V1\Data\Filter[] + * @return \Magento\Service\V1\Data\Filter[]|null */ public function getFilters() { $filters = $this->_get(self::FILTERS); - return is_null($filters) ? array() : $filters; + return is_null($filters) ? [] : $filters; } /** * Returns a list of filter groups in this group * - * @return \Magento\Customer\Service\V1\Data\Search\FilterGroupInterface[] + * @return \Magento\Customer\Service\V1\Data\Search\AndGroup[]|null */ - public function getGroups() + public function getAndGroups() { - $groups = $this->_get(self::GROUPS); - return is_null($groups) ? array() : $groups; + $groups = $this->_get(self::AND_GROUPS); + return is_null($groups) ? [] : $groups; } /** - * Returns the grouping type such as 'OR' or 'AND'. + * Returns a list of filter groups in this group * - * @return string + * @return \Magento\Customer\Service\V1\Data\Search\OrGroup[]|null */ - abstract public function getGroupType(); + public function getOrGroups() + { + $groups = $this->_get(self::OR_GROUPS); + return is_null($groups) ? [] : $groups; + } } diff --git a/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroupBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroupBuilder.php index 7ea70dded24e2738b529dd53fab42ef55bade82a..469d1c76656f4bba8af03e5f05f9fdbfad567123 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroupBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/Search/AbstractFilterGroupBuilder.php @@ -24,32 +24,45 @@ namespace Magento\Customer\Service\V1\Data\Search; use Magento\Service\Data\AbstractObjectBuilder; +use Magento\Service\V1\Data\Filter; +use Magento\Service\V1\Data\FilterBuilder; /** * Abstract Builder for AbstractFilterGroup DATA. */ abstract class AbstractFilterGroupBuilder extends AbstractObjectBuilder { + /** + * @var FilterBuilder + */ + protected $_filterBuilder; + + /** + * Constructor + * + * @param FilterBuilder $filterBuilder + */ + public function __construct(FilterBuilder $filterBuilder) + { + parent::__construct(); + $this->_filterBuilder = $filterBuilder; + } + /** * Add filter * - * @param \Magento\Customer\Service\V1\Data\Filter $filter + * @param Filter $filter * @return $this */ - public function addFilter(\Magento\Customer\Service\V1\Data\Filter $filter) + public function addFilter(\Magento\Service\V1\Data\Filter $filter) { - if (!isset($this->_data[AbstractFilterGroup::FILTERS]) || !is_array($this->_data[AbstractFilterGroup::FILTERS]) - ) { - $this->_data[AbstractFilterGroup::FILTERS] = array(); - } - $this->_data[AbstractFilterGroup::FILTERS][] = $filter; - return $this; + return $this->setFilterGroupData(AbstractFilterGroup::FILTERS, $filter); } /** * Set filters * - * @param \Magento\Customer\Service\V1\Data\Filter[] $filters + * @param Filter[] $filters * @return $this */ public function setFilters($filters) @@ -58,29 +71,95 @@ abstract class AbstractFilterGroupBuilder extends AbstractObjectBuilder } /** - * Add filter group + * Add And filter group * - * @param \Magento\Customer\Service\V1\Data\Search\FilterGroupInterface $group + * @param AndGroup $group * @return $this */ - public function addGroup(\Magento\Customer\Service\V1\Data\Search\FilterGroupInterface $group) + public function addAndGroup(\Magento\Customer\Service\V1\Data\Search\AndGroup $group) { - if (!isset($this->_data[AbstractFilterGroup::GROUPS]) || !is_array($this->_data[AbstractFilterGroup::GROUPS]) - ) { - $this->_data[AbstractFilterGroup::GROUPS] = array(); - } - $this->_data[AbstractFilterGroup::GROUPS][] = $group; - return $this; + return $this->setFilterGroupData(AbstractFilterGroup::AND_GROUPS, $group); + + } + + /** + * Add Or filter group + * + * @param OrGroup $group + * @return $this + */ + public function addOrGroup(\Magento\Customer\Service\V1\Data\Search\OrGroup $group) + { + return $this->setFilterGroupData(AbstractFilterGroup::OR_GROUPS, $group); } /** * Set filter groups * - * @param \Magento\Customer\Service\V1\Data\Search\FilterGroupInterface[] $groups + * @param AndGroup[] $groups * @return $this */ - public function setGroups($groups) + public function setAndGroups($groups) { - return $this->_set(AbstractFilterGroup::GROUPS, $groups); + return $this->_set(AbstractFilterGroup::AND_GROUPS, $groups); + } + + /** + * Set filter groups + * + * @param OrGroup[] $groups + * @return $this + */ + public function setOrGroups($groups) + { + return $this->_set(AbstractFilterGroup::OR_GROUPS, $groups); + } + + /** + * Set filter or group data + * + * @param string $key + * @param Filter|AbstractFilterGroup $data + * @return $this + */ + private function setFilterGroupData($key, $data) + { + if (!isset($this->_data[$key]) + || !is_array($this->_data[$key]) + ) { + $this->_data[$key] = []; + } + $this->_data[$key][] = $data; + return $this; + } + + /** + * {@inheritdoc} + */ + protected function _setDataValues(array $data) + { + $newData = []; + if (isset($data[AbstractFilterGroup::FILTERS])) { + $filters = []; + foreach ($data[AbstractFilterGroup::FILTERS] as $filter) { + $filters[] = $this->_filterBuilder->populateWithArray($filter)->create(); + } + $newData[AbstractFilterGroup::FILTERS] = $filters; + } + if (isset($data[AbstractFilterGroup::AND_GROUPS])) { + $andGroups = []; + foreach ($data[AbstractFilterGroup::AND_GROUPS] as $andGroup) { + $andGroups[] = (new AndGroupBuilder(new FilterBuilder()))->populateWithArray($andGroup)->create(); + } + $newData[AbstractFilterGroup::AND_GROUPS] = $andGroups; + } + if (isset($data[AbstractFilterGroup::OR_GROUPS])) { + $orGroups = []; + foreach ($data[AbstractFilterGroup::OR_GROUPS] as $orGroup) { + $orGroups[] = (new OrGroupBuilder(new FilterBuilder()))->populateWithArray($orGroup)->create(); + } + $newData[AbstractFilterGroup::OR_GROUPS] = $orGroups; + } + return parent::_setDataValues($newData); } } diff --git a/app/code/Magento/Customer/Service/V1/Data/Search/AndGroup.php b/app/code/Magento/Customer/Service/V1/Data/Search/AndGroup.php index 7e4a9ca6605b04b86c8f8bc20955a28496caf1ff..b2bd930fb3c67016c29a9ab7d61a54ba513f4653 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Search/AndGroup.php +++ b/app/code/Magento/Customer/Service/V1/Data/Search/AndGroup.php @@ -28,11 +28,4 @@ namespace Magento\Customer\Service\V1\Data\Search; */ class AndGroup extends AbstractFilterGroup { - /** - * {@inheritdoc} - */ - public function getGroupType() - { - return 'AND'; - } } diff --git a/app/code/Magento/Customer/Service/V1/Data/Search/OrGroup.php b/app/code/Magento/Customer/Service/V1/Data/Search/OrGroup.php index 49b91cfa906eca9572cb300130b9c9acd44c781a..973d032221500d6c9811565516f36bd6e69bee22 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Search/OrGroup.php +++ b/app/code/Magento/Customer/Service/V1/Data/Search/OrGroup.php @@ -28,11 +28,4 @@ namespace Magento\Customer\Service\V1\Data\Search; */ class OrGroup extends AbstractFilterGroup { - /** - * {@inheritdoc} - */ - public function getGroupType() - { - return 'OR'; - } } diff --git a/app/code/Magento/Customer/Service/V1/Data/SearchCriteria.php b/app/code/Magento/Customer/Service/V1/Data/SearchCriteria.php index 36f63c9aab984a295c97c6788ef6a3b3a05db35e..fc0ed4ebb03218ca7f1a6e00f2e717e32e4b2a3b 100644 --- a/app/code/Magento/Customer/Service/V1/Data/SearchCriteria.php +++ b/app/code/Magento/Customer/Service/V1/Data/SearchCriteria.php @@ -33,21 +33,22 @@ class SearchCriteria extends AbstractObject const SORT_ASC = 1; const SORT_DESC = -1; + const ROOT_GROUP_TYPE = 'andGroup'; /** * Get filters * - * @return \Magento\Customer\Service\V1\Data\Search\FilterGroupInterface + * @return \Magento\Customer\Service\V1\Data\Search\AndGroup */ - public function getFilters() + public function getAndGroup() { - return $this->_get('filters'); + return $this->_get(self::ROOT_GROUP_TYPE); } /** * Get sort order * - * @return string[] + * @return string[]|null */ public function getSortOrders() { @@ -57,7 +58,7 @@ class SearchCriteria extends AbstractObject /** * Get page size * - * @return int + * @return int|null */ public function getPageSize() { @@ -67,7 +68,7 @@ class SearchCriteria extends AbstractObject /** * Get current page * - * @return int + * @return int|null */ public function getCurrentPage() { diff --git a/app/code/Magento/Customer/Service/V1/Data/SearchCriteriaBuilder.php b/app/code/Magento/Customer/Service/V1/Data/SearchCriteriaBuilder.php index d9f03bf0a766fccdecc6c312663467c507b20d69..911e188e06ee74e680b1ac6a51823e64c7394922 100644 --- a/app/code/Magento/Customer/Service/V1/Data/SearchCriteriaBuilder.php +++ b/app/code/Magento/Customer/Service/V1/Data/SearchCriteriaBuilder.php @@ -25,6 +25,7 @@ namespace Magento\Customer\Service\V1\Data; use Magento\Customer\Service\V1\Data\Search\OrGroupBuilder; use Magento\Service\Data\AbstractObjectBuilder; +use Magento\Service\V1\Data\FilterBuilder; /** * Builder for SearchCriteria Service Data Object @@ -32,55 +33,70 @@ use Magento\Service\Data\AbstractObjectBuilder; class SearchCriteriaBuilder extends AbstractObjectBuilder { /** - * Builds the Data Object + * @var Search\AndGroupBuilder + */ + protected $_andGroupBuilder; + + /** + * Constructor + * + * @param Search\AndGroupBuilder $andGroupBuilder + */ + public function __construct(Search\AndGroupBuilder $andGroupBuilder) + { + parent::__construct(); + $this->_andGroupBuilder = $andGroupBuilder; + } + + /** + * Builds the SearchCriteria Data Object * * @return SearchCriteria */ public function create() { - $this->_data['filters'] = $this->getFilterGroup()->create(); + $this->_set(SearchCriteria::ROOT_GROUP_TYPE, $this->_andGroupBuilder->create()); return parent::create(); } /** * Add filter * - * @param \Magento\Customer\Service\V1\Data\Filter $filter + * @param \Magento\Service\V1\Data\Filter $filter * @return $this */ - public function addFilter(\Magento\Customer\Service\V1\Data\Filter $filter) + public function addFilter(\Magento\Service\V1\Data\Filter $filter) { - $this->getFilterGroup()->addFilter($filter); + $this->_andGroupBuilder->addFilter($filter); return $this; } /** - * Add an OR grouping of filters to this SearchCriteria. + * Set filters * - * @param \Magento\Customer\Service\V1\Data\Filter[] $filters + * @param \Magento\Customer\Service\V1\Data\Search\AndGroup $filterGroup * @return $this */ - public function addOrGroup($filters) + public function setAndGroup($filterGroup) { - $orGroup = new OrGroupBuilder(); - foreach ($filters as $filter) { - $orGroup->addFilter($filter); - } - $this->getFilterGroup()->addGroup($orGroup->create()); + $this->_andGroupBuilder->populate($filterGroup); return $this; } /** - * Get filter group + * Add an OR grouping of filters to this SearchCriteria. * - * @return \Magento\Customer\Service\V1\Data\Search\AndGroupBuilder + * @param \Magento\Service\V1\Data\Filter[] $filters + * @return $this */ - private function getFilterGroup() + public function addOrGroup($filters) { - if (!isset($this->_data['filters'])) { - $this->_data['filters'] = new Search\AndGroupBuilder(); + $orGroup = new OrGroupBuilder(new FilterBuilder()); + foreach ($filters as $filter) { + $orGroup->addFilter($filter); } - return $this->_data['filters']; + $this->_andGroupBuilder->addOrGroup($orGroup->create()); + return $this; } /** diff --git a/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.1-1.6.2.0.2.php b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.1-1.6.2.0.2.php index 8efa911803eaf1178eb9f424eb381212c53b8e21..242f63e5171c73b8195202498f20bdb71dbebdbd 100644 --- a/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.1-1.6.2.0.2.php +++ b/app/code/Magento/Customer/data/customer_setup/data-upgrade-1.6.2.0.1-1.6.2.0.2.php @@ -24,15 +24,16 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $this \Magento\Core\Model\Resource\Setup */ -$installer = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); +/** @var $this \Magento\Customer\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'customer_eav_attribute', 'data_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->doUpdateClassAliases(); diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 06620c2e64fcf23b0d76a77792cb8aadaa3e6502..307bcd50647887277d5c5cbb3f4fa30f3c3f78f2 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -66,17 +66,16 @@ <argument name="customerData" xsi:type="object">Magento\Customer\Helper\Data\Proxy</argument> </arguments> </type> - <type name="Magento\Customer\Service\V1\Dto\AddressBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\CustomerBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\CustomerGroupBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\Eav\AttributeBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\Eav\AttributeMetadataBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\Eav\OptionBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\FilterBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\RegionBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\Response\CreateCustomerAccountResponseBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\SearchCriteriaBuilder" shared="false" /> - <type name="Magento\Customer\Service\V1\Dto\SearchResultsBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\AddressBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\CustomerBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\CustomerGroupBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\Eav\AttributeBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\Eav\AttributeMetadataBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\Eav\OptionBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\RegionBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\Response\CreateCustomerAccountResponseBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\SearchCriteriaBuilder" shared="false" /> + <type name="Magento\Customer\Service\V1\Data\SearchResultsBuilder" shared="false" /> <type name="Magento\Eav\Model\Entity\Setup\PropertyMapper\Composite"> <arguments> <argument name="propertyMappers" xsi:type="array"> diff --git a/app/code/Magento/Customer/etc/frontend/di.xml b/app/code/Magento/Customer/etc/frontend/di.xml index 4e75ff8a4d9bc8f821342068020d83b88a222235..927076faa85bb22bac553ff81b6c7d91886a1ac0 100644 --- a/app/code/Magento/Customer/etc/frontend/di.xml +++ b/app/code/Magento/Customer/etc/frontend/di.xml @@ -36,7 +36,7 @@ </argument> </arguments> </type> - <type name="Magento\Core\Model\Layout"> + <type name="Magento\View\Layout"> <plugin name="customer-session-depersonalize" type="Magento\Customer\Model\Layout\DepersonalizePlugin" sortOrder="10"/> </type> diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index 3d17a0f79a57f2b730c677ed6d21188dd941793e..4dee58271f87871c11b4ad8c22a001d5207f923b 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Directory"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Eav"/> <module name="Magento_Directory"/> <module name="Magento_Core"/> @@ -44,7 +45,6 @@ <module name="Magento_Backend"/> <module name="Magento_Review"/> <module name="Magento_Tax"/> - <module name="Magento_Service"/> <module name="Magento_PageCache"/> </depends> </module> diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml index 8671b6b6732993a588ee8019aab218e704a98096..bc7c685bfde23b8bc4e8e8939b18118657609d50 100644 --- a/app/code/Magento/Customer/etc/webapi.xml +++ b/app/code/Magento/Customer/etc/webapi.xml @@ -54,7 +54,6 @@ <rest-route httpMethod="PUT" method="activateCustomer" resources="Magento_Customer::manage">/:customerId/activateCustomer</rest-route> <rest-route httpMethod="PUT" method="searchCustomers" resources="Magento_Customer::customer">/search</rest-route> <rest-route httpMethod="PUT" method="authenticate" resources="Magento_Customer::customer">/authenticate</rest-route> - <rest-route httpMethod="PUT" method="changePassword" resources="Magento_Customer::manage">/:customerId/changePassword</rest-route> <rest-route httpMethod="GET" method="validateResetPasswordLinkToken" resources="Magento_Customer::customer">/:customerId/validateResetPasswordLinkToken/:resetPasswordLinkToken</rest-route> <rest-route httpMethod="PUT" method="initiatePasswordReset" resources="Magento_Customer::customer">/initiatePasswordReset</rest-route> <rest-route httpMethod="PUT" method="resetPassword" resources="Magento_Customer::customer">/:customerId/resetPassword</rest-route> diff --git a/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php b/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php index 397cd3e8d14bd6d1129e2f3d7f6ffcead8793641..fe7d50c8d10e891605439f425875dd5e580477c1 100644 --- a/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php +++ b/app/code/Magento/Customer/sql/customer_setup/install-1.6.0.0.php @@ -112,16 +112,16 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('customer_entity', array('website_id')), array('website_id') )->addForeignKey( - $installer->getFkName('customer_entity', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('customer_entity', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('customer_entity', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('customer_entity', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1179,9 +1179,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('customer_eav_attribute_website', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('customer_eav_attribute_website', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php b/app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php index 664bf9f7e769214f07b04ae7030d2ff8b63dd2ff..74876ab304e4c60b456053d6d2202c8cfad15777 100644 --- a/app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php +++ b/app/code/Magento/Customer/sql/customer_setup/mysql4-upgrade-1.6.0.0-1.6.1.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Customer\Model\Entity\Setup */ +/* @var $installer \Magento\Customer\Model\Resource\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php index 664bf9f7e769214f07b04ae7030d2ff8b63dd2ff..74876ab304e4c60b456053d6d2202c8cfad15777 100644 --- a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php +++ b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.0.0-1.6.1.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Customer\Model\Entity\Setup */ +/* @var $installer \Magento\Customer\Model\Resource\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0-1.6.2.0.1.php b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0-1.6.2.0.1.php index a565197ef180c7121699be7ab86f86d53cd62c51..876533137b994465e0715761f89fd3dc111eaa8f 100644 --- a/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0-1.6.2.0.1.php +++ b/app/code/Magento/Customer/sql/customer_setup/upgrade-1.6.2.0-1.6.2.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Customer\Model\Entity\Setup */ +/** @var $installer \Magento\Customer\Model\Resource\Setup */ $installer = $this; $installer->getConnection()->addColumn( diff --git a/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml index fdfc9fae73b3a1e50022b34f877541abe7742709..79406ecbb5d8f23dab799c617f67bd1d23d77eb1 100644 --- a/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml +++ b/app/code/Magento/Customer/view/adminhtml/layout/customer_group_index.xml @@ -63,7 +63,7 @@ <arguments> <argument name="header" xsi:type="string" translate="true">Tax Class</argument> <argument name="width" xsi:type="string">200px</argument> - <argument name="index" xsi:type="string">code</argument> + <argument name="index" xsi:type="string">tax_class_id</argument> </arguments> </block> </block> diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Renderer/LogoUploader.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Renderer/LogoUploader.php index 8952a40e39fd0a1bc91e46f911465ac3cbbf37a3..4a5829c3a5523a97c7057fcb72633907b7f2c301 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Renderer/LogoUploader.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Renderer/LogoUploader.php @@ -78,7 +78,7 @@ class LogoUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Ren /** * Get logo upload url * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return string */ public function getLogoUploadUrl($store) @@ -92,7 +92,7 @@ class LogoUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Ren /** * Get logo upload url * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return string */ public function getLogoRemoveUrl($store) @@ -106,14 +106,14 @@ class LogoUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Ren /** * Get logo image * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return string|null */ public function getLogoImage($store) { $image = null; if (null !== $store) { - $image = basename($this->_storeConfig->getConfig('design/header/logo_src', $store->getId())); + $image = basename($this->_scopeConfig->getValue('design/header/logo_src', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId())); } return $image; } @@ -121,7 +121,7 @@ class LogoUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Ren /** * Get stores list * - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getStoresList() { diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php index 6f9c724acb34fb9cd6002df1241ced0da383e2e4..4f207070441ea3e5be7276b3f21241a4fd31929a 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme.php @@ -107,7 +107,7 @@ class Theme extends \Magento\Backend\Block\Template public function getStoresTitles() { $storesTitles = array(); - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($this->getTheme()->getAssignedStores() as $store) { $storesTitles[] = $store->getName(); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php index 84662d8eb6cc7aa6fa351dc9723eec8a1be69980..e536e1a8c20e8a6a17964b108ee1ccc0f17367cc 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/StoreView.php @@ -37,7 +37,7 @@ class StoreView extends \Magento\Backend\Block\Template /** * Website collection * - * @var \Magento\Core\Model\Resource\Website\Collection + * @var \Magento\Store\Model\Resource\Website\Collection */ protected $_websiteCollection; @@ -53,14 +53,14 @@ class StoreView extends \Magento\Backend\Block\Template /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Resource\Website\Collection $websiteCollection + * @param \Magento\Store\Model\Resource\Website\Collection $websiteCollection * @param \Magento\Theme\Model\Config\Customization $customizationConfig * @param \Magento\Core\Helper\Data $coreHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Resource\Website\Collection $websiteCollection, + \Magento\Store\Model\Resource\Website\Collection $websiteCollection, \Magento\Theme\Model\Config\Customization $customizationConfig, \Magento\Core\Helper\Data $coreHelper, array $data = array() @@ -75,7 +75,7 @@ class StoreView extends \Magento\Backend\Block\Template /** * Get website collection with stores and store-views joined * - * @return \Magento\Core\Model\Resource\Website\Collection + * @return \Magento\Store\Model\Resource\Website\Collection */ public function getCollection() { @@ -85,7 +85,7 @@ class StoreView extends \Magento\Backend\Block\Template /** * Get website, stores and store-views * - * @return \Magento\Core\Model\Resource\Website\Collection + * @return \Magento\Store\Model\Resource\Website\Collection */ public function getWebsiteStructure() { @@ -93,7 +93,7 @@ class StoreView extends \Magento\Backend\Block\Template $website = null; $store = null; $storeView = null; - /** @var $row \Magento\Core\Model\Website */ + /** @var $row \Magento\Store\Model\Website */ foreach ($this->getCollection() as $row) { $website = $row->getName(); $store = $row->getGroupTitle(); @@ -165,7 +165,7 @@ class StoreView extends \Magento\Backend\Block\Template } $storesByThemes[$themeId] = array(); - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { $storesByThemes[$themeId][] = (int)$store->getId(); } @@ -184,7 +184,7 @@ class StoreView extends \Magento\Backend\Block\Template $isMultipleMode = false; $tmpStore = null; foreach ($this->_customizationConfig->getStoresByThemes() as $stores) { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { if ($tmpStore === null) { $tmpStore = $store->getId(); diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php index 10db01f3f2a73b2512a3f3c0c04dcb98baa5cdfe..3915a01ff2efdd248d642e19de280d9b9d97daee 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -25,7 +25,7 @@ */ namespace Magento\DesignEditor\Controller\Adminhtml\System\Design; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Model\Exception as CoreException; use Magento\View\Design\ThemeInterface; @@ -581,8 +581,8 @@ class Editor extends \Magento\Backend\App\Action $defaultStore = -1; $emptyStores = -2; if ($stores == $defaultStore) { - /** @var \Magento\Core\Model\StoreManagerInterface $storeManager */ - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ + $storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface'); $ids = array_keys($storeManager->getStores()); $stores = array(array_shift($ids)); } elseif ($stores == $emptyStores) { diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php index de1b8b348bda31455f41e91d268ae694725b127c..b7075a4b89cdf536cfd423dd760c6851cd0f3c33 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php @@ -354,7 +354,7 @@ class Tools extends \Magento\Backend\App\Action /** @var $customizationConfig \Magento\Theme\Model\Config\Customization */ $customizationConfig = $this->_objectManager->get('Magento\Theme\Model\Config\Customization'); - $store = $this->_objectManager->get('Magento\Core\Model\Store')->load($storeId); + $store = $this->_objectManager->get('Magento\Store\Model\Store')->load($storeId); if (!$customizationConfig->isThemeAssignedToStore($theme, $store)) { throw new CoreException(__('This theme is not assigned to a store view #%1.', $theme->getId())); @@ -401,7 +401,7 @@ class Tools extends \Magento\Backend\App\Action /** @var $customizationConfig \Magento\Theme\Model\Config\Customization */ $customizationConfig = $this->_objectManager->get('Magento\Theme\Model\Config\Customization'); - $store = $this->_objectManager->get('Magento\Core\Model\Store')->load($storeId); + $store = $this->_objectManager->get('Magento\Store\Model\Store')->load($storeId); if (!$customizationConfig->isThemeAssignedToStore($theme, $store)) { throw new CoreException(__('This theme is not assigned to a store view #%1.', $theme->getId())); @@ -472,12 +472,12 @@ class Tools extends \Magento\Backend\App\Action /** * Re-init system configuration * - * @return \Magento\App\ReinitableConfigInterface + * @return \Magento\App\Config\ReinitableConfigInterface */ protected function _reinitSystemConfiguration() { - /** @var $configModel \Magento\App\ReinitableConfigInterface */ - $configModel = $this->_objectManager->get('Magento\App\ReinitableConfigInterface'); + /** @var $configModel \Magento\App\Config\ReinitableConfigInterface */ + $configModel = $this->_objectManager->get('Magento\App\Config\ReinitableConfigInterface'); return $configModel->reinit(); } } diff --git a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php index 81c76f0de99a609edc74ac13887aa0b7e2181124..ae828b9a78735f03a14af8125c6456273d4b22c5 100644 --- a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php +++ b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php @@ -75,8 +75,8 @@ class Standard extends \Magento\Core\App\Router\Base * @param \Magento\App\Route\Config $routeConfig * @param \Magento\App\State $appState * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Url\SecurityInfoInterface $urlSecurityInfo * @param string $routerId * @param \Magento\Code\NameBuilder $nameBuilder @@ -96,8 +96,8 @@ class Standard extends \Magento\Core\App\Router\Base \Magento\App\Route\Config $routeConfig, \Magento\App\State $appState, \Magento\UrlInterface $url, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Url\SecurityInfoInterface $urlSecurityInfo, $routerId, \Magento\Code\NameBuilder $nameBuilder, @@ -116,7 +116,7 @@ class Standard extends \Magento\Core\App\Router\Base $appState, $url, $storeManager, - $storeConfig, + $scopeConfig, $urlSecurityInfo, $routerId, $nameBuilder diff --git a/app/code/Magento/DesignEditor/Model/AreaEmulator.php b/app/code/Magento/DesignEditor/Model/AreaEmulator.php index 89210d61f3a2f7dab96ed08b85e541a3956c447e..a486b1af64e259403e9b10b39f289e2db4c30b38 100644 --- a/app/code/Magento/DesignEditor/Model/AreaEmulator.php +++ b/app/code/Magento/DesignEditor/Model/AreaEmulator.php @@ -45,7 +45,7 @@ class AreaEmulator public function emulateLayoutArea($areaCode) { $configuration = array( - 'Magento\Core\Model\Layout' => array( + 'Magento\View\Layout' => array( 'arguments' => array( 'area' => $areaCode ) diff --git a/app/code/Magento/DesignEditor/Model/State.php b/app/code/Magento/DesignEditor/Model/State.php index f7c6f503ae7daa18cd81f27c5e3353f0bf0b06ad..02ec468910925893705794f961bec9c191b90744 100644 --- a/app/code/Magento/DesignEditor/Model/State.php +++ b/app/code/Magento/DesignEditor/Model/State.php @@ -82,16 +82,16 @@ class State protected $_objectManager; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_configuration; /** - * Store list manager + * Mutable Config * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\App\Config\MutableScopeConfigInterface */ - protected $_storeManager; + protected $_mutableConfig; /** * @param \Magento\Backend\Model\Session $backendSession @@ -100,9 +100,9 @@ class State * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\DesignEditor\Helper\Data $dataHelper * @param \Magento\ObjectManager $objectManager - * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\App\Config\ScopeConfigInterface $configuration * @param Theme\Context $themeContext - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\MutableScopeConfigInterface $mutableConfig */ public function __construct( \Magento\Backend\Model\Session $backendSession, @@ -111,9 +111,9 @@ class State \Magento\App\Cache\StateInterface $cacheState, \Magento\DesignEditor\Helper\Data $dataHelper, \Magento\ObjectManager $objectManager, - \Magento\App\ConfigInterface $configuration, + \Magento\App\Config\ScopeConfigInterface $configuration, \Magento\DesignEditor\Model\Theme\Context $themeContext, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\App\Config\MutableScopeConfigInterface $mutableConfig ) { $this->_backendSession = $backendSession; $this->_areaEmulator = $areaEmulator; @@ -123,7 +123,7 @@ class State $this->_objectManager = $objectManager; $this->_configuration = $configuration; $this->_themeContext = $themeContext; - $this->_storeManager = $storeManager; + $this->_mutableConfig = $mutableConfig; } /** @@ -202,7 +202,11 @@ class State { if ($this->_themeContext->getEditableTheme()) { $themeId = $this->_themeContext->getVisibleTheme()->getId(); - $this->_storeManager->getStore()->setConfig(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); + $this->_mutableConfig->setValue( + \Magento\View\DesignInterface::XML_PATH_THEME_ID, + $themeId, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->_configuration->setValue(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); } } diff --git a/app/code/Magento/DesignEditor/Model/Translate/Inline.php b/app/code/Magento/DesignEditor/Model/Translate/Inline.php index 0ff98a882a028179a2611f489b39fc9b9d891b2c..77f8a1d476f35b498e4594aec2f2f22b05657512 100644 --- a/app/code/Magento/DesignEditor/Model/Translate/Inline.php +++ b/app/code/Magento/DesignEditor/Model/Translate/Inline.php @@ -88,7 +88,7 @@ class Inline implements \Magento\Translate\InlineInterface protected $_design; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $_scopeResolver; @@ -96,7 +96,7 @@ class Inline implements \Magento\Translate\InlineInterface * Initialize inline translation model specific for vde * * @param \Magento\View\DesignInterface $design - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param \Magento\Translate\Inline\ParserFactory $parserFactory * @param \Magento\DesignEditor\Helper\Data $helper * @param \Magento\UrlInterface $url @@ -104,7 +104,7 @@ class Inline implements \Magento\Translate\InlineInterface */ public function __construct( \Magento\View\DesignInterface $design, - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\Translate\Inline\ParserFactory $parserFactory, \Magento\DesignEditor\Helper\Data $helper, \Magento\UrlInterface $url, diff --git a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php index 424eedd039403c892f76298775f4f9ffee8003ba..b1418f17bfff2384da7a505298675657094fb0f1 100644 --- a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php +++ b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php @@ -61,6 +61,8 @@ class NavigationMode extends \Magento\Url * @param \Magento\Url\RouteParamsResolverFactory $routeParamsResolver * @param \Magento\Url\QueryParamsResolverInterface $queryParamsResolver * @param \Magento\DesignEditor\Helper\Data $helper + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param string $scopeType * @param array $data */ public function __construct( @@ -73,6 +75,8 @@ class NavigationMode extends \Magento\Url \Magento\Url\RouteParamsResolverFactory $routeParamsResolver, \Magento\Url\QueryParamsResolverInterface $queryParamsResolver, \Magento\DesignEditor\Helper\Data $helper, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + $scopeType, array $data = array() ) { $this->_helper = $helper; @@ -92,6 +96,8 @@ class NavigationMode extends \Magento\Url $sidResolver, $routeParamsResolver, $queryParamsResolver, + $scopeConfig, + $scopeType, $data ); } diff --git a/app/code/Magento/DesignEditor/etc/di.xml b/app/code/Magento/DesignEditor/etc/di.xml index 5814b1421a914919f0cd29e55da861de89debdab..7c10ff83adbad68594b8d9692b1f9215f6bd5e81 100644 --- a/app/code/Magento/DesignEditor/etc/di.xml +++ b/app/code/Magento/DesignEditor/etc/di.xml @@ -52,4 +52,9 @@ <argument name="inlineProvider" xsi:type="object">Magento\DesignEditor\Model\Translate\Inline\Provider</argument> </arguments> </type> + <type name="Magento\DesignEditor\Model\Url\NavigationMode"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/DesignEditor/etc/module.xml b/app/code/Magento/DesignEditor/etc/module.xml index bd8504b96d200ca402d5b176ebb9a238f85acc90..7c43f799b7896007dfd8dcca0b02cdd53d16748e 100644 --- a/app/code/Magento/DesignEditor/etc/module.xml +++ b/app/code/Magento/DesignEditor/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Theme"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Theme"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-1.0.0.1.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-1.0.0.1.php index 11a019f8c87495fb290b28aee0f131f6cd91c8db..0fdc82ebbf1cf367f3c2da4645a1b6ed0d9d891f 100644 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/install-1.0.0.1.php +++ b/app/code/Magento/DesignEditor/sql/designeditor_setup/install-1.0.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.1-1.0.0.2.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.1-1.0.0.2.php index a6b65e60fa90a7f7349ff6a6bffc9b5837078cb4..688727229544196e72b354e7c8e862e323c8f874 100644 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.1-1.0.0.2.php +++ b/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.1-1.0.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.2-1.0.0.3.php b/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.2-1.0.0.3.php index c45de15f6f2811be5ddc324234f6d0d2211e1ee0..b1134ac6586e65e030f24d02da82581e2ac7e0d3 100644 --- a/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.2-1.0.0.3.php +++ b/app/code/Magento/DesignEditor/sql/designeditor_setup/upgrade-1.0.0.2-1.0.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/DesignEditor/view/adminhtml/css/styles.css b/app/code/Magento/DesignEditor/view/adminhtml/css/styles.css index eaf0e4401e56d34958d30cea1ae6b2fa95f60521..30a71482530ea34f179af44ffb461b4b6ee9fd3f 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/css/styles.css +++ b/app/code/Magento/DesignEditor/view/adminhtml/css/styles.css @@ -41,7 +41,7 @@ border-bottom: 1px solid #000; } -.vde-dialog .action-close { +/*.vde-dialog .action-close { background: none; border: none; color: #6d665e; @@ -57,7 +57,7 @@ .vde-dialog .action-close:hover { color: #000; border-bottom: 1px solid #000; -} +}*/ .vde-dialog .ui-dialog-buttonset { text-align: right; diff --git a/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml b/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml index 79b6c44bd6841e2cc9eb9a077e3d43bdf84978ca..57f2d6498264371d87d2f20ea95732f2ebcbf3ac 100644 --- a/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml +++ b/app/code/Magento/DesignEditor/view/frontend/translate_inline.phtml @@ -26,7 +26,7 @@ <?php /** @var $this \Magento\View\Element\Template */ ?> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script> -<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/loader.js') ?>"></script> +<script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/loader_old.js') ?>"></script> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/bootstrap.js') ?>"></script> <link rel="stylesheet" type="text/css" href="<?php echo $this->getViewFileUrl('prototype/windows/themes/default.css') ?>"/> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/edit-trigger.js') ?>"></script> diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 24643cd1709e720e7444291f6ad122c35fdd714d..629bbd0929f67c679fd86bc57b3d68bbd8dcea23 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -174,7 +174,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin protected $_coreDate; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -206,7 +206,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin protected $_httpClientFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory @@ -222,7 +222,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * @param \Magento\Shipping\Helper\Carrier $carrierHelper * @param \Magento\Stdlib\DateTime\DateTime $coreDate * @param \Magento\Module\Dir\Reader $configReader - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\String $string * @param \Magento\Math\Division $mathDivision * @param \Magento\App\Filesystem $filesystem @@ -231,7 +231,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, @@ -247,7 +247,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin \Magento\Shipping\Helper\Carrier $carrierHelper, \Magento\Stdlib\DateTime\DateTime $coreDate, \Magento\Module\Dir\Reader $configReader, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\String $string, \Magento\Math\Division $mathDivision, \Magento\App\Filesystem $filesystem, @@ -265,7 +265,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $this->_dateTime = $dateTime; $this->_httpClientFactory = $httpClientFactory; parent::__construct( - $coreStoreConfig, + $scopeConfig, $rateErrorFactory, $logAdapterFactory, $xmlElFactory, @@ -295,7 +295,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin protected function _getDefaultValue($origValue, $pathToValue) { if (!$origValue) { - $origValue = $this->_coreStoreConfig->getConfig($pathToValue, $this->getStore()); + $origValue = $this->_scopeConfig->getValue( + $pathToValue, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore() + ); } return $origValue; @@ -318,7 +322,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $origCompanyName = $this->_getDefaultValue( $requestDhl->getOrigCompanyName(), - \Magento\Core\Model\Store::XML_PATH_STORE_STORE_NAME + \Magento\Store\Model\Store::XML_PATH_STORE_STORE_NAME ); $origCountryId = $this->_getDefaultValue($requestDhl->getOrigCountryId(), Shipment::XML_PATH_STORE_COUNTRY_ID); $origState = $this->_getDefaultValue($requestDhl->getOrigState(), Shipment::XML_PATH_STORE_REGION_ID); @@ -447,7 +451,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin )->setOrigPersonName( $request->getOrigPersonName() )->setOrigEmail( - $this->_coreStoreConfig->getConfig('trans_email/ident_general/email', $requestObject->getStoreId()) + $this->_scopeConfig->getValue( + 'trans_email/ident_general/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $requestObject->getStoreId() + ) )->setOrigCity( $request->getOrigCity() )->setOrigPostal( @@ -462,8 +470,9 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $request->getDestCompanyName() ); - $originStreet2 = $this->_coreStoreConfig->getConfig( + $originStreet2 = $this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_ADDRESS2, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $requestObject->getStoreId() ); @@ -606,8 +615,8 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin '9' => __('Europack'), 'B' => __('Break bulk express'), 'C' => __('Medical express'), - 'D' => __('Express worldwide'), // product content code: DOX - 'U' => __('Express worldwide'), // product content code: ECX + 'D' => __('Express worldwide'), + 'U' => __('Express worldwide'), 'K' => __('Express 9:00'), 'L' => __('Express 10:30'), 'G' => __('Domestic economy select'), @@ -1121,11 +1130,13 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $rate->setPrice($data['price_total']); $result->append($rate); } - } else if (!empty($this->_errors)) { - if ($this->_isShippingLabelFlag) { - throw new \Magento\Model\Exception($responseError); + } else { + if (!empty($this->_errors)) { + if ($this->_isShippingLabelFlag) { + throw new \Magento\Model\Exception($responseError); + } + return $this->_showError(); } - return $this->_showError(); } return $result; } @@ -1294,7 +1305,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin } $countryParams = $this->getCountryParams( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $request->getStoreId() + ) ); if (!$countryParams->getData()) { $this->_errors[] = __('Please, specify origin country'); @@ -1416,7 +1431,11 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $rawRequest = $this->_request; $originRegion = $this->getCountryParams( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $this->getStore()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore() + ) )->getRegion(); if (!$originRegion) { diff --git a/app/code/Magento/Dhl/Model/Plugin/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Dhl/Model/Plugin/Checkout/Block/Cart/Shipping.php index edc924b41e59ea40ef0b3116759d2be4307eec0c..efbca81e6a6b9e7b74d1dcb5a6d928b00bc9aff2 100644 --- a/app/code/Magento/Dhl/Model/Plugin/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Dhl/Model/Plugin/Checkout/Block/Cart/Shipping.php @@ -29,16 +29,16 @@ namespace Magento\Dhl\Model\Plugin\Checkout\Block\Cart; class Shipping { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -49,7 +49,7 @@ class Shipping */ public function afterGetStateActive(\Magento\Checkout\Block\Cart\Shipping $subject, $result) { - return (bool)$result || (bool)$this->_storeConfig->getConfig('carriers/dhl/active'); + return (bool)$result || (bool)$this->_scopeConfig->getValue('carriers/dhl/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -60,6 +60,6 @@ class Shipping */ public function afterGetCityActive(\Magento\Checkout\Block\Cart\Shipping $subject, $result) { - return (bool)$result || (bool)$this->_storeConfig->getConfig('carriers/dhl/active'); + return (bool)$result || (bool)$this->_scopeConfig->getValue('carriers/dhl/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php index 365fd9d48d3e6630f42afa816472f602e7a1d037..ec38043c8cf327ce18133ad56b809b47f84b7829 100644 --- a/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ b/app/code/Magento/Dhl/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php @@ -29,16 +29,16 @@ namespace Magento\Dhl\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General; class Shippingmethod { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** diff --git a/app/code/Magento/Dhl/Model/Resource/Setup.php b/app/code/Magento/Dhl/Model/Resource/Setup.php index 63b16157c01732ab85f7b212be2a7b2e607135d3..eefcb36c6c70bc620eef43eec46e50022c2e2d7f 100644 --- a/app/code/Magento/Dhl/Model/Resource/Setup.php +++ b/app/code/Magento/Dhl/Model/Resource/Setup.php @@ -24,7 +24,7 @@ */ namespace Magento\Dhl\Model\Resource; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\Locale\ListsInterface @@ -32,18 +32,18 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_localeLists; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param string $moduleName * @param \Magento\Locale\ListsInterface $localeLists * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, $moduleName, \Magento\Locale\ListsInterface $localeLists, - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_localeLists = $localeLists; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml index 6e5bc9a206b785c30230ef82b21db47c1d9b3738..d14e262d85bae1af9ce767ab37cf01ed6a602935 100644 --- a/app/code/Magento/Dhl/etc/module.xml +++ b/app/code/Magento/Dhl/etc/module.xml @@ -26,6 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Dhl" version="2.0.0.0" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Shipping"/> <module name="Magento_Backend"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/Directory/Block/Adminhtml/Frontend/Currency/Base.php b/app/code/Magento/Directory/Block/Adminhtml/Frontend/Currency/Base.php index 78dd6f916fba176f649bfa342fc9d6e3fd704063..f2d42d2c7699bd674844e4b8a580218f25301eee 100644 --- a/app/code/Magento/Directory/Block/Adminhtml/Frontend/Currency/Base.php +++ b/app/code/Magento/Directory/Block/Adminhtml/Frontend/Currency/Base.php @@ -38,8 +38,11 @@ class Base extends \Magento\Backend\Block\System\Config\Form\Field public function render(\Magento\Data\Form\Element\AbstractElement $element) { if ($this->getRequest()->getParam('website') != '') { - $priceScope = $this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); - if ($priceScope == \Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL) { + $priceScope = $this->_scopeConfig->getValue( + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + if ($priceScope == \Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL) { return ''; } } diff --git a/app/code/Magento/Directory/Controller/Currency.php b/app/code/Magento/Directory/Controller/Currency.php index 8cb49bc7ff55740e84e7fecdc0cdf275168736ee..410c45e59f63f9834008b4298a0385c173e2a4ab 100644 --- a/app/code/Magento/Directory/Controller/Currency.php +++ b/app/code/Magento/Directory/Controller/Currency.php @@ -36,8 +36,8 @@ class Currency extends \Magento\App\Action\Action */ public function switchAction() { - /** @var \Magento\Core\Model\StoreManagerInterface $storeManager */ - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ + $storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface'); $currency = (string)$this->getRequest()->getParam('currency'); if ($currency) { $storeManager->getStore()->setCurrentCurrencyCode($currency); diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index c799c86abc6cf12b037100d4f43052f73fcb7c0c..05478b635cf5d40b54bc9cb53d36c1383c83487d 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -97,7 +97,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_coreHelper; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -107,7 +107,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_currencyFactory; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -117,9 +117,9 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Directory\Model\Resource\Country\Collection $countryCollection * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollectionFactory, * @param \Magento\Core\Helper\Data $coreHelper - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\Helper\Context $context, @@ -127,9 +127,9 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Directory\Model\Resource\Country\Collection $countryCollection, \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollectionFactory, \Magento\Core\Helper\Data $coreHelper, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\App\ConfigInterface $config + \Magento\App\Config\ScopeConfigInterface $config ) { parent::__construct($context); $this->_configCacheType = $configCacheType; @@ -243,7 +243,12 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getCountriesWithOptionalZip($asJson = false) { if (null === $this->_optZipCountries) { - $value = trim($this->_storeManager->getStore()->getConfig(self::OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH)); + $value = trim( + $this->_config->getValue( + self::OPTIONAL_ZIP_COUNTRIES_CONFIG_PATH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); $this->_optZipCountries = preg_split('/\,/', $value, 0, PREG_SPLIT_NO_EMPTY); } if ($asJson) { @@ -272,7 +277,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getCountriesWithStatesRequired($asJson = false) { - $value = trim($this->_storeManager->getStore()->getConfig(self::XML_PATH_STATES_REQUIRED)); + $value = trim( + $this->_config->getValue(self::XML_PATH_STATES_REQUIRED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) + ); $countryList = preg_split('/\,/', $value, 0, PREG_SPLIT_NO_EMPTY); if ($asJson) { return $this->_coreHelper->jsonEncode($countryList); @@ -287,7 +294,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isShowNonRequiredState() { - return (bool)$this->_storeManager->getStore()->getConfig(self::XML_PATH_DISPLAY_ALL_STATES); + return (bool)$this->_config->getValue( + self::XML_PATH_DISPLAY_ALL_STATES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Directory/Helper/Url.php b/app/code/Magento/Directory/Helper/Url.php new file mode 100644 index 0000000000000000000000000000000000000000..3160c2289dd9a7637bcbdc982885b3f8694d9afb --- /dev/null +++ b/app/code/Magento/Directory/Helper/Url.php @@ -0,0 +1,75 @@ +<?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 Magento + * @package Magento_Directory + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Directory URL helper + */ +namespace Magento\Directory\Helper; + +class Url extends \Magento\Core\Helper\Url +{ + /** + * Core data + * + * @var \Magento\Core\Helper\Data + */ + protected $_coreData = null; + + /** + * @param \Magento\App\Helper\Context $context + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Helper\Data $coreData + */ + public function __construct( + \Magento\App\Helper\Context $context, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Core\Helper\Data $coreData + ) { + $this->_coreData = $coreData; + parent::__construct($context, $storeManager); + } + + /** + * Retrieve switch currency url + * + * @param array $params Additional url params + * @return string + */ + public function getSwitchCurrencyUrl($params = array()) + { + $params = is_array($params) ? $params : array(); + + if ($this->_getRequest()->getAlias('rewrite_request_path')) { + $url = $this->_storeManager->getStore()->getBaseUrl() . $this->_getRequest()->getAlias( + 'rewrite_request_path' + ); + } else { + $url = $this->_urlBuilder->getCurrentUrl(); + } + $params[\Magento\App\Action\Action::PARAM_NAME_URL_ENCODED] = $this->_coreData->urlEncode($url); + return $this->_getUrl('directory/currency/switch', $params); + } +} diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index 11ef48b227bc2055e5832d343b1034e0d7a2287f..646c904909a8072f91c4ca000b1197c09ef43d41 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -65,7 +65,7 @@ class Currency extends \Magento\Model\AbstractModel protected $_localeFormat; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -88,7 +88,7 @@ class Currency extends \Magento\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Locale\FormatInterface $localeFormat - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Helper\Data $directoryHelper * @param Currency\FilterFactory $currencyFilterFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency @@ -100,7 +100,7 @@ class Currency extends \Magento\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Locale\FormatInterface $localeFormat, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Directory\Model\Currency\FilterFactory $currencyFilterFactory, \Magento\Locale\CurrencyInterface $localeCurrency, diff --git a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php index 2bdb02440fb11cc235679d0d8d7a856f7706d68f..5a598bcf1263568abb2f626c728f91d3060e758a 100644 --- a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php +++ b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php @@ -30,24 +30,24 @@ class DefaultLocator /** * Config object * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_configuration; /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\App\ConfigInterface $configuration - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $configuration + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\App\ConfigInterface $configuration, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\App\Config\ScopeConfigInterface $configuration, + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_configuration = $configuration; $this->_storeManager = $storeManager; @@ -55,7 +55,7 @@ class DefaultLocator /** * Retrieve default currency for selected store, website or website group - * + * @todo: Refactor to ScopeDefiner * @param \Magento\App\RequestInterface $request * @return string */ @@ -64,17 +64,21 @@ class DefaultLocator if ($request->getParam('store')) { $store = $request->getParam('store'); $currencyCode = $this->_storeManager->getStore($store)->getBaseCurrencyCode(); - } else if ($request->getParam('website')) { - $website = $request->getParam('website'); - $currencyCode = $this->_storeManager->getWebsite($website)->getBaseCurrencyCode(); - } else if ($request->getParam('group')) { - $group = $request->getParam('group'); - $currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode(); } else { - $currencyCode = $this->_configuration->getValue( - \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, - 'default' - ); + if ($request->getParam('website')) { + $website = $request->getParam('website'); + $currencyCode = $this->_storeManager->getWebsite($website)->getBaseCurrencyCode(); + } else { + if ($request->getParam('group')) { + $group = $request->getParam('group'); + $currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode(); + } else { + $currencyCode = $this->_configuration->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); + } + } } return $currencyCode; diff --git a/app/code/Magento/Directory/Model/Currency/Filter.php b/app/code/Magento/Directory/Model/Currency/Filter.php index 9f325e115ef0c3f07b856f8df2a6338cfd5cfc14..3c1559bb4ff8f277b2d68f2fbf62fa80480ff2c5 100644 --- a/app/code/Magento/Directory/Model/Currency/Filter.php +++ b/app/code/Magento/Directory/Model/Currency/Filter.php @@ -51,7 +51,7 @@ class Filter implements \Zend_Filter_Interface protected $_localeFormat; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -62,14 +62,14 @@ class Filter implements \Zend_Filter_Interface /** * @param \Magento\Locale\FormatInterface $localeFormat - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\CurrencyInterface $localeCurrency * @param string $code * @param int $rate */ public function __construct( \Magento\Locale\FormatInterface $localeFormat, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\CurrencyInterface $localeCurrency, $code, $rate = 1 diff --git a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php index b299de6db0a7fa7923016585d9104918caad5328..9665cd8a788d3c627e6f9ad3772a66daef87f45e 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php +++ b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php @@ -46,20 +46,20 @@ class Webservicex extends \Magento\Directory\Model\Currency\Import\AbstractImpor /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { parent::__construct($currencyFactory); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_httpClient = new \Magento\HTTP\ZendClient(); } @@ -78,7 +78,12 @@ class Webservicex extends \Magento\Directory\Model\Currency\Import\AbstractImpor $response = $this->_httpClient->setUri( $url )->setConfig( - array('timeout' => $this->_coreStoreConfig->getConfig('currency/webservicex/timeout')) + array( + 'timeout' => $this->_scopeConfig->getValue( + 'currency/webservicex/timeout', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) )->request( 'GET' )->getBody(); diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php index 2218d73c6230243111b848204e4ff7b6f6a744e7..f6f7284212f510b5aa37464a747caa0f4b6b8ece 100644 --- a/app/code/Magento/Directory/Model/Observer.php +++ b/app/code/Magento/Directory/Model/Observer.php @@ -53,9 +53,9 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Mail\Template\TransportBuilder @@ -63,7 +63,7 @@ class Observer protected $_transportBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -79,22 +79,25 @@ class Observer /** * @param \Magento\Directory\Model\Currency\Import\Factory $importFactory - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\TranslateInterface $translate * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Directory\Model\Currency\Import\Factory $importFactory, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\TranslateInterface $translate, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Translate\Inline\StateInterface $inlineTranslation + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Directory\Model\CurrencyFactory $currencyFactory ) { $this->_importFactory = $importFactory; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; + $this->_translate = $translate; + $this->_importFactory = $importFactory; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_currencyFactory = $currencyFactory; @@ -108,10 +111,12 @@ class Observer public function scheduledUpdateCurrencyRates($schedule) { $importWarnings = array(); - if (!$this->_coreStoreConfig->getConfig( - self::IMPORT_ENABLE - ) || !$this->_coreStoreConfig->getConfig( - self::CRON_STRING_PATH + if (!$this->_scopeConfig->getValue( + self::IMPORT_ENABLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) || !$this->_scopeConfig->getValue( + self::CRON_STRING_PATH, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { return; @@ -119,7 +124,10 @@ class Observer $errors = array(); $rates = array(); - $service = $this->_coreStoreConfig->getConfig(self::IMPORT_SERVICE); + $service = $this->_scopeConfig->getValue( + self::IMPORT_SERVICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($service) { try { $importModel = $this->_importFactory->create($service); @@ -144,7 +152,10 @@ class Observer $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, @@ -153,9 +164,15 @@ class Observer )->setTemplateVars( array('warnings' => join("\n", $importWarnings)) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); diff --git a/app/code/Magento/Directory/Model/Resource/Country/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Collection.php index f096afc3f55c57c7b1d701981b73bb4a745bed15..f467bccec57562fc6d1120d20cda46b3a1521e62 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Collection.php @@ -41,9 +41,9 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Directory\Model\Resource\CountryFactory @@ -68,7 +68,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Locale\ListsInterface $localeLists - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Directory\Model\Resource\CountryFactory $countryFactory * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Locale\ResolverInterface $localeResolver @@ -81,7 +81,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Locale\ListsInterface $localeLists, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Directory\Model\Resource\CountryFactory $countryFactory, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Locale\ResolverInterface $localeResolver, @@ -89,7 +89,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_localeLists = $localeLists; $this->_localeResolver = $localeResolver; $this->_countryFactory = $countryFactory; @@ -121,7 +121,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ public function loadByStore($store = null) { - $allowCountries = explode(',', (string)$this->_coreStoreConfig->getConfig('general/country/allow', $store)); + $allowCountries = explode(',', (string)$this->_scopeConfig->getValue('general/country/allow', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)); if (!empty($allowCountries)) { $this->addFieldToFilter("country_id", array('in' => $allowCountries)); } diff --git a/app/code/Magento/Directory/Model/Resource/Setup.php b/app/code/Magento/Directory/Model/Resource/Setup.php index 5ac694a8a8fb86e700e33495cfa40d1b40f627f1..33bfb623da7be148aac59795e79e5a7c13a4edb8 100644 --- a/app/code/Magento/Directory/Model/Resource/Setup.php +++ b/app/code/Magento/Directory/Model/Resource/Setup.php @@ -33,7 +33,7 @@ */ namespace Magento\Directory\Model\Resource; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\Directory\Helper\Data @@ -41,18 +41,18 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_directoryData; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Directory\Helper\Data $directoryData * @param string $moduleName * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\Directory\Helper\Data $directoryData, $moduleName = 'Magento_Directory', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_directoryData = $directoryData; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Directory/data/directory_setup/data-install-1.6.0.0.php b/app/code/Magento/Directory/data/directory_setup/data-install-1.6.0.0.php index 5d1a9aa083147153ec9e21d33f2fe5d145993871..856f5378118348bdc30b0ea65518d4edbcbc03e5 100644 --- a/app/code/Magento/Directory/data/directory_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Directory/data/directory_setup/data-install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; /** diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index 47c39732abe20778e98d290540b01a2c779b7543..63dcbbd7793b348f92df6f185dddee41562f2e9b 100644 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Directory" version="1.6.0.2" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php b/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php index b085ab8f9633761e3013571313a1ca33d3285f57..a3e15b01b8ad25df946e6ffca5db1ff0038176eb 100644 --- a/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php +++ b/app/code/Magento/Directory/sql/directory_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php index 3299cd438c0ca6aa232962252ab340039e490535..b18dab4162c092cbb94f42e1822115b38b19450a 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Links.php @@ -227,8 +227,9 @@ class Links extends \Magento\Backend\Block\Template { return $this->getProduct()->getId() && $this->getProduct()->getTypeId() == - 'downloadable' ? $this->getProduct()->getLinksTitle() : $this->_storeConfig->getConfig( - \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE + 'downloadable' ? $this->getProduct()->getLinksTitle() : $this->_scopeConfig->getValue( + \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } @@ -249,8 +250,11 @@ class Links extends \Magento\Backend\Block\Template */ public function getIsPriceWebsiteScope() { - $scope = (int)$this->_storeManager->getStore()->getConfig(\Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE); - if ($scope == \Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE) { + $scope = (int)$this->_scopeConfig->getValue( + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + if ($scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE) { return true; } return false; @@ -359,7 +363,10 @@ class Links extends \Magento\Backend\Block\Template */ public function getConfigMaxDownloads() { - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_DEFAULT_DOWNLOADS_NUMBER); + return $this->_scopeConfig->getValue( + \Magento\Downloadable\Model\Link::XML_PATH_DEFAULT_DOWNLOADS_NUMBER, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -457,7 +464,7 @@ class Links extends \Magento\Backend\Block\Template } /** - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId $storeId + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId $storeId * @return string */ public function getBaseCurrencyCode($storeId) diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php index 21c014474e3f95b90f3bd6ec22064080c1dd4527..526dc9e9f4ad2e0b57856e3a8be04efb144e06b0 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/Samples.php @@ -218,10 +218,11 @@ class Samples extends \Magento\Backend\Block\Widget */ public function getSamplesTitle() { - return $this->getProduct()->getId() && - $this->getProduct()->getTypeId() == - 'downloadable' ? $this->getProduct()->getSamplesTitle() : $this->_storeConfig->getConfig( - \Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE + return $this->getProduct()->getId() + && $this->getProduct()->getTypeId() == 'downloadable' ? $this->getProduct()->getSamplesTitle() : + $this->_scopeConfig->getValue( + \Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php b/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php index 75a0c81608237962a88a7738c1890947fd7e93f0..95ad6de4e7b9421d0cc7e03641cc91225fcb2376 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Sales/Items/Column/Downloadable/Name.php @@ -88,6 +88,6 @@ class Name extends \Magento\Sales\Block\Adminhtml\Items\Column\Name if ($this->_purchased && $this->_purchased->getLinkSectionTitle()) { return $this->_purchased->getLinkSectionTitle(); } - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 704c036245db5e117f84e969b36a51b6f0fb27c0..293f330a3b5d5b76c296052783e12ea2412b711a 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -210,7 +210,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct if ($this->getProduct()->getLinksTitle()) { return $this->getProduct()->getLinksTitle(); } - return $this->_storeConfig->getConfig(Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -220,7 +220,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getIsOpenInNewWindow() { - return $this->_storeConfig->getConfigFlag(Link::XML_PATH_TARGET_NEW_WINDOW); + return $this->_scopeConfig->isSetFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php index 35bad6f2f83b3c0bfd53057557a50bfd4e721441..72a897cd9264180a4b05196137d7df4898cd54fb 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Samples.php @@ -75,7 +75,7 @@ class Samples extends \Magento\Catalog\Block\Product\AbstractProduct if ($this->getProduct()->getSamplesTitle()) { return $this->getProduct()->getSamplesTitle(); } - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Sample::XML_PATH_SAMPLES_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -85,6 +85,6 @@ class Samples extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getIsOpenInNewWindow() { - return $this->_storeConfig->getConfigFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW); + return $this->_scopeConfig->isSetFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php index 14f725385c938c4386cf8e17f7a547319000e170..74d802ffa558c998ab070c8115a7e97b99b0d589 100644 --- a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php +++ b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php @@ -184,6 +184,6 @@ class ListProducts extends \Magento\View\Element\Template */ public function getIsOpenInNewWindow() { - return $this->_storeConfig->getConfigFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW); + return $this->_scopeConfig->isSetFlag(\Magento\Downloadable\Model\Link::XML_PATH_TARGET_NEW_WINDOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php index 500eadf6a7b82cc718f4c929ed3f3edf41658973..b072b6ed880b888f4a385aa8061d9ce878bc1399 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Downloadable.php @@ -102,7 +102,7 @@ class Downloadable extends \Magento\Sales\Block\Order\Email\Items\DefaultItems if ($this->_purchased->getLinkSectionTitle()) { return $this->_purchased->getLinkSectionTitle(); } - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php index f87ef654382eb9d946fb959bbd1ef6164bc54925..1597696bc0b7e09346b4434cd03962359fe4c722 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Email/Items/Order/Downloadable.php @@ -93,7 +93,7 @@ class Downloadable extends \Magento\Sales\Block\Order\Email\Items\Order\DefaultO if ($this->_purchased->getLinkSectionTitle()) { return $this->_purchased->getLinkSectionTitle(); } - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php index c5f42b339535d57f4a99361793f18448bbaca6ed..2db330381acdd984b78818bd48374298690556a5 100644 --- a/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Sales/Order/Item/Renderer/Downloadable.php @@ -94,6 +94,6 @@ class Downloadable extends \Magento\Sales\Block\Order\Item\Renderer\DefaultRende if ($this->_purchasedLinks->getLinkSectionTitle()) { return $this->_purchasedLinks->getLinkSectionTitle(); } - return $this->_storeConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Downloadable/Controller/Download.php b/app/code/Magento/Downloadable/Controller/Download.php index 2cf998fe9fd1a144902036f3c761a2998e139d97..8fc6ec6eb52b5de0908c68336dc6e607b9e9108b 100644 --- a/app/code/Magento/Downloadable/Controller/Download.php +++ b/app/code/Magento/Downloadable/Controller/Download.php @@ -38,11 +38,11 @@ class Download extends \Magento\App\Action\Action /** * Return core session object * - * @return \Magento\Core\Model\Session + * @return \Magento\Session\Generic */ protected function _getSession() { - return $this->_objectManager->get('Magento\Core\Model\Session'); + return $this->_objectManager->get('Magento\Session\Generic'); } /** diff --git a/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php b/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php index ccbde3037d9b363e48d9537d7b4101c95e221495..e98c9f31b531ab9ba25c342dc2866997f3fdca44 100644 --- a/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php +++ b/app/code/Magento/Downloadable/Helper/Catalog/Product/Configuration.php @@ -45,22 +45,22 @@ class Configuration extends \Magento\App\Helper\AbstractHelper implements /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context * @param \Magento\Catalog\Helper\Product\Configuration $productConfigur - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Catalog\Helper\Product\Configuration $productConfigur, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_productConfigur = $productConfigur; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -98,7 +98,7 @@ class Configuration extends \Magento\App\Helper\AbstractHelper implements if (strlen($title)) { return $title; } - return $this->_coreStoreConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Downloadable/Helper/Data.php b/app/code/Magento/Downloadable/Helper/Data.php index b9375c10d121f3050e6dc9492d907067443bfd4d..68fd6e2c32a5440facc63b5be276a042f936d5de 100644 --- a/app/code/Magento/Downloadable/Helper/Data.php +++ b/app/code/Magento/Downloadable/Helper/Data.php @@ -39,19 +39,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -70,8 +70,9 @@ class Data extends \Magento\App\Helper\AbstractHelper $shareable = (bool)$link->getIsShareable(); break; case \Magento\Downloadable\Model\Link::LINK_SHAREABLE_CONFIG: - $shareable = (bool)$this->_coreStoreConfig->getConfigFlag( - \Magento\Downloadable\Model\Link::XML_PATH_CONFIG_IS_SHAREABLE + $shareable = (bool)$this->_scopeConfig->isSetFlag( + \Magento\Downloadable\Model\Link::XML_PATH_CONFIG_IS_SHAREABLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } return $shareable; diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index aef39f99912dc130ee6147d8b0b2bb2de1a25e69..03f6c0ce8b32f2339ff04420362f4eb64e387094 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -112,9 +112,9 @@ class Download extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\App\Filesystem @@ -132,7 +132,7 @@ class Download extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem */ public function __construct( @@ -140,13 +140,13 @@ class Download extends \Magento\App\Helper\AbstractHelper \Magento\Core\Helper\Data $coreData, \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem ) { $this->_coreData = $coreData; $this->_downloadableFile = $downloadableFile; $this->_coreFileStorageDb = $coreFileStorageDb; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_filesystem = $filesystem; parent::__construct($context); @@ -294,6 +294,6 @@ class Download extends \Magento\App\Helper\AbstractHelper */ public function getContentDisposition($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_CONTENT_DISPOSITION, $store); + return $this->_scopeConfig->getValue(self::XML_PATH_CONTENT_DISPOSITION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } } diff --git a/app/code/Magento/Downloadable/Model/Observer.php b/app/code/Magento/Downloadable/Model/Observer.php index 67f001de3e587674ffd036c2f1e76c9b7400e3d5..e837b9b8b5818db44f8d39f555fb439a595dbdc9 100644 --- a/app/code/Magento/Downloadable/Model/Observer.php +++ b/app/code/Magento/Downloadable/Model/Observer.php @@ -44,9 +44,9 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Downloadable\Model\Link\PurchasedFactory @@ -80,7 +80,7 @@ class Observer /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Downloadable\Model\Link\Purchased\ItemFactory $itemFactory @@ -90,7 +90,7 @@ class Observer */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Downloadable\Model\Link\Purchased\ItemFactory $itemFactory, @@ -99,7 +99,7 @@ class Observer \Magento\Object\Copy $objectCopyService ) { $this->_helper = $coreData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_purchasedFactory = $purchasedFactory; $this->_productFactory = $productFactory; $this->_itemFactory = $itemFactory; @@ -172,9 +172,10 @@ class Observer ); $linkSectionTitle = $product->getLinksTitle() ? $product ->getLinksTitle() : $this - ->_coreStoreConfig - ->getConfig( - \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE + ->_scopeConfig + ->getValue( + \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $linkPurchased->setLinkSectionTitle($linkSectionTitle)->save(); foreach ($linkIds as $linkId) { @@ -230,9 +231,9 @@ class Observer $order = $observer->getEvent()->getOrder(); foreach ($order->getAllItems() as $item) { /* @var $item \Magento\Sales\Model\Order\Item */ - if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE || - $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE || - $item->getProductOptionByCode( + if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + || $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + || $item->getProductOptionByCode( 'is_downloadable' ) ) { @@ -270,24 +271,25 @@ class Observer ); $downloadableItemsStatuses = array(); - $orderItemStatusToEnable = $this->_coreStoreConfig->getConfig( + $orderItemStatusToEnable = $this->_scopeConfig->getValue( \Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId() ); if ($order->getState() == \Magento\Sales\Model\Order::STATE_HOLDED) { $status = $linkStatuses['pending']; - } elseif ($order->isCanceled() || - $order->getState() == \Magento\Sales\Model\Order::STATE_CLOSED || - $order->getState() == \Magento\Sales\Model\Order::STATE_COMPLETE + } elseif ($order->isCanceled() + || $order->getState() == \Magento\Sales\Model\Order::STATE_CLOSED + || $order->getState() == \Magento\Sales\Model\Order::STATE_COMPLETE ) { $expiredStatuses = array( \Magento\Sales\Model\Order\Item::STATUS_CANCELED, \Magento\Sales\Model\Order\Item::STATUS_REFUNDED ); foreach ($order->getAllItems() as $item) { - if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE || - $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + || $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE ) { if (in_array($item->getStatusId(), $expiredStatuses)) { $downloadableItemsStatuses[$item->getId()] = $linkStatuses['expired']; @@ -303,12 +305,12 @@ class Observer } else { $availableStatuses = array($orderItemStatusToEnable, \Magento\Sales\Model\Order\Item::STATUS_INVOICED); foreach ($order->getAllItems() as $item) { - if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE || - $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + || $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE ) { - if ($item->getStatusId() == \Magento\Sales\Model\Order\Item::STATUS_BACKORDERED && - $orderItemStatusToEnable == \Magento\Sales\Model\Order\Item::STATUS_PENDING && - !in_array( + if ($item->getStatusId() == \Magento\Sales\Model\Order\Item::STATUS_BACKORDERED + && $orderItemStatusToEnable == \Magento\Sales\Model\Order\Item::STATUS_PENDING + && !in_array( \Magento\Sales\Model\Order\Item::STATUS_BACKORDERED, $availableStatuses, true @@ -325,8 +327,8 @@ class Observer } if (!$downloadableItemsStatuses && $status) { foreach ($order->getAllItems() as $item) { - if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE || - $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + if ($item->getProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + || $item->getRealProductType() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE ) { $downloadableItemsStatuses[$item->getId()] = $status; } @@ -339,8 +341,8 @@ class Observer array('in' => array_keys($downloadableItemsStatuses)) ); foreach ($linkPurchased as $link) { - if ($link->getStatus() != $linkStatuses['expired'] && - !empty($downloadableItemsStatuses[$link->getOrderItemId()]) + if ($link->getStatus() != $linkStatuses['expired'] + && !empty($downloadableItemsStatuses[$link->getOrderItemId()]) ) { $link->setStatus($downloadableItemsStatuses[$link->getOrderItemId()])->save(); } @@ -365,14 +367,20 @@ class Observer $isContain = false; foreach ($quote->getAllItems() as $item) { - if (($product = $item->getProduct()) && - $product->getTypeId() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE + if (($product = $item->getProduct()) + && $product->getTypeId() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE ) { $isContain = true; } } - if ($isContain && $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_DISABLE_GUEST_CHECKOUT, $store)) { + if ($isContain + && $this->_scopeConfig->isSetFlag( + self::XML_PATH_DISABLE_GUEST_CHECKOUT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) + ) { $result->setIsAllowed(false); } diff --git a/app/code/Magento/Downloadable/Model/Resource/Link.php b/app/code/Magento/Downloadable/Model/Resource/Link.php index c68d1d544b7975715a7467f3cfe9edc109928240..6c678b10aa8a2e49c758a721f9841a0a876d7663 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link.php @@ -42,7 +42,7 @@ class Link extends \Magento\Model\Resource\Db\AbstractDb protected $_catalogData; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_configuration; @@ -52,23 +52,23 @@ class Link extends \Magento\Model\Resource\Db\AbstractDb protected $_currencyFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\App\Config\ScopeConfigInterface $configuration * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $configuration, + \Magento\App\Config\ScopeConfigInterface $configuration, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_catalogData = $catalogData; $this->_configuration = $configuration; diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php index 1f980c823f1c52cdb7784c05c55e25c023b54636..e8898462f5dabaeaf6a9ae88488b42c4a6684c0e 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -40,9 +40,9 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Downloadable\Model\Link\PurchasedFactory @@ -60,7 +60,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Model\Resource\AbstractResource $resource @@ -73,14 +73,14 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra \Magento\Tax\Helper\Data $taxData, \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_purchasedFactory = $purchasedFactory; $this->_itemsFactory = $itemsFactory; parent::__construct( @@ -122,6 +122,6 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra if ($this->_purchasedLinks->getLinkSectionTitle()) { return $this->_purchasedLinks->getLinkSectionTitle(); } - return $this->_coreStoreConfig->getConfig(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE); + return $this->_scopeConfig->getValue(\Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index ac12183be2437d70171507405064a9ded99bce47..e74208ca77df3234c4e1eac8f316726e6ac50e91 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -41,7 +41,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string @@ -55,7 +55,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr \Magento\Tax\Helper\Data $taxData, \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, @@ -70,7 +70,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr $taxData, $filesystem, $filterManager, - $coreStoreConfig, + $scopeConfig, $purchasedFactory, $itemsFactory, $resource, diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index c8afa1865e3e116e9a7a4456d571cef610b15335..f75d3a7c9240c2475ecc393beaca16ddcdd97f35 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -41,7 +41,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string @@ -55,7 +55,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract \Magento\Tax\Helper\Data $taxData, \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, @@ -70,7 +70,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract $taxData, $filesystem, $filterManager, - $coreStoreConfig, + $scopeConfig, $purchasedFactory, $itemsFactory, $resource, diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index 7f3a76517542c97c5bccf9b5e2bed66f111b352d..71efd9de5312cb6c86e5cf8d3931aefb928685d1 100644 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/Downloadable/etc/product_types.xml b/app/code/Magento/Downloadable/etc/product_types.xml index 37a2555c87d8cb9c5b31283262b0d8b9a41431fc..8de193b02faeaf725a7c06b9b66464e46abe213e 100644 --- a/app/code/Magento/Downloadable/etc/product_types.xml +++ b/app/code/Magento/Downloadable/etc/product_types.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Catalog/etc/product_types.xsd"> - <type name="downloadable" label="Downloadable Product" modelInstance="Magento\Downloadable\Model\Product\Type" composite="false" isQty="true" canUseQtyDecimals="false"> + <type name="downloadable" label="Downloadable Product" modelInstance="Magento\Downloadable\Model\Product\Type" composite="false" isQty="true" canUseQtyDecimals="false" sortOrder="60"> <priceModel instance="Magento\Downloadable\Model\Product\Price" /> <indexerModel instance="Magento\Downloadable\Model\Resource\Indexer\Price" /> <customAttributes> diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php index f41c8ba89f6046ee7d66b8e594364373dac3d5eb..afb9b6feffda3276bb677c2f2325d7d8157b5089 100644 --- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php +++ b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php @@ -161,9 +161,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('downloadable_link_price', 'website_id'), 'website_id' )->addForeignKey( - $installer->getFkName('downloadable_link_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('downloadable_link_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -450,9 +450,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('downloadable_link_title', 'store_id'), 'store_id' )->addForeignKey( - $installer->getFkName('downloadable_link_title', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('downloadable_link_title', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -568,9 +568,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('downloadable_sample_title', 'store_id'), 'store_id' )->addForeignKey( - $installer->getFkName('downloadable_sample_title', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('downloadable_sample_title', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php index aae5663aabf9d26866e8968245306c779b948fb9..1c4153b860e848b394f234370e3c51c54c8748bc 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Labels.php @@ -61,7 +61,7 @@ class Labels extends \Magento\Backend\Block\Template /** * Retrieve stores collection with default store * - * @return \Magento\Core\Model\Resource\Store\Collection + * @return \Magento\Store\Model\Resource\Store\Collection */ public function getStores() { diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php index d09da162e4b66c946596dbb748b909ec2fbc8307..d54f2e6990e57921c21b99e84218489195f1d67f 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php @@ -33,7 +33,7 @@ */ namespace Magento\Eav\Block\Adminhtml\Attribute\Edit\Options; -use Magento\Core\Model\Resource\Store\Collection; +use Magento\Store\Model\Resource\Store\Collection; class Options extends \Magento\Backend\Block\Template { @@ -224,9 +224,7 @@ class Options extends \Magento\Backend\Block\Template foreach ($this->getStores() as $store) { $storeId = $store->getId(); $value['store' . $storeId] = $storeId == - \Magento\Core\Model\Store::DEFAULT_STORE_ID ? $valuePrefix . $this->escapeHtml( - $option['label'] - ) : ''; + \Magento\Store\Model\Store::DEFAULT_STORE_ID ? $valuePrefix . $this->escapeHtml($option['label']) : ''; } return array($value); diff --git a/app/code/Magento/Eav/Helper/Data.php b/app/code/Magento/Eav/Helper/Data.php index b0ecc07fb72d62eb11919bc295e1092c7ea1b218..42354fe29062ab82ebaf76ebf3e2746daab54686 100644 --- a/app/code/Magento/Eav/Helper/Data.php +++ b/app/code/Magento/Eav/Helper/Data.php @@ -50,9 +50,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Eav\Model\Entity\Attribute\Config @@ -67,16 +67,16 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context * @param \Magento\Eav\Model\Entity\Attribute\Config $attributeConfig - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Eav\Model\Entity\Attribute\Config $attributeConfig, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Eav\Model\Config $eavConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_attributeConfig = $attributeConfig; $this->_eavConfig = $eavConfig; parent::__construct($context); @@ -146,7 +146,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getInputTypesValidatorData() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_VALIDATOR_DATA_INPUT_TYPES); + return $this->_scopeConfig->getValue(self::XML_PATH_VALIDATOR_DATA_INPUT_TYPES, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Eav/Model/Attribute.php b/app/code/Magento/Eav/Model/Attribute.php index 5ef654b0bd63f7ede78a79ad5ad2a38b3f1de48a..92f27a5c05c4a9264d47ca9fb8fa603dd2d5af3f 100644 --- a/app/code/Magento/Eav/Model/Attribute.php +++ b/app/code/Magento/Eav/Model/Attribute.php @@ -36,7 +36,7 @@ */ namespace Magento\Eav\Model; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; abstract class Attribute extends \Magento\Eav\Model\Entity\Attribute { diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index e4b613ece117f054f1382680e025ff9845ab2194..f65805b2e53aae1a25eb3b60d3f25a99f1f5297d 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -28,7 +28,7 @@ namespace Magento\Eav\Model\Entity; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Type; use Magento\Model\Exception; -use Magento\Core\Model\Config\Element; +use Magento\App\Config\Element; use Magento\Model\AbstractModel; use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend; use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index 0e09cdf90e3852b713a998c70ef33583a1bf9350..cbc5bdda34038dad86b484ee409dc8c2b5f5fe32 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -70,9 +70,9 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im protected $_localeDate; /** - * @var \Magento\Catalog\Model\ProductFactory + * @var \Magento\Catalog\Model\Product\ReservedAttributeList */ - protected $_catalogProductFactory; + protected $reservedAttributeList; /** * @var \Magento\Locale\ResolverInterface @@ -85,11 +85,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory + * @param \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList * @param \Magento\Locale\ResolverInterface $localeResolver * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -101,11 +101,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Catalog\Model\ProductFactory $catalogProductFactory, + \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Locale\ResolverInterface $localeResolver, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -126,7 +126,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im ); $this->_localeDate = $localeDate; $this->_localeResolver = $localeResolver; - $this->_catalogProductFactory = $catalogProductFactory; + $this->reservedAttributeList = $reservedAttributeList; } /** @@ -216,12 +216,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im protected function _beforeSave() { // prevent overriding product data - if (isset( - $this->_data['attribute_code'] - ) && $this->_catalogProductFactory->create()->isReservedAttribute( - $this - ) - ) { + if (isset($this->_data['attribute_code']) && $this->reservedAttributeList->isReservedAttribute($this)) { throw new Exception( __( 'The attribute code \'%1\' is reserved by system. Please try another attribute code', diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 90f966215b61a24c17f8cd0f77e2ca0e1161c649..15d3e03a170880981b2abfaf78bedc761989f671 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -103,7 +103,7 @@ abstract class AbstractAttribute extends \Magento\Model\AbstractModel implements protected $_eavTypeFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -123,7 +123,7 @@ abstract class AbstractAttribute extends \Magento\Model\AbstractModel implements * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory * @param \Magento\Model\Resource\AbstractResource $resource @@ -136,7 +136,7 @@ abstract class AbstractAttribute extends \Magento\Model\AbstractModel implements \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, \Magento\Model\Resource\AbstractResource $resource = null, diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php index b8ccfc825a87b513008c64463965de22c6f7f649..2539b36bc183b74930510a4b13159ed9ed416172 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php @@ -28,15 +28,15 @@ namespace Magento\Eav\Model\Entity\Attribute\Backend; class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Logger $logger, \Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; parent::__construct($logger); diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php index aba5c91c0b38498295217603740d899e49ea1dce..2a8ee84a15ebcb89b7192660878b0cf48ed0772f 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php @@ -35,7 +35,7 @@ namespace Magento\Eav\Model\Entity\Attribute\Source; class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table { /** - * @var \Magento\Core\Model\Resource\Store\CollectionFactory + * @var \Magento\Store\Model\Resource\Store\CollectionFactory */ protected $_storeCollectionFactory; @@ -43,13 +43,13 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory + * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, - \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory + \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory ) { parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); $this->_storeCollectionFactory = $storeCollectionFactory; diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 478ca1212df3f7bd5b982e2e17fee300f40630bd..e7dc1cd62f6a63b5308ee4e0b009fe4bb120b73b 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -245,7 +245,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db { if ($entity instanceof \Magento\Eav\Model\Entity\AbstractEntity) { $this->_entity = $entity; - } elseif (is_string($entity) || $entity instanceof \Magento\Core\Model\Config\Element) { + } elseif (is_string($entity) || $entity instanceof \Magento\App\Config\Element) { $this->_entity = $this->_eavEntityFactory->create()->setType($entity); } else { throw new \Magento\Eav\Exception(__('Invalid entity supplied: %1', print_r($entity, 1))); @@ -460,7 +460,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db * * If $attribute == '*' select all attributes * - * @param array|string|integer|\Magento\Core\Model\Config\Element $attribute + * @param array|string|integer|\Magento\App\Config\Element $attribute * @param bool|string $joinType flag for joining attribute * @return $this * @throws \Magento\Eav\Exception diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index 7e9f01044561c9602371339e69685bdc2d0e7bf2..04180802b19c71124979381baf47a7786931570b 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Entity; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\App\CacheInterface @@ -56,7 +56,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, $moduleName = 'Magento_Eav', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_cache = $cache; $this->_attrGroupCollectionFactory = $attrGroupCollectionFactory; @@ -92,17 +92,6 @@ class Setup extends \Magento\Core\Model\Resource\Setup */ protected $_defaultAttributeSetName = 'Default'; - /** - * Create migration setup - * - * @param array $data - * @return \Magento\Core\Model\Resource\Setup\Migration - */ - public function createMigrationSetup(array $data = array()) - { - return $this->_migrationFactory->create($data); - } - /** * @return \Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection */ diff --git a/app/code/Magento/Eav/Model/Entity/Setup/Context.php b/app/code/Magento/Eav/Model/Entity/Setup/Context.php index 24f657a191f363647b4b68c4b73e94fcb7914722..efb8f0a32a6438ad868a3d557366d9aae67faa74 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup/Context.php +++ b/app/code/Magento/Eav/Model/Entity/Setup/Context.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Entity\Setup; -class Context extends \Magento\Core\Model\Resource\Setup\Context +class Context extends \Magento\Module\Setup\Context { /** * @var PropertyMapperInterface @@ -39,9 +39,7 @@ class Context extends \Magento\Core\Model\Resource\Setup\Context * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Module\ResourceInterface $resourceResource - * @param \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory - * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory + * @param \Magento\Module\Setup\MigrationFactory $migrationFactory * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\App\Filesystem $filesystem * @param PropertyMapperInterface $attributeMapper @@ -53,9 +51,7 @@ class Context extends \Magento\Core\Model\Resource\Setup\Context \Magento\Module\Dir\Reader $modulesReader, \Magento\Module\ModuleListInterface $moduleList, \Magento\Module\ResourceInterface $resourceResource, - \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory, - \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, - \Magento\Core\Model\Theme\CollectionFactory $themeFactory, + \Magento\Module\Setup\MigrationFactory $migrationFactory, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\App\Filesystem $filesystem, PropertyMapperInterface $attributeMapper @@ -69,8 +65,6 @@ class Context extends \Magento\Core\Model\Resource\Setup\Context $moduleList, $resourceResource, $migrationFactory, - $themeResourceFactory, - $themeFactory, $encryptor, $filesystem ); diff --git a/app/code/Magento/Eav/Model/Form.php b/app/code/Magento/Eav/Model/Form.php index 2ca49c90555db76ca03bf5af8fbbeb2bab434394..0d26dbfa43eb4b4e16642e6239e676e32f31d9ad 100644 --- a/app/code/Magento/Eav/Model/Form.php +++ b/app/code/Magento/Eav/Model/Form.php @@ -53,7 +53,7 @@ abstract class Form /** * Current store instance * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -126,7 +126,7 @@ abstract class Form protected $_validator = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -161,7 +161,7 @@ abstract class Form protected $_validatorConfigFactory; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Eav\Model\AttributeDataFactory $attrDataFactory @@ -172,7 +172,7 @@ abstract class Form * @throws \Magento\Model\Exception */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $eavConfig, \Magento\Module\Dir\Reader $modulesReader, \Magento\Eav\Model\AttributeDataFactory $attrDataFactory, @@ -226,7 +226,7 @@ abstract class Form /** * Set current store * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return $this */ public function setStore($store) @@ -277,7 +277,7 @@ abstract class Form /** * Return current store instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Eav/Model/Form/Fieldset.php b/app/code/Magento/Eav/Model/Form/Fieldset.php index 61175e140c31d75352dd5fc44ba3c02988ac5824..a276f0bbf1ab4222f4c1624ce2787522198c90b2 100644 --- a/app/code/Magento/Eav/Model/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Form/Fieldset.php @@ -50,14 +50,14 @@ class Fieldset extends \Magento\Model\AbstractModel protected $_eventPrefix = 'eav_form_fieldset'; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -65,7 +65,7 @@ class Fieldset extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() diff --git a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php index a0c60e77ab56929ce54ade0e7cbfc9b07d695e6c..d443dff0b1c88856795269ab0f96a9311e873145 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Attribute; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; /** * EAV additional attribute resource collection (Using Forms) @@ -61,7 +61,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C protected $_eavConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -71,7 +71,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -81,7 +81,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Eav/Model/Resource/Config.php b/app/code/Magento/Eav/Model/Resource/Config.php index d4b5fcb27869c78084355d6cc255412860bfe748..6aefb189979a37eb1623bd93b46cde5543fc7586 100644 --- a/app/code/Magento/Eav/Model/Resource/Config.php +++ b/app/code/Magento/Eav/Model/Resource/Config.php @@ -84,7 +84,7 @@ class Config extends \Magento\Model\Resource\Db\AbstractDb /** * Load attribute types * - * @param ind $typeId + * @param int $typeId * @return array */ protected function _loadTypeAttributes($typeId) diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php index d78e459d12df8a06882edaf01bf2a227ea0b04ba..ab979b3b3fa57ca02dce670267670e5a2628590e 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php @@ -47,7 +47,7 @@ class Attribute extends \Magento\Model\Resource\Db\AbstractDb protected static $_entityAttributes = array(); /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -60,12 +60,12 @@ class Attribute extends \Magento\Model\Resource\Db\AbstractDb * Class constructor * * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Type $eavEntityType */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, Type $eavEntityType ) { $this->_storeManager = $storeManager; @@ -557,7 +557,7 @@ class Attribute extends \Magento\Model\Resource\Db\AbstractDb 't1', 't1', 't1', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); if ($attribute->getFlatAddChildData()) { $joinCondition .= ' AND e.child_id = t1.entity_id'; diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php index 22777268d1b28ef7328c2901c369fcae1c6f31a5..2d26e2f9a979d4c4e1163d62bc364bac14621ac1 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php @@ -112,7 +112,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb 't1', 't1', 't1', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); if ($attribute->getFlatAddChildData()) { $joinCondition .= ' AND e.child_id = t1.entity_id'; diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php index 415d49834bf525121f3038b49b83e2c94dcc8643..2e2e256eadf8b38fa3f427f37044633fb1904440 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php @@ -47,7 +47,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected $_coreResource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -57,7 +57,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\App\Resource $coreResource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -67,7 +67,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\App\Resource $coreResource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php index c877b8cdea0f277f08fe3811460d2778a38da45b..7a620e397a16bca110d6560cfad075e585f513bf 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php @@ -51,7 +51,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Current store instance * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -63,7 +63,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected $_entityType; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -78,7 +78,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -88,7 +88,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -129,7 +129,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Set current store to collection * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return $this */ public function setStore($store) @@ -141,7 +141,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Return current store instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php index 192e3ebd30f89139be5dd3fa4e8830e5aef78f55..f41244f5d3e000c22f3f88aeb803c2358b570c7f 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php @@ -46,7 +46,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected $_storeId; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -55,7 +55,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -64,7 +64,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.0-1.6.0.1.php index ad18edf86ead0d848a838c0077970b23c35159cb..77a084b017d1469351f39e3f265cf385e4c4b27a 100644 --- a/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.0-1.6.0.1.php @@ -24,65 +24,65 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->createMigrationSetup(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'eav_attribute', 'attribute_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->appendClassAliasReplace( 'eav_attribute', 'backend_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->appendClassAliasReplace( 'eav_attribute', 'frontend_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->appendClassAliasReplace( 'eav_attribute', 'source_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('attribute_id') ); $installer->appendClassAliasReplace( 'eav_entity_type', 'entity_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('entity_type_id') ); $installer->appendClassAliasReplace( 'eav_entity_type', 'attribute_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('entity_type_id') ); $installer->appendClassAliasReplace( 'eav_entity_type', 'increment_model', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('entity_type_id') ); $installer->appendClassAliasReplace( 'eav_entity_type', 'entity_attribute_collection', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_RESOURCE, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('entity_type_id') ); diff --git a/app/code/Magento/Eav/etc/module.xml b/app/code/Magento/Eav/etc/module.xml index f8b6ebab93e6ab2b9023d238483d5f1191cbe7e4..fc99c4a1da42ff38d9eee1cc2416930514a25276 100644 --- a/app/code/Magento/Eav/etc/module.xml +++ b/app/code/Magento/Eav/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Eav" version="1.6.0.2" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> diff --git a/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php b/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php index bce36248fc7b862aa200a8d6aea91fe20f7dd8d7..e7dc3f5ab4d41c16c0cf66cc0342d5160bd34386 100644 --- a/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php +++ b/app/code/Magento/Eav/sql/eav_setup/install-1.6.0.0.php @@ -211,9 +211,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -304,9 +304,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_datetime', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_datetime', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -397,9 +397,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_decimal', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_decimal', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -490,9 +490,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_int', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_int', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -577,9 +577,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_text', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_text', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -670,9 +670,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_varchar', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_varchar', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -863,9 +863,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_entity_store', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_entity_store', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1147,9 +1147,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_attribute_option_value', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_attribute_option_value', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1204,9 +1204,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_attribute_label', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_attribute_label', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1268,9 +1268,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('eav_form_type', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('eav_form_type', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_form_type', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1407,9 +1407,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('eav_form_fieldset_label', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('eav_form_fieldset_label', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Email/Block/Adminhtml/Template.php b/app/code/Magento/Email/Block/Adminhtml/Template.php index 5b898cbd9abf8c2d93004cdbecc51090e2441136..284e69e82e7205554c2596e1662ed1f918e70b9a 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template.php @@ -49,13 +49,13 @@ class Template extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'add_button', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Template'), 'onclick' => "window.location='" . $this->getCreateUrl() . "'", - 'class' => 'add' + 'class' => 'add primary add-template' ) ); diff --git a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php index 51de80f10cfa882f5a057393515312f82463e4d0..853c0721d7dbf511e6107c1ae17ed39794ef56d7 100644 --- a/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Email/Block/Adminhtml/Template/Edit.php @@ -109,7 +109,7 @@ class Edit extends \Magento\Backend\Block\Widget */ protected function _prepareLayout() { - $this->setChild( + $this->getToolbar()->setChild( 'back_button', $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' @@ -121,7 +121,7 @@ class Edit extends \Magento\Backend\Block\Widget ) ) ); - $this->setChild( + $this->getToolbar()->setChild( 'reset_button', $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' @@ -129,56 +129,48 @@ class Edit extends \Magento\Backend\Block\Widget array('label' => __('Reset'), 'onclick' => 'window.location.href = window.location.href') ) ); - $this->setChild( - 'delete_button', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Button' - )->setData( - array( - 'label' => __('Delete Template'), - 'onclick' => 'templateControl.deleteTemplate();', - 'class' => 'delete' - ) - ) - ); - $this->setChild( - 'to_plain_button', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Button' - )->setData( - array( - 'label' => __('Convert to Plain Text'), - 'onclick' => 'templateControl.stripTags();', - 'id' => 'convert_button' + if ($this->getEditMode()) { + $this->getToolbar()->setChild( + 'delete_button', + $this->getLayout()->createBlock( + 'Magento\Backend\Block\Widget\Button' + )->setData( + array( + 'label' => __('Delete Template'), + 'onclick' => 'templateControl.deleteTemplate();', + 'class' => 'delete' + ) ) - ) - ); - $this->setChild( - 'to_html_button', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Button' - )->setData( - array( - 'label' => __('Return Html Version'), - 'onclick' => 'templateControl.unStripTags();', - 'id' => 'convert_button_back', - 'style' => 'display:none' + ); + } + if (!$this->isTextType()) { + $this->getToolbar()->setChild( + 'to_plain_button', + $this->getLayout()->createBlock( + 'Magento\Backend\Block\Widget\Button' + )->setData( + array( + 'label' => __('Convert to Plain Text'), + 'onclick' => 'templateControl.stripTags();', + 'id' => 'convert_button' + ) ) - ) - ); - $this->setChild( - 'toggle_button', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Widget\Button' - )->setData( - array( - 'label' => __('Toggle Editor'), - 'onclick' => 'templateControl.toggleEditor();', - 'id' => 'toggle_button' + ); + $this->getToolbar()->setChild( + 'to_html_button', + $this->getLayout()->createBlock( + 'Magento\Backend\Block\Widget\Button' + )->setData( + array( + 'label' => __('Return Html Version'), + 'onclick' => 'templateControl.unStripTags();', + 'id' => 'convert_button_back', + 'style' => 'display:none' + ) ) - ) - ); - $this->setChild( + ); + } + $this->getToolbar()->setChild( 'preview_button', $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' @@ -186,12 +178,16 @@ class Edit extends \Magento\Backend\Block\Widget array('label' => __('Preview Template'), 'onclick' => 'templateControl.preview();') ) ); - $this->setChild( + $this->getToolbar()->setChild( 'save_button', $this->getLayout()->createBlock( 'Magento\Backend\Block\Widget\Button' )->setData( - array('label' => __('Save Template'), 'onclick' => 'templateControl.save();', 'class' => 'save') + array( + 'label' => __('Save Template'), + 'onclick' => 'templateControl.save();', + 'class' => 'save primary save-template' + ) ) ); $this->setChild( @@ -252,86 +248,6 @@ class Edit extends \Magento\Backend\Block\Widget return $options; } - /** - * Get the html element for back button - * - * @return string - */ - public function getBackButtonHtml() - { - return $this->getChildHtml('back_button'); - } - - /** - * Get the html element for toggle button - * - * @return string - */ - public function getToggleButtonHtml() - { - return $this->getChildHtml('toggle_button'); - } - - /** - * Get the html element for reset button - * - * @return string - */ - public function getResetButtonHtml() - { - return $this->getChildHtml('reset_button'); - } - - /** - * Get the html element for to plain button - * - * @return string - */ - public function getToPlainButtonHtml() - { - return $this->getChildHtml('to_plain_button'); - } - - /** - * Get the 'to html' button - * - * @return string - */ - public function getToHtmlButtonHtml() - { - return $this->getChildHtml('to_html_button'); - } - - /** - * Get the html element for save button - * - * @return string - */ - public function getSaveButtonHtml() - { - return $this->getChildHtml('save_button'); - } - - /** - * Get the html element for preview button - * - * @return string - */ - public function getPreviewButtonHtml() - { - return $this->getChildHtml('preview_button'); - } - - /** - * Get the html element for delete button - * - * @return string - */ - public function getDeleteButtonHtml() - { - return $this->getChildHtml('delete_button'); - } - /** * Get the html element for load button * diff --git a/app/code/Magento/Email/Model/AbstractTemplate.php b/app/code/Magento/Email/Model/AbstractTemplate.php index 424349458e2a85878625f4984848b5cc37d04a78..570036f3695bc8dedd6031b22b12e5c12fc2532b 100644 --- a/app/code/Magento/Email/Model/AbstractTemplate.php +++ b/app/code/Magento/Email/Model/AbstractTemplate.php @@ -88,7 +88,7 @@ abstract class AbstractTemplate extends \Magento\Model\AbstractModel implements protected $_appEmulation; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -97,7 +97,7 @@ abstract class AbstractTemplate extends \Magento\Model\AbstractModel implements * @param \Magento\View\DesignInterface $design * @param \Magento\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( @@ -105,7 +105,7 @@ abstract class AbstractTemplate extends \Magento\Model\AbstractModel implements \Magento\View\DesignInterface $design, \Magento\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { $this->_design = $design; diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php index 1dba158d0a7bcd3043c2c7a2ff98fd0253dd8297..15a8cd92dd423a3c6f6727cad61e7c4e11d9068b 100644 --- a/app/code/Magento/Email/Model/BackendTemplate.php +++ b/app/code/Magento/Email/Model/BackendTemplate.php @@ -30,11 +30,6 @@ namespace Magento\Email\Model; */ class BackendTemplate extends Template { - /** - * @var \Magento\App\ConfigInterface - */ - protected $_coreConfig; - /** * @var \Magento\Backend\Model\Config\Structure */ @@ -45,12 +40,11 @@ class BackendTemplate extends Template * @param \Magento\View\DesignInterface $design * @param \Magento\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Email\Model\Template\FilterFactory $emailFilterFactory * @param \Magento\Email\Model\Template\Config $emailConfig * @param \Magento\Backend\Model\Config\Structure $structure @@ -63,12 +57,11 @@ class BackendTemplate extends Template \Magento\View\DesignInterface $design, \Magento\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Email\Model\Template\FilterFactory $emailFilterFactory, \Magento\Email\Model\Template\Config $emailConfig, \Magento\Backend\Model\Config\Structure $structure, @@ -83,8 +76,7 @@ class BackendTemplate extends Template $filesystem, $viewUrl, $viewFileSystem, - $coreStoreConfig, - $coreConfig, + $scopeConfig, $emailFilterFactory, $emailConfig, $data @@ -104,7 +96,7 @@ class BackendTemplate extends Template return array(); } - $configData = $this->_coreConfig->getValue(null, 'default'); + $configData = $this->_scopeConfig->getValue(null, \Magento\App\ScopeInterface::SCOPE_DEFAULT); $paths = $this->_findEmailTemplateUsages($templateCode, $configData, ''); return $paths; } diff --git a/app/code/Magento/Email/Model/Source/Variables.php b/app/code/Magento/Email/Model/Source/Variables.php index d72f1073ab3d37bc03fc615abc8c50389936d51f..0f41bc691b4164e2c6712a3833c40e9f470dcbe0 100644 --- a/app/code/Magento/Email/Model/Source/Variables.php +++ b/app/code/Magento/Email/Model/Source/Variables.php @@ -48,10 +48,10 @@ class Variables implements \Magento\Option\ArrayInterface { $this->_configVariables = array( array( - 'value' => \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, + 'value' => \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'label' => __('Base Unsecure URL') ), - array('value' => \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, 'label' => __('Base Secure URL')), + array('value' => \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'label' => __('Base Secure URL')), array('value' => 'trans_email/ident_general/name', 'label' => __('General Contact Name')), array('value' => 'trans_email/ident_general/email', 'label' => __('General Contact Email')), array('value' => 'trans_email/ident_sales/name', 'label' => __('Sales Representative Contact Name')), diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index 47204cc6b9934c35d38d246870be0a416de982da..05924eb9963dd4f6897fd54b7eb1227be6fc9359 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -28,6 +28,7 @@ namespace Magento\Email\Model; use Magento\Model\Exception; use Magento\Email\Model\Template\Filter; use Magento\Filter\Template as FilterTemplate; +use Magento\Store\Model\StoreManagerInterface; /** * Template model @@ -36,7 +37,10 @@ use Magento\Filter\Template as FilterTemplate; * * // Loading of template * \Magento\Email\Model\TemplateFactory $templateFactory - * $templateFactory->create()->load($this->_coreStoreConfig->getConfig('path_to_email_template_id_config')); + * $templateFactory->create()->load($this->_scopeConfig->getValue( + * 'path_to_email_template_id_config', + * \Magento\Store\Model\ScopeInterface::SCOPE_STORE + * )); * $variables = array( * 'someObject' => $this->_coreResourceEmailTemplate * 'someString' => 'Some string value' @@ -149,11 +153,11 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento protected $_viewFileSystem; /** - * Core store config + * Scope config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Email\Model\Template\Config @@ -174,12 +178,11 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento * @param \Magento\View\DesignInterface $design * @param \Magento\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param Template\FilterFactory $emailFilterFactory * @param Template\Config $emailConfig * @param array $data @@ -191,21 +194,19 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento \Magento\View\DesignInterface $design, \Magento\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + StoreManagerInterface $storeManager, \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Email\Model\Template\FilterFactory $emailFilterFactory, \Magento\Email\Model\Template\Config $emailConfig, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_filesystem = $filesystem; $this->_viewUrl = $viewUrl; $this->_viewFileSystem = $viewFileSystem; - $this->_coreConfig = $coreConfig; $this->_emailFilterFactory = $emailFilterFactory; $this->_emailConfig = $emailConfig; parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $data); @@ -224,13 +225,17 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento /** * Return logo URL for emails. Take logo from theme if custom logo is undefined * - * @param \Magento\Core\Model\Store|int|string $store + * @param \Magento\Store\Model\Store|int|string $store * @return string */ protected function _getLogoUrl($store) { $store = $this->_storeManager->getStore($store); - $fileName = $store->getConfig(self::XML_PATH_DESIGN_EMAIL_LOGO); + $fileName = $this->_scopeConfig->getValue( + self::XML_PATH_DESIGN_EMAIL_LOGO, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if ($fileName) { $uploadDir = \Magento\Backend\Model\Config\Backend\Email\Logo::UPLOAD_DIR; $mediaDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); @@ -259,13 +264,17 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento /** * Return logo alt for emails * - * @param \Magento\Core\Model\Store|int|string $store + * @param \Magento\Store\Model\Store|int|string $store * @return string */ protected function _getLogoAlt($store) { $store = $this->_storeManager->getStore($store); - $alt = $store->getConfig(self::XML_PATH_DESIGN_EMAIL_LOGO_ALT); + $alt = $this->_scopeConfig->getValue( + self::XML_PATH_DESIGN_EMAIL_LOGO_ALT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if ($alt) { return $alt; } @@ -384,8 +393,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate implements \Magento */ public function isValidForSend() { - return !$this->_coreStoreConfig->getConfigFlag( - 'system/smtp/disable' + return !$this->_scopeConfig->isSetFlag( + 'system/smtp/disable', + ScopeInterface::SCOPE_STORE ) && $this->getSenderName() && $this->getSenderEmail() && $this->getTemplateSubject(); } diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index f741a003c5af2aeb6268bc8cb9d568a35f0b0c24..6038198882348747c5ab5a17c147c8129317821f 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -89,7 +89,7 @@ class Filter extends \Magento\Filter\Template protected $_variableFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -106,9 +106,9 @@ class Filter extends \Magento\Filter\Template /** * Setup callbacks for filters * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Layout directive params @@ -129,9 +129,9 @@ class Filter extends \Magento\Filter\Template * @param \Magento\Logger $logger * @param \Magento\Escaper $escaper * @param \Magento\View\Url $viewUrl - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Model\VariableFactory $coreVariableFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\LayoutFactory $layoutFactory * @param \Magento\App\State $appState @@ -144,9 +144,9 @@ class Filter extends \Magento\Filter\Template \Magento\Logger $logger, \Magento\Escaper $escaper, \Magento\View\Url $viewUrl, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Model\VariableFactory $coreVariableFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\View\LayoutFactory $layoutFactory, \Magento\App\State $appState, @@ -155,7 +155,7 @@ class Filter extends \Magento\Filter\Template $this->_escaper = $escaper; $this->_viewUrl = $viewUrl; $this->_logger = $logger; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_modifiers['escape'] = array($this, 'modifierEscape'); $this->_variableFactory = $coreVariableFactory; $this->_storeManager = $storeManager; @@ -518,6 +518,7 @@ class Filter extends \Magento\Filter\Template * also allow additional parameter "store" * * @param string[] $construction + * @throws \Magento\Mail\Exception * @return string */ public function protocolDirective($construction) @@ -525,7 +526,11 @@ class Filter extends \Magento\Filter\Template $params = $this->_getIncludeParameters($construction[2]); $store = null; if (isset($params['store'])) { - $store = $this->_storeManager->getSafeStore($params['store']); + try { + $store = $this->_storeManager->getStore($params['store']); + } catch (\Exception $e) { + throw new \Magento\Mail\Exception(__('Requested invalid store "%1"', $params['store'])); + } } $isSecure = $this->_storeManager->getStore($store)->isCurrentlySecure(); $protocol = $isSecure ? 'https' : 'http'; @@ -553,7 +558,11 @@ class Filter extends \Magento\Filter\Template $params = $this->_getIncludeParameters($construction[2]); $storeId = $this->getStoreId(); if (isset($params['path'])) { - $configValue = $this->_coreStoreConfig->getConfig($params['path'], $storeId); + $configValue = $this->_scopeConfig->getValue( + $params['path'], + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } return $configValue; } @@ -574,9 +583,9 @@ class Filter extends \Magento\Filter\Template )->loadByCode( $params['code'] ); - $mode = $this->_plainTemplateMode ? - \Magento\Core\Model\Variable::TYPE_TEXT : - \Magento\Core\Model\Variable::TYPE_HTML; + $mode = $this->_plainTemplateMode + ? \Magento\Core\Model\Variable::TYPE_TEXT + : \Magento\Core\Model\Variable::TYPE_HTML; $value = $variable->getValue($mode); if ($value) { $customVarValue = $value; diff --git a/app/code/Magento/Email/Model/Template/SenderResolver.php b/app/code/Magento/Email/Model/Template/SenderResolver.php index 1391220a01193f9f53c3e7d98d32302de937becf..2f167cf57a0a4207e92fbf3f3be00929156d0b7c 100644 --- a/app/code/Magento/Email/Model/Template/SenderResolver.php +++ b/app/code/Magento/Email/Model/Template/SenderResolver.php @@ -30,16 +30,16 @@ class SenderResolver implements \Magento\Mail\Template\SenderResolverInterface /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\ConfigInterface $coreStoreConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -50,8 +50,16 @@ class SenderResolver implements \Magento\Mail\Template\SenderResolverInterface $result = array(); if (!is_array($sender)) { - $result['name'] = $this->_storeConfig->getConfig('trans_email/ident_' . $sender . '/name', $scopeId); - $result['email'] = $this->_storeConfig->getConfig('trans_email/ident_' . $sender . '/email', $scopeId); + $result['name'] = $this->_scopeConfig->getValue( + 'trans_email/ident_' . $sender . '/name', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $scopeId + ); + $result['email'] = $this->_scopeConfig->getValue( + 'trans_email/ident_' . $sender . '/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $scopeId + ); } else { $result = $sender; } diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index d37d8ccd7db146c2e0cadaf21cdcaf4170b8ee79..6c97e291052c3870cd6ba988dc1d0b34ccd5a4de 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -27,13 +27,15 @@ <module name="Magento_Email" version="1.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Cms"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> - <module name="Magento_Cms" /> - <module name="Magento_Backend" /> - <module name="Magento_Theme" /> + <module name="Magento_Cms"/> + <module name="Magento_Backend"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php b/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php index 27b195f91c0714c6ec334e4594c4c02e4a686039..ce1a98fc644ca23737fa49a864932ff3358d12a3 100644 --- a/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php +++ b/app/code/Magento/Email/sql/email_setup/install-1.0.0.0.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; /** diff --git a/app/code/Magento/Email/view/adminhtml/template/edit.phtml b/app/code/Magento/Email/view/adminhtml/template/edit.phtml index ab4856acf5f9dd95dea0516db4e4863f2ab2bd63..c81dfbf3108ad8d7fa589928e9fe41ba1e103e2b 100644 --- a/app/code/Magento/Email/view/adminhtml/template/edit.phtml +++ b/app/code/Magento/Email/view/adminhtml/template/edit.phtml @@ -24,19 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml(); ?> - <?php echo $this->getResetButtonHtml(); ?> - <?php if($this->getEditMode()): ?> - <?php echo $this->getDeleteButtonHtml(); ?> - <?php endif ?> - <?php if(!$this->isTextType()): ?> - <?php echo $this->getToPlainButtonHtml(); ?> - <?php echo $this->getToHtmlButtonHtml(); ?> - <?php endif ?> - <?php echo $this->getPreviewButtonHtml(); ?> - <?php echo $this->getSaveButtonHtml(); ?> -</div> <?php if (!$this->getEditMode()): ?> <form action="<?php echo $this->getLoadUrl() ?>" method="post" id="email_template_load_form"> <?php echo $this->getBlockHtml('formkey')?> diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 0a43f6bed2c07b23fea72081de6f63a559ce26db..f490c472edf380d3d057aa9fb88cb00b1b414bf0 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -113,7 +113,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C protected $_customizableContainerTypes = array('YOUR_PACKAGING'); /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -128,7 +128,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C protected $_productCollectionFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory @@ -142,7 +142,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Module\Dir\Reader $configReader * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data @@ -150,7 +150,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, @@ -164,7 +164,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Module\Dir\Reader $configReader, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, array $data = array() @@ -172,7 +172,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $this->_storeManager = $storeManager; $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( - $coreStoreConfig, + $scopeConfig, $rateErrorFactory, $logAdapterFactory, $xmlElFactory, @@ -303,8 +303,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C if ($request->getOrigCountry()) { $origCountry = $request->getOrigCountry(); } else { - $origCountry = $this->_coreStoreConfig->getConfig( + $origCountry = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ); } @@ -314,8 +315,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $r->setOrigPostal($request->getOrigPostcode()); } else { $r->setOrigPostal( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -429,12 +431,14 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'Amount' => $r->getValue(), 'Currency' => $this->getCurrencyCode() ); - } else if ($purpose == self::RATE_REQUEST_SMARTPOST) { - $ratesRequest['RequestedShipment']['ServiceType'] = self::RATE_REQUEST_SMARTPOST; - $ratesRequest['RequestedShipment']['SmartPostDetail'] = array( - 'Indicia' => (double)$r->getWeight() >= 1 ? 'PARCEL_SELECT' : 'PRESORTED_STANDARD', - 'HubId' => $this->getConfigData('smartpost_hubid') - ); + } else { + if ($purpose == self::RATE_REQUEST_SMARTPOST) { + $ratesRequest['RequestedShipment']['ServiceType'] = self::RATE_REQUEST_SMARTPOST; + $ratesRequest['RequestedShipment']['SmartPostDetail'] = array( + 'Indicia' => (double)$r->getWeight() >= 1 ? 'PARCEL_SELECT' : 'PRESORTED_STANDARD', + 'HubId' => $this->getConfigData('smartpost_hubid') + ); + } } return $ratesRequest; @@ -941,21 +945,21 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C public function getCurrencyCode() { $codes = array( - 'DOP' => 'RDD', // Dominican Peso - 'XCD' => 'ECD', // Caribbean Dollars - 'ARS' => 'ARN', // Argentina Peso - 'SGD' => 'SID', // Singapore Dollars - 'KRW' => 'WON', // South Korea Won - 'JMD' => 'JAD', // Jamaican Dollars - 'CHF' => 'SFR', // Swiss Francs - 'JPY' => 'JYE', // Japanese Yen - 'KWD' => 'KUD', // Kuwaiti Dinars - 'GBP' => 'UKL', // British Pounds - 'AED' => 'DHS', // UAE Dirhams - 'MXN' => 'NMP', // Mexican Pesos - 'UYU' => 'UYP', // Uruguay New Pesos - 'CLP' => 'CHP', // Chilean Pesos - 'TWD' => 'NTD', // New Taiwan Dollars + 'DOP' => 'RDD', + 'XCD' => 'ECD', + 'ARS' => 'ARN', + 'SGD' => 'SID', + 'KRW' => 'WON', + 'JMD' => 'JAD', + 'CHF' => 'SFR', + 'JPY' => 'JYE', + 'KWD' => 'KUD', + 'GBP' => 'UKL', + 'AED' => 'DHS', + 'MXN' => 'NMP', + 'UYU' => 'UYP', + 'CLP' => 'CHP', + 'TWD' => 'NTD' ); $currencyCode = $this->_storeManager->getStore()->getBaseCurrencyCode(); return isset($codes[$currencyCode]) ? $codes[$currencyCode] : $currencyCode; @@ -1018,10 +1022,6 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C ), 'Version' => array('ServiceId' => 'trck', 'Major' => '5', 'Intermediate' => '0', 'Minor' => '0'), 'PackageIdentifier' => array('Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $tracking), - /* - * 0 = summary data, one signle scan structure with the most recent scan - * 1 = multiple sacn activity for each package - */ 'IncludeDetailedScans' => 1 ); $requestString = serialize($trackRequest); @@ -1315,8 +1315,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'PaymentType' => $paymentType, 'Payor' => array( 'AccountNumber' => $this->getConfigData('account'), - 'CountryCode' => $this->_coreStoreConfig->getConfig( + 'CountryCode' => $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ) @@ -1351,8 +1352,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'PaymentType' => $paymentType, 'Payor' => array( 'AccountNumber' => $this->getConfigData('account'), - 'CountryCode' => $this->_coreStoreConfig->getConfig( + 'CountryCode' => $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ) @@ -1470,18 +1472,24 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $method == 'FEDEX_GROUND' ) { return array('YOUR_PACKAGING' => __('Your Packaging')); - } else if ($method == 'INTERNATIONAL_ECONOMY' || $method == 'INTERNATIONAL_FIRST') { - $allTypes = $this->getContainerTypesAll(); - $exclude = array('FEDEX_10KG_BOX' => '', 'FEDEX_25KG_BOX' => ''); - return array_diff_key($allTypes, $exclude); - } else if ($method == 'EUROPE_FIRST_INTERNATIONAL_PRIORITY') { - $allTypes = $this->getContainerTypesAll(); - $exclude = array('FEDEX_BOX' => '', 'FEDEX_TUBE' => ''); - return array_diff_key($allTypes, $exclude); - } else if ($countryShipper == self::CANADA_COUNTRY_ID && $countryRecipient == self::CANADA_COUNTRY_ID) { - // hack for Canada domestic. Apply the same filter rules as for US domestic - $params->setCountryShipper(self::USA_COUNTRY_ID); - $params->setCountryRecipient(self::USA_COUNTRY_ID); + } else { + if ($method == 'INTERNATIONAL_ECONOMY' || $method == 'INTERNATIONAL_FIRST') { + $allTypes = $this->getContainerTypesAll(); + $exclude = array('FEDEX_10KG_BOX' => '', 'FEDEX_25KG_BOX' => ''); + return array_diff_key($allTypes, $exclude); + } else { + if ($method == 'EUROPE_FIRST_INTERNATIONAL_PRIORITY') { + $allTypes = $this->getContainerTypesAll(); + $exclude = array('FEDEX_BOX' => '', 'FEDEX_TUBE' => ''); + return array_diff_key($allTypes, $exclude); + } else { + if ($countryShipper == self::CANADA_COUNTRY_ID && $countryRecipient == self::CANADA_COUNTRY_ID) { + // hack for Canada domestic. Apply the same filter rules as for US domestic + $params->setCountryShipper(self::USA_COUNTRY_ID); + $params->setCountryRecipient(self::USA_COUNTRY_ID); + } + } + } } return $this->_getAllowedContainers($params); diff --git a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php b/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php index b9cd4b4e0d5b8f4a0166cf17bc84beae6bf81fde..cdef0c92fdbeb46bc924b821b4870fabe7b6e522 100644 --- a/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php +++ b/app/code/Magento/Fedex/Model/Plugin/Rma/Block/Adminhtml/Rma/Edit/Tab/General/Shippingmethod.php @@ -29,16 +29,16 @@ namespace Magento\Fedex\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General; class Shippingmethod { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** diff --git a/app/code/Magento/Fedex/etc/di.xml b/app/code/Magento/Fedex/etc/di.xml index 076128e59bff85330a4f03b79d66d1ca2be4facb..d6194a25fdfeea4a92c3355c068b2e3e746bba9a 100644 --- a/app/code/Magento/Fedex/etc/di.xml +++ b/app/code/Magento/Fedex/etc/di.xml @@ -24,13 +24,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <type name="Magento\Module\Updater\SetupFactory"> - <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="fedex_setup" xsi:type="string">Magento\Core\Model\Resource\Setup</item> - </argument> - </arguments> - </type> <type name="Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"> <plugin name="rma_tab_shippingmethod_fedex" type="Magento\Fedex\Model\Plugin\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shippingmethod"/> diff --git a/app/code/Magento/Fedex/etc/module.xml b/app/code/Magento/Fedex/etc/module.xml index c349e8c53bf0f83343a89a5e623b1f760aa07f92..c653a069c19ff029d703d9b867f97cb85eec0c4c 100644 --- a/app/code/Magento/Fedex/etc/module.xml +++ b/app/code/Magento/Fedex/etc/module.xml @@ -26,6 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Fedex" version="2.0.0.0" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Shipping"/> <module name="Magento_Directory"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php b/app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php index 3548192c0b3fac86529ad79d6073da210a636597..e58847892385e0a48cc3225be09b2be0f4f8aacc 100644 --- a/app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php +++ b/app/code/Magento/Fedex/sql/fedex_setup/install-2.0.0.0.php @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\Resource\Setup $this */ +/** @var \Magento\Module\Setup $this */ $codes = array( 'method' => array( 'EUROPEFIRSTINTERNATIONALPRIORITY' => 'EUROPE_FIRST_INTERNATIONAL_PRIORITY', @@ -65,7 +65,7 @@ $codes = array( ) ); -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $configDataTable = $installer->getTable('core_config_data'); $conn = $installer->getConnection(); diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php index 16008b0b36733bbc83f8ee5813549336949b9e25..e0f491a5f084c296141ed43ba02aa28b510b526f 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php @@ -37,25 +37,25 @@ class Config extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection * @param \Magento\Escaper $escaper - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data */ public function __construct( \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Escaper $escaper, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } @@ -66,8 +66,9 @@ class Config extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Config */ protected function _getValueFromConfig() { - return $this->_coreStoreConfig->getConfig( - \Magento\GiftMessage\Helper\Message::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS + return $this->_scopeConfig->getValue( + \Magento\GiftMessage\Helper\Message::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } } diff --git a/app/code/Magento/GiftMessage/Helper/Message.php b/app/code/Magento/GiftMessage/Helper/Message.php index e4bbb908b0d69f959ba4acd4917a310e325ae1d0..3f5e283babea650b8d31ca6a953e3d0c7c2c670c 100644 --- a/app/code/Magento/GiftMessage/Helper/Message.php +++ b/app/code/Magento/GiftMessage/Helper/Message.php @@ -74,8 +74,8 @@ class Message extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\View\LayoutFactory $layoutFactory @@ -85,8 +85,8 @@ class Message extends \Magento\Core\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\View\LayoutFactory $layoutFactory, @@ -98,7 +98,7 @@ class Message extends \Magento\Core\Helper\Data $this->_productFactory = $productFactory; $this->_layoutFactory = $layoutFactory; $this->_giftMessageFactory = $giftMessageFactory; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** @@ -132,7 +132,7 @@ class Message extends \Magento\Core\Helper\Data * * @param string $type * @param \Magento\Object $entity - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool|string|null */ public function isMessagesAvailable($type, \Magento\Object $entity, $store = null) @@ -140,7 +140,7 @@ class Message extends \Magento\Core\Helper\Data if ($type == 'items') { $items = $entity->getAllItems(); if (!is_array($items) || empty($items)) { - return $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); + return $this->_scopeConfig->getValue(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } if ($entity instanceof \Magento\Sales\Model\Quote) { $_type = $entity->getIsMultiShipping() ? 'address_item' : 'item'; @@ -176,7 +176,7 @@ class Message extends \Magento\Core\Helper\Data $store ); } else { - return $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store); + return $this->_scopeConfig->getValue(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } return false; } @@ -185,12 +185,12 @@ class Message extends \Magento\Core\Helper\Data * Check availablity of gift messages from store config if flag eq 2. * * @param bool $productGiftMessageAllow - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool|string|null */ protected function _getDependenceFromStoreConfig($productGiftMessageAllow, $store = null) { - $result = $this->_coreStoreConfig->getConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); + $result = $this->_scopeConfig->getValue(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); if ($productGiftMessageAllow === '' || is_null($productGiftMessageAllow)) { return $result; } else { @@ -203,7 +203,7 @@ class Message extends \Magento\Core\Helper\Data * * @param string $type * @param \Magento\Object $entity - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool|null|string */ public function getIsMessagesAvailable($type, \Magento\Object $entity, $store = null) @@ -285,7 +285,7 @@ class Message extends \Magento\Core\Helper\Data * Check availability for onepage checkout items * * @param array $quote - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool */ public function getAvailableForQuoteItems($quote, $store = null) @@ -302,7 +302,7 @@ class Message extends \Magento\Core\Helper\Data * Check availability for multishipping checkout items * * @param array $items - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool */ public function getAvailableForAddressItems($items, $store = null) diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php index ddfa02f565fcea00112d4e1cd58727395b508fcc..ce0fb357b72df72ae979189df6424986821e0fa0 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Setup.php @@ -37,7 +37,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup * @param string $resourceName * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory * @param string $moduleName * @param string $connectionName @@ -47,10 +47,10 @@ class Setup extends \Magento\Sales\Model\Resource\Setup $resourceName, \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory, $moduleName = 'Magento_GiftMessage', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_catalogSetupFactory = $catalogSetupFactory; parent::__construct( diff --git a/app/code/Magento/GiftMessage/etc/di.xml b/app/code/Magento/GiftMessage/etc/di.xml index fee254b98384b7ddf6a17051b7a6e75b2612e2f7..9ac77fa48e5e13ccc150deda471e5aefeffc4cb2 100644 --- a/app/code/Magento/GiftMessage/etc/di.xml +++ b/app/code/Magento/GiftMessage/etc/di.xml @@ -31,4 +31,11 @@ </argument> </arguments> </type> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="giftmessage" xsi:type="string">Magento_GiftMessage</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/GiftMessage/etc/module.xml b/app/code/Magento/GiftMessage/etc/module.xml index e79d6806273bda91982e4007392a824d458e7203..172a19bd70c3393c647a39ba53d8fadd398b3ef0 100644 --- a/app/code/Magento/GiftMessage/etc/module.xml +++ b/app/code/Magento/GiftMessage/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Sales"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Multishipping"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/GoogleAdwords/Helper/Data.php b/app/code/Magento/GoogleAdwords/Helper/Data.php index 0c0d37ea75bbe7455b0127eae2d92f5c32ed5425..8e9c4d171966221c5b68ee3657d7e71c3e0aceb3 100644 --- a/app/code/Magento/GoogleAdwords/Helper/Data.php +++ b/app/code/Magento/GoogleAdwords/Helper/Data.php @@ -86,14 +86,14 @@ class Data extends \Magento\App\Helper\AbstractHelper /**#@-*/ /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\Registry @@ -102,19 +102,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Registry $registry */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Registry $registry ) { parent::__construct($context); $this->_config = $config; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_registry = $registry; } @@ -125,8 +125,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isGoogleAdwordsActive() { - return $this->_storeConfig->getConfigFlag( - self::XML_PATH_ACTIVE + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_ACTIVE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && $this->getConversionId() && $this->getConversionLanguage() && @@ -188,7 +189,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionId() { - return (int)$this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_ID); + return (int)$this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -198,7 +202,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionLanguage() { - return $this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_LANGUAGE); + return $this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_LANGUAGE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -208,7 +215,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionFormat() { - return $this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_FORMAT); + return $this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_FORMAT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -218,7 +228,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionColor() { - return $this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_COLOR); + return $this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_COLOR, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -228,7 +241,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionLabel() { - return $this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_LABEL); + return $this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_LABEL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -238,7 +254,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionValueType() { - return $this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_VALUE_TYPE); + return $this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_VALUE_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -258,7 +277,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getConversionValueConstant() { - return (double)$this->_storeConfig->getConfig(self::XML_PATH_CONVERSION_VALUE); + return (double)$this->_scopeConfig->getValue( + self::XML_PATH_CONVERSION_VALUE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php index 6d4c08c95fe833316e7feaeb2f78336ad7e7dc9d..2b194a858e34bdfd1e62261c2401538482a1e93e 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php @@ -28,7 +28,7 @@ namespace Magento\GoogleAdwords\Model\Config\Backend; /** * @SuppressWarnings(PHPMD.LongVariable) */ -abstract class AbstractConversion extends \Magento\Core\Model\Config\Value +abstract class AbstractConversion extends \Magento\App\Config\Value { /** * @var \Magento\Validator\Object @@ -43,8 +43,7 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Validator\ObjectFactory $validatorCompositeFactory * @param \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory * @param \Magento\Model\Resource\AbstractResource $resource @@ -54,15 +53,14 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Validator\ObjectFactory $validatorCompositeFactory, \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); $this->_validatorFactory = $validatorFactory; $this->_validatorComposite = $validatorCompositeFactory->create(); diff --git a/app/code/Magento/GoogleAdwords/etc/module.xml b/app/code/Magento/GoogleAdwords/etc/module.xml index 84dc5daa82511aa070b2ae564d3217d2bc8e94de..8e74e1f064e51d4aa2f9a9b33d447313190ff3ea 100644 --- a/app/code/Magento/GoogleAdwords/etc/module.xml +++ b/app/code/Magento/GoogleAdwords/etc/module.xml @@ -29,7 +29,7 @@ <module name="Magento_Checkout"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Sales"/> </depends> </module> diff --git a/app/code/Magento/GoogleAnalytics/Block/Ga.php b/app/code/Magento/GoogleAnalytics/Block/Ga.php index 04f2dea9862c0b9b58826afc6b9a7cf9658985a5..e11c808e87b92d42b2d7e2b48df9f89d30ccaf3f 100644 --- a/app/code/Magento/GoogleAnalytics/Block/Ga.php +++ b/app/code/Magento/GoogleAnalytics/Block/Ga.php @@ -27,10 +27,6 @@ namespace Magento\GoogleAnalytics\Block; /** * GoogleAnalitics Page Block - * - * @category Magento - * @package Magento_GoogleAnalytics - * @author Magento Core Team <core@magentocommerce.com> */ class Ga extends \Magento\View\Element\Template { @@ -71,7 +67,7 @@ class Ga extends \Magento\View\Element\Template */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/GoogleAnalytics/Helper/Data.php b/app/code/Magento/GoogleAnalytics/Helper/Data.php index bc68275657c7b9c2f9837e06c2993c2cdea1cc53..de758157c44e4cb4f643a29e60caaf46e8d04e9e 100644 --- a/app/code/Magento/GoogleAnalytics/Helper/Data.php +++ b/app/code/Magento/GoogleAnalytics/Helper/Data.php @@ -25,7 +25,7 @@ */ namespace Magento\GoogleAnalytics\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * GoogleAnalytics data helper @@ -45,19 +45,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -69,7 +69,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isGoogleAnalyticsAvailable($store = null) { - $accountId = $this->_coreStoreConfig->getConfig(self::XML_PATH_ACCOUNT, $store); - return $accountId && $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ACTIVE, $store); + $accountId = $this->_scopeConfig->getValue(self::XML_PATH_ACCOUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); + return $accountId && $this->_scopeConfig->isSetFlag(self::XML_PATH_ACTIVE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } } diff --git a/app/code/Magento/GoogleAnalytics/Model/Observer.php b/app/code/Magento/GoogleAnalytics/Model/Observer.php index 3e47769f7529b4854a2df4a7e64fa34b631e76d8..53f0b284ec310affa4e7f4e71246f8a4dffa7ac3 100644 --- a/app/code/Magento/GoogleAnalytics/Model/Observer.php +++ b/app/code/Magento/GoogleAnalytics/Model/Observer.php @@ -48,17 +48,17 @@ class Observer protected $_layout; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout * @param \Magento\GoogleAnalytics\Helper\Data $googleAnalyticsData */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\GoogleAnalytics\Helper\Data $googleAnalyticsData ) { diff --git a/app/code/Magento/GoogleAnalytics/etc/di.xml b/app/code/Magento/GoogleAnalytics/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..3151816148df5bcfb134092099f5a27063d7c18e --- /dev/null +++ b/app/code/Magento/GoogleAnalytics/etc/di.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="googleanalytics" xsi:type="string">Magento_GoogleAnalytics</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/GoogleAnalytics/etc/module.xml b/app/code/Magento/GoogleAnalytics/etc/module.xml index 61dfa23e4de900ef068fb1de014ef84349e17ff4..c88702e1a6a13e28478101041726ff53cdebc4e8 100644 --- a/app/code/Magento/GoogleAnalytics/etc/module.xml +++ b/app/code/Magento/GoogleAnalytics/etc/module.xml @@ -27,9 +27,10 @@ <module name="Magento_GoogleAnalytics" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Sales"/> </depends> </module> diff --git a/app/code/Magento/GoogleAnalytics/view/frontend/ga.phtml b/app/code/Magento/GoogleAnalytics/view/frontend/ga.phtml index d6500958978f4268cf9567ecab64e6653f0f7d81..741da36a5d1a48334d169ad8db50a1a09c5f12a4 100644 --- a/app/code/Magento/GoogleAnalytics/view/frontend/ga.phtml +++ b/app/code/Magento/GoogleAnalytics/view/frontend/ga.phtml @@ -25,7 +25,7 @@ */ ?> <?php /** @var $this \Magento\GoogleAnalytics\Block\Ga */ ?> -<?php if (!$this->helper('Magento\Core\Helper\Cookie')->isUserNotAllowSaveCookie()): ?> +<?php if (!$this->helper('Magento\Store\Helper\Cookie')->isUserNotAllowSaveCookie()): ?> <?php $accountId = $this->getConfig(\Magento\GoogleAnalytics\Helper\Data::XML_PATH_ACCOUNT) ?> <!-- BEGIN GOOGLE ANALYTICS CODEs --> <script type="text/javascript"> diff --git a/app/code/Magento/GoogleOptimizer/Helper/Data.php b/app/code/Magento/GoogleOptimizer/Helper/Data.php index 7077c124b60325f19a0e87e60cba1a0aa94717c4..81262a9fc74a863ef50dd7728f2fc0048c0304d4 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Data.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Data.php @@ -38,9 +38,9 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_activeForCmsFlag; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\GoogleAnalytics\Helper\Data @@ -49,15 +49,15 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\GoogleAnalytics\Helper\Data $analyticsHelper */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\GoogleAnalytics\Helper\Data $analyticsHelper ) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_analyticsHelper = $analyticsHelper; parent::__construct($context); } @@ -70,7 +70,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isGoogleExperimentEnabled($store = null) { - return (bool)$this->_storeConfig->getConfigFlag(self::XML_PATH_ENABLED, $store); + return (bool)$this->_scopeConfig->isSetFlag(self::XML_PATH_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** diff --git a/app/code/Magento/GoogleOptimizer/etc/module.xml b/app/code/Magento/GoogleOptimizer/etc/module.xml index fcde63b505f363e2093a648aaf3046d1f30db484..2b69804d9b6075c13c8267e7a1a19e8d10007a64 100644 --- a/app/code/Magento/GoogleOptimizer/etc/module.xml +++ b/app/code/Magento/GoogleOptimizer/etc/module.xml @@ -31,10 +31,10 @@ <module name="Magento_Cms"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_GoogleAnalytics"/> <module name="Magento_Catalog"/> <module name="Magento_Cms"/> - <module name="Magento_Core"/> <module name="Magento_Backend"/> </depends> </module> diff --git a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.0.php b/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.0.php index 439bc022013cb5410b40d1157e6cf4c9a8d3afde..8fe9b21c31d579b429839ce04c8ef46a543a1b80 100644 --- a/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.0.php +++ b/app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); @@ -75,9 +75,9 @@ $table = $installer->getConnection()->newTable( array('store_id', 'entity_id', 'entity_type'), array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) )->addForeignKey( - $installer->getFkName('googleoptimizer_code', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('googleoptimizer_code', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php index fdab11dbc1912d8f96af7fd52143561530318697..48a6a2a660c151390952f066c6240a0983b99bd4 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items.php @@ -69,20 +69,20 @@ class Items extends \Magento\Backend\Block\Widget\Grid\Container { $this->addChild('item', 'Magento\GoogleShopping\Block\Adminhtml\Items\Item'); $this->addChild('product', 'Magento\GoogleShopping\Block\Adminhtml\Items\Product'); - $this->addChild('store_switcher', 'Magento\GoogleShopping\Block\Adminhtml\Store\Switcher'); + //$this->addChild('store_switcher', 'Magento\GoogleShopping\Block\Adminhtml\Store\Switcher'); return $this; } - /** - * Get HTML code for Store Switcher select - * - * @return string - */ - public function getStoreSwitcherHtml() - { - return $this->getChildHtml('store_switcher'); - } + // /** + // * Get HTML code for Store Switcher select + // * + // * @return string + // */ + // public function getStoreSwitcherHtml() + // { + // return $this->getChildHtml('store_switcher'); + // } /** * Get HTML code for CAPTCHA @@ -103,7 +103,7 @@ class Items extends \Magento\Backend\Block\Widget\Grid\Container /** * Get selecetd store * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php index e684bea6068416a84891b0aa63e5b9c6f68e424a..464b384811ae0e4d0b43522e0d00a881f4f8c929 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Items/Product.php @@ -253,7 +253,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Extended /** * Get store model by request param * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getStore() { diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index 44dd4de0209e8b9bd42b0675e4f98cba25ea3976..c8407001d5b9f19f4d65ce5557d1c82a6a181617 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -69,7 +69,7 @@ class Items extends \Magento\Backend\App\Action 'adminhtml/*/', array( 'store' => $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getAnyStoreView()->getId(), '_current' => true ) @@ -395,13 +395,13 @@ class Items extends \Magento\Backend\App\Action /** * Get store object, basing on request * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store * @throws \Magento\Model\Exception */ public function _getStore() { $store = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( (int)$this->getRequest()->getParam('store', 0) ); diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php index 5042237161210992e691164398576ac4b6bc671a..e97243686b1857ef453a71affc3b551fb15c2c19 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Types.php @@ -341,15 +341,15 @@ class Types extends \Magento\Backend\App\Action /** * Get store object, basing on request * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function _getStore() { $storeId = (int)$this->getRequest()->getParam('store', 0); if ($storeId == 0) { - return $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getDefaultStoreView(); + return $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getDefaultStoreView(); } - return $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore($storeId); + return $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore($storeId); } /** diff --git a/app/code/Magento/GoogleShopping/Helper/Data.php b/app/code/Magento/GoogleShopping/Helper/Data.php index 5c1c4e332d6d9188a69893f1dc68f1efbe7eca9b..8e7110c71d65ed4f80024b18e66ebd14a3a0736e 100644 --- a/app/code/Magento/GoogleShopping/Helper/Data.php +++ b/app/code/Magento/GoogleShopping/Helper/Data.php @@ -44,19 +44,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Helper\Context $context * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Stdlib\String $string, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->string = $string; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Link.php b/app/code/Magento/GoogleShopping/Model/Attribute/Link.php index 6e4d63b9ec407fe4e453e57b978d194a45750a1f..f52ca93edb7a62139f3730a1d57b39ede33f0729 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Link.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Link.php @@ -37,9 +37,9 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Model\Context $context @@ -49,7 +49,7 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute * @param \Magento\GoogleShopping\Helper\Product $gsProduct * @param \Magento\Catalog\Model\Product\CatalogPrice $catalogPrice * @param \Magento\GoogleShopping\Model\Resource\Attribute $resource - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -61,11 +61,11 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute \Magento\GoogleShopping\Helper\Product $gsProduct, \Magento\Catalog\Model\Product\CatalogPrice $catalogPrice, \Magento\GoogleShopping\Model\Resource\Attribute $resource, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct( $context, $registry, @@ -90,7 +90,7 @@ class Link extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute { $url = $product->getProductUrl(false); if ($url) { - if (!$this->_coreStoreConfig->getConfigFlag('web/url/use_store')) { + if (!$this->_scopeConfig->isSetFlag('web/url/use_store', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $urlInfo = parse_url($url); $store = $product->getStore()->getCode(); if (isset($urlInfo['query']) && $urlInfo['query'] != '') { diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php index 5e88f48a0d887afbb9b6017f68e8fb24ef031a41..d6d567d3745358f387734aa7999361a92bd54360 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Price.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Price.php @@ -45,9 +45,9 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Config @@ -59,7 +59,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -76,9 +76,9 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute * @param \Magento\GoogleShopping\Helper\Product $gsProduct * @param \Magento\Catalog\Model\Product\CatalogPrice $catalogPrice * @param \Magento\GoogleShopping\Model\Resource\Attribute $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\GoogleShopping\Model\Config $config * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -91,9 +91,9 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute \Magento\GoogleShopping\Helper\Product $gsProduct, \Magento\Catalog\Model\Product\CatalogPrice $catalogPrice, \Magento\GoogleShopping\Model\Resource\Attribute $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Tax\Helper\Data $taxData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\GoogleShopping\Model\Config $config, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -101,7 +101,7 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $this->_storeManager = $storeManager; $this->_config = $config; $this->_taxData = $taxData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->catalogPrice = $catalogPrice; parent::__construct( $context, @@ -127,8 +127,9 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute { $product->setWebsiteId($this->_storeManager->getStore($product->getStoreId())->getWebsiteId()); $product->setCustomerGroupId( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Customer\Model\Group::XML_PATH_DEFAULT_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $product->getStoreId() ) ); @@ -151,8 +152,10 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute } if (!is_null($salePriceMapValue) && floatval($salePriceMapValue) > .0001) { $finalPrice = $salePriceMapValue; - } else if ($isSalePriceAllowed) { - $finalPrice = $this->catalogPrice->getCatalogPrice($product, $store, $inclTax); + } else { + if ($isSalePriceAllowed) { + $finalPrice = $this->catalogPrice->getCatalogPrice($product, $store, $inclTax); + } } if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { $finalPrice = $taxHelp->getPrice( @@ -171,11 +174,13 @@ class Price extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $price = null; if (!is_null($priceMapValue) && floatval($priceMapValue) > .0001) { $price = $priceMapValue; - } else if ($isSalePriceAllowed) { - $price = $this->catalogPrice->getCatalogRegularPrice($product, $store); } else { - $inclTax = $priceDisplayType != \Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX; - $price = $this->catalogPrice->getCatalogPrice($product, $store, $inclTax); + if ($isSalePriceAllowed) { + $price = $this->catalogPrice->getCatalogRegularPrice($product, $store); + } else { + $inclTax = $priceDisplayType != \Magento\Tax\Model\Config::DISPLAY_TYPE_EXCLUDING_TAX; + $price = $this->catalogPrice->getCatalogPrice($product, $store, $inclTax); + } } if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { $price = $taxHelp->getPrice($product, $price, $inclTax, null, null, null, $product->getStoreId()); diff --git a/app/code/Magento/GoogleShopping/Model/Config.php b/app/code/Magento/GoogleShopping/Model/Config.php index 18cefc6ff82398be677192d986ab952a9966985b..1fbeb0e9148e1ee452bed9299c671e02d82be742 100644 --- a/app/code/Magento/GoogleShopping/Model/Config.php +++ b/app/code/Magento/GoogleShopping/Model/Config.php @@ -44,14 +44,14 @@ class Config extends \Magento\Object /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -61,18 +61,18 @@ class Config extends \Magento\Object protected $_encryptor; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Encryption\EncryptorInterface $encryptor * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Encryption\EncryptorInterface $encryptor, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_encryptor = $encryptor; parent::__construct($data); @@ -88,7 +88,7 @@ class Config extends \Magento\Object public function getConfigData($key, $storeId = null) { if (!isset($this->_config[$key][$storeId])) { - $value = $this->_coreStoreConfig->getConfig('google/googleshopping/' . $key, $storeId); + $value = $this->_scopeConfig->getValue('google/googleshopping/' . $key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); $this->_config[$key][$storeId] = $value; } return $this->_config[$key][$storeId]; diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index e51919f471b2802cc4fe7f940c31a5f291fea707..dbc3f0f338a95365df6f6cc1bd62302798efadcd 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -54,7 +54,7 @@ class MassOperations /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -91,7 +91,7 @@ class MassOperations * @param \Magento\GoogleShopping\Model\ItemFactory $itemFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Logger $logger * @param \Magento\GoogleShopping\Helper\Data $gleShoppingData * @param \Magento\GoogleShopping\Helper\Category $gleShoppingCategory @@ -102,7 +102,7 @@ class MassOperations \Magento\GoogleShopping\Model\ItemFactory $itemFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Logger $logger, \Magento\GoogleShopping\Helper\Data $gleShoppingData, \Magento\GoogleShopping\Helper\Category $gleShoppingCategory, diff --git a/app/code/Magento/GoogleShopping/Model/Observer.php b/app/code/Magento/GoogleShopping/Model/Observer.php index 38a13a7d7ff3156935104966807025aa39904d0a..a788acdfc04bce409d13af752a4d42828e201b46 100644 --- a/app/code/Magento/GoogleShopping/Model/Observer.php +++ b/app/code/Magento/GoogleShopping/Model/Observer.php @@ -33,9 +33,9 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Message\ManagerInterface @@ -74,7 +74,7 @@ class Observer * @param \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory * @param \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\GoogleShopping\Model\Flag $flag */ @@ -82,14 +82,14 @@ class Observer \Magento\GoogleShopping\Model\Resource\Item\CollectionFactory $collectionFactory, \Magento\GoogleShopping\Model\MassOperationsFactory $operationsFactory, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Message\ManagerInterface $messageManager, \Magento\GoogleShopping\Model\Flag $flag ) { $this->_collectionFactory = $collectionFactory; $this->_operationsFactory = $operationsFactory; $this->_inboxFactory = $inboxFactory; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->messageManager = $messageManager; $this->_flag = $flag; } @@ -148,7 +148,7 @@ class Observer } foreach ($items as $item) { - if (!$this->_coreStoreConfig->getConfigFlag('google/googleshopping/observed', $item->getStoreId())) { + if (!$this->_scopeConfig->isSetFlag('google/googleshopping/observed', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $item->getStoreId())) { $items->removeItemByKey($item->getId()); } } diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php index 2c6634312ee562c19fb2e30494039bf3359c0a31..7c0eaeefaf208d99c48ce62aadbd2444b46a0380 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Setup.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Setup.php @@ -23,7 +23,7 @@ */ namespace Magento\GoogleShopping\Model\Resource; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\GoogleShopping\Helper\Data @@ -36,7 +36,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_configFactory; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\GoogleShopping\Model\ConfigFactory $configFactory * @param \Magento\GoogleShopping\Helper\Data $googleShoppingData @@ -44,12 +44,12 @@ class Setup extends \Magento\Core\Model\Resource\Setup * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\GoogleShopping\Model\ConfigFactory $configFactory, \Magento\GoogleShopping\Helper\Data $googleShoppingData, $moduleName = 'Magento_GoogleShopping', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_configFactory = $configFactory; $this->_googleShoppingData = $googleShoppingData; diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index 76ac805fa99f2b5515b09e3ae96704ecf760fbfa..2d20ee4cb2c4aea919f8af00be3a54c1e554f20e 100644 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_AdminNotification"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php index b035c813490a91e94e3626bfee605f0e7bf04e6b..c6a0521a6cd16edc1fb4cd8410809df5bbc576ac 100644 --- a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php +++ b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php @@ -31,7 +31,7 @@ * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -128,9 +128,9 @@ $table = $connection->newTable( 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('googleshopping_items', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('googleshopping_items', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('core_store'), + $this->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE )->addIndex( diff --git a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php index 0bda83d03047613a56bb56b8a288a133a6b80928..71e0ed58697b1a1655675e0cee8e802df704ca33 100644 --- a/app/code/Magento/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php +++ b/app/code/Magento/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->getConnection()->addColumn( diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/items.phtml b/app/code/Magento/GoogleShopping/view/adminhtml/items.phtml index bf7b4742124891e128a4f6dec46f3099d93cac51..b438917b940ed62e82eca6a03d2c42d4ba0806d9 100644 --- a/app/code/Magento/GoogleShopping/view/adminhtml/items.phtml +++ b/app/code/Magento/GoogleShopping/view/adminhtml/items.phtml @@ -27,7 +27,6 @@ <?php echo $this->getCaptchaHtml() ?> -<?php echo $this->getStoreSwitcherHtml() ?> <div class="grid-title"> <span class="title"><?php echo __('Google Content Items') ?></span> </div> diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml index f6eb6b3bb0a607f0e35250d2d08ddc06bf7bb474..92f40ef1663af65cb782087380597effb0dfc03c 100644 --- a/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml +++ b/app/code/Magento/GoogleShopping/view/adminhtml/layout/adminhtml_googleshopping_items_index.xml @@ -31,4 +31,9 @@ </arguments> </block> </referenceBlock> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="store_switcher" + template="Magento_Backend::store/switcher.phtml" /> + </referenceContainer> </layout> diff --git a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php index aa1415ad21eb75a5dc1141c42bf90526ee5d795e..6e5b8da72971f9e450da30639b1c2bc5c00dfc9d 100644 --- a/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Cart/Item/Renderer/Grouped.php @@ -88,8 +88,9 @@ class Grouped extends \Magento\Checkout\Block\Cart\Item\Renderer implements \Mag * Show grouped product thumbnail if it must be always shown according to the related setting in system config * or if child product thumbnail is not available */ - if ($this->_storeConfig->getConfig( - self::CONFIG_THUMBNAIL_SOURCE + if ($this->_scopeConfig->getValue( + self::CONFIG_THUMBNAIL_SOURCE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) == ThumbnailSource::OPTION_USE_PARENT_IMAGE || !($this->getProduct()->getThumbnail() && $this->getProduct()->getThumbnail() != 'no_selection') ) { diff --git a/app/code/Magento/GroupedProduct/Model/Product/CatalogPrice.php b/app/code/Magento/GroupedProduct/Model/Product/CatalogPrice.php index 253cb2f2130d8e76477ec43a85428cbb751abc03..d6df970824f23faf4c9e96447422a3977e97210e 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/CatalogPrice.php +++ b/app/code/Magento/GroupedProduct/Model/Product/CatalogPrice.php @@ -29,7 +29,7 @@ namespace Magento\GroupedProduct\Model\Product; class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $storeManager; @@ -39,11 +39,11 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa protected $commonPriceModel; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\CatalogPrice $commonPriceModel ) { $this->storeManager = $storeManager; @@ -54,7 +54,7 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa * Minimal price for "regular" user * * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Core\Model\Store $store Store view + * @param null|\Magento\Store\Model\Store $store Store view * @param bool $inclTax * @return null|float * @SuppressWarnings(PHPMD.UnusedFormalParameter) @@ -62,12 +62,12 @@ class CatalogPrice implements \Magento\Catalog\Model\Product\CatalogPriceInterfa public function getCatalogPrice(\Magento\Catalog\Model\Product $product, $store = null, $inclTax = false) { // Workaround to avoid loading stock status by admin's website - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $oldStore = $this->storeManager->getStore(); $this->storeManager->setCurrentStore($store); } $subProducts = $product->getTypeInstance()->getAssociatedProducts($product); - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $this->storeManager->setCurrentStore($oldStore); } if (!count($subProducts)) { diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index e499d90d6079706038320ffd0e00a04fd8d99802..07c82525a561c4cd3fbe853327fea028c2c0e94c 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -79,7 +79,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -107,7 +107,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Registry $coreRegistry * @param \Magento\Logger $logger * @param \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus * @param \Magento\App\State $appState * @param array $data @@ -126,7 +126,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Registry $coreRegistry, \Magento\Logger $logger, \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Attribute\Source\Status $catalogProductStatus, \Magento\App\State $appState, array $data = array() diff --git a/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php index d83c93a67b1f927547aa0c0ee9a9c11b3dbb7c0a..2301f3083b89d9dc294f1c526790309a62cd107f 100644 --- a/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php +++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php @@ -56,10 +56,10 @@ class AssociatedProductsCollection extends \Magento\Catalog\Model\Resource\Produ * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -81,10 +81,10 @@ class AssociatedProductsCollection extends \Magento\Catalog\Model\Resource\Produ \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -109,7 +109,7 @@ class AssociatedProductsCollection extends \Magento\Catalog\Model\Resource\Produ $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index c49b99b70a4451fe297d5337d0fcf98f273dbca4..a9b6a5c46f2c9676b6bcd2b34f02bee944d3272a 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -26,11 +26,12 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_GroupedProduct" version="0.0.1" active="true"> <sequence> - <module name="Magento_Catalog" /> - <module name="Magento_CatalogInventory" /> - <module name="Magento_Sales" /> + <module name="Magento_Catalog"/> + <module name="Magento_CatalogInventory"/> + <module name="Magento_Sales"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog" /> <module name="Magento_CatalogInventory" /> <module name="Magento_Sales" /> diff --git a/app/code/Magento/GroupedProduct/etc/product_types.xml b/app/code/Magento/GroupedProduct/etc/product_types.xml index 8eec40ecd04e1005b3a4c0b0b81682024265fa40..7aa52fca37cb43601caed94e8f442e80684f34b0 100644 --- a/app/code/Magento/GroupedProduct/etc/product_types.xml +++ b/app/code/Magento/GroupedProduct/etc/product_types.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Catalog/etc/product_types.xsd"> - <type name="grouped" label="Grouped Product" modelInstance="Magento\GroupedProduct\Model\Product\Type\Grouped" composite='true' indexPriority="50"> + <type name="grouped" label="Grouped Product" modelInstance="Magento\GroupedProduct\Model\Product\Type\Grouped" composite='true' indexPriority="50" sortOrder="30"> <priceModel instance="Magento\GroupedProduct\Model\Product\Type\Grouped\Price" /> <indexerModel instance="Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped" /> <stockIndexerModel instance="Magento\GroupedProduct\Model\Resource\Indexer\Stock\Grouped" /> diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css b/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css index a3ebc2baf5a10cb5e225214fc0916b8bb830bc99..95f7ce9fb5209b4a068b613b9d5a64cfa6ca576d 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css +++ b/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css @@ -37,6 +37,10 @@ display: none; } +.ui-dialog.grouped .data { + table-layout: auto; +} + .ui-dialog.grouped .col-entity_id { width: 2%; } diff --git a/app/code/Magento/ImportExport/Helper/Data.php b/app/code/Magento/ImportExport/Helper/Data.php index ecba00fa36d63b14872f84e547578fd5e5e17a7a..85c1aa525815cafafd926c615158185ba3c9ae28 100644 --- a/app/code/Magento/ImportExport/Helper/Data.php +++ b/app/code/Magento/ImportExport/Helper/Data.php @@ -50,22 +50,22 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\File\Size $fileSize * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\File\Size $fileSize, $dbCompatibleMode = true ) { $this->_fileSize = $fileSize; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** @@ -91,7 +91,7 @@ class Data extends \Magento\Core\Helper\Data */ public function getLocalValidPaths() { - $paths = $this->_coreStoreConfig->getConfig(self::XML_PATH_EXPORT_LOCAL_VALID_PATH); + $paths = $this->_scopeConfig->getValue(self::XML_PATH_EXPORT_LOCAL_VALID_PATH, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); return $paths; } @@ -102,6 +102,6 @@ class Data extends \Magento\Core\Helper\Data */ public function getBunchSize() { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_BUNCH_SIZE); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_BUNCH_SIZE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php index 3acf4db71bdfbae888d36cf7d557e2ba3d6d054d..799f0d3f3eb9f0f3c1d2bec97e893eb1a0fb9475 100644 --- a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php @@ -53,7 +53,7 @@ abstract class AbstractEntity /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -172,25 +172,25 @@ abstract class AbstractEntity /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_attributeCollection = isset( $data['attribute_collection'] @@ -199,8 +199,9 @@ abstract class AbstractEntity ); $this->_pageSize = isset( $data['page_size'] - ) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_coreStoreConfig->getConfig( - static::XML_PATH_PAGE_SIZE + ) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_scopeConfig->getValue( + static::XML_PATH_PAGE_SIZE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : 0); $this->_byPagesIterator = isset( $data['collection_by_pages_iterator'] @@ -214,7 +215,7 @@ abstract class AbstractEntity */ protected function _initStores() { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($this->_storeManager->getStores(true) as $store) { $this->_storeIdToCode[$store->getId()] = $store->getCode(); } @@ -232,7 +233,7 @@ abstract class AbstractEntity */ protected function _initWebsites($withDefault = false) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($this->_storeManager->getWebsites($withDefault) as $website) { $this->_websiteIdToCode[$website->getId()] = $website->getCode(); } diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php index 51ea13eb7d92c5fd64bf7aac4a77b8ebd02e9436..99ac254884d6d5de4a7cb14e364f211444604ec4 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php @@ -75,8 +75,8 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn protected $_localeDate; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -84,8 +84,8 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -93,7 +93,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn array $data = array() ) { $this->_localeDate = $localeDate; - parent::__construct($coreStoreConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); + parent::__construct($scopeConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); if (isset($data['entity_type_id'])) { $this->_entityTypeId = $data['entity_type_id']; @@ -267,7 +267,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn $index = in_array($attribute->getAttributeCode(), $this->_indexValueAttributes) ? 'value' : 'label'; // only default (admin) store values used - $attribute->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $attribute->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); try { foreach ($attribute->getSource()->getAllOptions(false) as $option) { diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php index 0f103225a7210d43165ea7993a781fba33e73026..33e5c799547a15a34ee6aa480e395ad01cbbb05a 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php @@ -161,7 +161,7 @@ abstract class AbstractEntity protected $_localeDate; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -169,13 +169,13 @@ abstract class AbstractEntity * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Eav\Model\Config $config * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Eav\Model\Config $config, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_localeDate = $localeDate; $this->_storeManager = $storeManager; @@ -410,7 +410,7 @@ abstract class AbstractEntity $index = in_array($attribute->getAttributeCode(), $this->_indexValueAttributes) ? 'value' : 'label'; // only default (admin) store values used - $attribute->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $attribute->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); try { foreach ($attribute->getSource()->getAllOptions(false) as $option) { diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer.php b/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer.php index af52ade823c5839b73dbb14258f3e178de0962f5..1646c942adca115710c608f1611833057c2dc7d7 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer.php @@ -104,8 +104,8 @@ class Customer extends \Magento\ImportExport\Model\Export\Entity\AbstractEav protected $_customerCollection; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -114,8 +114,8 @@ class Customer extends \Magento\ImportExport\Model\Export\Entity\AbstractEav * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -124,7 +124,7 @@ class Customer extends \Magento\ImportExport\Model\Export\Entity\AbstractEav array $data = array() ) { parent::__construct( - $coreStoreConfig, + $scopeConfig, $storeManager, $collectionFactory, $resourceColFactory, diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer/Address.php b/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer/Address.php index 1c9bea33bdf236021fea2cd0d577e76f4627985c..57ed8f801c01a5ba209ab22430ed3a7db6df8035 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer/Address.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Eav/Customer/Address.php @@ -129,8 +129,8 @@ class Address extends \Magento\ImportExport\Model\Export\Entity\AbstractEav protected $_customers = array(); /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -141,8 +141,8 @@ class Address extends \Magento\ImportExport\Model\Export\Entity\AbstractEav * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -153,7 +153,7 @@ class Address extends \Magento\ImportExport\Model\Export\Entity\AbstractEav array $data = array() ) { parent::__construct( - $coreStoreConfig, + $scopeConfig, $storeManager, $collectionFactory, $resourceColFactory, diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index da7d74da6467e18679517cad476405739ba7ec4e..d8bdbbca7d8045e3c8859f9fbb8b00dc61c4fd4a 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -220,7 +220,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Eav\Model\Config $config * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\Resource\Product\Collection $collection * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig @@ -238,7 +238,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Eav\Model\Config $config, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Logger $logger, \Magento\Catalog\Model\Resource\Product\Collection $collection, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, @@ -332,7 +332,8 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity if (!$model instanceof \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType) { throw new \Magento\Model\Exception( __( - 'Entity type model must be an instance of \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType' + 'Entity type model must be an instance of' + . ' \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType' ) ); } @@ -360,7 +361,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity */ protected function _initWebsites() { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($this->_storeManager->getWebsites() as $website) { $this->_websiteIdToCode[$website->getId()] = $website->getCode(); } @@ -389,7 +390,9 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity $stmt = $this->_connection->query($select); while ($tierRow = $stmt->fetch()) { $rowTierPrices[$tierRow['entity_id']][] = array( - '_tier_price_customer_group' => $tierRow['all_groups'] ? self::VALUE_ALL : $tierRow['customer_group_id'], + '_tier_price_customer_group' => $tierRow['all_groups'] + ? self::VALUE_ALL + : $tierRow['customer_group_id'], '_tier_price_website' => 0 == $tierRow['website_id'] ? self::VALUE_ALL : $this->_websiteIdToCode[$tierRow['website_id']], '_tier_price_qty' => $tierRow['qty'], @@ -422,7 +425,9 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity $statement = $this->_connection->query($select); while ($groupRow = $statement->fetch()) { $rowGroupPrices[$groupRow['entity_id']][] = array( - '_group_price_customer_group' => $groupRow['all_groups'] ? self::VALUE_ALL : $groupRow['customer_group_id'], + '_group_price_customer_group' => $groupRow['all_groups'] + ? self::VALUE_ALL + : $groupRow['customer_group_id'], '_group_price_website' => 0 == $groupRow['website_id'] ? self::VALUE_ALL : $this->_websiteIdToCode[$groupRow['website_id']], '_group_price_price' => $groupRow['value'] @@ -780,7 +785,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity try { $collection = $this->_getEntityCollection(); $validAttrCodes = $this->_getExportAttrCodes(); - $defaultStoreId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $defaultStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; $dataRows = array(); $rowCategories = array(); $rowWebsites = array(); @@ -821,10 +826,12 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity array_flip($attrValue) ); $rowMultiselects[$itemId][$attrCode] = $attrValue; - } else if (isset($this->_attributeValues[$attrCode][$attrValue])) { - $attrValue = $this->_attributeValues[$attrCode][$attrValue]; } else { - $attrValue = null; + if (isset($this->_attributeValues[$attrCode][$attrValue])) { + $attrValue = $this->_attributeValues[$attrCode][$attrValue]; + } else { + $attrValue = null; + } } } // do not save value same as default or not existent @@ -1170,10 +1177,8 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity { foreach ($this->getAttributeCollection() as $attribute) { $this->_attributeValues[$attribute->getAttributeCode()] = $this->getAttributeOptions($attribute); - $this->_attributeTypes[$attribute - ->getAttributeCode()] = \Magento\ImportExport\Model\Import::getAttributeType( - $attribute - ); + $this->_attributeTypes[$attribute->getAttributeCode()] = + \Magento\ImportExport\Model\Import::getAttributeType($attribute); } return $this; } diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index 6767d3b2bf1167218ef3be39eb5b29bc37d02b2f..90b81dd3a71f287b8c26709346b924027aa87d14 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -145,7 +145,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel * @param \Magento\App\Filesystem $filesystem * @param \Magento\Logger\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Helper\Data $importExportData - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig * @param \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory * @param \Magento\ImportExport\Model\Resource\Import\Data $importData @@ -161,7 +161,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel \Magento\App\Filesystem $filesystem, \Magento\Logger\AdapterFactory $adapterFactory, \Magento\ImportExport\Helper\Data $importExportData, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\ImportExport\Model\Import\ConfigInterface $importConfig, \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory, \Magento\ImportExport\Model\Resource\Import\Data $importData, diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php index 774ec251dc3d7499ab8568776b44282827faa0b7..a9dd0c61a405ef2c68fc6fbe5c8f01afa52c90a0 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php @@ -246,14 +246,14 @@ abstract class AbstractEntity /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource @@ -262,13 +262,13 @@ abstract class AbstractEntity public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_dataSourceModel = isset( $data['data_source_model'] ) ? $data['data_source_model'] : $importFactory->create()->getDataSourceModel(); @@ -277,16 +277,18 @@ abstract class AbstractEntity $this->string = $string; $this->_pageSize = isset( $data['page_size'] - ) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_coreStoreConfig->getConfig( - static::XML_PATH_PAGE_SIZE + ) ? $data['page_size'] : (static::XML_PATH_PAGE_SIZE ? (int)$this->_scopeConfig->getValue( + static::XML_PATH_PAGE_SIZE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : 0); $this->_maxDataSize = isset( $data['max_data_size'] ) ? $data['max_data_size'] : $resourceHelper->getMaxDataSize(); $this->_bunchSize = isset( $data['bunch_size'] - ) ? $data['bunch_size'] : (static::XML_PATH_BUNCH_SIZE ? (int)$this->_coreStoreConfig->getConfig( - static::XML_PATH_BUNCH_SIZE + ) ? $data['bunch_size'] : (static::XML_PATH_BUNCH_SIZE ? (int)$this->_scopeConfig->getValue( + static::XML_PATH_BUNCH_SIZE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : 0); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php index a1f32813f0718cbed276069c075f07f1685d9a33..7aaaf4b6111e2e62a1ed63af3018a568ca6dbe8f 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEav.php @@ -38,7 +38,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -94,11 +94,11 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param array $data @@ -106,16 +106,16 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, array $data = array() ) { - parent::__construct($coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data); + parent::__construct($coreData, $string, $scopeConfig, $importFactory, $resourceHelper, $resource, $data); $this->_storeManager = $storeManager; $this->_attributeCollection = isset( @@ -154,7 +154,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn */ protected function _initWebsites($withDefault = false) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($this->_storeManager->getWebsites($withDefault) as $website) { $this->_websiteCodeToId[$website->getCode()] = $website->getId(); } @@ -169,7 +169,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn */ protected function _initStores($withDefault = false) { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($this->_storeManager->getStores($withDefault) as $store) { $this->_storeCodeToId[$store->getCode()] = $store->getId(); } @@ -230,7 +230,7 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Import\AbstractEn $index = in_array($attribute->getAttributeCode(), $indexAttributes) ? 'value' : 'label'; // only default (admin) store values used - $attribute->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $attribute->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); try { foreach ($attribute->getSource()->getAllOptions(false) as $option) { diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php index fc8575ebce07aa5d2cfe9c7fb45c42ca1e5b8531..b214882f8b4c6fbc2b32ce19ca9f49d8eb6c535d 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php @@ -415,7 +415,7 @@ abstract class AbstractEntity $index = in_array($attribute->getAttributeCode(), $indexValAttrs) ? 'value' : 'label'; // only default (admin) store values used - $attribute->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $attribute->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID); try { foreach ($attribute->getSource()->getAllOptions(false) as $option) { diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php b/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php index 6aa8ac1238194273984310211a32c8a71b3cf1fd..9df5b48e24bad1c8149cd1109f6d3370c782f10b 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/CustomerComposite.php @@ -146,7 +146,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource @@ -160,7 +160,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, @@ -169,7 +169,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit \Magento\ImportExport\Model\Import\Entity\Eav\Customer\AddressFactory $addressFactory, array $data = array() ) { - parent::__construct($coreData, $string, $coreStoreConfig, $importFactory, $resourceHelper, $resource, $data); + parent::__construct($coreData, $string, $scopeConfig, $importFactory, $resourceHelper, $resource, $data); $this->addMessageTemplate( self::ERROR_ROW_IS_ORPHAN, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php index c35c8566b9c9e8638427df020c0cc9c6cb350c1f..2d670c91ff773ab6b69542e93d8273b8e67cd6a8 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/AbstractCustomer.php @@ -83,11 +83,11 @@ abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entit /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory @@ -96,11 +96,11 @@ abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entit public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory, @@ -110,7 +110,7 @@ abstract class AbstractCustomer extends \Magento\ImportExport\Model\Import\Entit parent::__construct( $coreData, $string, - $coreStoreConfig, + $scopeConfig, $importFactory, $resourceHelper, $resource, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php index 7a4fa681836acac61804b8239dd777e60caa4075..06d6fc88eab20632449a5d51a988ed99a41b6448 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer.php @@ -142,11 +142,11 @@ class Customer extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCus /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory @@ -157,11 +157,11 @@ class Customer extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCus public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory, @@ -183,7 +183,7 @@ class Customer extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCus parent::__construct( $coreData, $string, - $coreStoreConfig, + $scopeConfig, $importFactory, $resourceHelper, $resource, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php index dc6069a0d608211a385606e20e805643ff0880a6..22cb7ad9adc1233761d138888ba0617076157e5c 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Eav/Customer/Address.php @@ -237,11 +237,11 @@ class Address extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCust /** * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Export\Factory $collectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory @@ -256,11 +256,11 @@ class Address extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCust public function __construct( \Magento\Core\Helper\Data $coreData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\ImportExport\Model\Resource\Customer\StorageFactory $storageFactory, @@ -287,7 +287,7 @@ class Address extends \Magento\ImportExport\Model\Import\Entity\Eav\AbstractCust parent::__construct( $coreData, $string, - $coreStoreConfig, + $scopeConfig, $importFactory, $resourceHelper, $resource, diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index d2b158a320356dcc1b264e936963659b08006c8c..1e546734d8cec341704ed63d8e7b72352ac247c6 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -406,7 +406,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity protected $_productFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -478,7 +478,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryColFactory * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $groupColFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ImportExport\Model\Import\Entity\Product\Type\Factory $productTypeFactory * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory * @param \Magento\ImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory @@ -509,7 +509,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryColFactory, \Magento\Customer\Model\Resource\Group\CollectionFactory $groupColFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Import\Entity\Product\Type\Factory $productTypeFactory, \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory, \Magento\ImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory, @@ -770,7 +770,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ protected function _initWebsites() { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($this->_storeManager->getWebsites() as $website) { $this->_websiteCodeToId[$website->getCode()] = $website->getId(); $this->_websiteCodeToStoreIds[$website->getCode()] = array_flip($website->getStoreCodes()); @@ -1659,7 +1659,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $valueArr = array( 'value_id' => $insertValue['value_id'], - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'label' => $insertValue['label'], 'position' => $insertValue['position'], 'disabled' => $insertValue['disabled'] diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php index a46cb75973f9ce4318464c9f19de56babc2bd96a..412d84f48ebceaf576a54d917205540d605877ae 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php @@ -281,9 +281,9 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\ImportExport\Model\ImportFactory @@ -296,7 +296,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity protected $_resource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -324,12 +324,12 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\ImportExport\Model\Resource\Import\Data $importData * @param \Magento\App\Resource $resource * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\StoreManagerInterface $_storeManager + * @param \Magento\Store\Model\StoreManagerInterface $_storeManager * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Resource\Product\Option\CollectionFactory $optionColFactory * @param \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Stdlib\DateTime $dateTime * @param array $data * @@ -339,12 +339,12 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\ImportExport\Model\Resource\Import\Data $importData, \Magento\App\Resource $resource, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, - \Magento\Core\Model\StoreManagerInterface $_storeManager, + \Magento\Store\Model\StoreManagerInterface $_storeManager, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Resource\Product\Option\CollectionFactory $optionColFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $colIteratorFactory, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { @@ -355,7 +355,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_dataSourceModel = $importData; $this->_optionColFactory = $optionColFactory; $this->_colIteratorFactory = $colIteratorFactory; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->dateTime = $dateTime; if (isset($data['connection'])) { @@ -459,7 +459,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if (isset($data['stores'])) { $this->_storeCodeToId = $data['stores']; } else { - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($this->_storeManager->getStores(true) as $store) { $this->_storeCodeToId[$store->getCode()] = $store->getId(); } @@ -502,8 +502,9 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if (isset($data['page_size'])) { $this->_pageSize = $data['page_size']; } else { - $this->_pageSize = self::XML_PATH_PAGE_SIZE ? (int)$this->_coreStoreConfig->getConfig( - self::XML_PATH_PAGE_SIZE + $this->_pageSize = self::XML_PATH_PAGE_SIZE ? (int)$this->_scopeConfig->getValue( + self::XML_PATH_PAGE_SIZE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) : 0; } return $this; @@ -817,7 +818,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $storeCode = $rowData[self::COLUMN_STORE]; $storeId = $this->_storeCodeToId[$storeCode]; } else { - $storeId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } if (isset($this->_productsSkuToId[$this->_rowProductSku])) { // save in existing data array @@ -1199,18 +1200,18 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $typeValues[$prevOptionId][] = $specificTypeData['value']; // ensure default title is set - if (!isset($typeTitles[$nextValueId][\Magento\Core\Model\Store::DEFAULT_STORE_ID])) { - $typeTitles[$nextValueId][\Magento\Core\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['title']; + if (!isset($typeTitles[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID])) { + $typeTitles[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['title']; } $typeTitles[$nextValueId][$this->_rowStoreId] = $specificTypeData['title']; if ($specificTypeData['price']) { if ($this->_isPriceGlobal) { - $typePrices[$nextValueId][\Magento\Core\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; + $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; } else { // ensure default price is set - if (!isset($typePrices[$nextValueId][\Magento\Core\Model\Store::DEFAULT_STORE_ID])) { - $typePrices[$nextValueId][\Magento\Core\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; + if (!isset($typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID])) { + $typePrices[$nextValueId][\Magento\Store\Model\Store::DEFAULT_STORE_ID] = $specificTypeData['price']; } $typePrices[$nextValueId][$this->_rowStoreId] = $specificTypeData['price']; } @@ -1231,7 +1232,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity */ protected function _collectOptionTitle(array $rowData, $prevOptionId, array &$titles) { - $defaultStoreId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $defaultStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; if (!empty($rowData[self::COLUMN_TITLE])) { if (!isset($titles[$prevOptionId][$defaultStoreId])) { // ensure default title is set @@ -1293,7 +1294,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity } $this->_rowStoreId = $this->_storeCodeToId[$rowData[self::COLUMN_STORE]]; } else { - $this->_rowStoreId = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $this->_rowStoreId = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } // Init option type and set param which tell that row is main if (!empty($rowData[self::COLUMN_TYPE])) { @@ -1412,7 +1413,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity ) { $priceData = array( 'option_id' => $optionId, - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'price_type' => 'fixed' ); diff --git a/app/code/Magento/ImportExport/etc/di.xml b/app/code/Magento/ImportExport/etc/di.xml index 444195e3b9ad414787ae862087ba6340bc2f39f3..85645352208e5a616dd690010b76c28115b1b1bc 100644 --- a/app/code/Magento/ImportExport/etc/di.xml +++ b/app/code/Magento/ImportExport/etc/di.xml @@ -27,4 +27,11 @@ <preference for="Magento\ImportExport\Model\Import\ConfigInterface" type="Magento\ImportExport\Model\Import\Config" /> <preference for="Magento\ImportExport\Model\Export\ConfigInterface" type="Magento\ImportExport\Model\Export\Config" /> <preference for="Magento\ImportExport\Model\Export\RowCustomizerInterface" type="Magento\ImportExport\Model\Export\RowCustomizer\Composite" /> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="importexport" xsi:type="string">Magento_ImportExport</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index 3dffaff9d27b007a3a673c1ed32e1ffcee7389b9..03ba81e649b8eadb130466343d7bb3b932f86c8d 100644 --- a/app/code/Magento/ImportExport/etc/module.xml +++ b/app/code/Magento/ImportExport/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php b/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php index bc5ec56f8c6ec810f18ff576a712812422f97c34..10048f475ba48eae61acc9c81d858a4016959812 100644 --- a/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php +++ b/app/code/Magento/ImportExport/sql/importexport_setup/install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php index fe44068388de1db41c32d4e136f98c3bc97b6a2b..c12d85ce0514ab2528c31f54996754df67e9319f 100644 --- a/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/ImportExport/sql/importexport_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->getConnection()->modifyColumn( diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.2-1.6.0.3.php index f65d39c21ac52df3f703b582d00cbabebd07000b..e46820ae274f386038576948c705c8443cd3b17b 100644 --- a/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->getConnection()->addColumn( diff --git a/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.3-1.6.0.4.php index abd548bc5c3791a01775b25f83e4fb723a3e1dd7..b49f340bcb44fa553f4f01a3061994f18146303e 100644 --- a/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.3-1.6.0.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->getConnection()->dropColumn($installer->getTable('importexport_importdata'), 'entity_subtype'); diff --git a/app/code/Magento/Index/Model/Observer.php b/app/code/Magento/Index/Model/Observer.php index 00477a192fc431ea22375510a001966cad019932..290fcd3e25a0b4571b125970ee027ca02dacc9e1 100644 --- a/app/code/Magento/Index/Model/Observer.php +++ b/app/code/Magento/Index/Model/Observer.php @@ -53,7 +53,7 @@ class Observer $store = $observer->getEvent()->getStore(); $this->_indexer->processEntityAction( $store, - \Magento\Core\Model\Store::ENTITY, + \Magento\Store\Model\Store::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE ); } @@ -69,7 +69,7 @@ class Observer $storeGroup = $observer->getEvent()->getStoreGroup(); $this->_indexer->processEntityAction( $storeGroup, - \Magento\Core\Model\Store\Group::ENTITY, + \Magento\Store\Model\Store::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE ); } @@ -85,7 +85,7 @@ class Observer $website = $observer->getEvent()->getWebsite(); $this->_indexer->processEntityAction( $website, - \Magento\Core\Model\Website::ENTITY, + \Magento\Store\Model\Website::ENTITY, \Magento\Index\Model\Event::TYPE_SAVE ); } @@ -101,7 +101,7 @@ class Observer $store = $observer->getEvent()->getStore(); $this->_indexer->processEntityAction( $store, - \Magento\Core\Model\Store::ENTITY, + \Magento\Store\Model\Store::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE ); } @@ -117,7 +117,7 @@ class Observer $storeGroup = $observer->getEvent()->getStoreGroup(); $this->_indexer->processEntityAction( $storeGroup, - \Magento\Core\Model\Store\Group::ENTITY, + \Magento\Store\Model\Store::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE ); } @@ -133,7 +133,7 @@ class Observer $website = $observer->getEvent()->getWebsite(); $this->_indexer->processEntityAction( $website, - \Magento\Core\Model\Website::ENTITY, + \Magento\Store\Model\Website::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE ); } diff --git a/app/code/Magento/Index/Model/Resource/Setup.php b/app/code/Magento/Index/Model/Resource/Setup.php index 578f8e69c2b135c412001e3c8c099a3a7e768674..4e7f2790ca667dee75bafdcbcd1a6d19b62dba17 100644 --- a/app/code/Magento/Index/Model/Resource/Setup.php +++ b/app/code/Magento/Index/Model/Resource/Setup.php @@ -34,7 +34,7 @@ */ namespace Magento\Index\Model\Resource; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\Index\Model\Indexer\ConfigInterface @@ -42,18 +42,18 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_indexerConfig; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig * @param string $moduleName * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig, $moduleName = 'Magento_Index', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_indexerConfig = $indexerConfig; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Index/etc/events.xml b/app/code/Magento/Index/etc/events.xml index 68144aea83bae8703dc42b42e073d82babcf05da..ac047cf643ef8f6b12d4f6322484791e2301befb 100644 --- a/app/code/Magento/Index/etc/events.xml +++ b/app/code/Magento/Index/etc/events.xml @@ -42,7 +42,7 @@ <event name="website_delete_commit_after"> <observer name="index" instance="Magento\Index\Model\Observer" method="processWebsiteDelete" /> </event> - <event name="core_config_data_save_commit_after"> + <event name="config_data_save_commit_after"> <observer name="index" instance="Magento\Index\Model\Observer" method="processConfigDataSave" /> </event> </config> diff --git a/app/code/Magento/Index/etc/module.xml b/app/code/Magento/Index/etc/module.xml index a67de8da3b68ca327ddca05759aa73a5c8bd5b3a..4dec28f97bdcbe77407e6fac09837c51d05a6b93 100644 --- a/app/code/Magento/Index/etc/module.xml +++ b/app/code/Magento/Index/etc/module.xml @@ -27,9 +27,10 @@ <module name="Magento_Index" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Backend"/> <module name="Magento_AdminNotification"/> </depends> diff --git a/app/code/Magento/Indexer/Block/Backend/Container.php b/app/code/Magento/Indexer/Block/Backend/Container.php index 8b3f4d30a50c564a6e9a542e2ac89fb331de8bf3..6612eeeaeec87b2fa5f3c7b3d84eb4ca391a5451 100644 --- a/app/code/Magento/Indexer/Block/Backend/Container.php +++ b/app/code/Magento/Indexer/Block/Backend/Container.php @@ -36,17 +36,6 @@ class Container extends \Magento\Backend\Block\Widget\Grid\Container $this->_blockGroup = 'Magento_Indexer'; $this->_headerText = __('New Indexer Management'); parent::_construct(); - } - - /** - * Prepare layout, remove button - * - * @return $this - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); $this->_removeButton('add'); - return $this; } } diff --git a/app/code/Magento/Indexer/Model/Mview/View/State.php b/app/code/Magento/Indexer/Model/Mview/View/State.php index 51504fa158e1ccb66409af79013c07054c8be9d7..a694eab568f8b527ffd534d7e6b0abd9e4ef05f5 100644 --- a/app/code/Magento/Indexer/Model/Mview/View/State.php +++ b/app/code/Magento/Indexer/Model/Mview/View/State.php @@ -24,7 +24,7 @@ namespace Magento\Indexer\Model\Mview\View; /** - * @method \Magento\Indexer\Model\Indexer\State setViewId(string $value) + * @method \Magento\Core\Model\Mview\View\State setViewId(string $value) */ class State extends \Magento\Model\AbstractModel implements \Magento\Mview\View\StateInterface { diff --git a/app/code/Magento/Indexer/etc/cron_groups.xml b/app/code/Magento/Indexer/etc/cron_groups.xml index e9762fb4076f5c4e0b39d70b8c22eb69ce62699b..e0f9598adedadedbcc48f1e5541ab0aec3cae64c 100644 --- a/app/code/Magento/Indexer/etc/cron_groups.xml +++ b/app/code/Magento/Indexer/etc/cron_groups.xml @@ -33,6 +33,6 @@ <history_cleanup_every>10</history_cleanup_every> <history_success_lifetime>60</history_success_lifetime> <history_failure_lifetime>600</history_failure_lifetime> - <use_separate_process>true</use_separate_process> + <use_separate_process>1</use_separate_process> </group> </config> \ No newline at end of file diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index cd1fced8c23fb7b65179508ebb6b74fa2c8c84ed..26e0b750b7f38d1c12e2a7f2843d2478c4169033 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -25,6 +25,10 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Indexer" version="1.0.0.0" active="true"> + <sequence> + <module name="Magento_Core"/> + <module name="Magento_Store"/> + </sequence> <depends> <module name="Magento_Backend"/> <module name="Magento_PageCache"/> diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php index 2a94037505cdaff64f1c3ed44a0f7cff40faf6b3..f83a34d00bc881a4ddb73a29036be988ffdbba1a 100644 --- a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php +++ b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php @@ -23,7 +23,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Install/App/Action/Plugin/Design.php b/app/code/Magento/Install/App/Action/Plugin/Design.php index 840d7a6709e38cbba52ef543e4601a087399c11c..be7710e02c597fa8c9bac3422e2af1a9e7d642ea 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Design.php +++ b/app/code/Magento/Install/App/Action/Plugin/Design.php @@ -38,9 +38,9 @@ class Design protected $_areaList; /** - * @var \Magento\View\LayoutInterface + * @var \Magento\App\State */ - protected $_layout; + protected $appState; /** * @var \Magento\View\Design\Theme\ListInterface @@ -55,14 +55,14 @@ class Design /** * @param RequestInterface $request * @param \Magento\App\AreaList $areaList - * @param \Magento\View\LayoutInterface $layout + * @param \Magento\App\State $appState * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\View\Design\Theme\ListInterface $themeList */ public function __construct( \Magento\App\RequestInterface $request, \Magento\App\AreaList $areaList, - \Magento\View\LayoutInterface $layout, + \Magento\App\State $appState, \Magento\View\DesignInterface $viewDesign, \Magento\View\Design\Theme\ListInterface $themeList ) { @@ -70,7 +70,7 @@ class Design $this->_themeList = $themeList; $this->_request = $request; $this->_areaList = $areaList; - $this->_layout = $layout; + $this->appState = $appState; } /** @@ -84,14 +84,14 @@ class Design */ public function beforeDispatch(\Magento\Install\Controller\Action $subject, RequestInterface $request) { - $areaCode = $this->_layout->getArea(); + $areaCode = $this->appState->getAreaCode(); $area = $this->_areaList->getArea($areaCode); $area->load(\Magento\Core\Model\App\Area::PART_CONFIG); $themePath = $this->_viewDesign->getConfigurationDesignTheme($areaCode); $themeFullPath = $areaCode . \Magento\View\Design\ThemeInterface::PATH_SEPARATOR . $themePath; $themeModel = $this->_themeList->getThemeByFullPath($themeFullPath); - $this->_viewDesign->setArea($areaCode)->setDesignTheme($themeModel); + $this->_viewDesign->setDesignTheme($themeModel); $area->detectDesign($this->_request); $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); diff --git a/app/code/Magento/Install/Block/End.php b/app/code/Magento/Install/Block/End.php index eb910245e7ccc44a9c1b684dd67ecba2dd6a15aa..1abc0e8db2f47bdeb538e73abe92d7390cc6f9a0 100644 --- a/app/code/Magento/Install/Block/End.php +++ b/app/code/Magento/Install/Block/End.php @@ -38,11 +38,6 @@ class End extends \Magento\Install\Block\AbstractBlock */ protected $_template = 'end.phtml'; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_coreConfig; - /** * @var \Magento\AdminNotification\Model\Survey */ @@ -60,7 +55,6 @@ class End extends \Magento\Install\Block\AbstractBlock * @param \Magento\Install\Model\Installer $installer * @param \Magento\Install\Model\Wizard $installWizard * @param \Magento\Session\Generic $session - * @param \Magento\App\ConfigInterface $coreConfig * @param \Magento\AdminNotification\Model\Survey $survey * @param string $cryptKey * @param array $data @@ -70,14 +64,12 @@ class End extends \Magento\Install\Block\AbstractBlock \Magento\Install\Model\Installer $installer, \Magento\Install\Model\Wizard $installWizard, \Magento\Session\Generic $session, - \Magento\App\ConfigInterface $coreConfig, \Magento\AdminNotification\Model\Survey $survey, $cryptKey, array $data = array() ) { $this->_cryptKey = $cryptKey; parent::__construct($context, $installer, $installWizard, $session, $data); - $this->_coreConfig = $coreConfig; $this->_survey = $survey; } diff --git a/app/code/Magento/Install/Controller/Wizard.php b/app/code/Magento/Install/Controller/Wizard.php index 27bdd680bc54ffb90c5b4f60a61d664efd2c8620..154fdb4608c460d7388e1ea178ea60dd43cfe369 100644 --- a/app/code/Magento/Install/Controller/Wizard.php +++ b/app/code/Magento/Install/Controller/Wizard.php @@ -75,7 +75,7 @@ class Wizard extends \Magento\Install\Controller\Action * @param \Magento\Install\Model\Wizard $wizard * @param \Magento\Session\Generic $session * @param \Magento\Module\UpdaterInterface $dbUpdater - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState */ public function __construct( @@ -85,7 +85,7 @@ class Wizard extends \Magento\Install\Controller\Action \Magento\Install\Model\Wizard $wizard, \Magento\Session\Generic $session, \Magento\Module\UpdaterInterface $dbUpdater, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index aa80892b7a5d053f951686e7c26d0c256fc1ac44..8e36ad4e4fff9350b6bd8a838e293eb182ef382d 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -54,7 +54,7 @@ class Installer extends \Magento\Object /** * Application config model * - * @var \Magento\App\ReinitableConfigInterface + * @var \Magento\App\Config\ReinitableConfigInterface */ protected $_config; @@ -69,16 +69,9 @@ class Installer extends \Magento\Object protected $_cacheTypeList; /** - * Core data - * - * @var \Magento\Core\Helper\Data + * @var \Magento\Install\Model\Setup */ - protected $_coreData = null; - - /** - * @var \Magento\Module\Updater\SetupFactory - */ - protected $_setupFactory; + protected $_installSetup; /** * Install installer pear @@ -111,7 +104,7 @@ class Installer extends \Magento\Object /** * Store Manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -191,16 +184,16 @@ class Installer extends \Magento\Object protected $_localeResolver; /** - * @param \Magento\App\ReinitableConfigInterface $config + * @param \Magento\App\Config\ReinitableConfigInterface $config * @param \Magento\Module\UpdaterInterface $dbUpdater * @param \Magento\App\CacheInterface $cache * @param \Magento\App\Cache\TypeListInterface $cacheTypeList * @param \Magento\App\Cache\StateInterface $cacheState - * @param \Magento\Module\Updater\SetupFactory $setupFactory + * @param \Magento\Install\Model\Setup $installSetup * @param \Magento\App\Arguments $arguments * @param \Magento\App\AreaList $areaList * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\User\Model\UserFactory $userModelFactory * @param Installer\Filesystem $filesystem * @param Installer\Pear $installerPear @@ -218,16 +211,16 @@ class Installer extends \Magento\Object * @param array $data */ public function __construct( - \Magento\App\ReinitableConfigInterface $config, + \Magento\App\Config\ReinitableConfigInterface $config, \Magento\Module\UpdaterInterface $dbUpdater, \Magento\App\CacheInterface $cache, \Magento\App\Cache\TypeListInterface $cacheTypeList, \Magento\App\Cache\StateInterface $cacheState, - \Magento\Module\Updater\SetupFactory $setupFactory, + \Magento\Install\Model\Setup $installSetup, \Magento\App\Arguments $arguments, \Magento\App\AreaList $areaList, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\User\Model\UserFactory $userModelFactory, \Magento\Install\Model\Installer\Filesystem $filesystem, \Magento\Install\Model\Installer\Pear $installerPear, @@ -249,7 +242,7 @@ class Installer extends \Magento\Object $this->_cache = $cache; $this->_cacheState = $cacheState; $this->_cacheTypeList = $cacheTypeList; - $this->_setupFactory = $setupFactory; + $this->_installSetup = $installSetup; $this->_encryptor = $encryptor; $this->mathRandom = $mathRandom; $this->_arguments = $arguments; @@ -408,37 +401,34 @@ class Installer extends \Magento\Object /** * Saving host information into DB */ - /** @var $setupModel \Magento\Core\Model\Resource\Setup */ - $setupModel = $this->_setupFactory->create('core_setup', 'Magento_Core'); - if (!empty($data['use_rewrites'])) { - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES, 1); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_USE_REWRITES, 1); } if (!empty($data['enable_charts'])) { - $setupModel->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 1); + $this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 1); } else { - $setupModel->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 0); + $this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 0); } if (!empty($data['admin_no_form_key'])) { - $setupModel->setConfigData('admin/security/use_form_key', 0); + $this->_installSetup->setConfigData('admin/security/use_form_key', 0); } $unsecureBaseUrl = $this->_storeManager->getStore()->getBaseUrl('web'); if (!empty($data['unsecure_base_url'])) { $unsecureBaseUrl = $data['unsecure_base_url']; - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl); } if (!empty($data['use_secure'])) { - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_SECURE_IN_FRONTEND, 1); - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, 1); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']); if (!empty($data['use_secure_admin'])) { - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, 1); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, 1); } } elseif (!empty($data['unsecure_base_url'])) { - $setupModel->setConfigData(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl); + $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl); } /** @@ -446,25 +436,25 @@ class Installer extends \Magento\Object */ $locale = $this->getDataModel()->getLocaleData(); if (!empty($locale['locale'])) { - $setupModel->setConfigData($this->_localeResolver->getDefaultLocalePath(), $locale['locale']); + $this->_installSetup->setConfigData($this->_localeResolver->getDefaultLocalePath(), $locale['locale']); } if (!empty($locale['timezone'])) { - $setupModel->setConfigData($this->_localeDate->getDefaultTimezonePath(), $locale['timezone']); + $this->_installSetup->setConfigData($this->_localeDate->getDefaultTimezonePath(), $locale['timezone']); } if (!empty($locale['currency'])) { - $setupModel->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, $locale['currency']); - $setupModel->setConfigData( + $this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, $locale['currency']); + $this->_installSetup->setConfigData( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency'] ); - $setupModel->setConfigData( + $this->_installSetup->setConfigData( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency'] ); } if (!empty($data['order_increment_prefix'])) { - $this->_setOrderIncrementPrefix($setupModel, $data['order_increment_prefix']); + $this->_setOrderIncrementPrefix($this->_installSetup, $data['order_increment_prefix']); } return $this; @@ -473,11 +463,11 @@ class Installer extends \Magento\Object /** * Set order number prefix * - * @param \Magento\Core\Model\Resource\Setup $setupModel + * @param \Magento\Module\Setup $setupModel * @param string $orderIncrementPrefix * @return void */ - protected function _setOrderIncrementPrefix(\Magento\Core\Model\Resource\Setup $setupModel, $orderIncrementPrefix) + protected function _setOrderIncrementPrefix(\Magento\Module\Setup $setupModel, $orderIncrementPrefix) { $select = $setupModel->getConnection()->select()->from( $setupModel->getTable('eav_entity_type'), diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index f24e7773bb41042a83fe0d81ada945cd05a6a49c..56380a0f96084b5deed727011b1fc428e9889e45 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -69,7 +69,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller /** * Store Manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -82,14 +82,14 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller * @param \Magento\Install\Model\Installer $installer * @param \Magento\App\RequestInterface $request * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Install\Model\Installer $installer, \Magento\App\RequestInterface $request, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Message\ManagerInterface $messageManager ) { parent::__construct($installer); diff --git a/app/code/Magento/Install/Model/Resource/Resource.php b/app/code/Magento/Install/Model/Resource/Resource.php index e1e613a722926df9336307bf96bd1ff1e09bcba5..857bcc5d257251755e7dd76229bb27cdbabc0d76 100644 --- a/app/code/Magento/Install/Model/Resource/Resource.php +++ b/app/code/Magento/Install/Model/Resource/Resource.php @@ -49,7 +49,7 @@ class Resource extends \Magento\Model\Resource\Db\AbstractDb implements \Magento */ protected function _construct() { - $this->_init('core_resource', 'store_id'); + $this->_init('core_resource', 'code'); } /** diff --git a/app/code/Magento/Install/Model/Setup.php b/app/code/Magento/Install/Model/Setup.php new file mode 100644 index 0000000000000000000000000000000000000000..b1fcca378bc8439945ec7a4e7362b2287f07d62b --- /dev/null +++ b/app/code/Magento/Install/Model/Setup.php @@ -0,0 +1,49 @@ +<?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 Magento + * @package Magento_Install + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Install\Model; + +class Setup extends \Magento\Module\Setup +{ + /** + * Save configuration data + * + * @param string $path + * @param string $value + * @param int|string $scope + * @param int $scopeId + * @return $this + */ + public function setConfigData($path, $value, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeId = 0) + { + $table = $this->getTable('core_config_data'); + // this is a fix for mysql 4.1 + $this->getConnection()->showTableStatus($table); + + $data = array('scope' => $scope, 'scope_id' => $scopeId, 'path' => $path, 'value' => $value); + $this->getConnection()->insertOnDuplicate($table, $data, array('value')); + return $this; + } +} diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index 547c3f2e3c21427871d343da220fe5f8d436a7fb..7d3e17f83b579dd2f8552aa8c620b2de80b8e003 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -144,4 +144,10 @@ <type name="Magento\App\Action\Action"> <plugin name="installInitializer" type="Magento\Install\App\Action\Plugin\Install" sortOrder="5"/> </type> + <type name="Magento\Install\Model\Setup"> + <arguments> + <argument name="resourceName" xsi:type="string">core_setup</argument> + <argument name="moduleName" xsi:type="string">Magento_Core</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Install/etc/module.xml b/app/code/Magento/Install/etc/module.xml index 53fa0501f1fe748dc0dd6bb9d5433524c8bdc2df..9e63c12249160dd9f4df5259724ceb5973492ca1 100644 --- a/app/code/Magento/Install/etc/module.xml +++ b/app/code/Magento/Install/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Install" version="0.7.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_AdminNotification"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/Install/view/install/page.phtml b/app/code/Magento/Install/view/install/page.phtml index 6aa82558d6bd3a47809b867485a15b09a985e6c9..8214c287ecc9a50187fe08aa1a8524080ffa3c20 100644 --- a/app/code/Magento/Install/view/install/page.phtml +++ b/app/code/Magento/Install/view/install/page.phtml @@ -39,6 +39,7 @@ <link rel="shortcut icon" href="<?php echo $this->getViewFileUrl('Magento_Theme::favicon.ico') ?>" type="image/x-icon"/> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-ui.js') ?>"></script> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('headjs/head.load.min.js') ?>"></script> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('mage/mage.js') ?>"></script> diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php index 4b9ee926bedcc523b26dc22c6f296a6f43191aa0..dd0388f9ed4eacc85b00fca499723d142787966c 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php @@ -88,7 +88,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container 'id' => 'save-split-button', 'label' => __('Save'), 'class_name' => 'Magento\Backend\Block\Widget\Button\SplitButton', - 'button_class' => 'PrimarySplitButton', + 'button_class' => '', 'data_attribute' => array( 'mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form')) ), diff --git a/app/code/Magento/Integration/Helper/Oauth/Data.php b/app/code/Magento/Integration/Helper/Oauth/Data.php index 6d55c1b01dd0c8ab9989fe6c9b373dd4ed855670..b342af3b6e01b8528981a797cbb76556d936f172 100644 --- a/app/code/Magento/Integration/Helper/Oauth/Data.php +++ b/app/code/Magento/Integration/Helper/Oauth/Data.php @@ -28,15 +28,15 @@ namespace Magento\Integration\Helper\Oauth; */ class Data { - /** @var \Magento\Core\Model\Store\Config */ - protected $_storeConfig; + /** @var \Magento\App\Config\ScopeConfigInterface */ + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /**#@+ @@ -81,7 +81,10 @@ class Data public function isCleanupProbability() { // Safe get cleanup probability value from system configuration - $configValue = (int)$this->_storeConfig->getConfig(self::XML_PATH_CLEANUP_PROBABILITY); + $configValue = (int)$this->_scopeConfig->getValue( + self::XML_PATH_CLEANUP_PROBABILITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $configValue > 0 ? 1 == mt_rand(1, $configValue) : false; } @@ -92,7 +95,10 @@ class Data */ public function getCleanupExpirationPeriod() { - $minutes = (int)$this->_storeConfig->getConfig(self::XML_PATH_CLEANUP_EXPIRATION_PERIOD); + $minutes = (int)$this->_scopeConfig->getValue( + self::XML_PATH_CLEANUP_EXPIRATION_PERIOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $minutes > 0 ? $minutes : self::CLEANUP_EXPIRATION_PERIOD_DEFAULT; } @@ -103,7 +109,10 @@ class Data */ public function getConsumerExpirationPeriod() { - $seconds = (int)$this->_storeConfig->getConfig(self::XML_PATH_CONSUMER_EXPIRATION_PERIOD); + $seconds = (int)$this->_scopeConfig->getValue( + self::XML_PATH_CONSUMER_EXPIRATION_PERIOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $seconds > 0 ? $seconds : self::CONSUMER_EXPIRATION_PERIOD_DEFAULT; } @@ -114,7 +123,10 @@ class Data */ public function getConsumerPostMaxRedirects() { - $redirects = (int)$this->_storeConfig->getConfig(self::XML_PATH_CONSUMER_POST_MAXREDIRECTS); + $redirects = (int)$this->_scopeConfig->getValue( + self::XML_PATH_CONSUMER_POST_MAXREDIRECTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $redirects > 0 ? $redirects : 0; } @@ -125,7 +137,10 @@ class Data */ public function getConsumerPostTimeout() { - $seconds = (int)$this->_storeConfig->getConfig(self::XML_PATH_CONSUMER_POST_TIMEOUT); + $seconds = (int)$this->_scopeConfig->getValue( + self::XML_PATH_CONSUMER_POST_TIMEOUT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $seconds > 0 ? $seconds : self::CONSUMER_POST_TIMEOUT_DEFAULT; } } diff --git a/app/code/Magento/Integration/Model/Resource/Setup.php b/app/code/Magento/Integration/Model/Resource/Setup.php index 4b4c2d585c139b8b1a58e33ca3fbc293bd4c2703..705a409152a311216fd480967d1598f5f3e48962 100644 --- a/app/code/Magento/Integration/Model/Resource/Setup.php +++ b/app/code/Magento/Integration/Model/Resource/Setup.php @@ -28,7 +28,7 @@ use Magento\Integration\Model\Manager; /** * Resource Setup Model */ -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var Manager @@ -38,7 +38,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup /** * Construct resource Setup Model * - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param Manager $integrationManager * @param string $moduleName @@ -46,11 +46,11 @@ class Setup extends \Magento\Core\Model\Resource\Setup * */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, Manager $integrationManager, $moduleName = 'Magento_Integration', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_integrationManager = $integrationManager; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Integration/Service/OauthV1.php b/app/code/Magento/Integration/Service/OauthV1.php index 7f88cfdf9f78a1191dedf48133d404e63b1cdd3a..18bc930027ed68bd177370bfa9c3388ab7afe1c0 100644 --- a/app/code/Magento/Integration/Service/OauthV1.php +++ b/app/code/Magento/Integration/Service/OauthV1.php @@ -41,7 +41,7 @@ use Magento\Integration\Model\Oauth\Consumer as ConsumerModel; class OauthV1 implements OauthV1Interface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -83,7 +83,7 @@ class OauthV1 implements OauthV1Interface /** * Initialize dependencies. * - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param ConsumerFactory $consumerFactory * @param TokenFactory $tokenFactory * @param IntegrationOauthHelper $dataHelper @@ -93,7 +93,7 @@ class OauthV1 implements OauthV1Interface * @param TokenProvider $tokenProvider */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, ConsumerFactory $consumerFactory, TokenFactory $tokenFactory, IntegrationOauthHelper $dataHelper, diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index 57de95a4ed126c85d129c051b4a24fdcc4c1d05e..956bcf5f1b0b3a15e66c79e8d05f52c256032039 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Integration" version="1.0.0.2" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php index b0190f05a8e51b9e7f7838454a8e365b0232f35b..09b0dd0ca0deab0ffd09ba15b06759664a5e8a43 100644 --- a/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php +++ b/app/code/Magento/Integration/sql/integration_setup/install-1.0.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var \Magento\Core\Model\Resource\Setup $installer */ +/* @var \Magento\Module\Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Log/Model/Aggregation.php b/app/code/Magento/Log/Model/Aggregation.php index 30e8fa28c313c619a6c7350858ac7e5d51128f82..80193ba6fae901074b144b1e94307bbd3ac2fc6b 100644 --- a/app/code/Magento/Log/Model/Aggregation.php +++ b/app/code/Magento/Log/Model/Aggregation.php @@ -45,14 +45,14 @@ class Aggregation extends \Magento\Model\AbstractModel protected $_lastRecord; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -60,7 +60,7 @@ class Aggregation extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() diff --git a/app/code/Magento/Log/Model/Cron.php b/app/code/Magento/Log/Model/Cron.php index 70d35de7b6af643b441e53b984397845664d4066..2c5ca83c0ef0b55dab15654b6db5834f63bb8af9 100644 --- a/app/code/Magento/Log/Model/Cron.php +++ b/app/code/Magento/Log/Model/Cron.php @@ -54,12 +54,12 @@ class Cron extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -82,9 +82,9 @@ class Cron extends \Magento\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param Log $log - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Log\Model\Log $log + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -95,8 +95,8 @@ class Cron extends \Magento\Model\AbstractModel \Magento\Registry $registry, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Log\Model\Log $log, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -105,7 +105,7 @@ class Cron extends \Magento\Model\AbstractModel $this->_transportBuilder = $transportBuilder; $this->_log = $log; $this->_storeManager = $storeManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -120,14 +120,20 @@ class Cron extends \Magento\Model\AbstractModel if (!$this->_errors) { return $this; } - if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT)) { + if (!$this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $this; } $this->inlineTranslation->suspend(); - $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, @@ -136,9 +142,15 @@ class Cron extends \Magento\Model\AbstractModel )->setTemplateVars( array('warnings' => join("\n", $this->_errors)) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_IDENTITY) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_LOG_CLEAN_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_LOG_CLEAN_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->getTransport(); $transport->sendMessage(); @@ -155,7 +167,11 @@ class Cron extends \Magento\Model\AbstractModel */ public function logClean() { - if (!$this->_coreStoreConfig->getConfigFlag(self::XML_PATH_LOG_CLEAN_ENABLED)) { + if (!$this->_scopeConfig->isSetFlag( + self::XML_PATH_LOG_CLEAN_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $this; } diff --git a/app/code/Magento/Log/Model/Log.php b/app/code/Magento/Log/Model/Log.php index a523909587293552bc7751b05404047b47194e0a..cb48b1b144b6da43fd73eb806812930d1666ffa7 100644 --- a/app/code/Magento/Log/Model/Log.php +++ b/app/code/Magento/Log/Model/Log.php @@ -52,14 +52,14 @@ class Log extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -67,12 +67,12 @@ class Log extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -93,7 +93,10 @@ class Log extends \Magento\Model\AbstractModel */ public function getLogCleanTime() { - return $this->_coreStoreConfig->getConfig(self::XML_LOG_CLEAN_DAYS) * 60 * 60 * 24; + return $this->_scopeConfig->getValue( + self::XML_LOG_CLEAN_DAYS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) * 60 * 60 * 24; } /** diff --git a/app/code/Magento/Log/Model/Resource/Visitor.php b/app/code/Magento/Log/Model/Resource/Visitor.php index fa093a98afaed05ea535d2a2e9020c0ed27fb78f..55861b02dfa349484afd69e3795bdcd5c5454407 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor.php +++ b/app/code/Magento/Log/Model/Resource/Visitor.php @@ -43,20 +43,20 @@ class Visitor extends \Magento\Model\Resource\Db\AbstractDb protected $_date; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\String $string */ public function __construct( \Magento\App\Resource $resource, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\String $string ) { $this->_date = $date; diff --git a/app/code/Magento/Log/Model/Shell/Command/Clean.php b/app/code/Magento/Log/Model/Shell/Command/Clean.php index 7fb13cb97490f4c703acc8d3cb6d2731453300ac..ccef52c6579c9003c7b07e29d6bef8a0398048f2 100644 --- a/app/code/Magento/Log/Model/Shell/Command/Clean.php +++ b/app/code/Magento/Log/Model/Shell/Command/Clean.php @@ -23,15 +23,16 @@ */ namespace Magento\Log\Model\Shell\Command; -use Magento\Core\Model\StoreManagerInterface; use Magento\Log\Model\LogFactory; class Clean implements \Magento\Log\Model\Shell\CommandInterface { /** - * @var StoreManagerInterface + * Mutable Config + * + * @var \Magento\App\Config\MutableScopeConfigInterface */ - protected $_storeManager; + protected $_mutableConfig; /** * @var LogFactory @@ -46,13 +47,16 @@ class Clean implements \Magento\Log\Model\Shell\CommandInterface protected $_days; /** - * @param StoreManagerInterface $storeManager + * @param \Magento\App\Config\MutableScopeConfigInterface $mutableConfig * @param LogFactory $logFactory * @param int $days */ - public function __construct(StoreManagerInterface $storeManager, LogFactory $logFactory, $days) - { - $this->_storeManager = $storeManager; + public function __construct( + \Magento\App\Config\MutableScopeConfigInterface $mutableConfig, + LogFactory $logFactory, + $days + ) { + $this->_mutableConfig = $mutableConfig; $this->_logFactory = $logFactory; $this->_days = $days; } @@ -65,7 +69,11 @@ class Clean implements \Magento\Log\Model\Shell\CommandInterface public function execute() { if ($this->_days > 0) { - $this->_storeManager->getStore()->setConfig(\Magento\Log\Model\Log::XML_LOG_CLEAN_DAYS, $this->_days); + $this->_mutableConfig->setValue( + \Magento\Log\Model\Log::XML_LOG_CLEAN_DAYS, + $this->_days, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @var $model \Magento\Log\Model\Log */ $model = $this->_logFactory->create(); diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php index 428fd2b2bde60459da213208bcc870af1aed4b37..7f03049e1cb413db0c0a9fbe7b4263ed48d8bd91 100644 --- a/app/code/Magento/Log/Model/Visitor.php +++ b/app/code/Magento/Log/Model/Visitor.php @@ -58,12 +58,12 @@ class Visitor extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -75,7 +75,7 @@ class Visitor extends \Magento\Model\AbstractModel protected $_ignores; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -112,11 +112,11 @@ class Visitor extends \Magento\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Session\SessionManagerInterface $session - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\HTTP\Header $httpHeader * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress @@ -131,11 +131,11 @@ class Visitor extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Session\SessionManagerInterface $session, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $coreConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\HTTP\Header $httpHeader, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress, @@ -147,7 +147,7 @@ class Visitor extends \Magento\Model\AbstractModel array $ignores = array(), array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_quoteFactory = $quoteFactory; $this->_session = $session; $this->_storeManager = $storeManager; @@ -232,7 +232,10 @@ class Visitor extends \Magento\Model\AbstractModel */ public function getOnlineMinutesInterval() { - $configValue = $this->_coreStoreConfig->getConfig('customer/online_customers/online_minutes_interval'); + $configValue = $this->_scopeConfig->getValue( + 'customer/online_customers/online_minutes_interval', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return intval($configValue) > 0 ? intval($configValue) : self::DEFAULT_ONLINE_MINUTES_INTERVAL; } @@ -334,11 +337,12 @@ class Visitor extends \Magento\Model\AbstractModel */ public function bindCustomerLogin($observer) { - if (!$this->getCustomerId() && ($customer = $observer->getEvent()->getCustomer())) { + /** @var \Magento\Customer\Service\V1\Data\Customer $customer */ + $customer = $observer->getEvent()->getCustomer(); + if (!$this->getCustomerId()) { $this->setDoCustomerLogin(true); $this->setCustomerId($customer->getId()); } - return $this; } /** @@ -351,11 +355,9 @@ class Visitor extends \Magento\Model\AbstractModel */ public function bindCustomerLogout($observer) { - $customer = $observer->getEvent()->getCustomer(); - if ($this->getCustomerId() && $customer) { + if ($this->getCustomerId()) { $this->setDoCustomerLogout(true); } - return $this; } /** diff --git a/app/code/Magento/Log/Model/Visitor/Online.php b/app/code/Magento/Log/Model/Visitor/Online.php index d625224e73bb77ae93d6d02f6e40fd241b5d6fc0..e40a9d9148429da076f15445f9cdb2046631e3e2 100644 --- a/app/code/Magento/Log/Model/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Visitor/Online.php @@ -55,14 +55,14 @@ class Online extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -70,12 +70,12 @@ class Online extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -142,7 +142,10 @@ class Online extends \Magento\Model\AbstractModel */ public function getUpdateFrequency() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_FREQUENCY); + return $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_FREQUENCY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -152,7 +155,12 @@ class Online extends \Magento\Model\AbstractModel */ public function getOnlineInterval() { - $value = intval($this->_coreStoreConfig->getConfig(self::XML_PATH_ONLINE_INTERVAL)); + $value = intval( + $this->_scopeConfig->getValue( + self::XML_PATH_ONLINE_INTERVAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); if (!$value) { $value = \Magento\Log\Model\Visitor::DEFAULT_ONLINE_MINUTES_INTERVAL; } diff --git a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php b/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php index 05d52b5e5cadd6bea05523c60a288336799741b7..8e5e54e6ddd1639e9187b3ee3b9e7bcb5eed85f1 100644 --- a/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Log/data/log_setup/data-install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $data = array( array('type_id' => 1, 'type_code' => 'hour', 'period' => 1, 'period_type' => 'HOUR'), diff --git a/app/code/Magento/Log/etc/di.xml b/app/code/Magento/Log/etc/di.xml index 50a231f708e6bfb0edb546509cfd94015c8bfef0..9885f427f9d6c1528a72e02d252ccedbab5d3cef 100644 --- a/app/code/Magento/Log/etc/di.xml +++ b/app/code/Magento/Log/etc/di.xml @@ -26,7 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <type name="Magento\Log\Model\Shell\Command\Clean"> <arguments> - <argument name="storeManager" xsi:type="object">Magento\Core\Model\StoreManager\Proxy</argument> + <argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManager\Proxy</argument> </arguments> </type> <type name="Magento\Log\Model\Visitor"> diff --git a/app/code/Magento/Log/etc/frontend/events.xml b/app/code/Magento/Log/etc/frontend/events.xml index ba4d3f6e54a88459761d1f36eaf9255bc185f5de..7d08f27071cdea1c3e89d388002f9fa248c87f0c 100644 --- a/app/code/Magento/Log/etc/frontend/events.xml +++ b/app/code/Magento/Log/etc/frontend/events.xml @@ -30,7 +30,7 @@ <event name="controller_action_postdispatch"> <observer name="log" instance="Magento\Log\Model\Visitor" method="saveByRequest" /> </event> - <event name="customer_login"> + <event name="customer_data_object_login"> <observer name="log" instance="Magento\Log\Model\Visitor" method="bindCustomerLogin" /> </event> <event name="customer_logout"> diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml index 280e757c075795b52333a093dff42612ed58c7a3..a04a8593cbb514cf1a226217f19c0eee698a4a95 100644 --- a/app/code/Magento/Log/etc/module.xml +++ b/app/code/Magento/Log/etc/module.xml @@ -27,9 +27,11 @@ <module name="Magento_Log" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Customer"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/Log/sql/log_setup/install-1.6.0.0.php b/app/code/Magento/Log/sql/log_setup/install-1.6.0.0.php index 64762513708d5d708a60ebef7a63a9feada3d3ee..2ca4730b4fdc29cb5fc493e8cc71714b5efccfa6 100644 --- a/app/code/Magento/Log/sql/log_setup/install-1.6.0.0.php +++ b/app/code/Magento/Log/sql/log_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php index 851e360a9bdf6beeda69b63590d6b642f61cd789..aeb1ef042a043fc0295ff336f574475f1afca7b5 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Addresses.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php @@ -18,19 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Checkout * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Multishipping\Block\Checkout; +use Magento\Customer\Model\Address\Config as AddressConfig; + /** * Multishipping checkout choose item addresses block - * - * @category Magento - * @package Magento_Checkout - * @author Magento Core Team <core@magentocommerce.com> */ class Addresses extends \Magento\Sales\Block\Items\AbstractItems { @@ -44,20 +40,36 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems */ protected $_multishipping; + /** + * @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface + */ + protected $_customerAddressService; + + /** + * @var \Magento\Customer\Model\Address\Config + */ + private $_addressConfig; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Filter\Object\GridFactory $filterGridFactory * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping + * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $customerAddressService + * @param AddressConfig $addressConfig * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Filter\Object\GridFactory $filterGridFactory, \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, + \Magento\Customer\Service\V1\CustomerAddressServiceInterface $customerAddressService, + AddressConfig $addressConfig, array $data = array() ) { $this->_filterGridFactory = $filterGridFactory; $this->_multishipping = $multishipping; + $this->_customerAddressService = $customerAddressService; + $this->_addressConfig = $addressConfig; parent::__construct($context, $data); $this->_isScopePrivate = true; } @@ -105,17 +117,11 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems */ public function getAddressesHtmlSelect($item, $index) { - $select = $this->getLayout()->createBlock( - 'Magento\View\Element\Html\Select' - )->setName( - 'ship[' . $index . '][' . $item->getQuoteItemId() . '][address]' - )->setId( - 'ship_' . $index . '_' . $item->getQuoteItemId() . '_address' - )->setValue( - $item->getCustomerAddressId() - )->setOptions( - $this->getAddressOptions() - ); + $select = $this->getLayout()->createBlock('Magento\View\Element\Html\Select') + ->setName('ship['.$index.']['.$item->getQuoteItemId().'][address]') + ->setId('ship_'.$index.'_'.$item->getQuoteItemId().'_address') + ->setValue($item->getCustomerAddressId()) + ->setOptions($this->getAddressOptions()); return $select->getHtml(); } @@ -129,9 +135,25 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems { $options = $this->getData('address_options'); if (is_null($options)) { - $options = array(); - foreach ($this->getCustomer()->getAddresses() as $address) { - $options[] = array('value' => $address->getId(), 'label' => $address->format('oneline')); + $options = []; + $addresses = []; + + try { + $addresses = $this->_customerAddressService->getAddresses($this->getCustomerId()); + } catch (\Magento\Exception\NoSuchEntityException $e) { + /** Customer does not exist */ + } + /** @var \Magento\Customer\Service\V1\Data\Address $address */ + foreach ($addresses as $address) { + $label = $this->_addressConfig + ->getFormatByCode(AddressConfig::DEFAULT_ADDRESS_FORMAT) + ->getRenderer() + ->renderArray(\Magento\Customer\Service\V1\Data\AddressConverter::toFlatArray($address)); + + $options[] = [ + 'value' => $address->getId(), + 'label' => $label + ]; } $this->setData('address_options', $options); } @@ -140,11 +162,13 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems } /** - * @return \Magento\Customer\Model\Customer + * Retrieve active customer ID + * + * @return int|null */ - public function getCustomer() + public function getCustomerId() { - return $this->getCheckout()->getCustomerSession()->getCustomer(); + return $this->getCheckout()->getCustomerSession()->getCustomerId(); } /** diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index c29ff2bf8756493c90d8c9fe48aa2af14654e3fd..ff97f22fdb403091af32c13085c89fa8718a1d9a 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -25,7 +25,7 @@ */ namespace Magento\Multishipping\Block\Checkout; -use Magento\Customer\Model\Address; +use Magento\Sales\Model\Quote\Address; /** * Mustishipping checkout shipping @@ -153,7 +153,11 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems */ public function getCarrierName($carrierCode) { - if ($name = $this->_storeConfig->getConfig('carriers/' . $carrierCode . '/title')) { + if ($name = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $name; } return $carrierCode; diff --git a/app/code/Magento/Multishipping/Helper/Data.php b/app/code/Magento/Multishipping/Helper/Data.php index 36c5ee76800aaa609b8e81186bc96b5a660f8509..e3068190e9fb821a3a9f2252e4cec149840b3694 100644 --- a/app/code/Magento/Multishipping/Helper/Data.php +++ b/app/code/Magento/Multishipping/Helper/Data.php @@ -40,9 +40,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $coreStoreConfig; + protected $scopeConfig; /** * Checkout session @@ -55,15 +55,15 @@ class Data extends \Magento\App\Helper\AbstractHelper * Construct * * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Checkout\Model\Session $checkoutSession */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Session $checkoutSession ) { - $this->coreStoreConfig = $coreStoreConfig; + $this->scopeConfig = $scopeConfig; $this->checkoutSession = $checkoutSession; parent::__construct($context); } @@ -85,7 +85,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMaximumQty() { - return (int)$this->coreStoreConfig->getConfig(self::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY); + return (int)$this->scopeConfig->getValue(self::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -97,7 +97,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function isMultishippingCheckoutAvailable() { $quote = $this->getQuote(); - $isMultiShipping = $this->coreStoreConfig->getConfigFlag(self::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE); + $isMultiShipping = $this->scopeConfig->isSetFlag(self::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if (!$quote || !$quote->hasItems()) { return $isMultiShipping; } diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 01e9dc342a04a369e8b5edaa7bd07e9377d2559d..11b62bf412c3858d1b793f66cc8931a59ffb85ec 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -28,7 +28,7 @@ use Magento\Customer\Service\V1\CustomerAddressServiceInterface; /** * Multishipping checkout model */ -class Multishipping extends \Magento\Checkout\Model\Type\AbstractType +class Multishipping extends \Magento\Object { /** * Quote shipping addresses items cache @@ -47,17 +47,17 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $_session; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -83,17 +83,37 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType */ protected $helper; + /** + * @var \Magento\Checkout\Model\Session + */ + protected $_checkoutSession; + + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * @var \Magento\Sales\Model\OrderFactory + */ + protected $_orderFactory; + + /** + * @var CustomerAddressServiceInterface + */ + protected $_customerAddressService; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param CustomerAddressServiceInterface $customerAddressService * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Session $session + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Session\Generic $session * @param \Magento\Sales\Model\Quote\AddressFactory $addressFactory * @param \Magento\Sales\Model\Convert\Quote $quote - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Payment\Model\Method\SpecificationInterface $paymentSpecification * @param \Magento\Multishipping\Helper\Data $helper * @param array $data @@ -104,24 +124,28 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType \Magento\Sales\Model\OrderFactory $orderFactory, CustomerAddressServiceInterface $customerAddressService, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Session $session, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Session\Generic $session, \Magento\Sales\Model\Quote\AddressFactory $addressFactory, \Magento\Sales\Model\Convert\Quote $quote, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Payment\Model\Method\SpecificationInterface $paymentSpecification, \Magento\Multishipping\Helper\Data $helper, array $data = array() ) { $this->_eventManager = $eventManager; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_session = $session; $this->_addressFactory = $addressFactory; $this->_quote = $quote; $this->_storeManager = $storeManager; $this->paymentSpecification = $paymentSpecification; $this->helper = $helper; - parent::__construct($checkoutSession, $customerSession, $orderFactory, $customerAddressService, $data); + $this->_checkoutSession = $checkoutSession; + $this->_customerSession = $customerSession; + $this->_orderFactory = $orderFactory; + $this->_customerAddressService = $customerAddressService; + parent::__construct($data); $this->_init(); } @@ -385,7 +409,6 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType try { $address = $this->_customerAddressService->getAddress($addressId); } catch (\Exception $e) { - /** Customer address does not exist. */ } if (isset($address)) { if (!($quoteAddress = $this->getQuote()->getShippingAddressByCustomerAddressId($address->getId()))) { @@ -420,7 +443,6 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType try { $address = $this->_customerAddressService->getAddress($addressId); } catch (\Exception $e) { - /** Customer address does not exist. */ } if (isset($address)) { $this->getQuote()->getShippingAddressByCustomerAddressId( @@ -446,7 +468,6 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType try { $address = $this->_customerAddressService->getAddress($addressId); } catch (\Exception $e) { - /** Customer address does not exist. */ } if (isset($address)) { $this->getQuote()->getBillingAddress($addressId)->importCustomerAddressData($address)->collectTotals(); @@ -669,10 +690,12 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType */ public function validateMinimumAmount() { - return !($this->_coreStoreConfig->getConfigFlag( - 'sales/minimum_order/active' - ) && $this->_coreStoreConfig->getConfigFlag( - 'sales/minimum_order/multi_address' + return !($this->_scopeConfig->isSetFlag( + 'sales/minimum_order/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) && $this->_scopeConfig->isSetFlag( + 'sales/minimum_order/multi_address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && !$this->getQuote()->validateMinimumAmount()); } @@ -683,9 +706,15 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType */ public function getMinimumAmountDescription() { - $descr = $this->_coreStoreConfig->getConfig('sales/minimum_order/multi_address_description'); + $descr = $this->_scopeConfig->getValue( + 'sales/minimum_order/multi_address_description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (empty($descr)) { - $descr = $this->_coreStoreConfig->getConfig('sales/minimum_order/description'); + $descr = $this->_scopeConfig->getValue( + 'sales/minimum_order/description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $descr; } @@ -695,9 +724,15 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType */ public function getMinimumAmountError() { - $error = $this->_coreStoreConfig->getConfig('sales/minimum_order/multi_address_error_message'); + $error = $this->_scopeConfig->getValue( + 'sales/minimum_order/multi_address_error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (empty($error)) { - $error = $this->_coreStoreConfig->getConfig('sales/minimum_order/error_message'); + $error = $this->_scopeConfig->getValue( + 'sales/minimum_order/error_message', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $error; } @@ -713,4 +748,101 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType $idsAssoc = $this->_session->getOrderIds(); return $asAssoc ? $idsAssoc : array_keys($idsAssoc); } + + /** + * Retrieve customer default billing address + * + * @return \Magento\Customer\Service\V1\Data\Address|null + */ + public function getCustomerDefaultBillingAddress() + { + $address = $this->getData('customer_default_billing_address'); + if (is_null($address)) { + $customerId = $this->getCustomer()->getId(); + $address = $this->_customerAddressService->getDefaultBillingAddress($customerId); + if (!$address) { + /** Default billing address is not available, try to find any customer address */ + $allAddresses = $this->_customerAddressService->getAddresses($customerId); + $address = count($allAddresses) ? reset($allAddresses) : null; + } + $this->setData('customer_default_billing_address', $address); + } + return $address; + } + + /** + * Retrieve customer default shipping address + * + * @return \Magento\Customer\Service\V1\Data\Address|null + */ + public function getCustomerDefaultShippingAddress() + { + $address = $this->getData('customer_default_shipping_address'); + if (is_null($address)) { + $customerId = $this->getCustomer()->getId(); + $address = $this->_customerAddressService->getDefaultShippingAddress($customerId); + if (!$address) { + /** Default shipping address is not available, try to find any customer address */ + $allAddresses = $this->_customerAddressService->getAddresses($customerId); + $address = count($allAddresses) ? reset($allAddresses) : null; + } + $this->setData('customer_default_shipping_address', $address); + } + return $address; + } + + /** + * Retrieve checkout session model + * + * @return \Magento\Checkout\Model\Session + */ + public function getCheckoutSession() + { + $checkout = $this->getData('checkout_session'); + if (is_null($checkout)) { + $checkout = $this->_checkoutSession; + $this->setData('checkout_session', $checkout); + } + return $checkout; + } + + /** + * Retrieve quote model + * + * @return \Magento\Sales\Model\Quote + */ + public function getQuote() + { + return $this->getCheckoutSession()->getQuote(); + } + + /** + * Retrieve quote items + * + * @return \Magento\Sales\Model\Quote\Item[] + */ + public function getQuoteItems() + { + return $this->getQuote()->getAllItems(); + } + + /** + * Retrieve customer session model + * + * @return \Magento\Customer\Model\Session + */ + public function getCustomerSession() + { + return $this->_customerSession; + } + + /** + * Retrieve customer object + * + * @return \Magento\Customer\Service\V1\Data\Customer + */ + public function getCustomer() + { + return $this->_customerSession->getCustomerDataObject(); + } } diff --git a/app/code/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecure.php b/app/code/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecure.php index aa66bb29373c25833798eb9165b250cb3a7484a4..f5134561c0792ad7f13db71d8c2f2e402f5186eb 100644 --- a/app/code/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecure.php +++ b/app/code/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecure.php @@ -25,7 +25,7 @@ namespace Magento\Multishipping\Model\Payment\Method\Specification; use Magento\Payment\Model\Method\Specification\AbstractSpecification; use Magento\Payment\Model\Config as PaymentConfig; -use Magento\Core\Model\Store\ConfigInterface as StoreConfig; +use Magento\App\Config\ScopeConfigInterface as StoreConfig; /** * 3D secure specification @@ -51,18 +51,18 @@ class Is3DSecure extends AbstractSpecification * * @var StoreConfig */ - protected $storeConfig; + protected $scopeConfig; /** * Construct * * @param PaymentConfig $paymentConfig - * @param StoreConfig $storeConfig + * @param StoreConfig $scopeConfig */ - public function __construct(PaymentConfig $paymentConfig, StoreConfig $storeConfig) + public function __construct(PaymentConfig $paymentConfig, StoreConfig $scopeConfig) { parent::__construct($paymentConfig); - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; } /** @@ -84,10 +84,10 @@ class Is3DSecure extends AbstractSpecification */ protected function is3DSecureEnabled($paymentMethod) { - return $this->storeConfig->getConfigFlag( - sprintf(self::PATH_PAYMENT_3DSECURE, $paymentMethod) - ) || $this->storeConfig->getConfigFlag( - sprintf(self::PATH_PAYMENT_CENTINEL, $paymentMethod) + return $this->scopeConfig->isSetFlag( + sprintf(self::PATH_PAYMENT_3DSECURE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $paymentMethod) + ) || $this->scopeConfig->isSetFlag( + sprintf(self::PATH_PAYMENT_CENTINEL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $paymentMethod) ); } } diff --git a/app/code/Magento/Multishipping/etc/module.xml b/app/code/Magento/Multishipping/etc/module.xml index d2b659ded3e07c513310054f14189b82b9d10539..4da05e635e689d233f0cdbb3e32015c134b264b4 100644 --- a/app/code/Magento/Multishipping/etc/module.xml +++ b/app/code/Magento/Multishipping/etc/module.xml @@ -27,9 +27,11 @@ <module name="Magento_Multishipping" version="2.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Checkout"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php index abaf2dde6026fdcfe48c744f995099b0c871d2b6..d5c66d3b144a437540407644caf1d8a8cefde743 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit.php @@ -130,13 +130,31 @@ class Edit extends \Magento\Backend\Block\Template $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true); } - $this->addChild( + $this->getToolbar()->addChild( + 'back_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Back'), + 'onclick' => "window.location.href = '" . $this->getUrl( + $this->getTemplateId() ? '*/template' : '*/*' + ) . "'", + 'class' => 'action-back' + ) + ); + + $this->getToolbar()->addChild( + 'reset_button', + 'Magento\Backend\Block\Widget\Button', + array('label' => __('Reset'), 'class' => 'reset', 'onclick' => 'window.location = window.location') + ); + + $this->getToolbar()->addChild( 'preview_button', 'Magento\Backend\Block\Widget\Button', array('label' => __('Preview Template'), 'onclick' => 'queueControl.preview();', 'class' => 'preview') ); - $this->addChild( + $this->getToolbar()->addChild( 'save_button', 'Magento\Backend\Block\Widget\Button', array( @@ -148,7 +166,7 @@ class Edit extends \Magento\Backend\Block\Template ) ); - $this->addChild( + $this->getToolbar()->addChild( 'save_and_resume', 'Magento\Backend\Block\Widget\Button', array( @@ -166,24 +184,6 @@ class Edit extends \Magento\Backend\Block\Template ) ); - $this->addChild( - 'reset_button', - 'Magento\Backend\Block\Widget\Button', - array('label' => __('Reset'), 'onclick' => 'window.location = window.location') - ); - - $this->addChild( - 'back_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Back'), - 'onclick' => "window.location.href = '" . $this->getUrl( - $this->getTemplateId() ? '*/template' : '*/*' - ) . "'", - 'class' => 'action-back' - ) - ); - return parent::_prepareLayout(); } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php index b52946a63d58b99d898d4739b25d4261c79d9e5c..d30ac8fd4dc36c2bfd3fb678ab204ac07bac83f5 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Edit/Form.php @@ -40,7 +40,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_wysiwygConfig; /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Newsletter\Model\QueueFactory $queueFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @param array $data */ @@ -63,7 +63,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Newsletter\Model\QueueFactory $queueFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, array $data = array() ) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php index fe7d0f8b4ad8da5db7f1855953b28f3a4350d911..38bd0c88a154f3728d469115358080a8de4fa879 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php @@ -29,7 +29,7 @@ */ namespace Magento\Newsletter\Block\Adminhtml\Subscriber\Grid\Filter; -use Magento\Core\Model\Resource\Website\Collection; +use Magento\Store\Model\Resource\Website\Collection; class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select { @@ -48,28 +48,28 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select protected $_coreRegistry; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Core\Model\Resource\Website\CollectionFactory + * @var \Magento\Store\Model\Resource\Website\CollectionFactory */ protected $_websitesFactory; /** * @param \Magento\Backend\Block\Context $context * @param \Magento\DB\Helper $resourceHelper - * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\Resource\Website\CollectionFactory $websitesFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\DB\Helper $resourceHelper, - \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\Resource\Website\CollectionFactory $websitesFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, array $data = array() ) { diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template.php index a79733698c5e45d102ce7e1345194e598d783245..5a9ab17d60fe3cf7920a75c809b45ccd2e8d133d 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template.php @@ -45,6 +45,16 @@ class Template extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { + $this->getToolbar()->addChild( + 'add_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Add New Template'), + 'onclick' => "window.location='" . $this->getCreateUrl() . "'", + 'class' => 'add primary add-template' + ) + ); + $this->setChild( 'grid', $this->getLayout()->createBlock( diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php index cc177a6d0ee5e80cf66d84cd2660268b18fdbe79..4c955df991fdea626462ee959d15db04638fae53 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit.php @@ -35,13 +35,6 @@ namespace Magento\Newsletter\Block\Adminhtml\Template; class Edit extends \Magento\Backend\Block\Widget { - /** - * Edit Block model - * - * @var bool - */ - protected $_editMode = false; - /** * Core registry * @@ -94,7 +87,7 @@ class Edit extends \Magento\Backend\Block\Widget $block->setCanLoadTinyMce(true); } - $this->addChild( + $this->getToolbar()->addChild( 'back_button', 'Magento\Backend\Block\Widget\Button', array( @@ -104,7 +97,7 @@ class Edit extends \Magento\Backend\Block\Widget ) ); - $this->addChild( + $this->getToolbar()->addChild( 'reset_button', 'Magento\Backend\Block\Widget\Button', array( @@ -114,152 +107,64 @@ class Edit extends \Magento\Backend\Block\Widget ) ); - $this->addChild( - 'to_plain_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Convert to Plain Text'), - 'onclick' => 'templateControl.stripTags();', - 'id' => 'convert_button', - 'class' => 'convert' - ) - ); - - $this->addChild( - 'to_html_button', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Return HTML Version'), - 'onclick' => 'templateControl.unStripTags();', - 'id' => 'convert_button_back', - 'style' => 'display:none', - 'class' => 'return' - ) - ); - - $this->addChild( - 'save_button', - 'Magento\Backend\Block\Widget\Button', - array('label' => __('Save Template'), 'onclick' => 'templateControl.save();', 'class' => 'save primary') - ); - - $this->addChild( - 'save_as_button', - 'Magento\Backend\Block\Widget\Button', - array('label' => __('Save As'), 'onclick' => 'templateControl.saveAs();', 'class' => 'save-as') - ); + if (!$this->isTextType()) { + $this->getToolbar()->addChild( + 'to_plain_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Convert to Plain Text'), + 'onclick' => 'templateControl.stripTags();', + 'id' => 'convert_button', + 'class' => 'convert' + ) + ); + + $this->getToolbar()->addChild( + 'to_html_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Return HTML Version'), + 'onclick' => 'templateControl.unStripTags();', + 'id' => 'convert_button_back', + 'style' => 'display:none', + 'class' => 'return' + ) + ); + } - $this->addChild( + $this->getToolbar()->addChild( 'preview_button', 'Magento\Backend\Block\Widget\Button', array('label' => __('Preview Template'), 'onclick' => 'templateControl.preview();', 'class' => 'preview') ); - $this->addChild( - 'delete_button', + if ($this->getEditMode()) { + $this->getToolbar()->addChild( + 'delete_button', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Delete Template'), + 'onclick' => 'templateControl.deleteTemplate();', + 'class' => 'delete' + ) + ); + + $this->getToolbar()->addChild( + 'save_as_button', + 'Magento\Backend\Block\Widget\Button', + array('label' => __('Save As'), 'onclick' => 'templateControl.saveAs();', 'class' => 'save-as') + ); + } + + $this->getToolbar()->addChild( + 'save_button', 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Delete Template'), - 'onclick' => 'templateControl.deleteTemplate();', - 'class' => 'delete' - ) + array('label' => __('Save Template'), 'onclick' => 'templateControl.save();', 'class' => 'save primary') ); return parent::_prepareLayout(); } - /** - * Retrieve Back Button HTML - * - * @return string - */ - public function getBackButtonHtml() - { - return $this->getChildHtml('back_button'); - } - - /** - * Retrieve Reset Button HTML - * - * @return string - */ - public function getResetButtonHtml() - { - return $this->getChildHtml('reset_button'); - } - - /** - * Retrieve Convert To Plain Button HTML - * - * @return string - */ - public function getToPlainButtonHtml() - { - return $this->getChildHtml('to_plain_button'); - } - - /** - * Retrieve Convert to HTML Button HTML - * - * @return string - */ - public function getToHtmlButtonHtml() - { - return $this->getChildHtml('to_html_button'); - } - - /** - * Retrieve Save Button HTML - * - * @return string - */ - public function getSaveButtonHtml() - { - return $this->getChildHtml('save_button'); - } - - /** - * Retrieve Preview Button HTML - * - * @return string - */ - public function getPreviewButtonHtml() - { - return $this->getChildHtml('preview_button'); - } - - /** - * Retrieve Delete Button HTML - * - * @return string - */ - public function getDeleteButtonHtml() - { - return $this->getChildHtml('delete_button'); - } - - /** - * Retrieve Save as Button HTML - * - * @return string - */ - public function getSaveAsButtonHtml() - { - return $this->getChildHtml('save_as_button'); - } - - /** - * Set edit flag for block - * - * @param boolean $value - * @return $this - */ - public function setEditMode($value = true) - { - $this->_editMode = (bool)$value; - return $this; - } - /** * Return edit flag for block * @@ -267,7 +172,10 @@ class Edit extends \Magento\Backend\Block\Widget */ public function getEditMode() { - return $this->_editMode; + if ($this->getModel()->getId()) { + return true; + } + return false; } /** diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php index 2458143c5de74681abd475f6356aeb17d75d13f2..c600e26db005e3a870fcc21e53f056b8d831da12 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php @@ -77,11 +77,18 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected function _prepareForm() { $model = $this->getModel(); - $identity = $this->_storeConfig->getConfig( - \Magento\Newsletter\Model\Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY + $identity = $this->_scopeConfig->getValue( + \Magento\Newsletter\Model\Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $identityName = $this->_scopeConfig->getValue( + 'trans_email/ident_' . $identity . '/name', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $identityEmail = $this->_scopeConfig->getValue( + 'trans_email/ident_' . $identity . '/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - $identityName = $this->_storeConfig->getConfig('trans_email/ident_' . $identity . '/name'); - $identityEmail = $this->_storeConfig->getConfig('trans_email/ident_' . $identity . '/email'); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create( diff --git a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php index ff7d7055da37a200d3574137b3a4f19a97e02382..33821f9fdf5fae47f33a8e4dc2340ac600649e66 100644 --- a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php +++ b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/GroupOptionHash.php @@ -30,14 +30,14 @@ class GroupOptionHash implements \Magento\Option\ArrayInterface /** * System Store Model * - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore */ - public function __construct(\Magento\Core\Model\System\Store $systemStore) + public function __construct(\Magento\Store\Model\System\Store $systemStore) { $this->_systemStore = $systemStore; } diff --git a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php index a10143abdf6270af1ad520f93b2cdae3ca16a872..680936786f0d8282454c2306e6d951f51ff33895 100644 --- a/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php +++ b/app/code/Magento/Newsletter/Block/Subscribe/Grid/Options/StoreOptionHash.php @@ -30,14 +30,14 @@ class StoreOptionHash implements \Magento\Option\ArrayInterface /** * System Store Model * - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore */ - public function __construct(\Magento\Core\Model\System\Store $systemStore) + public function __construct(\Magento\Store\Model\System\Store $systemStore) { $this->_systemStore = $systemStore; } diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php index 796aca675add8bd0d8a44090af5d20dc34677cac..6904c916a406751b42570488e103027b329a991d 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php @@ -102,7 +102,7 @@ class Queue extends \Magento\Backend\App\Action // set default value for selected store $data['preview_store_id'] = $this->_objectManager->get( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->getDefaultStoreView()->getId(); $this->_view->getLayout()->getBlock('preview_form')->setFormData($data); @@ -336,8 +336,8 @@ class Queue extends \Magento\Backend\App\Action $this->getRequest()->getParam('styles') ); - if ($queue->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_PAUSE && - $this->getRequest()->getParam( + if ($queue->getQueueStatus() == \Magento\Newsletter\Model\Queue::STATUS_PAUSE + && $this->getRequest()->getParam( '_resume', false ) diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php index 95924c54debaadb427ed98ec63fa08f7d1341e46..7a9850279c0e55a499a5e422c53cd80950cd1d81 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php @@ -153,11 +153,6 @@ class Template extends \Magento\Backend\App\Action $model->addData($values); } - $editBlock = $this->_view->getLayout()->getBlock('template_edit'); - if ($editBlock) { - $editBlock->setEditMode($model->getId() > 0); - } - $this->_view->renderLayout(); } @@ -282,7 +277,7 @@ class Template extends \Magento\Backend\App\Action // set default value for selected store $data['preview_store_id'] = $this->_objectManager->get( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->getDefaultStoreView()->getId(); $this->_view->getLayout()->getBlock('preview_form')->setFormData($data); diff --git a/app/code/Magento/Newsletter/Controller/Manage.php b/app/code/Magento/Newsletter/Controller/Manage.php index 350a6916c57a32d16a287e3726039a88d169c252..849148966bf0e3c4fd6a0f4b04736d389cadec53 100644 --- a/app/code/Magento/Newsletter/Controller/Manage.php +++ b/app/code/Magento/Newsletter/Controller/Manage.php @@ -45,7 +45,7 @@ class Manage extends \Magento\App\Action\Action protected $_formKeyValidator; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -73,7 +73,7 @@ class Manage extends \Magento\App\Action\Action * @param \Magento\App\Action\Context $context * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService * @param \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder @@ -83,7 +83,7 @@ class Manage extends \Magento\App\Action\Action \Magento\App\Action\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService, \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder, \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, diff --git a/app/code/Magento/Newsletter/Controller/Subscriber.php b/app/code/Magento/Newsletter/Controller/Subscriber.php index 2fc1a8ab2990c923214bc2dd684e5cf4044d71dc..30827b361d69523ee54c76fe845400848a641beb 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber.php @@ -26,15 +26,11 @@ /** * Newsletter subscribe controller - * - * @category Magento - * @package Magento_Newsletter - * @author Magento Core Team <core@magentocommerce.com> */ namespace Magento\Newsletter\Controller; use Magento\App\Action\Context; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Customer\Model\Session; use Magento\Customer\Service\V1\CustomerAccountServiceInterface; use Magento\Newsletter\Model\SubscriberFactory; @@ -64,7 +60,7 @@ class Subscriber extends \Magento\App\Action\Action protected $_subscriberFactory; /** - * @var StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -205,8 +201,11 @@ class Subscriber extends \Magento\App\Action\Action */ protected function validateGuestSubscription() { - if ($this->_objectManager->get('Magento\Core\Model\Store\Config') - ->getConfig(\Magento\Newsletter\Model\Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 + if ($this->_objectManager->get('Magento\App\Config\ScopeConfigInterface') + ->getValue( + \Magento\Newsletter\Model\Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) != 1 && !$this->_customerSession->isLoggedIn() ) { throw new \Magento\Model\Exception( diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index e0e1ab094ffa6ac8f5bbf4fc72631823dd4e65d4..d0d8bcce8a06a61f91ec9e5ea0853261334271b0 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -70,7 +70,7 @@ class CustomerPlugin * @param CustomerAccountServiceInterface $subject * @param callable $updateCustomer * @param CustomerDetails $customerDetails - * @return void + * @return bool * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -79,9 +79,11 @@ class CustomerPlugin callable $updateCustomer, CustomerDetails $customerDetails ) { - $updateCustomer($customerDetails); + $result = $updateCustomer($customerDetails); $this->subscriberFactory->create()->updateSubscription($customerDetails->getCustomer()->getId()); + + return $result; } /** @@ -90,9 +92,7 @@ class CustomerPlugin * @param CustomerAccountServiceInterface $subject * @param callable $deleteCustomer Function we are wrapping around * @param int $customerId Input to the function - * @return void - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @return bool */ public function aroundDeleteCustomer( CustomerAccountServiceInterface $subject, @@ -101,7 +101,7 @@ class CustomerPlugin ) { $customer = $subject->getCustomer($customerId); - $deleteCustomer($customerId); + $result = $deleteCustomer($customerId); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ $subscriber = $this->subscriberFactory->create(); @@ -109,5 +109,7 @@ class CustomerPlugin if ($subscriber->getId()) { $subscriber->delete(); } + + return $result; } } diff --git a/app/code/Magento/Newsletter/Model/Queue.php b/app/code/Magento/Newsletter/Model/Queue.php index 5e934a20930adb71f84099162af36eef3138b198..8b9c74c49c6e50d498fe6a81144f637b1ea68989 100644 --- a/app/code/Magento/Newsletter/Model/Queue.php +++ b/app/code/Magento/Newsletter/Model/Queue.php @@ -135,7 +135,7 @@ class Queue extends \Magento\Email\Model\AbstractTemplate * @param \Magento\View\DesignInterface $design * @param \Magento\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Newsletter\Model\Template\Filter $templateFilter * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime\DateTime $date @@ -150,7 +150,7 @@ class Queue extends \Magento\Email\Model\AbstractTemplate \Magento\View\DesignInterface $design, \Magento\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Newsletter\Model\Template\Filter $templateFilter, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime\DateTime $date, diff --git a/app/code/Magento/Newsletter/Model/Resource/Setup.php b/app/code/Magento/Newsletter/Model/Resource/Setup.php deleted file mode 100644 index 5fbd185979466d750b5781b2ea13afcfa89b5065..0000000000000000000000000000000000000000 --- a/app/code/Magento/Newsletter/Model/Resource/Setup.php +++ /dev/null @@ -1,64 +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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Newsletter resource setup - */ -namespace Magento\Newsletter\Model\Resource; - -class Setup extends \Magento\Core\Model\Resource\Setup -{ - /** - * Resource setup model - * - * @var \Magento\Core\Model\Resource\Setup\Migration - */ - protected $_setupMigration; - - /** - * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param string $resourceName - * @param string $moduleName - * @param string $connectionName - */ - public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, - $resourceName, - $moduleName = 'Magento_Newsletter', - $connectionName = '' - ) { - parent::__construct($context, $resourceName, $moduleName, $connectionName); - $this->_setupMigration = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); - } - - /** - * Get block factory - * - * @return \Magento\Core\Model\Resource\Setup\Migration - */ - public function getSetupMigration() - { - return $this->_migrationFactory->create(array('resourceName' => 'core_setup')); - } -} diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php index 9748a9507c0e2a10c5b023b87d97e4b5b937af60..948039c9266e5d27b652a6eafca0f0af0b2bdb13 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php @@ -112,7 +112,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio parent::_construct(); $this->_init('Magento\Newsletter\Model\Subscriber', 'Magento\Newsletter\Model\Resource\Subscriber'); $this->_queueLinkTable = $this->getTable('newsletter_queue_link'); - $this->_storeTable = $this->getTable('core_store'); + $this->_storeTable = $this->getTable('store'); // defining mapping for fields represented in several tables diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 9e0cb2a6dbd0ae8372341ba9c1e580b74293b39a..f1340e5c6ea65d3fc019ef71173196442322a904 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -98,9 +98,9 @@ class Subscriber extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Customer session @@ -112,7 +112,7 @@ class Subscriber extends \Magento\Model\AbstractModel /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -134,30 +134,26 @@ class Subscriber extends \Magento\Model\AbstractModel protected $inlineTranslation; /** - * Construct - * - * @param \Magento\Model\Context $context - * @param \Magento\Registry $registry - * @param \Magento\Newsletter\Helper\Data $newsletterData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Customer\Model\Session $customerSession - * @param CustomerAccountServiceInterface $customerAccountService - * @param \Magento\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @param \Magento\Model\Context $context + * @param \Magento\Registry $registry + * @param \Magento\Newsletter\Helper\Data $newsletterData + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Newsletter\Helper\Data $newsletterData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, CustomerAccountServiceInterface $customerAccountService, \Magento\Translate\Inline\StateInterface $inlineTranslation, @@ -166,7 +162,7 @@ class Subscriber extends \Magento\Model\AbstractModel array $data = [] ) { $this->_newsletterData = $newsletterData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_customerSession = $customerSession; @@ -411,7 +407,10 @@ class Subscriber extends \Magento\Model\AbstractModel $this->setSubscriberConfirmCode($this->randomSequence()); } - $isConfirmNeed = ($this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false; + $isConfirmNeed = $this->_scopeConfig->getValue( + self::XML_PATH_CONFIRMATION_FLAG, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) == 1 ? true : false; $isOwnSubscribes = false; $isSubscribeOwnEmail = $this->_customerSession->isLoggedIn() @@ -632,32 +631,44 @@ class Subscriber extends \Magento\Model\AbstractModel */ public function sendConfirmationRequestEmail() { - if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE) - || !$this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY) + if ($this->getImportMode()) { + return $this; + } + + if (!$this->_scopeConfig->getValue( + self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) || !$this->_scopeConfig->getValue( + self::XML_PATH_CONFIRM_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) { return $this; } $this->inlineTranslation->suspend(); - $this->_transportBuilder - ->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE) + $this->_transportBuilder->setTemplateIdentifier( + $this->_scopeConfig->getValue( + self::XML_PATH_CONFIRM_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) - ->setTemplateOptions( - array( - 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), - ) + )->setTemplateOptions( + array( + 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, + 'store' => $this->_storeManager->getStore()->getId() ) - ->setTemplateVars( - array( - 'subscriber' => $this, - 'store' => $this->_storeManager->getStore(), - ) + )->setTemplateVars( + array('subscriber' => $this, 'store' => $this->_storeManager->getStore()) + )->setFrom( + $this->_scopeConfig->getValue( + self::XML_PATH_CONFIRM_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) - ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_IDENTITY)) - ->addTo($this->getEmail(), $this->getName()); + )->addTo( + $this->getEmail(), + $this->getName() + ); $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); @@ -673,27 +684,44 @@ class Subscriber extends \Magento\Model\AbstractModel */ public function sendConfirmationSuccessEmail() { - if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE) - || !$this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY) + if ($this->getImportMode()) { + return $this; + } + + if (!$this->_scopeConfig->getValue( + self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) || !$this->_scopeConfig->getValue( + self::XML_PATH_SUCCESS_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) { return $this; } $this->inlineTranslation->suspend(); - $this->_transportBuilder - ->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE) + $this->_transportBuilder->setTemplateIdentifier( + $this->_scopeConfig->getValue( + self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + )->setTemplateOptions( + array( + 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, + 'store' => $this->_storeManager->getStore()->getId() ) - ->setTemplateOptions( - array( - 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), - ) + )->setTemplateVars( + array('subscriber' => $this) + )->setFrom( + $this->_scopeConfig->getValue( + self::XML_PATH_SUCCESS_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) - ->setTemplateVars(array('subscriber' => $this)) - ->setFrom($this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_IDENTITY)) - ->addTo($this->getEmail(), $this->getName()); + )->addTo( + $this->getEmail(), + $this->getName() + ); $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); @@ -709,29 +737,43 @@ class Subscriber extends \Magento\Model\AbstractModel */ public function sendUnsubscriptionEmail() { - if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE) - || !$this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY) + if ($this->getImportMode()) { + return $this; + } + if (!$this->_scopeConfig->getValue( + self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) || !$this->_scopeConfig->getValue( + self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ) { return $this; } $this->inlineTranslation->suspend(); - $this->_transportBuilder - ->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE) + $this->_transportBuilder->setTemplateIdentifier( + $this->_scopeConfig->getValue( + self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) - ->setTemplateOptions( - array( - 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, - 'store' => $this->_storeManager->getStore()->getId(), - ) + )->setTemplateOptions( + array( + 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, + 'store' => $this->_storeManager->getStore()->getId() ) - ->setTemplateVars(array('subscriber' => $this)) - ->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY) + )->setTemplateVars( + array('subscriber' => $this) + )->setFrom( + $this->_scopeConfig->getValue( + self::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) - ->addTo($this->getEmail(), $this->getName()); + )->addTo( + $this->getEmail(), + $this->getName() + ); $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index 7dc55992080623c2c9153c862c8d5a55d799461b..8a2cef173c9cec84b4a69527c275cf4e27744cb4 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -74,7 +74,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate /** * Store manager to emulate design * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -95,9 +95,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Template factory @@ -116,10 +116,10 @@ class Template extends \Magento\Email\Model\AbstractTemplate * @param \Magento\View\DesignInterface $design * @param \Magento\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Newsletter\Model\Template\Filter $filter - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Newsletter\Model\TemplateFactory $templateFactory * @param \Magento\Filter\FilterManager $filterManager * @param array $data @@ -129,10 +129,10 @@ class Template extends \Magento\Email\Model\AbstractTemplate \Magento\View\DesignInterface $design, \Magento\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Newsletter\Model\Template\Filter $filter, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Newsletter\Model\TemplateFactory $templateFactory, \Magento\Filter\FilterManager $filterManager, array $data = array() @@ -141,7 +141,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate $this->_storeManager = $storeManager; $this->_request = $request; $this->_filter = $filter; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_templateFactory = $templateFactory; $this->_filterManager = $filterManager; } @@ -352,8 +352,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate */ public function isValidForSend() { - return !$this->_coreStoreConfig->getConfigFlag( - \Magento\Email\Model\Template::XML_PATH_SYSTEM_SMTP_DISABLE + return !$this->_scopeConfig->isSetFlag( + \Magento\Email\Model\Template::XML_PATH_SYSTEM_SMTP_DISABLE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && $this->getTemplateSenderName() && $this->getTemplateSenderEmail() && $this->getTemplateSubject(); } } diff --git a/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.0-1.6.0.1.php index d26692aa646a1915fbec28f11f7a0908a9cf4198..623183595a9b3a0af18c0d84c8e73ce22062b376 100644 --- a/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.0-1.6.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $subscriberTable = $installer->getTable('newsletter_subscriber'); diff --git a/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.1-1.6.0.2.php index e7dfdb6278095ed2d29c406245fb300700da5b54..ba52b3a29d18dfff7ce4eb854cfa467f11b8b0a2 100644 --- a/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.1-1.6.0.2.php @@ -24,29 +24,29 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'newsletter_template', 'template_text', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, array('template_id') ); $installer->appendClassAliasReplace( 'newsletter_template', 'template_text_preprocessed', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, array('template_id') ); $installer->appendClassAliasReplace( 'newsletter_queue', 'newsletter_text', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI, array('queue_id') ); diff --git a/app/code/Magento/Newsletter/etc/di.xml b/app/code/Magento/Newsletter/etc/di.xml index 0a08e03ee4c761e8922173bac63399cebbd883fb..13addd3297378d2db8c8fa87ac67ca2439644082 100644 --- a/app/code/Magento/Newsletter/etc/di.xml +++ b/app/code/Magento/Newsletter/etc/di.xml @@ -24,13 +24,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <type name="Magento\Module\Updater\SetupFactory"> - <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="newsletter_setup" xsi:type="string">Magento\Newsletter\Model\Resource\Setup</item> - </argument> - </arguments> - </type> <virtualType name="Magento\Newsletter\Model\Session\Storage" type="Magento\Session\Storage"> <arguments> <argument name="namespace" xsi:type="string">newsletter</argument> diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index c42ffa6cf90191e8c2fa00cf1b0e1a8f474dfe12..006dd78f50af6b9e102d5420f1b05e0eccc40df3 100644 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -27,11 +27,13 @@ <module name="Magento_Newsletter" version="1.6.0.2" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Customer"/> <module name="Magento_Eav"/> <module name="Magento_Widget"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Widget"/> diff --git a/app/code/Magento/Newsletter/sql/newsletter_setup/install-1.6.0.0.php b/app/code/Magento/Newsletter/sql/newsletter_setup/install-1.6.0.0.php index 57b758f4e730eee5cddb7170b838e82a33277430..b71aebd6cd42c2ff20a1cb829a88b7fe5be8af07 100644 --- a/app/code/Magento/Newsletter/sql/newsletter_setup/install-1.6.0.0.php +++ b/app/code/Magento/Newsletter/sql/newsletter_setup/install-1.6.0.0.php @@ -33,7 +33,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); @@ -91,9 +91,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('newsletter_subscriber', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('newsletter_subscriber', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('newsletter_subscriber', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -364,9 +364,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('newsletter_queue_store_link', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('newsletter_queue_store_link', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml index b905078abda3ada00c22b19b3d944c90b3e0f41b..71937cc4b93c36c85be4702b8f3039dfe7fe8a06 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_queue_preview.xml @@ -29,6 +29,6 @@ <argument name="template" xsi:type="string">Magento_Newsletter::preview/iframeswitcher.phtml</argument> </action> <block class="Magento\Newsletter\Block\Adminhtml\Queue\Preview\Form" name="preview_form"/> - <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="Magento_Newsletter::preview/store.phtml"/> + <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="Magento_Backend::store/switcher.phtml" /> </referenceBlock> </layout> diff --git a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml index 3326ad035b3d221d6c691bb171a017f7504d0b00..cc43857dde773ad6a0ff3373d6b10c554629bb38 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml +++ b/app/code/Magento/Newsletter/view/adminhtml/layout/newsletter_template_preview.xml @@ -29,6 +29,6 @@ <argument name="template" xsi:type="string">Magento_Newsletter::preview/iframeswitcher.phtml</argument> </action> <block class="Magento\Newsletter\Block\Adminhtml\Template\Preview\Form" name="preview_form"/> - <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="Magento_Newsletter::preview/store.phtml"/> + <block class="Magento\Backend\Block\Store\Switcher" name="store_switcher" template="Magento_Backend::store/switcher.phtml" /> </referenceBlock> </layout> diff --git a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml index c92decdc6778e642e7e05187674602b67cd4e4e2..1f63e0862fd59a2526eb958c1595d621abbfd783 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/preview/iframeswitcher.phtml @@ -38,7 +38,6 @@ <?php if (!$this->isSingleStoreMode()) :?> <div class="store-switcher"> <?php echo $this->getChildHtml('store_switcher') ?> - <button class="button" onclick="preview();"><span><?php echo __('Preview'); ?></span></button> </div> <?php endif;?> </div> diff --git a/app/code/Magento/Newsletter/view/adminhtml/queue/list.phtml b/app/code/Magento/Newsletter/view/adminhtml/queue/list.phtml index 9f7359ad1acf54e4199f756065b2570073727dd4..f7cec9f81a4712b5931256ff10f8a9cae8f116ea 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/queue/list.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/queue/list.phtml @@ -24,5 +24,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"><?php echo $this->getButtonsHtml() ?></div> <?php echo $this->getChildHtml('grid'); ?> diff --git a/app/code/Magento/Newsletter/view/adminhtml/template/edit.phtml b/app/code/Magento/Newsletter/view/adminhtml/template/edit.phtml index 43c85f92d6c840eaf07885775bf56736021015ea..d0e42696363cdaaa59cbf6708a4d3d3a9b8facdd 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/template/edit.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/template/edit.phtml @@ -25,22 +25,6 @@ */ /* @var $this \Magento\Newsletter\Block\Adminhtml\Template\Edit */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml(); ?> - <?php echo $this->getResetButtonHtml(); ?> - <?php if(!$this->isTextType()): ?> - <?php echo $this->getToPlainButtonHtml(); ?> - <?php echo $this->getToHtmlButtonHtml(); ?> - <?php endif ?> - <?php echo $this->getPreviewButtonHtml(); ?> - <?php if($this->getEditMode()): ?> - <?php echo $this->getDeleteButtonHtml(); ?> - <?php endif ?> - <?php if($this->getEditMode()): ?> - <?php echo $this->getSaveAsButtonHtml(); ?> - <?php endif ?> - <?php echo $this->getSaveButtonHtml(); ?> -</div> <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="newsletter_template_edit_form"> <?php echo $this->getBlockHtml('formkey')?> <div class="no-display"> diff --git a/app/code/Magento/Newsletter/view/adminhtml/template/list.phtml b/app/code/Magento/Newsletter/view/adminhtml/template/list.phtml index 950c9b038123940a82ceb5b3b56763978028d1df..bd50807cb4ad32cd77d09c2b3843d7ecdce28742 100644 --- a/app/code/Magento/Newsletter/view/adminhtml/template/list.phtml +++ b/app/code/Magento/Newsletter/view/adminhtml/template/list.phtml @@ -24,9 +24,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <button class="action- add default" onclick="window.location='<?php echo $this->getCreateUrl() ?>'"> - <span><?php echo __('Add New Template'); ?></span> - </button> -</div> <?php echo $this->getChildHtml('grid') ?> diff --git a/app/code/Magento/OfflinePayments/etc/config.xml b/app/code/Magento/OfflinePayments/etc/config.xml index 39957f6efc9f9cc763b76a44487f8d23b21de574..4bddc0ad7c37042bb3df56e8b6775bf77036352d 100644 --- a/app/code/Magento/OfflinePayments/etc/config.xml +++ b/app/code/Magento/OfflinePayments/etc/config.xml @@ -67,6 +67,9 @@ <allowspecific>0</allowspecific> <group>offline</group> </cashondelivery> + <free> + <group>offline</group> + </free> </payment> </default> </config> diff --git a/app/code/Magento/OfflinePayments/etc/module.xml b/app/code/Magento/OfflinePayments/etc/module.xml index 347a2811b4f998bca8d88f625fc7d85fa92db855..c40a3a6e90fc3b655a9f5cef0306f678e42c54cd 100644 --- a/app/code/Magento/OfflinePayments/etc/module.xml +++ b/app/code/Magento/OfflinePayments/etc/module.xml @@ -27,6 +27,7 @@ <module name="Magento_OfflinePayments" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> <depends> diff --git a/app/code/Magento/OfflineShipping/Controller/Adminhtml/System/Config.php b/app/code/Magento/OfflineShipping/Controller/Adminhtml/System/Config.php index 91cd1a901607587d81c723b1c136ea00977a8df9..bde9261879a34a3d2d152c0fb69f6b6944781dfe 100644 --- a/app/code/Magento/OfflineShipping/Controller/Adminhtml/System/Config.php +++ b/app/code/Magento/OfflineShipping/Controller/Adminhtml/System/Config.php @@ -37,7 +37,7 @@ class Config extends AbstractConfig protected $_fileFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -45,13 +45,13 @@ class Config extends AbstractConfig * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Backend\Model\Config\Structure $configStructure * @param \Magento\App\Response\Http\FileFactory $fileFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Backend\Model\Config\Structure $configStructure, \Magento\App\Response\Http\FileFactory $fileFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; $this->_fileFactory = $fileFactory; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php index a4c9007038a3ebaf5e2acdde10df7599cfa2ac85..1d5d8fa203488f3f22813c0b65e4de49944ddc98 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php @@ -52,7 +52,7 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement protected $_rateMethodFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory @@ -60,7 +60,7 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, @@ -69,7 +69,7 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement ) { $this->_rateResultFactory = $rateResultFactory; $this->_rateMethodFactory = $rateMethodFactory; - parent::__construct($coreStoreConfig, $rateErrorFactory, $logAdapterFactory, $data); + parent::__construct($scopeConfig, $rateErrorFactory, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php index 81b8f8d3c3f691d5d2933afe324e0d6d2a51084f..03b1b1b1e4c63c42389aa5978d6f06936683d9f1 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php @@ -56,7 +56,7 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple protected $_rateMethodFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory @@ -64,7 +64,7 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, @@ -73,7 +73,7 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple ) { $this->_rateResultFactory = $rateResultFactory; $this->_rateMethodFactory = $rateMethodFactory; - parent::__construct($coreStoreConfig, $rateErrorFactory, $logAdapterFactory, $data); + parent::__construct($scopeConfig, $rateErrorFactory, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php index f9aa5c91dff79848405891d62badc65ac835716f..9e05a7c6264adc2af3d8fb826db82ec53f795104 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php @@ -47,7 +47,7 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements protected $_rateMethodFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory @@ -55,7 +55,7 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, @@ -64,7 +64,7 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements ) { $this->_rateResultFactory = $rateResultFactory; $this->_rateMethodFactory = $rateMethodFactory; - parent::__construct($coreStoreConfig, $rateErrorFactory, $logAdapterFactory, $data); + parent::__construct($scopeConfig, $rateErrorFactory, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index c7fb30c9c0172664c4dadeda67a4724dacef698d..e57997cdc19cbfeb9cea0607ff9fd8970a937d0c 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -62,7 +62,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen protected $_tablerateFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory @@ -71,7 +71,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, @@ -82,7 +82,7 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen $this->_rateResultFactory = $rateResultFactory; $this->_resultMethodFactory = $resultMethodFactory; $this->_tablerateFactory = $tablerateFactory; - parent::__construct($coreStoreConfig, $rateErrorFactory, $logAdapterFactory, $data); + parent::__construct($scopeConfig, $rateErrorFactory, $logAdapterFactory, $data); foreach ($this->getCode('condition_name') as $k => $v) { $this->_conditionNames[] = $k; } diff --git a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php index 0195e5200f22cd9292ba088c46289d6c2fb2696a..e9b5a66358f068957e1a9ba81845bf6cc0599770 100644 --- a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php @@ -30,7 +30,7 @@ use Magento\Model\AbstractModel; * * @author Magento Core Team <core@magentocommerce.com> */ -class Tablerate extends \Magento\Core\Model\Config\Value +class Tablerate extends \Magento\App\Config\Value { /** * @var \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory @@ -40,8 +40,7 @@ class Tablerate extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -50,15 +49,14 @@ class Tablerate extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_tablerateFactory = $tablerateFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/OfflineShipping/Model/Plugin/Checkout/Block/Cart/Shipping.php b/app/code/Magento/OfflineShipping/Model/Plugin/Checkout/Block/Cart/Shipping.php index 4055b7adca20b39018e217006c970e695b90d7d9..4fbc5aa2193d0a66c159ad16fbcf2691b9da393d 100644 --- a/app/code/Magento/OfflineShipping/Model/Plugin/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/OfflineShipping/Model/Plugin/Checkout/Block/Cart/Shipping.php @@ -34,16 +34,16 @@ namespace Magento\OfflineShipping\Model\Plugin\Checkout\Block\Cart; class Shipping { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $storeConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -54,6 +54,6 @@ class Shipping */ public function afterGetStateActive(\Magento\Checkout\Block\Cart\Shipping $subject, $result) { - return (bool)$result || (bool)$this->_storeConfig->getConfig('carriers/tablerate/active'); + return (bool)$result || (bool)$this->_scopeConfig->getValue('carriers/tablerate/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/OfflineShipping/Model/Quote/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Quote/Freeshipping.php index c5765a18110845573d7290310872298b2fe1d29a..7104a2ae1be658da0ba02261be162ab6a7d383c9 100644 --- a/app/code/Magento/OfflineShipping/Model/Quote/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Quote/Freeshipping.php @@ -37,16 +37,16 @@ class Freeshipping extends \Magento\Sales\Model\Quote\Address\Total\AbstractTota protected $_calculator; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\OfflineShipping\Model\SalesRule\Calculator $calculator */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\OfflineShipping\Model\SalesRule\Calculator $calculator ) { $this->setCode('discount'); diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php index dcc235bacf7ec321729f4ce5d6e261e00a06e600..0dce4e02a5ad102abed84903f3c0445fbf681c49 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php @@ -98,7 +98,7 @@ class Tablerate extends \Magento\Model\Resource\Db\AbstractDb protected $_conditionFullNames = array(); /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; @@ -108,7 +108,7 @@ class Tablerate extends \Magento\Model\Resource\Db\AbstractDb protected $_logger; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -137,8 +137,8 @@ class Tablerate extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource * @param \Magento\Logger $logger - * @param \Magento\App\ConfigInterface $coreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\OfflineShipping\Model\Carrier\Tablerate $carrierTablerate * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory @@ -147,8 +147,8 @@ class Tablerate extends \Magento\Model\Resource\Db\AbstractDb public function __construct( \Magento\App\Resource $resource, \Magento\Logger $logger, - \Magento\App\ConfigInterface $coreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $coreConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\OfflineShipping\Model\Carrier\Tablerate $carrierTablerate, \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, diff --git a/app/code/Magento/OfflineShipping/etc/di.xml b/app/code/Magento/OfflineShipping/etc/di.xml index 2fcd8cf4a11b3f07a786969a331f8e8624321388..0baccfccd7f1c284fbd0b0154ccfa620488754dc 100644 --- a/app/code/Magento/OfflineShipping/etc/di.xml +++ b/app/code/Magento/OfflineShipping/etc/di.xml @@ -24,13 +24,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <type name="Magento\Module\Updater\SetupFactory"> - <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="offlineshipping_setup" xsi:type="string">Magento\Core\Model\Resource\Setup</item> - </argument> - </arguments> - </type> <type name="Magento\Checkout\Block\Cart\Shipping"> <plugin name="checkout_cart_shipping_plugin" type="Magento\OfflineShipping\Model\Plugin\Checkout\Block\Cart\Shipping"/> </type> diff --git a/app/code/Magento/OfflineShipping/etc/module.xml b/app/code/Magento/OfflineShipping/etc/module.xml index 6f610ff8e4bbec2d71d9469acb6167a62af6e54e..43c9bb6eb271330a290e4e3a4384c7555765b8f4 100644 --- a/app/code/Magento/OfflineShipping/etc/module.xml +++ b/app/code/Magento/OfflineShipping/etc/module.xml @@ -26,12 +26,12 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_OfflineShipping" version="2.0.0.0" active="true"> <sequence> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Sales"/> <module name="Magento_SalesRule"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Backend"/> <module name="Magento_Shipping"/> <module name="Magento_Catalog"/> diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php index 80c1e46202ba3c1442c74325c2b379ea4b0636c6..fdbedc58992736510cf595a438fa38a109fbd8b7 100644 --- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php +++ b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Ogone/Model/Api.php b/app/code/Magento/Ogone/Model/Api.php index 2c13d7c07204832b7e122a92a3d7c250e5dba0f9..ce9b4ced589b973600e461c6f01f7193f09f612f 100644 --- a/app/code/Magento/Ogone/Model/Api.php +++ b/app/code/Magento/Ogone/Model/Api.php @@ -464,7 +464,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod protected $_urlBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -476,9 +476,9 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Stdlib\String $string @@ -488,9 +488,9 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, \Magento\UrlInterface $urlBuilder, \Magento\Stdlib\String $string, @@ -502,7 +502,7 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod $this->_urlBuilder = $urlBuilder; $this->string = $string; $this->_config = $config; - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/Ogone/Model/Config.php b/app/code/Magento/Ogone/Model/Config.php index 1f716de5f9adc3c5995cb945092d3512dd469a14..c2ce28236a4ebbca1512d66dae13c813ddcf73f0 100644 --- a/app/code/Magento/Ogone/Model/Config.php +++ b/app/code/Magento/Ogone/Model/Config.php @@ -43,8 +43,8 @@ class Config extends \Magento\Payment\Model\Config protected $_encryptor; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Payment\Model\Method\Factory $paymentMethodFactory * @param \Magento\Locale\ListsInterface $localeLists * @param \Magento\Config\DataInterface $dataStorage @@ -52,15 +52,15 @@ class Config extends \Magento\Payment\Model\Config * @param \Magento\Encryption\EncryptorInterface $encryptor */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Locale\ListsInterface $localeLists, \Magento\Config\DataInterface $dataStorage, \Magento\UrlInterface $urlBuilder, \Magento\Encryption\EncryptorInterface $encryptor ) { - parent::__construct($coreStoreConfig, $coreConfig, $paymentMethodFactory, $localeLists, $dataStorage); + parent::__construct($scopeConfig, $coreConfig, $paymentMethodFactory, $localeLists, $dataStorage); $this->_urlBuilder = $urlBuilder; $this->_encryptor = $encryptor; } @@ -75,7 +75,7 @@ class Config extends \Magento\Payment\Model\Config public function getConfigData($path, $storeId = null) { if (!empty($path)) { - return $this->_coreStoreConfig->getConfig(self::OGONE_PAYMENT_PATH . $path, $storeId); + return $this->_scopeConfig->getValue(self::OGONE_PAYMENT_PATH . $path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); } return false; } diff --git a/app/code/Magento/Ogone/etc/module.xml b/app/code/Magento/Ogone/etc/module.xml index bdcea0b65ce710cbf76a7c3cc3e5070b44eff2fb..dadb0b28b1c8815bb14a8f200061afa6e9365f73 100644 --- a/app/code/Magento/Ogone/etc/module.xml +++ b/app/code/Magento/Ogone/etc/module.xml @@ -30,9 +30,9 @@ <module name="Magento_Payment"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Sales"/> <module name="Magento_Payment"/> - <module name="Magento_Core"/> <module name="Magento_Checkout"/> </depends> </module> diff --git a/app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php b/app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php index b7ef1134d7eb5ffc0a5719833c166e8ef8feb896..fa7ebaa205d03a8d3d5cb6634e677f4a8e459254 100644 --- a/app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php +++ b/app/code/Magento/Ogone/sql/ogone_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $data = array(); $statuses = array( diff --git a/app/code/Magento/PageCache/Block/System/Config/Form/Field/Export.php b/app/code/Magento/PageCache/Block/System/Config/Form/Field/Export.php index baf553955162aae1025c6f3fe9b874307bcf020a..d9ec51b8f151be3ee8abbbee5024c8c3464d72f6 100644 --- a/app/code/Magento/PageCache/Block/System/Config/Form/Field/Export.php +++ b/app/code/Magento/PageCache/Block/System/Config/Form/Field/Export.php @@ -25,30 +25,11 @@ */ namespace Magento\PageCache\Block\System\Config\Form\Field; -use Magento\App\ConfigInterface; -use Magento\Backend\Block\Template\Context; - /** * Class Export */ class Export extends \Magento\Backend\Block\System\Config\Form\Field { - /** - * @var ConfigInterface - */ - protected $config; - - /** - * @param Context $context - * @param ConfigInterface $config - * @param array $data - */ - public function __construct(Context $context, ConfigInterface $config, array $data = array()) - { - $this->config = $config; - parent::__construct($context, $data); - } - /** * Retrieve element HTML markup * @@ -81,6 +62,6 @@ class Export extends \Magento\Backend\Block\System\Config\Form\Field */ public function getTtlValue() { - return $this->config->getValue(\Magento\PageCache\Model\Config::XML_PAGECACHE_TTL); + return $this->_scopeConfig->getValue(\Magento\PageCache\Model\Config::XML_PAGECACHE_TTL); } } diff --git a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php index 9417361095186af568d05eb12d7b54dec8a22259..ed15764433503b14d40310c6efbf0b5b1796e579 100755 --- a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php @@ -29,7 +29,7 @@ namespace Magento\PageCache\Model\App\FrontController; class BuiltinPlugin { /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; diff --git a/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php index f2bd0070dba951b8b60acc5f0a960da28b70b067..d6ab88385d8fd03915d7e5112cb01c50ccfc107d 100755 --- a/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/VarnishPlugin.php @@ -29,7 +29,7 @@ namespace Magento\PageCache\Model\App\FrontController; class VarnishPlugin { /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; diff --git a/app/code/Magento/PageCache/Model/Config.php b/app/code/Magento/PageCache/Model/Config.php index fc1d6edff40f8c07238d7dae98b68e57ba85c517..8f3e1d3c5d5b498a05ed7ad2f5749ad30d78f9e0 100644 --- a/app/code/Magento/PageCache/Model/Config.php +++ b/app/code/Magento/PageCache/Model/Config.php @@ -25,9 +25,7 @@ */ namespace Magento\PageCache\Model; -use Magento\App\ConfigInterface; use Magento\App\Filesystem; -use Magento\Core\Model\Store\Config as StoreConfig; /** * Model is responsible for replacing default vcl template @@ -68,14 +66,9 @@ class Config const XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX = 'design/theme/ua_regexp'; /** - * @var StoreConfig + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; - - /** - * @var ConfigInterface - */ - protected $_config; + protected $_scopeConfig; /** * XML path to value for saving temporary .vcl configuration @@ -94,19 +87,16 @@ class Config /** * @param Filesystem $filesystem - * @param StoreConfig $coreStoreConfig - * @param ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Cache\StateInterface $cacheState */ public function __construct( \Magento\App\Filesystem $filesystem, - StoreConfig $coreStoreConfig, - ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Cache\StateInterface $cacheState ) { $this->_modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); - $this->_coreStoreConfig = $coreStoreConfig; - $this->_config = $config; + $this->_scopeConfig = $scopeConfig; $this->_cacheState = $cacheState; } @@ -117,7 +107,7 @@ class Config */ public function getType() { - return $this->_config->getValue(self::XML_PAGECACHE_TYPE); + return $this->_scopeConfig->getValue(self::XML_PAGECACHE_TYPE); } /** @@ -127,7 +117,7 @@ class Config */ public function getTtl() { - return $this->_config->getValue(self::XML_PAGECACHE_TTL); + return $this->_scopeConfig->getValue(self::XML_PAGECACHE_TTL); } /** @@ -137,7 +127,7 @@ class Config */ public function getVclFile() { - $data = $this->_modulesDirectory->readFile($this->_config->getValue(self::VARNISH_CONFIGURATION_PATH)); + $data = $this->_modulesDirectory->readFile($this->_scopeConfig->getValue(self::VARNISH_CONFIGURATION_PATH)); return strtr($data, $this->_getReplacements()); } @@ -149,8 +139,14 @@ class Config protected function _getReplacements() { return array( - '{{ host }}' => $this->_coreStoreConfig->getConfig(self::XML_VARNISH_PAGECACHE_BACKEND_HOST), - '{{ port }}' => $this->_coreStoreConfig->getConfig(self::XML_VARNISH_PAGECACHE_BACKEND_PORT), + '{{ host }}' => $this->_scopeConfig->getValue( + self::XML_VARNISH_PAGECACHE_BACKEND_HOST, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), + '{{ port }}' => $this->_scopeConfig->getValue( + self::XML_VARNISH_PAGECACHE_BACKEND_PORT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), '{{ ips }}' => $this->_getAccessList(), '{{ design_exceptions_code }}' => $this->_getDesignExceptions() ); @@ -170,7 +166,10 @@ class Config { $result = ''; $tpl = " \"%s\";"; - $accessList = $this->_coreStoreConfig->getConfig(self::XML_VARNISH_PAGECACHE_ACCESS_LIST); + $accessList = $this->_scopeConfig->getValue( + self::XML_VARNISH_PAGECACHE_ACCESS_LIST, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!empty($accessList)) { $ips = explode(', ', $accessList); foreach ($ips as $ip) { @@ -193,7 +192,11 @@ class Config { $result = ''; $tpl = "%s (req.http.user-agent ~ \"%s\") {\n" . " hash_data(\"%s\");\n" . " }"; - $expressions = $this->_coreStoreConfig->getConfig(self::XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX); + + $expressions = $this->_scopeConfig->getValue( + self::XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($expressions) { $rules = array_values(unserialize($expressions)); foreach ($rules as $i => $rule) { diff --git a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php index 31f3c67d0385a9cb766dd853ff0b5fc80b07a8db..f3ee1385a8648e54598360ef765b9788bc1d110a 100644 --- a/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php +++ b/app/code/Magento/PageCache/Model/Layout/LayoutPlugin.php @@ -23,15 +23,13 @@ */ namespace Magento\PageCache\Model\Layout; -use Magento\TestFramework\Inspection\Exception; - /** * Class LayoutPlugin */ class LayoutPlugin { /** - * @var \Magento\Core\Model\Layout + * @var \Magento\View\Layout */ protected $layout; @@ -48,12 +46,12 @@ class LayoutPlugin /** * Constructor * - * @param \Magento\Core\Model\Layout $layout + * @param \Magento\View\Layout $layout * @param \Magento\App\ResponseInterface $response * @param \Magento\PageCache\Model\Config $config */ public function __construct( - \Magento\Core\Model\Layout $layout, + \Magento\View\Layout $layout, \Magento\App\ResponseInterface $response, \Magento\PageCache\Model\Config $config ) { @@ -66,11 +64,11 @@ class LayoutPlugin * Set appropriate Cache-Control headers * We have to set public headers in order to tell Varnish and Builtin app that page should be cached * - * @param \Magento\Core\Model\Layout $subject + * @param \Magento\View\Layout $subject * @param mixed $result * @return mixed */ - public function afterGenerateXml(\Magento\Core\Model\Layout $subject, $result) + public function afterGenerateXml(\Magento\View\Layout $subject, $result) { if ($this->layout->isCacheable() && $this->config->isEnabled()) { $this->response->setPublicHeaders($this->config->getTtl()); @@ -81,17 +79,17 @@ class LayoutPlugin /** * Retrieve all identities from blocks for further cache invalidation * - * @param \Magento\Core\Model\Layout $subject + * @param \Magento\View\Layout $subject * @param mixed $result * @return mixed */ - public function afterGetOutput(\Magento\Core\Model\Layout $subject, $result) + public function afterGetOutput(\Magento\View\Layout $subject, $result) { if ($this->layout->isCacheable() && $this->config->isEnabled()) { $tags = array(); foreach ($this->layout->getAllBlocks() as $block) { if ($block instanceof \Magento\View\Block\IdentityInterface) { - $isEsiBlock = ($block->getTtl() > 0); + $isEsiBlock = $block->getTtl() > 0; $isVarnish = $this->config->getType() == \Magento\PageCache\Model\Config::VARNISH; if ($isVarnish && $isEsiBlock) { continue; diff --git a/app/code/Magento/PageCache/Model/Observer.php b/app/code/Magento/PageCache/Model/Observer.php index e96f2bdb139ffa40653adb6a6c2955cb27a31031..82318fc81bbef38a597b6815a372fb544d988e40 100644 --- a/app/code/Magento/PageCache/Model/Observer.php +++ b/app/code/Magento/PageCache/Model/Observer.php @@ -53,12 +53,12 @@ class Observer protected $_typeList; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $_session; /** - * @var \Magento\Core\Model\Session + * @var \Magento\App\PageCache\FormKey */ protected $_formKey; @@ -69,7 +69,7 @@ class Observer * @param \Magento\App\PageCache\Cache $cache * @param \Magento\PageCache\Helper\Data $helper * @param \Magento\App\Cache\TypeListInterface $typeList - * @param \Magento\Core\Model\Session $session + * @param \Magento\Session\Generic $session * @param \Magento\App\PageCache\FormKey $formKey */ public function __construct( @@ -78,7 +78,7 @@ class Observer \Magento\PageCache\Helper\Data $helper, \Magento\App\Cache\TypeListInterface $typeList, \Magento\App\PageCache\FormKey $formKey, - \Magento\Core\Model\Session $session + \Magento\Session\Generic $session ) { $this->_config = $config; $this->_cache = $cache; @@ -98,7 +98,7 @@ class Observer public function processLayoutRenderElement(\Magento\Event\Observer $observer) { $event = $observer->getEvent(); - /** @var \Magento\Core\Model\Layout $layout */ + /** @var \Magento\View\Layout $layout */ $layout = $event->getLayout(); if ($layout->isCacheable() && $this->_config->isEnabled()) { $name = $event->getElementName(); diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php index f4c1fadeafc10c2f1195ce5ccd808f3fb2b49d93..075f54406619498884234c1ffacd107b9d1855a8 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php @@ -30,7 +30,7 @@ namespace Magento\PageCache\Model\System\Config\Backend; * Class Ttl * @package Magento\PageCache\Model\System\Config\Backend */ -class Ttl extends \Magento\Core\Model\Config\Value +class Ttl extends \Magento\App\Config\Value { /** * Throw exception if Ttl data is invalid or empty diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php index 33574f73886e3072a8aa2c01b27993a8d48a39c6..36fd9084896c462ee01523e16612027de714e716 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php @@ -29,7 +29,7 @@ namespace Magento\PageCache\Model\System\Config\Backend; * Class Varnish * @package Magento\PageCache\Model\System\Config\Backend */ -class Varnish extends \Magento\Core\Model\Config\Value +class Varnish extends \Magento\App\Config\Value { /** * @var array diff --git a/app/code/Magento/PageCache/etc/frontend/di.xml b/app/code/Magento/PageCache/etc/frontend/di.xml index 494eb8938ebf451adc608398336167398b1009d0..d40fd62a48303679d725373d752d01a0f6e8de9a 100644 --- a/app/code/Magento/PageCache/etc/frontend/di.xml +++ b/app/code/Magento/PageCache/etc/frontend/di.xml @@ -28,7 +28,7 @@ <plugin name="front-controller-builtin-cache" type="Magento\PageCache\Model\App\FrontController\BuiltinPlugin"/> <plugin name="front-controller-varnish-cache" type="Magento\PageCache\Model\App\FrontController\VarnishPlugin"/> </type> - <type name="Magento\Core\Model\Layout"> + <type name="Magento\View\Layout"> <plugin name="layout-model-caching-unique-name" type="Magento\PageCache\Model\Layout\LayoutPlugin"/> </type> </config> diff --git a/app/code/Magento/PageCache/etc/module.xml b/app/code/Magento/PageCache/etc/module.xml index db2b2af268ea75dda9c221faddae4f312d1a5791..1e9a1bdd4faa70aa2e0f901fe446df4e7eff9e5f 100644 --- a/app/code/Magento/PageCache/etc/module.xml +++ b/app/code/Magento/PageCache/etc/module.xml @@ -27,10 +27,11 @@ <module name="Magento_PageCache" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Backend"/> - <module name="Magento_Core"/> <module name="Magento_Theme"/> </depends> </module> diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml index d95906ac37affd18a8e5d53284d4eaf7aecc0549..9a6e6aad1451ba840f19729a3964c3ad5664b4f9 100644 --- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml +++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml @@ -26,8 +26,8 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_PayPalRecurringPayment" version="1.0.0.0" active="true"> <depends> - <module name="Magento_Customer" /> - <module name="Magento_Directory" /> + <module name="Magento_Customer"/> + <module name="Magento_Directory"/> <module name="Magento_Payment"/> <module name="Magento_Paypal"/> <module name="Magento_RecurringPayment"/> diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index 07f8dfec54d55bd7da8471e7b5f50efb02722cdc..b7b43ac4239d2f2348894a850c924443c37dd675 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -152,7 +152,7 @@ class Info extends \Magento\View\Element\Template } $methodStore = $this->_storeManager->getStore($store); - return $methodStore->getCode() != \Magento\Core\Model\Store::ADMIN_CODE; + return $methodStore->getCode() != \Magento\Store\Model\Store::ADMIN_CODE; } /** diff --git a/app/code/Magento/Payment/Block/Info/Substitution.php b/app/code/Magento/Payment/Block/Info/Substitution.php new file mode 100644 index 0000000000000000000000000000000000000000..9a17ad83f24db6384fc2341915fe3bb53bb946d7 --- /dev/null +++ b/app/code/Magento/Payment/Block/Info/Substitution.php @@ -0,0 +1,54 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Payment\Block\Info; + +/** + * Substitution payment info + */ +class Substitution extends \Magento\Payment\Block\Info +{ + /** + * Add additional info block + * + * @return $this + */ + protected function _beforeToHtml() + { + $parentBlock = $this->getParentBlock(); + if (!$parentBlock) { + return $this; + } + + $container = $parentBlock->getParentBlock(); + if ($container) { + $block = $this->_layout->createBlock( + 'Magento\View\Element\Template', + '', + ['data' => ['method' => $this->getMethod(), 'template' => 'Magento_Payment::info/substitution.phtml']] + ); + $container->setChild('order_payment_additional', $block); + } + return $this; + } +} diff --git a/app/code/Magento/Payment/Helper/Data.php b/app/code/Magento/Payment/Helper/Data.php index fab0a709fc0c36ca085dd8dee61e0f5a6010fb62..c24ff534764e9f94f25eb2f02ec66d3470a4683f 100644 --- a/app/code/Magento/Payment/Helper/Data.php +++ b/app/code/Magento/Payment/Helper/Data.php @@ -24,7 +24,7 @@ namespace Magento\Payment\Helper; use Magento\Sales\Model\Quote; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Payment\Block\Form; use Magento\Payment\Model\Info; use Magento\View\Element\Template; @@ -39,9 +39,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Payment\Model\Config @@ -62,13 +62,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_methodFactory; - /** - * Config - * - * @var \Magento\App\ConfigInterface - */ - protected $_config; - /** * App emulation model * @@ -85,29 +78,27 @@ class Data extends \Magento\App\Helper\AbstractHelper * Construct * * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\LayoutInterface $layout * @param \Magento\Payment\Model\Method\Factory $paymentMethodFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Payment\Model\Config $paymentConfig * @param \Magento\App\Config\Initial $initialConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\LayoutInterface $layout, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, - \Magento\App\ConfigInterface $config, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Payment\Model\Config $paymentConfig, \Magento\App\Config\Initial $initialConfig ) { parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_layout = $layout; $this->_methodFactory = $paymentMethodFactory; - $this->_config = $config; $this->_appEmulation = $appEmulation; $this->_paymentConfig = $paymentConfig; $this->_initialConfig = $initialConfig; @@ -122,8 +113,8 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getMethodInstance($code) { $key = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/model'; - $class = $this->_coreStoreConfig->getConfig($key); - return $this->_methodFactory->create($class); + $class = $this->_scopeConfig->getValue($key, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + return $class ? $this->_methodFactory->create($class) : false; } /** @@ -143,7 +134,12 @@ class Data extends \Magento\App\Helper\AbstractHelper uasort($methods, array($this, '_sortMethods')); foreach ($methods as $code => $methodConfig) { $prefix = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/'; - if (!($model = $this->_coreStoreConfig->getConfig($prefix . 'model', $store))) { + if (!($model = $this->_scopeConfig->getValue( + $prefix . 'model', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + )) + ) { continue; } $methodInstance = $this->_methodFactory->create($model); @@ -308,7 +304,7 @@ class Data extends \Magento\App\Helper\AbstractHelper if ($asLabelValue && $withGroups) { $groups = $this->_paymentConfig->getGroups(); foreach ($groups as $code => $title) { - $methods[$code] = $title; // for sorting, see below + $methods[$code] = $title; } } if ($sorted) { @@ -343,8 +339,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isZeroSubTotal($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( \Magento\Payment\Model\Method\Free::XML_PATH_PAYMENT_FREE_ACTIVE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -357,8 +354,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getZeroSubTotalOrderStatus($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( \Magento\Payment\Model\Method\Free::XML_PATH_PAYMENT_FREE_ORDER_STATUS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -371,8 +369,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getZeroSubTotalPaymentAutomaticInvoice($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( \Magento\Payment\Model\Method\Free::XML_PATH_PAYMENT_FREE_PAYMENT_ACTION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } diff --git a/app/code/Magento/Payment/Model/Config.php b/app/code/Magento/Payment/Model/Config.php index 20bd653a068b5c8063dd130505b4ae1c541fae57..bcbe160258fcc68d624ae7523557ea8549d11e93 100644 --- a/app/code/Magento/Payment/Model/Config.php +++ b/app/code/Magento/Payment/Model/Config.php @@ -25,7 +25,7 @@ */ namespace Magento\Payment\Model; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Payment\Model\Method\AbstractMethod; /** @@ -43,9 +43,9 @@ class Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Config\DataInterface @@ -69,20 +69,20 @@ class Config /** * Construct * - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Payment\Model\Method\Factory $paymentMethodFactory * @param \Magento\Locale\ListsInterface $localeLists * @param \Magento\Config\DataInterface $dataStorage */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Locale\ListsInterface $localeLists, \Magento\Config\DataInterface $dataStorage ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_dataStorage = $dataStorage; $this->_coreConfig = $coreConfig; $this->_methodFactory = $paymentMethodFactory; @@ -98,9 +98,14 @@ class Config public function getActiveMethods($store = null) { $methods = array(); - $config = $this->_coreStoreConfig->getConfig('payment', $store); + $config = $this->_scopeConfig->getValue('payment', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); foreach ($config as $code => $methodConfig) { - if ($this->_coreStoreConfig->getConfigFlag('payment/' . $code . '/active', $store)) { + if ($this->_scopeConfig->isSetFlag( + 'payment/' . $code . '/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) + ) { if (array_key_exists('model', $methodConfig)) { $methodModel = $this->_methodFactory->create($methodConfig['model']); if ($methodModel && $methodModel->getConfigData('active', $store)) { @@ -121,7 +126,7 @@ class Config public function getAllMethods($store = null) { $methods = array(); - $config = $this->_coreStoreConfig->getConfig('payment', $store); + $config = $this->_scopeConfig->getValue('payment', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); foreach ($config as $code => $methodConfig) { $data = $this->_getMethod($code, $methodConfig); if (false !== $data) { diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index 260c3f183bfdf16fea649db4aa4de8cc10ddf606..b9d574568173f7507d065caa0577e02defbd9bd9 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -105,11 +105,14 @@ class Info extends \Magento\Model\AbstractModel if (!$this->hasMethodInstance()) { if ($this->getMethod()) { $instance = $this->_paymentData->getMethodInstance($this->getMethod()); - if ($instance) { - $instance->setInfoInstance($this); - $this->setMethodInstance($instance); - return $instance; + if (!$instance) { + $instance = $this->_paymentData->getMethodInstance( + \Magento\Payment\Model\Method\Substitution::CODE + ); } + $instance->setInfoInstance($this); + $this->setMethodInstance($instance); + return $instance; } throw new \Magento\Model\Exception(__('The payment method you requested is not available.')); } diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 59eef7598d3a9383dcb4942636c7ae5ab43eab99..c1df6b7971de4eaa10bbef6998666cf338f41f36 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -194,9 +194,9 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Core event manager proxy @@ -217,21 +217,21 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, array $data = array() ) { parent::__construct($data); $this->_eventManager = $eventManager; $this->_paymentData = $paymentData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_logAdapterFactory = $logAdapterFactory; } @@ -246,7 +246,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen } /** - * Check authorise availability + * Check authorize availability * * @return bool */ @@ -445,7 +445,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen } /** - * Retrieve payment iformation model object + * Retrieve payment information model object * * @return \Magento\Payment\Model\Info * @throws \Magento\Model\Exception @@ -676,7 +676,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Retrieve information from payment configuration * * @param string $field - * @param int|string|null|\Magento\Core\Model\Store $storeId + * @param int|string|null|\Magento\Store\Model\Store $storeId * * @return mixed */ @@ -686,7 +686,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen $storeId = $this->getStore(); } $path = 'payment/' . $this->getCode() . '/' . $field; - return $this->_coreStoreConfig->getConfig($path, $storeId); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); } /** diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 4304f2ef94b074b62a9a61ad2910e86750dc5a71..d0e79896a71e41836dcfe3e193d7d2fec6a1fd6a 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -69,7 +69,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList @@ -80,7 +80,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, @@ -88,7 +88,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod \Magento\Centinel\Model\Service $centinelService, array $data = array() ) { - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); $this->_moduleList = $moduleList; $this->_logger = $logger; $this->_localeDate = $localeDate; diff --git a/app/code/Magento/Payment/Model/Method/Free.php b/app/code/Magento/Payment/Model/Method/Free.php index 0a34b9af85b72613ced45121878fe2abc2465f0d..9a1840a0c20c400a6cd1b540d928a9a9d5fcc904 100644 --- a/app/code/Magento/Payment/Model/Method/Free.php +++ b/app/code/Magento/Payment/Model/Method/Free.php @@ -56,7 +56,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -65,20 +65,20 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod * * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Core/Model/StoreManagerInterface.php b/app/code/Magento/Payment/Model/Method/Substitution.php similarity index 58% rename from app/code/Magento/Core/Model/StoreManagerInterface.php rename to app/code/Magento/Payment/Model/Method/Substitution.php index 05e7b1f73b5df75d082cc5850a9ebf00f5d45073..8590598158ad8b52e9f5abe71ec464421641a8d2 100644 --- a/app/code/Magento/Core/Model/StoreManagerInterface.php +++ b/app/code/Magento/Payment/Model/Method/Substitution.php @@ -21,33 +21,41 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; -interface StoreManagerInterface extends \Magento\Core\Model\Store\ListInterface +namespace Magento\Payment\Model\Method; + +/** + * Substitution payment method for non-existing payments + */ +class Substitution extends AbstractMethod { - /**#@+ - * Available scope types + /** + * Method code */ - const SCOPE_TYPE_STORE = 'store'; - - const SCOPE_TYPE_GROUP = 'group'; + const CODE = 'substitution'; - const SCOPE_TYPE_WEBSITE = 'website'; + /** + * Key of title in instance additional information + */ + const INFO_KEY_TITLE = 'method_title'; - /**#@-*/ + /** + * @var string + */ + protected $_code = self::CODE; /** - * Retrieve application store object without Store_Exception - * - * @param string|int|Store $storeId - * @return Store + * @var string */ - public function getSafeStore($storeId = null); + protected $_infoBlockType = 'Magento\Payment\Block\Info\Substitution'; /** - * Check if system is run in the single store mode + * Retrieve payment method title * - * @return bool + * @return string */ - public function isSingleStoreMode(); + public function getTitle() + { + return $this->getInfoInstance()->getAdditionalInformation(self::INFO_KEY_TITLE); + } } diff --git a/app/code/Magento/Payment/etc/config.xml b/app/code/Magento/Payment/etc/config.xml index e5513bc03cd783094e13af648d348f067eba79e4..014d2fe837baaa70dc34277684194c4db125c7f0 100644 --- a/app/code/Magento/Payment/etc/config.xml +++ b/app/code/Magento/Payment/etc/config.xml @@ -35,8 +35,12 @@ <title>No Payment Information Required</title> <allowspecific>0</allowspecific> <sort_order>1</sort_order> - <group>offline</group> </free> + <substitution> + <active>0</active> + <model>Magento\Payment\Model\Method\Substitution</model> + <allowspecific>0</allowspecific> + </substitution> </payment> </default> </config> diff --git a/app/code/Magento/Payment/etc/module.xml b/app/code/Magento/Payment/etc/module.xml index 0c15491eee6bd44d3b7c204637a8cb1a06d7fd55..9e39e89985f29711e1af99106743c47081e70bd1 100644 --- a/app/code/Magento/Payment/etc/module.xml +++ b/app/code/Magento/Payment/etc/module.xml @@ -27,9 +27,11 @@ <module name="Magento_Payment" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Sales"/> <module name="Magento_Centinel"/> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/config.xml b/app/code/Magento/Payment/view/adminhtml/info/substitution.phtml similarity index 85% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/config.xml rename to app/code/Magento/Payment/view/adminhtml/info/substitution.phtml index 7d29da47b0e4205a05efe5036e0f89d9fecadfba..cdd7d72536d73542c66d22be99f203141795bfb3 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/config.xml +++ b/app/code/Magento/Payment/view/adminhtml/info/substitution.phtml @@ -1,5 +1,4 @@ -<?xml version="1.0"?> -<!-- +<?php /** * Magento * @@ -19,11 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ---> -<config/> +?> +<div><?php echo __('%1 is not available. You still can process offline actions.', $this->escapeHtml($this->getMethod()->getTitle())) ?></div> diff --git a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php index 9e0d6adb8bf271b9926f12aa3b05c05e03b32be2..f11728a37bad42e8b9a10e66696cc85918eec203 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/System/Config/Fieldset/Store.php @@ -38,23 +38,15 @@ class Store extends \Magento\Backend\Block\Template implements \Magento\Data\For */ protected $_template = 'Magento_Paypal::system/config/fieldset/store.phtml'; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_coreConfig; - /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\App\ConfigInterface $coreConfig * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\App\ConfigInterface $coreConfig, array $data = array() ) { parent::__construct($context, $data); - $this->_coreConfig = $coreConfig; } /** @@ -89,7 +81,7 @@ class Store extends \Magento\Backend\Block\Template implements \Magento\Data\For $website = $this->getRequest()->getParam('website'); $disabledMethods = array(); foreach ($methods as $methodId => $methodPath) { - $isEnabled = (int)$this->_coreConfig->getValue($methodPath, 'website', $website); + $isEnabled = (int)$this->_scopeConfig->getValue($methodPath, 'website', $website); if ($isEnabled === 0) { $disabledMethods[$methodId] = $isEnabled; } diff --git a/app/code/Magento/Paypal/Block/Express/Review.php b/app/code/Magento/Paypal/Block/Express/Review.php index f33d5f7d8e318dcad1983923cd7dfb9e285d774e..35e0972a5f04e4f79d39597f83def1f0a257c92e 100644 --- a/app/code/Magento/Paypal/Block/Express/Review.php +++ b/app/code/Magento/Paypal/Block/Express/Review.php @@ -39,6 +39,16 @@ class Review extends \Magento\View\Element\Template */ protected $_quote; + /** + * @var \Magento\Sales\Model\Quote\Address + */ + protected $_address; + + /** + * @var \Magento\Customer\Model\Address\Config + */ + protected $_addressConfig; + /** * Currently selected shipping rate * @@ -59,16 +69,21 @@ class Review extends \Magento\View\Element\Template protected $_taxHelper; /** + * Initialize dependencies. + * * @param \Magento\View\Element\Template\Context $context * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Customer\Model\Address\Config $addressConfig * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Tax\Helper\Data $taxHelper, + \Magento\Customer\Model\Address\Config $addressConfig, array $data = array() ) { $this->_taxHelper = $taxHelper; + $this->_addressConfig = $addressConfig; parent::__construct($context, $data); } @@ -115,7 +130,10 @@ class Review extends \Magento\View\Element\Template */ public function renderAddress($address) { - return $address->format('html'); + /** @var \Magento\Customer\Block\Address\Renderer\RendererInterface $renderer */ + $renderer = $this->_addressConfig->getFormatByCode('html')->getRenderer(); + $addressData = \Magento\Convert\ConvertArray::toFlatArray($address->getData()); + return $renderer->renderArray($addressData); } /** @@ -126,7 +144,7 @@ class Review extends \Magento\View\Element\Template */ public function getCarrierName($carrierCode) { - if ($name = $this->_storeConfig->getConfig("carriers/{$carrierCode}/title")) { + if ($name = $this->_scopeConfig->getValue("carriers/{$carrierCode}/title", \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { return $name; } return $carrierCode; diff --git a/app/code/Magento/Paypal/Controller/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Billing/Agreement.php index 10fbd747956c75a94f84e78ee7c185f8d9bcdb34..d2a5c6fc532f49ed10500684468ce0ea0553c522 100644 --- a/app/code/Magento/Paypal/Controller/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Controller/Billing/Agreement.php @@ -120,23 +120,16 @@ class Agreement extends \Magento\App\Action\Action if ($paymentCode) { try { $agreement->setStoreId( - $this->_objectManager->get('Magento\Core\Model\StoreManager')->getStore()->getId() + $this->_objectManager->get('Magento\Store\Model\StoreManager')->getStore()->getId() )->setMethodCode( $paymentCode )->setReturnUrl( $this->_objectManager->create( 'Magento\UrlInterface' - )->getUrl( - '*/*/returnWizard', - array('payment_method' => $paymentCode) - ) + )->getUrl('*/*/returnWizard', array('payment_method' => $paymentCode)) )->setCancelUrl( - $this->_objectManager->create( - 'Magento\UrlInterface' - )->getUrl( - '*/*/cancelWizard', - array('payment_method' => $paymentCode) - ) + $this->_objectManager->create('Magento\UrlInterface') + ->getUrl('*/*/cancelWizard', array('payment_method' => $paymentCode)) ); return $this->getResponse()->setRedirect($agreement->initToken()); @@ -157,20 +150,22 @@ class Agreement extends \Magento\App\Action\Action */ public function returnWizardAction() { + /** @var \Magento\Paypal\Model\Billing\Agreement $agreement */ $agreement = $this->_objectManager->create('Magento\Paypal\Model\Billing\Agreement'); $paymentCode = $this->getRequest()->getParam('payment_method'); $token = $this->getRequest()->getParam('token'); if ($token && $paymentCode) { try { $agreement->setStoreId( - $this->_objectManager->get('Magento\Core\Model\StoreManager')->getStore()->getId() + $this->_objectManager->get('Magento\Store\Model\StoreManager')->getStore()->getId() )->setToken( $token )->setMethodCode( $paymentCode - )->setCustomer( - $this->_objectManager->get('Magento\Customer\Model\Session')->getCustomer() + )->setCustomerId( + $this->_getSession()->getCustomerId() )->place(); + $this->messageManager->addSuccess( __('The billing agreement "%1" has been created.', $agreement->getReferenceId()) ); @@ -234,11 +229,8 @@ class Agreement extends \Magento\App\Action\Action $agreementId = $this->getRequest()->getParam('agreement'); if ($agreementId) { /** @var \Magento\Paypal\Model\Billing\Agreement $billingAgreement */ - $billingAgreement = $this->_objectManager->create( - 'Magento\Paypal\Model\Billing\Agreement' - )->load( - $agreementId - ); + $billingAgreement = $this->_objectManager->create('Magento\Paypal\Model\Billing\Agreement') + ->load($agreementId); $currentCustomerId = $this->_getSession()->getCustomerId(); $agreementCustomerId = $billingAgreement->getCustomerId(); if ($billingAgreement->getId() && $agreementCustomerId == $currentCustomerId) { diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php index 5faab9ef7fdc63f92f3d828addc23757abd6506b..025145cb4533ce4f6ba7888bba3d39fd5249b3b0 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php @@ -18,18 +18,19 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Paypal * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Paypal\Controller\Express; +use Magento\Checkout\Model\Type\Onepage; +use Magento\App\Action\Action as AppAction; +use Magento\Checkout\Controller\Express\RedirectLoginInterface; + /** * Abstract Express Checkout Controller */ -abstract class AbstractExpress extends \Magento\App\Action\Action implements - \Magento\Checkout\Controller\Express\RedirectLoginInterface +abstract class AbstractExpress extends AppAction implements RedirectLoginInterface { /** * @var \Magento\Paypal\Model\Express\Checkout @@ -148,19 +149,16 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->_getQuote()->removeAllAddresses(); } - $customer = $this->_customerSession->getCustomer(); + $customerData = $this->_customerSession->getCustomerDataObject(); $quoteCheckoutMethod = $this->_getQuote()->getCheckoutMethod(); - if ($customer && $customer->getId()) { + if ($customerData->getId()) { $this->_checkout->setCustomerWithAddressChange( - $customer, + $customerData, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress() ); - } elseif ((!$quoteCheckoutMethod || - $quoteCheckoutMethod != \Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER) && - !$this->_objectManager->get( - 'Magento\Checkout\Helper\Data' - )->isAllowedGuestCheckout( + } elseif ((!$quoteCheckoutMethod || $quoteCheckoutMethod != Onepage::METHOD_REGISTER) + && !$this->_objectManager->get('Magento\Checkout\Helper\Data')->isAllowedGuestCheckout( $this->_getQuote(), $this->_getQuote()->getStoreId() ) @@ -177,11 +175,10 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } // billing agreement - $isBARequested = (bool)$this->getRequest()->getParam( - \Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT - ); - if ($customer && $customer->getId()) { - $this->_checkout->setIsBillingAgreementRequested($isBARequested); + $isBaRequested = (bool)$this->getRequest() + ->getParam(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); + if ($customerData->getId()) { + $this->_checkout->setIsBillingAgreementRequested($isBaRequested); } // giropay @@ -191,8 +188,12 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->_url->getUrl('checkout/onepage/success') ); - $token = $this->_checkout->start($this->_url->getUrl('*/*/return'), $this->_url->getUrl('*/*/cancel')); - if ($token && ($url = $this->_checkout->getRedirectUrl())) { + $token = $this->_checkout->start( + $this->_url->getUrl('*/*/return'), + $this->_url->getUrl('*/*/cancel') + ); + $url = $this->_checkout->getRedirectUrl(); + if ($token && $url) { $this->_initToken($token); $this->getResponse()->setRedirect($url); return; @@ -303,7 +304,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { - $this->messageManager->addError(__('We can\'t initialize Express Checkout review.')); + $this->messageManager->addError( + __('We can\'t initialize Express Checkout review.') + ); $this->_objectManager->get('Magento\Logger')->logException($e); } $this->_redirect('checkout/cart'); @@ -350,9 +353,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } if ($isAjax) { $this->getResponse()->setBody( - '<script type="text/javascript">window.location.href = ' . $this->_url->getUrl( - '*/*/review' - ) . ';</script>' + '<script type="text/javascript">window.location.href = ' + . $this->_url->getUrl('*/*/review') + . ';</script>' ); } else { $this->_redirect('*/*/review'); @@ -372,11 +375,11 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->_view->loadLayout('paypal_express_review'); $this->getResponse()->setBody( - $this->_view->getLayout()->getBlock( - 'express.review.shipping.method' - )->setQuote( - $this->_getQuote() - )->toHtml() + $this->_view + ->getLayout() + ->getBlock('express.review.shipping.method') + ->setQuote($this->_getQuote()) + ->toHtml() ); return; } catch (\Magento\Model\Exception $e) { @@ -416,9 +419,9 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } if ($isAjax) { $this->getResponse()->setBody( - '<script type="text/javascript">window.location.href = ' . $this->_url->getUrl( - '*/*/review' - ) . ';</script>' + '<script type="text/javascript">window.location.href = ' + . $this->_url->getUrl('*/*/review') + . ';</script>' ); } else { $this->_redirect('*/*/review'); @@ -434,9 +437,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements public function placeOrderAction() { try { - $requiredAgreements = $this->_objectManager->get( - 'Magento\Checkout\Helper\Data' - )->getRequiredAgreementIds(); + $requiredAgreements = $this->_objectManager->get('Magento\Checkout\Helper\Data')->getRequiredAgreementIds(); if ($requiredAgreements) { $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array())); if (array_diff($requiredAgreements, $postedAgreements)) { @@ -459,16 +460,16 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements // an order may be created $order = $this->_checkout->getOrder(); if ($order) { - $this->_getCheckoutSession()->setLastOrderId( - $order->getId() - )->setLastRealOrderId( - $order->getIncrementId() - ); + $this->_getCheckoutSession()->setLastOrderId($order->getId()) + ->setLastRealOrderId($order->getIncrementId()); } $this->_eventManager->dispatch( 'paypal_express_place_order_success', - array('order' => $order, 'quote' => $this->_getQuote()) + [ + 'order' => $order, + 'quote' => $this->_getQuote() + ] ); // redirect if PayPal specified some URL (for example, to Giropay bank) @@ -477,8 +478,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->getResponse()->setRedirect($url); return; } - $this->_initToken(false); - // no need in token anymore + $this->_initToken(false); // no need in token anymore $this->_redirect('checkout/onepage/success'); return; } catch (\Magento\Model\Exception $e) { @@ -504,11 +504,14 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements throw new \Magento\Model\Exception(__('We can\'t initialize Express Checkout.')); } if (!isset($this->_checkoutTypes[$this->_checkoutType])) { - $parameters = array('params' => array('quote' => $quote, 'config' => $this->_config)); - $this->_checkoutTypes[$this->_checkoutType] = $this->_checkoutFactory->create( - $this->_checkoutType, - $parameters + $parameters = array( + 'params' => array( + 'quote' => $quote, + 'config' => $this->_config, + ), ); + $this->_checkoutTypes[$this->_checkoutType] = $this->_checkoutFactory + ->create($this->_checkoutType, $parameters); } $this->_checkout = $this->_checkoutTypes[$this->_checkoutType]; } diff --git a/app/code/Magento/Paypal/Helper/Data.php b/app/code/Magento/Paypal/Helper/Data.php index dfde6ab12111311874435c025be2b6ec968f1f12..45455d8188042734b59e12a1b0e80370c40a29f5 100644 --- a/app/code/Magento/Paypal/Helper/Data.php +++ b/app/code/Magento/Paypal/Helper/Data.php @@ -85,7 +85,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Retrieve available billing agreement methods * - * @param null|string|bool|int|\Magento\Core\Model\Store $store + * @param null|string|bool|int|\Magento\Store\Model\Store $store * @param \Magento\Sales\Model\Quote|null $quote * @return MethodInterface[] */ diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Billing/Agreement.php index 1685646f7a866aee6d05765960768a364ec2777e..d753701caaf1d29a487b67aa2788d47db16a4352 100644 --- a/app/code/Magento/Paypal/Model/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/Billing/Agreement.php @@ -158,7 +158,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement */ public function initToken() { - $this->getPaymentMethodInstance()->initBillingAgreementToken($this); + $this->getPaymentMethodInstance() + ->initBillingAgreementToken($this); return $this->getRedirectUrl(); } @@ -170,7 +171,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement */ public function verifyToken() { - $this->getPaymentMethodInstance()->getBillingAgreementTokenInfo($this); + $this->getPaymentMethodInstance() + ->getBillingAgreementTokenInfo($this); return $this; } @@ -183,19 +185,15 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement { $this->verifyToken(); - $paymentMethodInstance = $this->getPaymentMethodInstance()->placeBillingAgreement($this); + $paymentMethodInstance = $this->getPaymentMethodInstance() + ->placeBillingAgreement($this); - $this->setCustomerId( - $this->getCustomer()->getId() - )->setMethodCode( - $this->getMethodCode() - )->setReferenceId( - $this->getBillingAgreementId() - )->setStatus( - self::STATUS_ACTIVE - )->setAgreementLabel( - $paymentMethodInstance->getTitle() - )->save(); + $this->setCustomerId($this->getCustomerId()) + ->setMethodCode($this->getMethodCode()) + ->setReferenceId($this->getBillingAgreementId()) + ->setStatus(self::STATUS_ACTIVE) + ->setAgreementLabel($paymentMethodInstance->getTitle()) + ->save(); return $this; } @@ -228,7 +226,10 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement */ public function getStatusesArray() { - return array(self::STATUS_ACTIVE => __('Active'), self::STATUS_CANCELED => __('Canceled')); + return array( + self::STATUS_ACTIVE => __('Active'), + self::STATUS_CANCELED => __('Canceled') + ); } /** @@ -262,22 +263,15 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement { $baData = $payment->getBillingAgreementData(); - $this->_paymentMethodInstance = isset( - $baData['method_code'] - ) ? $this->_paymentData->getMethodInstance( - $baData['method_code'] - ) : $payment->getMethodInstance(); + $this->_paymentMethodInstance = (isset($baData['method_code'])) + ? $this->_paymentData->getMethodInstance($baData['method_code']) + : $payment->getMethodInstance(); if ($this->_paymentMethodInstance) { $this->_paymentMethodInstance->setStore($payment->getMethodInstance()->getStore()); - $this->setCustomerId( - $payment->getOrder()->getCustomerId() - )->setMethodCode( - $this->_paymentMethodInstance->getCode() - )->setReferenceId( - $baData['billing_agreement_id'] - )->setStatus( - self::STATUS_ACTIVE - ); + $this->setCustomerId($payment->getOrder()->getCustomerId()) + ->setMethodCode($this->_paymentMethodInstance->getCode()) + ->setReferenceId($baData['billing_agreement_id']) + ->setStatus(self::STATUS_ACTIVE); } return $this; } @@ -291,15 +285,9 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement public function getAvailableCustomerBillingAgreements($customerId) { $collection = $this->_billingAgreementFactory->create(); - $collection->addFieldToFilter( - 'customer_id', - $customerId - )->addFieldToFilter( - 'status', - self::STATUS_ACTIVE - )->setOrder( - 'agreement_id' - ); + $collection->addFieldToFilter('customer_id', $customerId) + ->addFieldToFilter('status', self::STATUS_ACTIVE) + ->setOrder('agreement_id'); return $collection; } diff --git a/app/code/Magento/Paypal/Model/Config.php b/app/code/Magento/Paypal/Model/Config.php index 7ebff1d0c04031982722fdad8fdf3b34e9152b09..5c5da6cc9b7656266388c1fb5195ac8fa2f9a796 100644 --- a/app/code/Magento/Paypal/Model/Config.php +++ b/app/code/Magento/Paypal/Model/Config.php @@ -608,12 +608,12 @@ class Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -629,21 +629,21 @@ class Config /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Payment\Model\Source\CctypeFactory $cctypeFactory * @param \Magento\Paypal\Model\CertFactory $certFactory * @param array $params */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Payment\Model\Source\CctypeFactory $cctypeFactory, \Magento\Paypal\Model\CertFactory $certFactory, $params = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_coreData = $coreData; $this->_storeManager = $storeManager; $this->_cctypeFactory = $cctypeFactory; @@ -706,8 +706,9 @@ class Config { return $this->isMethodSupportedForCountry( $method - ) && $this->_coreStoreConfig->getConfigFlag( + ) && $this->_scopeConfig->isSetFlag( "payment/{$method}/active", + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_storeId ); } @@ -795,7 +796,11 @@ class Config $underscored = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $key)); $path = $this->_getSpecificConfigPath($underscored); if ($path !== null) { - $value = $this->_coreStoreConfig->getConfig($path, $this->_storeId); + $value = $this->_scopeConfig->getValue( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); $value = $this->_prepareValue($underscored, $value); $this->{$key} = $value; $this->{$underscored} = $value; @@ -851,9 +856,12 @@ class Config */ public function getMerchantCountry() { - $countryCode = $this->_coreStoreConfig->getConfig( - $this->_mapGeneralFieldset('merchant_country'), - $this->_storeId + $countryCode = $this->_scopeConfig->getValue( + $this->_mapGeneralFieldset( + 'merchant_country', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ) ); if (!$countryCode) { $countryCode = $this->_coreData->getDefaultCountry($this->_storeId); @@ -1212,7 +1220,11 @@ class Config */ public function getAdditionalOptionsLogoUrl($localeCode, $type = false) { - $configType = $this->_coreStoreConfig->getConfig($this->_mapGenericStyleFieldset('logo'), $this->_storeId); + $configType = $this->_scopeConfig->getValue( + $this->_mapGenericStyleFieldset('logo'), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId + ); if (!$configType) { return false; } @@ -1392,12 +1404,7 @@ class Config */ public function getWpsPaymentDeliveryMethods() { - return array( - self::WPS_TRANSPORT_IPN => __('IPN (Instant Payment Notification) Only') - // not supported yet: - // self::WPS_TRANSPORT_PDT => __('PDT (Payment Data Transfer) Only'), - // self::WPS_TRANSPORT_IPN_PDT => __('Both IPN and PDT'), - ); + return array(self::WPS_TRANSPORT_IPN => __('IPN (Instant Payment Notification) Only')); } /** diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index ddb2d1b082e5000adc28ab90259f4e743834760f..d0aa159603356227cbd78d0b762191420abeefb2 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -144,7 +144,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc protected $_proTypeFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -166,14 +166,14 @@ class Direct extends \Magento\Payment\Model\Method\Cc /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\Paypal\Model\CartFactory $cartFactory @@ -184,14 +184,14 @@ class Direct extends \Magento\Payment\Model\Method\Cc public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Centinel\Model\Service $centinelService, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, \Magento\App\RequestInterface $requestHttp, \Magento\Paypal\Model\CartFactory $cartFactory, @@ -200,7 +200,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, @@ -227,7 +227,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc * Store setter * Also updates store ID in config object * - * @param \Magento\Core\Model\Store|int $store + * @param \Magento\Store\Model\Store|int $store * @return $this */ public function setStore($store) diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index 6c0b2c3bfdfe9129dac69cde87364c00c728c192..a663058ac87ee7dce2fdd606e95d2ab97748c253 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -167,7 +167,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod protected $_proTypeFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -184,10 +184,10 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Paypal\Model\CartFactory $cartFactory * @param array $data @@ -195,15 +195,15 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, array $data = array() ) { - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); $this->_proTypeFactory = $proTypeFactory; $this->_storeManager = $storeManager; $this->_urlBuilder = $urlBuilder; @@ -222,7 +222,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod * Store setter * Also updates store ID in config object * - * @param \Magento\Core\Model\Store|int $store + * @param \Magento\Store\Model\Store|int $store * @return $this */ public function setStore($store) @@ -242,10 +242,12 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod */ public function canUseCheckout() { - if ($this->_coreStoreConfig->getConfigFlag( - 'payment/hosted_pro/active' - ) && !$this->_coreStoreConfig->getConfigFlag( - 'payment/hosted_pro/display_ec' + if ($this->_scopeConfig->isSetFlag( + 'payment/hosted_pro/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) && !$this->_scopeConfig->isSetFlag( + 'payment/hosted_pro/display_ec', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ) { return false; diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index 3fdb92932afd4736c3f313ecb62785576148910e..0ad3b256d627df4471c254a9f0427bdcdd1cc214 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -18,15 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Paypal * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Paypal\Model\Express; +use Magento\Customer\Service\V1\CustomerAccountServiceInterface; use Magento\Sales\Model\Quote\Address; -use Magento\Customer\Model\Customer; +use Magento\Customer\Service\V1\Data\Customer as CustomerDataObject; +use Magento\Paypal\Model\Config as PaypalConfig; /** * Wrapper that performs Paypal Express and Checkout communication @@ -44,16 +44,11 @@ class Checkout * Keys for passthrough variables in sales/quote_payment and sales/order_payment * Uses additional_information as storage */ - const PAYMENT_INFO_TRANSPORT_TOKEN = 'paypal_express_checkout_token'; - + const PAYMENT_INFO_TRANSPORT_TOKEN = 'paypal_express_checkout_token'; const PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDDEN = 'paypal_express_checkout_shipping_overridden'; - const PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD = 'paypal_express_checkout_shipping_method'; - const PAYMENT_INFO_TRANSPORT_PAYER_ID = 'paypal_express_checkout_payer_id'; - const PAYMENT_INFO_TRANSPORT_REDIRECT = 'paypal_express_checkout_redirect_required'; - const PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT = 'paypal_ec_create_ba'; /** @@ -64,7 +59,7 @@ class Checkout /** * Config instance * - * @var \Magento\Paypal\Model\Config + * @var PaypalConfig */ protected $_config; @@ -87,7 +82,7 @@ class Checkout * * @var string */ - protected $_methodType = \Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS; + protected $_methodType = PaypalConfig::METHOD_WPP_EXPRESS; /** * State helper variable @@ -146,7 +141,7 @@ class Checkout /** * Order * - * @var \Magento\Sales\Model\Quote + * @var \Magento\Sales\Model\Order */ protected $_order; @@ -192,7 +187,7 @@ class Checkout protected $_paypalInfo; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -241,6 +236,36 @@ class Checkout */ protected $_checkoutSession; + /** + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + */ + protected $_customerAccountService; + + /** + * @var \Magento\Customer\Service\V1\Data\AddressBuilderFactory + */ + protected $_addressBuilderFactory; + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerBuilder + */ + protected $_customerBuilder; + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder + */ + protected $_customerDetailsBuilder; + + /** + * @var \Magento\Encryption\EncryptorInterface + */ + protected $_encryptor; + + /** + * @var \Magento\Message\ManagerInterface + */ + protected $_messageManager; + /** * Set config, session and quote instances * @@ -252,7 +277,7 @@ class Checkout * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Locale\ResolverInterface $localeResolver * @param \Magento\Paypal\Model\Info $paypalInfo - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $coreUrl * @param \Magento\Paypal\Model\CartFactory $cartFactory * @param \Magento\Logger\AdapterFactory $logFactory @@ -262,6 +287,12 @@ class Checkout * @param \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory * @param \Magento\Object\Copy $objectCopyService * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + * @param \Magento\Customer\Service\V1\Data\AddressBuilderFactory $addressBuilder + * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder + * @param \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder + * @param \Magento\Encryption\EncryptorInterface $encryptor + * @param \Magento\Message\ManagerInterface $messageManager * @param array $params * @throws \Exception */ @@ -274,7 +305,7 @@ class Checkout \Magento\App\Cache\Type\Config $configCacheType, \Magento\Locale\ResolverInterface $localeResolver, \Magento\Paypal\Model\Info $paypalInfo, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $coreUrl, \Magento\Paypal\Model\CartFactory $cartFactory, \Magento\Logger\AdapterFactory $logFactory, @@ -284,6 +315,12 @@ class Checkout \Magento\Paypal\Model\Api\Type\Factory $apiTypeFactory, \Magento\Object\Copy $objectCopyService, \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService, + \Magento\Customer\Service\V1\Data\AddressBuilderFactory $addressBuilder, + \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, + \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder, + \Magento\Encryption\EncryptorInterface $encryptor, + \Magento\Message\ManagerInterface $messageManager, $params = array() ) { $this->_customerData = $customerData; @@ -304,8 +341,14 @@ class Checkout $this->_apiTypeFactory = $apiTypeFactory; $this->_objectCopyService = $objectCopyService; $this->_checkoutSession = $checkoutSession; - - if (isset($params['config']) && $params['config'] instanceof \Magento\Paypal\Model\Config) { + $this->_customerAccountService = $customerAccountService; + $this->_addressBuilderFactory = $addressBuilder; + $this->_customerBuilder = $customerBuilder; + $this->_customerDetailsBuilder = $customerDetailsBuilder; + $this->_encryptor = $encryptor; + $this->_messageManager = $messageManager; + + if (isset($params['config']) && $params['config'] instanceof PaypalConfig) { $this->_config = $params['config']; } else { throw new \Exception('Config instance is required.'); @@ -383,28 +426,31 @@ class Checkout /** * Setter for customer * - * @param Customer $customer + * @param CustomerDataObject $customerData * @return $this */ - public function setCustomer($customer) + public function setCustomerData(CustomerDataObject $customerData) { - $this->_quote->assignCustomer($customer); - $this->_customerId = $customer->getId(); + $this->_quote->assignCustomer($customerData); + $this->_customerId = $customerData->getId(); return $this; } /** * Setter for customer with billing and shipping address changing ability * - * @param Customer $customer + * @param CustomerDataObject $customerData * @param Address|null $billingAddress * @param Address|null $shippingAddress * @return $this */ - public function setCustomerWithAddressChange($customer, $billingAddress = null, $shippingAddress = null) - { - $this->_quote->assignCustomerWithAddressChange($customer, $billingAddress, $shippingAddress); - $this->_customerId = $customer->getId(); + public function setCustomerWithAddressChange( + CustomerDataObject $customerData, + $billingAddress = null, + $shippingAddress = null + ) { + $this->_quote->assignCustomerWithAddressChange($customerData, $billingAddress, $shippingAddress); + $this->_customerId = $customerData->getId(); return $this; } @@ -423,8 +469,8 @@ class Checkout if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) { throw new \Magento\Model\Exception( __( - 'PayPal can\'t process orders with a zero balance due. ' . - 'To finish your purchase, please go through the standard checkout process.' + 'PayPal can\'t process orders with a zero balance due. ' + . 'To finish your purchase, please go through the standard checkout process.' ) ); } @@ -432,42 +478,34 @@ class Checkout $this->_quote->reserveOrderId()->save(); // prepare API $this->_getApi(); - $this->_api->setAmount( - $this->_quote->getBaseGrandTotal() - )->setCurrencyCode( - $this->_quote->getBaseCurrencyCode() - )->setInvNum( - $this->_quote->getReservedOrderId() - )->setReturnUrl( - $returnUrl - )->setCancelUrl( - $cancelUrl - )->setSolutionType( - $this->_config->solutionType - )->setPaymentAction( - $this->_config->paymentAction - ); + $this->_api->setAmount($this->_quote->getBaseGrandTotal()) + ->setCurrencyCode($this->_quote->getBaseCurrencyCode()) + ->setInvNum($this->_quote->getReservedOrderId()) + ->setReturnUrl($returnUrl) + ->setCancelUrl($cancelUrl) + ->setSolutionType($this->_config->solutionType) + ->setPaymentAction($this->_config->paymentAction) + ; if ($this->_giropayUrls) { list($successUrl, $cancelUrl, $pendingUrl) = $this->_giropayUrls; $this->_api->addData( - array( + [ 'giropay_cancel_url' => $cancelUrl, 'giropay_success_url' => $successUrl, - 'giropay_bank_txn_pending_url' => $pendingUrl - ) + 'giropay_bank_txn_pending_url' => $pendingUrl, + ] ); } $this->_setBillingAgreementRequest(); - if ($this->_config->requireBillingAddress == \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_ALL) { + if ($this->_config->requireBillingAddress == PaypalConfig::REQUIRE_BILLING_ADDRESS_ALL) { $this->_api->setRequireBillingAddress(1); } // suppress or export shipping address if ($this->_quote->getIsVirtual()) { - if ($this->_config->requireBillingAddress == \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_VIRTUAL - ) { + if ($this->_config->requireBillingAddress == PaypalConfig::REQUIRE_BILLING_ADDRESS_VIRTUAL) { $this->_api->setRequireBillingAddress(1); } $this->_api->setSuppressShipping(true); @@ -488,7 +526,8 @@ class Checkout // add line items /** @var $cart \Magento\Payment\Model\Cart */ $cart = $this->_cartFactory->create(array('salesModel' => $this->_quote)); - $this->_api->setPaypalCart($cart)->setIsLineItemsEnabled($this->_config->lineItemsEnabled); + $this->_api->setPaypalCart($cart) + ->setIsLineItemsEnabled($this->_config->lineItemsEnabled); // add shipping options if needed and line items are available $cartItems = $cart->getAllItems(); @@ -499,11 +538,9 @@ class Checkout $this->_api->setShippingOptionsCallbackUrl( $this->_coreUrl->getUrl( '*/*/shippingOptionsCallback', - array('quote_id' => $this->_quote->getId()) + ['quote_id' => $this->_quote->getId()] ) - )->setShippingOptions( - $options - ); + )->setShippingOptions($options); } } } @@ -533,7 +570,8 @@ class Checkout public function returnFromPaypal($token) { $this->_getApi(); - $this->_api->setToken($token)->callGetExpressCheckoutDetails(); + $this->_api->setToken($token) + ->callGetExpressCheckoutDetails(); $quote = $this->_quote; $this->_ignoreAddressValidation(); @@ -570,7 +608,10 @@ class Checkout $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true); } } - $quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, $code); + $quote->getPayment()->setAdditionalInformation( + self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, + $code + ); } } @@ -578,13 +619,8 @@ class Checkout $payment = $quote->getPayment(); $payment->setMethod($this->_methodType); $this->_paypalInfo->importToPayment($this->_api, $payment); - $payment->setAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_PAYER_ID, - $this->_api->getPayerId() - )->setAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_TOKEN, - $token - ); + $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId()) + ->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token); $quote->collectTotals()->save(); } @@ -602,9 +638,7 @@ class Checkout throw new \Magento\Model\Exception(__('Payer is not identified.')); } $this->_quote->setMayEditShippingAddress( - 1 != $this->_quote->getPayment()->getAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDDEN - ) + 1 != $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDDEN) ); $this->_quote->setMayEditShippingMethod( '' == $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD) @@ -661,7 +695,8 @@ class Checkout */ public function updateShippingMethod($methodCode) { - if (!$this->_quote->getIsVirtual() && ($shippingAddress = $this->_quote->getShippingAddress())) { + $shippingAddress = $this->_quote->getShippingAddress(); + if (!$this->_quote->getIsVirtual() && $shippingAddress) { if ($methodCode != $shippingAddress->getShippingMethod()) { $this->_ignoreAddressValidation(); $shippingAddress->setShippingMethod($methodCode)->setCollectShippingRates(true); @@ -703,8 +738,7 @@ class Checkout } /** - * Place the order when customer returned from paypal - * Until this moment all quote data must be valid + * Place the order when customer returned from PayPal until this moment all quote data must be valid. * * @param string $token * @param string|null $shippingMethodCode @@ -734,7 +768,7 @@ class Checkout $this->_quote->collectTotals(); $parameters = array('quote' => $this->_quote); $service = $this->_serviceQuoteFactory->create($parameters); - $service->submitAll(); + $service->submitAllWithDataObject(); $this->_quote->save(); if ($isNewCustomer) { @@ -751,10 +785,7 @@ class Checkout } // commence redirecting to finish payment, if paypal requires it - if ($order->getPayment()->getAdditionalInformation( - \Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT - ) - ) { + if ($order->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_REDIRECT)) { $this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token); } @@ -879,12 +910,11 @@ class Checkout return $this; } - $isRequested = $this->_isBARequested || $this->_quote->getPayment()->getAdditionalInformation( - self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT - ); + $isRequested = $this->_isBARequested || $this->_quote->getPayment() + ->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT); - if (!($this->_config->allow_ba_signup == \Magento\Paypal\Model\Config::EC_BA_SIGNUP_AUTO || - $isRequested && $this->_config->shouldAskToCreateBillingAgreement()) + if (!($this->_config->allow_ba_signup == PaypalConfig::EC_BA_SIGNUP_AUTO + || $isRequested && $this->_config->shouldAskToCreateBillingAgreement()) ) { return $this; } @@ -936,12 +966,12 @@ class Checkout $amountInclTax = $this->_taxData->getShippingPrice($amount, true, $address); $options[$i] = new \Magento\Object( - array( + [ 'is_default' => $isDefault, 'name' => trim("{$rate->getCarrierTitle()} - {$rate->getMethodTitle()}", ' -'), 'code' => $rate->getCode(), - 'amount' => $amountExclTax - ) + 'amount' => $amountExclTax, + ] ); if ($calculateTax) { $options[$i]->setTaxAmount( @@ -961,7 +991,12 @@ class Checkout if ($mayReturnEmpty && is_null($userSelectedOption)) { $options[] = new \Magento\Object( - array('is_default' => true, 'name' => __('N/A'), 'code' => 'no_rate', 'amount' => 0.00) + [ + 'is_default' => true, + 'name' => __('N/A'), + 'code' => 'no_rate', + 'amount' => 0.00, + ] ); if ($calculateTax) { $options[$i]->setTaxAmount($address->getTaxAmount()); @@ -998,7 +1033,7 @@ class Checkout if ($option1->getAmount() == $option2->getAmount()) { return 0; } - return $option1->getAmount() < $option2->getAmount() ? -1 : 1; + return ($option1->getAmount() < $option2->getAmount()) ? -1 : 1; } /** @@ -1015,10 +1050,10 @@ class Checkout { $options = $this->_prepareShippingOptions($address, false); foreach ($options as $option) { - if ($selectedCode === $option['code'] || // the proper case as outlined in documentation - $selectedCode === $option['name'] || // workaround: PayPal may return name instead of the code + if ($selectedCode === $option['code'] // the proper case as outlined in documentation + || $selectedCode === $option['name'] // workaround: PayPal may return name instead of the code // workaround: PayPal may concatenate code and name, and return it instead of the code: - $selectedCode === "{$option['code']} {$option['name']}" + || $selectedCode === "{$option['code']} {$option['name']}" ) { return $option['code']; } @@ -1034,15 +1069,10 @@ class Checkout protected function _prepareGuestQuote() { $quote = $this->_quote; - $quote->setCustomerId( - null - )->setCustomerEmail( - $quote->getBillingAddress()->getEmail() - )->setCustomerIsGuest( - true - )->setCustomerGroupId( - \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID - ); + $quote->setCustomerId(null) + ->setCustomerEmail($quote->getBillingAddress()->getEmail()) + ->setCustomerIsGuest(true) + ->setCustomerGroupId(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID); return $this; } @@ -1050,30 +1080,34 @@ class Checkout * Prepare quote for customer registration and customer order submit * and restore magento customer data from quote * - * @return $this + * @return void */ protected function _prepareNewCustomerQuote() { - $quote = $this->_quote; - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - - $customer = $quote->getCustomer(); - /** @var $customer Customer */ - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); - $customerBilling->setIsDefaultBilling(true); + $quote = $this->_quote; + $billing = $quote->getBillingAddress(); + $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); + + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $billingAddressBuilder */ + $billingAddressBuilder = $this->_addressBuilderFactory->create(); + $customerBilling = $billingAddressBuilder + ->populate($billing->exportCustomerAddressData()) + ->setDefaultBilling(true); if ($shipping && !$shipping->getSameAsBilling()) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); - $customerShipping->setIsDefaultShipping(true); + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $shippingAddressBuilder */ + $shippingAddressBuilder = $this->_addressBuilderFactory->create(); + $customerShipping = $shippingAddressBuilder + ->populate($shipping->exportCustomerAddressData()) + ->setDefaultShipping(true) + ->create(); + $shipping->setCustomerAddressData($customerShipping); } elseif ($shipping) { - $customerBilling->setIsDefaultShipping(true); + $customerBilling->setDefaultShipping(true); } + $customerBilling = $customerBilling->create(); + $billing->setCustomerAddressData($customerBilling); /** - * @todo integration with dynamica attributes customer_dob, customer_taxvat, customer_gender + * @todo integration with dynamic attributes customer_dob, customer_taxvat, customer_gender */ if ($quote->getCustomerDob() && !$billing->getCustomerDob()) { $billing->setCustomerDob($quote->getCustomerDob()); @@ -1087,63 +1121,81 @@ class Checkout $billing->setCustomerGender($quote->getCustomerGender()); } - $this->_objectCopyService->copyFieldsetToTarget( + $customerData = $this->_objectCopyService->getDataFromFieldset( 'checkout_onepage_billing', 'to_customer', - $billing, - $customer + $billing ); + + $customer = $this->_customerBuilder->populateWithArray($customerData); + $customer->setEmail($quote->getCustomerEmail()); $customer->setPrefix($quote->getCustomerPrefix()); $customer->setFirstname($quote->getCustomerFirstname()); $customer->setMiddlename($quote->getCustomerMiddlename()); $customer->setLastname($quote->getCustomerLastname()); $customer->setSuffix($quote->getCustomerSuffix()); - $customer->setPassword($customer->decryptPassword($quote->getPasswordHash())); - $customer->setPasswordHash($customer->hashPassword($customer->getPassword())); - $customer->save(); - $quote->setCustomer($customer); - return $this; + $quote->setCustomerData($customer->create())->addCustomerAddressData($customerBilling); + + if (isset($customerShipping)) { + $quote->addCustomerAddressData($customerShipping); + } } /** * Prepare quote for customer order submit * - * @return $this + * @return void */ protected function _prepareCustomerQuote() { - $quote = $this->_quote; - $billing = $quote->getBillingAddress(); - $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); + $quote = $this->_quote; + $billing = $quote->getBillingAddress(); + $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); - $customer = $this->getCustomerSession()->getCustomer(); + $customer = $this->_customerAccountService->getCustomer($this->getCustomerSession()->getCustomerId()); if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) { - $customerBilling = $billing->exportCustomerAddress(); - $customer->addAddress($customerBilling); - $billing->setCustomerAddress($customerBilling); + $billingAddress = $billing->exportCustomerAddressData(); + $billing->setCustomerAddressData($billingAddress); } - if ($shipping && (!$shipping->getCustomerId() && !$shipping->getSameAsBilling() || - !$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook()) + if ($shipping + && !$shipping->getSameAsBilling() + && (!$shipping->getCustomerId() || $shipping->getSaveInAddressBook()) ) { - $customerShipping = $shipping->exportCustomerAddress(); - $customer->addAddress($customerShipping); - $shipping->setCustomerAddress($customerShipping); + $shippingAddress = $shipping->exportCustomerAddressData(); + $shipping->setCustomerAddressData($shippingAddress); } - if (isset($customerBilling) && !$customer->getDefaultBilling()) { - $customerBilling->setIsDefaultBilling(true); + $isBillingAddressDefaultBilling = false; + $isBillingAddressDefaultShipping = false; + if (!$customer->getDefaultBilling()) { + $isBillingAddressDefaultBilling = true; } - if ($shipping && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling() - ) { - $customerBilling->setIsDefaultShipping(true); - } elseif ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) { - $customerShipping->setIsDefaultShipping(true); + + if ($shipping && isset($shippingAddress) && !$customer->getDefaultShipping()) { + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $shippingAddressBuilder */ + $shippingAddressBuilder = $this->_addressBuilderFactory->create(); + $shippingAddress = $shippingAddressBuilder->populate($shippingAddress) + ->setDefaultBilling(false) + ->setDefaultShipping(true) + ->create(); + $quote->addCustomerAddressData($shippingAddress); + } else if (!$customer->getDefaultShipping()) { + $isBillingAddressDefaultShipping = true; } - $quote->setCustomer($customer); - return $this; + if (isset($billingAddress)) { + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $billingAddressBuilder */ + $billingAddressBuilder = $this->_addressBuilderFactory->create(); + $billingAddress = $billingAddressBuilder + ->populate($billingAddress) + ->setDefaultBilling($isBillingAddressDefaultBilling) + ->setDefaultShipping($isBillingAddressDefaultShipping) + ->create(); + $quote->addCustomerAddressData($billingAddress); + } + $quote->setCustomerData($customer); } /** @@ -1153,20 +1205,16 @@ class Checkout */ protected function _involveNewCustomer() { - $customer = $this->_quote->getCustomer(); - if ($customer->isConfirmationRequired()) { - $customer->sendNewAccountEmail('confirmation'); + $customer = $this->_quote->getCustomerData(); + $confirmationStatus = $this->_customerAccountService->getConfirmationStatus($customer->getId()); + if ($confirmationStatus === CustomerAccountServiceInterface::ACCOUNT_CONFIRMATION_REQUIRED) { $url = $this->_customerData->getEmailConfirmationUrl($customer->getEmail()); - $this->getCustomerSession()->addSuccess( - __( - 'Account confirmation is required. ' . - 'Please, check your e-mail for confirmation link. ' . - 'To resend confirmation email please <a href="%1">click here</a>.', - $url - ) + $this->_messageManager->addSuccess( + // @codingStandardsIgnoreStart + __('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%1">click here</a>.', $url) + // @codingStandardsIgnoreEnd ); } else { - $customer->sendNewAccountEmail(); $this->getCustomerSession()->loginById($customer->getId()); } return $this; diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index a5d536224ca454d55de8a33054eb4895dca59bf7..230a037329f314de5f9ef573de8df29b81406209 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -91,14 +91,14 @@ class Hostedpro extends \Magento\Paypal\Model\Direct /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\Paypal\Model\CartFactory $cartFactory @@ -110,14 +110,14 @@ class Hostedpro extends \Magento\Paypal\Model\Direct public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Centinel\Model\Service $centinelService, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, \Magento\App\RequestInterface $requestHttp, \Magento\Paypal\Model\CartFactory $cartFactory, @@ -128,7 +128,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php index c7ee0a0f13276ed1153426270448f33743a7e9ad..30992645189b2684f3b9be958ca792d197d68c3c 100644 --- a/app/code/Magento/Paypal/Model/Method/Agreement.php +++ b/app/code/Magento/Paypal/Model/Method/Agreement.php @@ -25,7 +25,7 @@ */ namespace Magento\Paypal\Model\Method; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Payment\Model\Info; use Magento\Sales\Model\Order\Payment; @@ -120,7 +120,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr protected $_pro; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -137,10 +137,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Paypal\Model\CartFactory $cartFactory @@ -151,10 +151,10 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, \Magento\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, @@ -166,7 +166,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $agreementFactory, $data diff --git a/app/code/Magento/Paypal/Model/PayflowExpress.php b/app/code/Magento/Paypal/Model/PayflowExpress.php index 417985ec00f0e6168343d157b3484b148bb732cf..04da1a17bcb78334f2791bea7f65ed5bc71c2834 100644 --- a/app/code/Magento/Paypal/Model/PayflowExpress.php +++ b/app/code/Magento/Paypal/Model/PayflowExpress.php @@ -57,10 +57,10 @@ class PayflowExpress extends \Magento\Paypal\Model\Express /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Paypal\Model\CartFactory $cartFactory * @param \Magento\Paypal\Model\InfoFactory $paypalInfoFactory @@ -69,10 +69,10 @@ class PayflowExpress extends \Magento\Paypal\Model\Express public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, \Magento\Paypal\Model\InfoFactory $paypalInfoFactory, @@ -81,7 +81,7 @@ class PayflowExpress extends \Magento\Paypal\Model\Express parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $proTypeFactory, $storeManager, diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index d797e3b7d72d7ff117047a3ec21c90aadc9d718d..ebaee46d2f4a1b2250b20cde1d046bccb11fba51 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -142,27 +142,27 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro protected $_orderFactory; /** - * @var \Magento\Core\Model\WebsiteFactory + * @var \Magento\Store\Model\WebsiteFactory */ protected $_websiteFactory; /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Paypal\Model\ConfigFactory $configFactory * @param \Magento\Math\Random $mathRandom * @param \Magento\Paypal\Model\Payflow\RequestFactory $requestFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\App\RequestInterface $requestHttp - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -170,20 +170,20 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Centinel\Model\Service $centinelService, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\ConfigFactory $configFactory, \Magento\Math\Random $mathRandom, \Magento\Paypal\Model\Payflow\RequestFactory $requestFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\App\RequestInterface $requestHttp, - \Magento\Core\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\WebsiteFactory $websiteFactory, array $data = array() ) { $this->_requestFactory = $requestFactory; @@ -194,7 +194,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, @@ -802,16 +802,24 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro protected function _getCallbackUrl($actionName) { if ($this->_requestHttp->getParam('website')) { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ $website = $this->_websiteFactory->create()->load($this->_requestHttp->getParam('website')); - $secure = $this->_coreStoreConfig->getConfigFlag( - \Magento\Core\Model\Store::XML_PATH_SECURE_IN_FRONTEND, + $secure = $this->_scopeConfig->isSetFlag( + \Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $website->getDefaultStore() + ); + $path = $secure ? \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL : \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL; + $websiteUrl = $this->_scopeConfig->getValue( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $website->getDefaultStore() ); - $path = $secure ? \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL : \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL; - $websiteUrl = $this->_coreStoreConfig->getConfig($path, $website->getDefaultStore()); } else { - $secure = $this->_coreStoreConfig->getConfigFlag(\Magento\Core\Model\Store::XML_PATH_SECURE_IN_FRONTEND); + $secure = $this->_scopeConfig->isSetFlag( + \Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $websiteUrl = $this->_storeManager->getStore()->getBaseUrl(\Magento\UrlInterface::URL_TYPE_LINK, $secure); } diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index b6f8f3cae7c7d173933ab22dd0ef6b04b1d0b15e..33eda8848c32acb2f8d4c00f56811ba049573a76 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -201,7 +201,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc ); /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -218,13 +218,13 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Logger $logger * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Paypal\Model\ConfigFactory $configFactory * @param \Magento\Math\Random $mathRandom * @param array $data @@ -234,13 +234,13 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Logger $logger, \Magento\Module\ModuleListInterface $moduleList, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Centinel\Model\Service $centinelService, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Paypal\Model\ConfigFactory $configFactory, \Magento\Math\Random $mathRandom, array $data = array() @@ -251,7 +251,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc parent::__construct( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, diff --git a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php index e4b2741bf0b41f59b0ac6225e5e99030479e98d4..68e627b791572fd709788e395ed82ae7ff196190 100644 --- a/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php +++ b/app/code/Magento/Paypal/Model/Payment/Method/Billing/AbstractAgreement.php @@ -60,7 +60,7 @@ abstract class AbstractAgreement extends \Magento\Payment\Model\Method\AbstractM /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory * @param array $data @@ -68,13 +68,13 @@ abstract class AbstractAgreement extends \Magento\Payment\Model\Method\AbstractM public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Paypal\Model\Billing\AgreementFactory $agreementFactory, array $data = array() ) { $this->_agreementFactory = $agreementFactory; - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index b7c37113cd60ad9becc0ebf5689267a3e14e319f..c92aa51e5ee34271c13cb036248b5d3fead6fcfb 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -164,30 +164,38 @@ class Settlement extends \Magento\Model\AbstractModel protected $_tmpDirectory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Model\Context $context - * @param \Magento\Registry $registry - * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data + * @var \Magento\App\Config\ScopeConfigInterface */ + protected $_scopeConfig; + + /** + * @param \Magento\Model\Context $context + * @param \Magento\Registry $registry + * @param \Magento\App\Filesystem $filesystem + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_tmpDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SYS_TMP_DIR); $this->_storeManager = $storeManager; + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -460,17 +468,41 @@ class Settlement extends \Magento\Model\AbstractModel $configs = array(); $uniques = array(); foreach ($this->_storeManager->getStores() as $store) { - /*@var $store \Magento\Core\Model\Store */ - $active = (bool)$store->getConfig('paypal/fetch_reports/active'); + /*@var $store \Magento\Store\Model\Store */ + $active = $this->_scopeConfig->isSetFlag( + 'paypal/fetch_reports/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if (!$active && $automaticMode) { continue; } $cfg = array( - 'hostname' => $store->getConfig('paypal/fetch_reports/ftp_ip'), - 'path' => $store->getConfig('paypal/fetch_reports/ftp_path'), - 'username' => $store->getConfig('paypal/fetch_reports/ftp_login'), - 'password' => $store->getConfig('paypal/fetch_reports/ftp_password'), - 'sandbox' => $store->getConfig('paypal/fetch_reports/ftp_sandbox') + 'hostname' => $this->_scopeConfig->getValue( + 'paypal/fetch_reports/ftp_ip', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ), + 'path' => $this->_scopeConfig->getValue( + 'paypal/fetch_reports/ftp_path', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ), + 'username' => $this->_scopeConfig->getValue( + 'paypal/fetch_reports/ftp_login', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ), + 'password' => $this->_scopeConfig->getValue( + 'paypal/fetch_reports/ftp_password', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ), + 'sandbox' => $this->_scopeConfig->getValue( + 'paypal/fetch_reports/ftp_sandbox', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) ); if (empty($cfg['username']) || empty($cfg['password'])) { continue; diff --git a/app/code/Magento/Paypal/Model/Standard.php b/app/code/Magento/Paypal/Model/Standard.php index 134af9c81868031c29030f12674a797bc92c6e17..94c2cd90409c81ad613c4d3cb24d2b22a2dc7784 100644 --- a/app/code/Magento/Paypal/Model/Standard.php +++ b/app/code/Magento/Paypal/Model/Standard.php @@ -78,7 +78,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod protected $_urlBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -105,12 +105,12 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Session\Generic $paypalSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Paypal\Model\Api\StandardFactory $apiStandardFactory * @param \Magento\Paypal\Model\CartFactory $cartFactory @@ -122,12 +122,12 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Session\Generic $paypalSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\UrlInterface $urlBuilder, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Paypal\Model\Api\StandardFactory $apiStandardFactory, \Magento\Paypal\Model\CartFactory $cartFactory, @@ -142,7 +142,7 @@ class Standard extends \Magento\Payment\Model\Method\AbstractMethod $this->_apiStandardFactory = $apiStandardFactory; $this->_cartFactory = $cartFactory; $this->_configFactory = $configFactory; - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $data); + parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php index bca063327161dcbbfb30df27f151dd4e5de3c80c..bf1583544adfd65671fefc7d10f422662c0e81ca 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\System\Config\Backend; /** * Backend model for saving certificate file in case of using certificate based authentication */ -class Cert extends \Magento\Core\Model\Config\Value +class Cert extends \Magento\App\Config\Value { /** * @var \Magento\Paypal\Model\CertFactory @@ -48,8 +48,7 @@ class Cert extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Paypal\Model\CertFactory $certFactory * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\App\Filesystem $filesystem @@ -60,8 +59,7 @@ class Cert extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Paypal\Model\CertFactory $certFactory, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\App\Filesystem $filesystem, @@ -72,7 +70,7 @@ class Cert extends \Magento\Core\Model\Config\Value $this->_certFactory = $certFactory; $this->_encryptor = $encryptor; $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php index 42112746d7be8d01bc04f7044c1de3b016467743..4e72683ee4634acdb61be2d6bdaa9219449c3451 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php @@ -25,23 +25,22 @@ */ namespace Magento\Paypal\Model\System\Config\Backend; -class Cron extends \Magento\Core\Model\Config\Value +class Cron extends \Magento\App\Config\Value { const CRON_STRING_PATH = 'crontab/default/jobs/paypal_fetch_settlement_reports/schedule/cron_expr'; const CRON_MODEL_PATH_INTERVAL = 'paypal/fetch_reports/schedule'; /** - * @var \Magento\Core\Model\Config\ValueFactory + * @var \Magento\App\Config\ValueFactory */ protected $_configValueFactory; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\App\Config\ValueFactory $configValueFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -49,15 +48,14 @@ class Cron extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Config\ValueFactory $configValueFactory, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\App\Config\ValueFactory $configValueFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_configValueFactory = $configValueFactory; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php index de2a6c6a8fc0483d1018b808445e7dce8bac162c..a5ba9c992e9c9ac9a6f62a2d69232ca275c112dc 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\System\Config\Backend; /** * Backend model for merchant country. Default country used instead of empty value. */ -class MerchantCountry extends \Magento\Core\Model\Config\Value +class MerchantCountry extends \Magento\App\Config\Value { /** * Core data @@ -37,11 +37,16 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value */ protected $_coreData; + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $_storeManager; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -50,15 +55,16 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Core\Helper\Data $coreData, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_coreData = $coreData; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); + $this->_storeManager = $storeManager; } /** diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml index 8a0bf86eef9854b19ffbfda324a017b3c5736e94..8814ec3b40ef0ab465152b05e36835c0e793ad45 100644 --- a/app/code/Magento/Paypal/etc/module.xml +++ b/app/code/Magento/Paypal/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Sales"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Checkout"/> <module name="Magento_Sales"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php b/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php index 6558cfb69a4c876c3f16a262a19830a88192d142..c0fa9948c72d6ece45e7618a1690da8f24f125be 100644 --- a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php +++ b/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php @@ -105,9 +105,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('paypal_billing_agreement', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('paypal_billing_agreement', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -363,9 +363,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('paypal_cert', array('website_id')), array('website_id') )->addForeignKey( - $installer->getFkName('paypal_cert', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('paypal_cert', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php index fd0a10c1bbb41a63f561f0f32ec36bd262ab7b44..4f5e26d0319b339f085e5f0ca8a0889622be31ad 100644 --- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $this \Magento\Core\Model\Resource\Setup */ +/** @var $this \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); $installer->startSetup(); diff --git a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml index f0a7809622888cbcf03c14e8607066420f5fc3a1..e9e7d78e1b71826c71e1acc227a3ef02bfc2498d 100644 --- a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml @@ -23,10 +23,25 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> +<?php +/** + * @var \Magento\Paypal\Block\Express\Review\Shipping|\Magento\Paypal\Block\Express\Review\Billing $this + */ +?> <?php $prefix = $this->getFieldNamePrefix(); ?> <input type="hidden" name="<?php echo $prefix ?>[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="<?php echo $prefix ?>:address_id"/> -<?php echo $this->getLayout()->createBlock('Magento\Customer\Block\Widget\Name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat($prefix . ':%s')->setFieldNameFormat($prefix . '[%s]')->toHtml() ?> +<?php +/** @var \Magento\Customer\Block\Widget\Name $nameWidget */ +$nameWidget = $this->getLayout()->createBlock('Magento\Customer\Block\Widget\Name'); +$widgetObject = $this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomerData(); +echo $nameWidget + ->setObject($widgetObject) + ->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn()) + ->setFieldIdFormat($prefix . ':%s') + ->setFieldNameFormat($prefix . '[%s]') + ->toHtml() +?> <div class="field company"> <label for="<?php echo $prefix ?>:company" class="label"><span><?php echo __('Company') ?></span></label> diff --git a/app/code/Magento/Paypal/view/frontend/hss/form.phtml b/app/code/Magento/Paypal/view/frontend/hss/form.phtml index 1a9fe5669aacefe9859a6cee4b9a06608f97072c..43ed790cda89d09a78beea831570aaa8b8fe26c3 100644 --- a/app/code/Magento/Paypal/view/frontend/hss/form.phtml +++ b/app/code/Magento/Paypal/view/frontend/hss/form.phtml @@ -30,6 +30,7 @@ <html> <head> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> </head> <body> <form id="token_form" method="POST" action="<?php echo $this->getTransactionUrl() ?>"> diff --git a/app/code/Magento/Paypal/view/frontend/hss/redirect.phtml b/app/code/Magento/Paypal/view/frontend/hss/redirect.phtml index b85ed6d004a175b7448110f5dfc6c055ef9d9bf4..99e7a6163da8e92fb50f72feac36642b27699119 100644 --- a/app/code/Magento/Paypal/view/frontend/hss/redirect.phtml +++ b/app/code/Magento/Paypal/view/frontend/hss/redirect.phtml @@ -30,6 +30,7 @@ <html> <head> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> </head> <body> <script type="text/javascript"> diff --git a/app/code/Magento/Paypal/view/frontend/order-review.js b/app/code/Magento/Paypal/view/frontend/order-review.js index ad9096a89ba5fb7e509ecf008ddedcebfc724827..8f976ecc5b4246d688d69fbc9a58c65c2fd6bff3 100644 --- a/app/code/Magento/Paypal/view/frontend/order-review.js +++ b/app/code/Magento/Paypal/view/frontend/order-review.js @@ -168,7 +168,7 @@ * Validate Order form */ _validateForm: function () { - if (this.element.data('validation')) { + if (this.element.data('mageValidation')) { return this.element.validation().valid(); } }, diff --git a/app/code/Magento/Paypal/view/frontend/payflowadvanced/form.phtml b/app/code/Magento/Paypal/view/frontend/payflowadvanced/form.phtml index e85fa55133e39a02483a1154686a310127fbdfac..88d62efffdf6efcde433ac8e61bade40070c1fb0 100644 --- a/app/code/Magento/Paypal/view/frontend/payflowadvanced/form.phtml +++ b/app/code/Magento/Paypal/view/frontend/payflowadvanced/form.phtml @@ -30,6 +30,7 @@ <html> <head> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> </head> <body> <form id="token_form" method="POST" action="<?php echo $this->getTransactionUrl() ?>"> diff --git a/app/code/Magento/Paypal/view/frontend/payflowadvanced/redirect.phtml b/app/code/Magento/Paypal/view/frontend/payflowadvanced/redirect.phtml index 0742d91705d951cc5ba2ba797fff79a17474b9fc..f4614d7d7d93c6c53406c2ed0111efb54949b539 100644 --- a/app/code/Magento/Paypal/view/frontend/payflowadvanced/redirect.phtml +++ b/app/code/Magento/Paypal/view/frontend/payflowadvanced/redirect.phtml @@ -30,6 +30,7 @@ <html> <head> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> </head> <body> <script type="text/javascript"> diff --git a/app/code/Magento/Paypal/view/frontend/payflowlink/form.phtml b/app/code/Magento/Paypal/view/frontend/payflowlink/form.phtml index 1a9fe5669aacefe9859a6cee4b9a06608f97072c..43ed790cda89d09a78beea831570aaa8b8fe26c3 100644 --- a/app/code/Magento/Paypal/view/frontend/payflowlink/form.phtml +++ b/app/code/Magento/Paypal/view/frontend/payflowlink/form.phtml @@ -30,6 +30,7 @@ <html> <head> <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script type="text/javascript" src="<?php echo $this->getViewFileUrl('jquery/jquery-migrate.js') ?>"></script> </head> <body> <form id="token_form" method="POST" action="<?php echo $this->getTransactionUrl() ?>"> diff --git a/app/code/Magento/Persistent/Helper/Data.php b/app/code/Magento/Persistent/Helper/Data.php index 45958330bbb3b4acb6208dd66e48d22e69ecc856..634e9bddd81470c28d1a5f7341fd731d6369e623 100644 --- a/app/code/Magento/Persistent/Helper/Data.php +++ b/app/code/Magento/Persistent/Helper/Data.php @@ -69,8 +69,8 @@ class Data extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param Session $persistentSession * @param \Magento\Module\Dir\Reader $modulesReader @@ -79,8 +79,8 @@ class Data extends \Magento\Core\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, Session $persistentSession, \Magento\Module\Dir\Reader $modulesReader, @@ -91,62 +91,84 @@ class Data extends \Magento\Core\Helper\Data $this->_persistentSession = $persistentSession; $this->_escaper = $escaper; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** * Checks whether Persistence Functionality is enabled * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return bool */ public function isEnabled($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ENABLED, $store); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Checks whether "Remember Me" enabled * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return bool */ public function isRememberMeEnabled($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_REMEMBER_ME_ENABLED, $store); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_REMEMBER_ME_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Is "Remember Me" checked by default * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return bool */ public function isRememberMeCheckedDefault($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_REMEMBER_ME_DEFAULT, $store); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_REMEMBER_ME_DEFAULT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Is shopping cart persist * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return bool */ public function isShoppingCartPersist($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_PERSIST_SHOPPING_CART, $store); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_PERSIST_SHOPPING_CART, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** * Get Persistence Lifetime * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return int */ public function getLifeTime($store = null) { - $lifeTime = intval($this->_coreStoreConfig->getConfig(self::XML_PATH_LIFE_TIME, $store)); + $lifeTime = intval( + $this->_scopeConfig->getValue( + self::XML_PATH_LIFE_TIME, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) + ); return $lifeTime < 0 ? 0 : $lifeTime; } @@ -157,7 +179,10 @@ class Data extends \Magento\Core\Helper\Data */ public function getClearOnLogout() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_LOGOUT_CLEAR); + return $this->_scopeConfig->isSetFlag( + self::XML_PATH_LOGOUT_CLEAR, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Persistent/Helper/Session.php b/app/code/Magento/Persistent/Helper/Session.php index d4426b2e0ccddcd98a0b662d33873be1af6b565f..a018b171113c20808d21ac97af9435b084ca66ec 100644 --- a/app/code/Magento/Persistent/Helper/Session.php +++ b/app/code/Magento/Persistent/Helper/Session.php @@ -81,8 +81,8 @@ class Session extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param Data $persistentData * @param \Magento\Checkout\Model\Session $checkoutSession @@ -92,8 +92,8 @@ class Session extends \Magento\Core\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\Persistent\Helper\Data $persistentData, \Magento\Checkout\Model\Session $checkoutSession, @@ -105,7 +105,7 @@ class Session extends \Magento\Core\Helper\Data $this->_checkoutSession = $checkoutSession; $this->_customerFactory = $customerFactory; $this->_sessionFactory = $sessionFactory; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** diff --git a/app/code/Magento/Persistent/Model/Observer.php b/app/code/Magento/Persistent/Model/Observer.php index bd56f82b4bc0d5d1a02b80afe260b166b2467c43..fd287266d511782835abc09054af44deb4290d39 100644 --- a/app/code/Magento/Persistent/Model/Observer.php +++ b/app/code/Magento/Persistent/Model/Observer.php @@ -126,7 +126,7 @@ class Observer /** * Website collection factory * - * @var \Magento\Core\Model\Resource\Website\CollectionFactory + * @var \Magento\Store\Model\Resource\Website\CollectionFactory */ protected $_websiteCollectionFactory; @@ -151,7 +151,7 @@ class Observer * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Persistent\Helper\Session $persistentSession * @param \Magento\Persistent\Helper\Data $persistentData - * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory + * @param \Magento\Store\Model\Resource\Website\CollectionFactory $websiteCollectionFactory * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\UrlInterface $url @@ -171,7 +171,7 @@ class Observer \Magento\Event\ManagerInterface $eventManager, \Magento\Persistent\Helper\Session $persistentSession, \Magento\Persistent\Helper\Data $persistentData, - \Magento\Core\Model\Resource\Website\CollectionFactory $websiteCollectionFactory, + \Magento\Store\Model\Resource\Website\CollectionFactory $websiteCollectionFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\UrlInterface $url, diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 0c4acc9c161538dc68ac5905d550f47812ab5c82..05f78c577da8c7f28fa310089762ef249bc7ca02 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -76,14 +76,14 @@ class Session extends \Magento\Model\AbstractModel protected $_coreData; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_coreConfig; /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -109,11 +109,11 @@ class Session extends \Magento\Model\AbstractModel * * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\App\ConfigInterface $coreConfig + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Persistent\Helper\Data $persistentData * @param \Magento\Stdlib\Cookie $cookie - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Math\Random $mathRandom * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param \Magento\Model\Resource\AbstractResource $resource @@ -123,11 +123,11 @@ class Session extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\App\ConfigInterface $coreConfig, + \Magento\App\Config\ScopeConfigInterface $coreConfig, \Magento\Core\Helper\Data $coreData, \Magento\Persistent\Helper\Data $persistentData, \Magento\Stdlib\Cookie $cookie, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Math\Random $mathRandom, \Magento\Session\Config\ConfigInterface $sessionConfig, \Magento\Model\Resource\AbstractResource $resource = null, @@ -179,7 +179,7 @@ class Session extends \Magento\Model\AbstractModel /** * Get date-time before which persistent session is expired * - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return string */ public function getExpiredBefore($store = null) diff --git a/app/code/Magento/Persistent/etc/module.xml b/app/code/Magento/Persistent/etc/module.xml index 5489daf107106aa87bdc81967164dc6f4e596598..a25a692b3d07b3effbe36b88d34a5332c6b53367 100644 --- a/app/code/Magento/Persistent/etc/module.xml +++ b/app/code/Magento/Persistent/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Checkout"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Checkout"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php index 519ff406d63a5e22e95b7ee300330359997599ac..9cd96f467dd063f91a98a94e5975716a75810780 100644 --- a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php +++ b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -87,9 +87,9 @@ $table = $installer->getConnection()->newTable( 'entity_id', \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('persistent_session', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('persistent_session', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE )->setComment( diff --git a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php index ee10a20f37d495bbad910f8fa1fe0e4b4e5e7773..1406c44484b94e6c4f6308b68ce3f32897a03aaa 100644 --- a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php +++ b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php @@ -44,22 +44,22 @@ abstract class AbstractEmail extends \Magento\View\Element\Template /** * Current Store scope object * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; /** * Set Store scope * - * @param int|string|\Magento\Core\Model\Website|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Website|\Magento\Store\Model\Store $store * @return $this */ public function setStore($store) { - if ($store instanceof \Magento\Core\Model\Website) { + if ($store instanceof \Magento\Store\Model\Website) { $store = $store->getDefaultStore(); } - if (!$store instanceof \Magento\Core\Model\Store) { + if (!$store instanceof \Magento\Store\Model\Store) { $store = $this->_storeManager->getStore($store); } @@ -71,7 +71,7 @@ abstract class AbstractEmail extends \Magento\View\Element\Template /** * Retrieve current store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/ProductAlert/Controller/Add.php b/app/code/Magento/ProductAlert/Controller/Add.php index b1c7cf9dc2a59968006d5db73dfe72952cb6a24f..cc67044c67a09fe6fd180ec433fc58569fdd35e9 100644 --- a/app/code/Magento/ProductAlert/Controller/Add.php +++ b/app/code/Magento/ProductAlert/Controller/Add.php @@ -38,17 +38,17 @@ use Magento\App\RequestInterface; class Add extends \Magento\App\Action\Action { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; parent::__construct($context); @@ -119,7 +119,7 @@ class Add extends \Magento\App\Action\Action )->setPrice( $product->getFinalPrice() )->setWebsiteId( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $model->save(); $this->messageManager->addSuccess(__('You saved the alert subscription.')); @@ -156,7 +156,7 @@ class Add extends \Magento\App\Action\Action )->setProductId( $product->getId() )->setWebsiteId( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $model->save(); $this->messageManager->addSuccess(__('Alert subscription has been saved.')); diff --git a/app/code/Magento/ProductAlert/Controller/Unsubscribe.php b/app/code/Magento/ProductAlert/Controller/Unsubscribe.php index 01c09d4b5c9f9bb70d18574aaa67c0fd14c8d76f..ae038ed11ca0dc5cc33eb816f15ba5073b2d595c 100644 --- a/app/code/Magento/ProductAlert/Controller/Unsubscribe.php +++ b/app/code/Magento/ProductAlert/Controller/Unsubscribe.php @@ -85,7 +85,7 @@ class Unsubscribe extends \Magento\App\Action\Action )->setProductId( $product->getId() )->setWebsiteId( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() )->loadByParam(); if ($model->getId()) { $model->delete(); @@ -111,7 +111,7 @@ class Unsubscribe extends \Magento\App\Action\Action 'Magento\ProductAlert\Model\Price' )->deleteCustomer( $session->getCustomerId(), - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $this->messageManager->addSuccess(__('You will no longer receive price alerts for this product.')); } catch (\Exception $e) { @@ -148,7 +148,7 @@ class Unsubscribe extends \Magento\App\Action\Action )->setProductId( $product->getId() )->setWebsiteId( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() )->loadByParam(); if ($model->getId()) { $model->delete(); @@ -173,7 +173,7 @@ class Unsubscribe extends \Magento\App\Action\Action 'Magento\ProductAlert\Model\Stock' )->deleteCustomer( $session->getCustomerId(), - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId() + $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId() ); $this->messageManager->addSuccess(__('You will no longer receive stock alerts.')); } catch (\Exception $e) { diff --git a/app/code/Magento/ProductAlert/Helper/Data.php b/app/code/Magento/ProductAlert/Helper/Data.php index fe488b07fce46a7567fabcd1c96ef0007003e804..4b26d2f7c091ca5bc0318cfb8fdb8b47eee3434a 100644 --- a/app/code/Magento/ProductAlert/Helper/Data.php +++ b/app/code/Magento/ProductAlert/Helper/Data.php @@ -25,7 +25,7 @@ */ namespace Magento\ProductAlert\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Customer\Model\Session; /** @@ -54,9 +54,9 @@ class Data extends \Magento\Core\Helper\Url /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\View\LayoutInterface @@ -70,23 +70,23 @@ class Data extends \Magento\Core\Helper\Url /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $coreRegistry * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Model\Session $session */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Registry $coreRegistry, \Magento\View\LayoutInterface $layout, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $session ) { $this->_coreRegistry = $coreRegistry; $this->_layout = $layout; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_session = $session; parent::__construct($context, $storeManager); } @@ -174,7 +174,7 @@ class Data extends \Magento\Core\Helper\Url */ public function isStockAlertAllowed() { - return $this->_coreStoreConfig->getConfigFlag(\Magento\ProductAlert\Model\Observer::XML_PATH_STOCK_ALLOW); + return $this->_scopeConfig->isSetFlag(\Magento\ProductAlert\Model\Observer::XML_PATH_STOCK_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -184,6 +184,6 @@ class Data extends \Magento\Core\Helper\Url */ public function isPriceAlertAllowed() { - return $this->_coreStoreConfig->getConfigFlag(\Magento\ProductAlert\Model\Observer::XML_PATH_PRICE_ALLOW); + return $this->_scopeConfig->isSetFlag(\Magento\ProductAlert\Model\Observer::XML_PATH_PRICE_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } } diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php index e2a0b89352c17cdd0ff3c802a4e03ddc207a9508..8db18d59f0ed206a188ad27ab402c953e9c275af 100644 --- a/app/code/Magento/ProductAlert/Model/Email.php +++ b/app/code/Magento/ProductAlert/Model/Email.php @@ -50,7 +50,7 @@ class Email extends \Magento\Model\AbstractModel /** * Website Model * - * @var \Magento\Core\Model\Website + * @var \Magento\Store\Model\Website */ protected $_website; @@ -99,12 +99,12 @@ class Email extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -127,8 +127,8 @@ class Email extends \Magento\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\ProductAlert\Helper\Data $productAlertData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Mail\Template\TransportBuilder $transportBuilder @@ -140,8 +140,8 @@ class Email extends \Magento\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\ProductAlert\Helper\Data $productAlertData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Mail\Template\TransportBuilder $transportBuilder, @@ -150,7 +150,7 @@ class Email extends \Magento\Model\AbstractModel array $data = array() ) { $this->_productAlertData = $productAlertData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_customerFactory = $customerFactory; $this->_appEmulation = $appEmulation; @@ -182,10 +182,10 @@ class Email extends \Magento\Model\AbstractModel /** * Set website model * - * @param \Magento\Core\Model\Website $website + * @param \Magento\Store\Model\Website $website * @return $this */ - public function setWebsite(\Magento\Core\Model\Website $website) + public function setWebsite(\Magento\Store\Model\Website $website) { $this->_website = $website; return $this; @@ -316,14 +316,16 @@ class Email extends \Magento\Model\AbstractModel $store = $this->_website->getDefaultStore(); $storeId = $store->getId(); - if ($this->_type == 'price' && !$this->_coreStoreConfig->getConfig( + if ($this->_type == 'price' && !$this->_scopeConfig->getValue( self::XML_PATH_EMAIL_PRICE_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ) ) { return false; - } elseif ($this->_type == 'stock' && !$this->_coreStoreConfig->getConfig( + } elseif ($this->_type == 'stock' && !$this->_scopeConfig->getValue( self::XML_PATH_EMAIL_STOCK_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ) ) { @@ -343,7 +345,11 @@ class Email extends \Magento\Model\AbstractModel $this->_getPriceBlock()->addProduct($product); } $block = $this->_getPriceBlock()->toHtml(); - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_PRICE_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } else { $this->_getStockBlock()->setStore($store)->reset(); foreach ($this->_stockProducts as $product) { @@ -351,7 +357,11 @@ class Email extends \Magento\Model\AbstractModel $this->_getStockBlock()->addProduct($product); } $block = $this->_getStockBlock()->toHtml(); - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_STOCK_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } $this->_appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo); @@ -363,7 +373,11 @@ class Email extends \Magento\Model\AbstractModel )->setTemplateVars( array('customerName' => $this->_customer->getName(), 'alertGrid' => $block) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $this->_customer->getEmail(), $this->_customer->getName() diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 88ecc5bf527e888067678a142b80a67b366b01c5..712b616e4cf1607204557e1fd9aee0104ae1c83e 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -85,12 +85,12 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -136,8 +136,8 @@ class Observer /** * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\ProductAlert\Model\Resource\Price\CollectionFactory $priceColFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -149,8 +149,8 @@ class Observer */ public function __construct( \Magento\Tax\Helper\Data $taxData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ProductAlert\Model\Resource\Price\CollectionFactory $priceColFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -161,7 +161,7 @@ class Observer \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_taxData = $taxData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_priceColFactory = $priceColFactory; $this->_customerFactory = $customerFactory; @@ -200,13 +200,14 @@ class Observer { $email->setType('price'); foreach ($this->_getWebsites() as $website) { - /* @var $website \Magento\Core\Model\Website */ + /* @var $website \Magento\Store\Model\Website */ if (!$website->getDefaultGroup() || !$website->getDefaultGroup()->getDefaultStore()) { continue; } - if (!$this->_coreStoreConfig->getConfig( + if (!$this->_scopeConfig->getValue( self::XML_PATH_PRICE_ALLOW, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $website->getDefaultGroup()->getDefaultStore()->getId() ) ) { @@ -287,13 +288,14 @@ class Observer $email->setType('stock'); foreach ($this->_getWebsites() as $website) { - /* @var $website \Magento\Core\Model\Website */ + /* @var $website \Magento\Store\Model\Website */ if (!$website->getDefaultGroup() || !$website->getDefaultGroup()->getDefaultStore()) { continue; } - if (!$this->_coreStoreConfig->getConfig( + if (!$this->_scopeConfig->getValue( self::XML_PATH_STOCK_ALLOW, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $website->getDefaultGroup()->getDefaultStore()->getId() ) ) { @@ -374,14 +376,21 @@ class Observer protected function _sendErrorEmail() { if (count($this->_errors)) { - if (!$this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE)) { + if (!$this->_scopeConfig->getValue( + self::XML_PATH_ERROR_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return $this; } $this->inlineTranslation->suspend(); $transport = $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, @@ -390,9 +399,15 @@ class Observer )->setTemplateVars( array('warnings' => join("\n", $this->_errors)) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->getTransport(); $transport->sendMessage(); diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php index 726efb6163284c19e95f5ac1d0911b46e7ee24f1..a1d169fd49ac1a2301de52dcd2d77968ee84a7a4 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php @@ -76,7 +76,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio } if (is_array($website)) { $condition = $this->getConnection()->quoteInto('website_id IN(?)', $website); - } elseif ($website instanceof \Magento\Core\Model\Website) { + } elseif ($website instanceof \Magento\Store\Model\Website) { $condition = $this->getConnection()->quoteInto('website_id=?', $website->getId()); } else { $condition = $this->getConnection()->quoteInto('website_id=?', $website); diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php index fc8bc4166333c36c6e1284b82eb390bc48018b75..2003f21436b9dfb8f7842b4e792dc143e7450d54 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php @@ -78,7 +78,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio } if (is_array($website)) { $condition = $adapter->quoteInto('website_id IN(?)', $website); - } elseif ($website instanceof \Magento\Core\Model\Website) { + } elseif ($website instanceof \Magento\Store\Model\Website) { $condition = $adapter->quoteInto('website_id=?', $website->getId()); } else { $condition = $adapter->quoteInto('website_id=?', $website); diff --git a/app/code/Magento/Rating/etc/adminhtml/events.xml b/app/code/Magento/ProductAlert/etc/di.xml similarity index 73% rename from app/code/Magento/Rating/etc/adminhtml/events.xml rename to app/code/Magento/ProductAlert/etc/di.xml index 92b8931e794b415fc240a3a8d14c0fdea3517bb6..54b8cbb0e59746f62aff488cc2399e886663f39d 100644 --- a/app/code/Magento/Rating/etc/adminhtml/events.xml +++ b/app/code/Magento/ProductAlert/etc/di.xml @@ -23,8 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="catalog_product_delete_after_done"> - <observer name="rating" instance="Magento\Rating\Model\Observer" method="processProductAfterDeleteEvent" /> - </event> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <type name="Magento\Module\Setup\Migration"> + <arguments> + <argument name="compositeModules" xsi:type="array"> + <item name="productalert" xsi:type="string">Magento_ProductAlert</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/ProductAlert/etc/module.xml b/app/code/Magento/ProductAlert/etc/module.xml index 1e0246f8c226b509db638106523a12c663e5edae..d52a64c7a4b4f876ca8426ad50018edce75c74f6 100644 --- a/app/code/Magento/ProductAlert/etc/module.xml +++ b/app/code/Magento/ProductAlert/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Customer"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/ProductAlert/sql/productalert_setup/install-1.6.0.0.php b/app/code/Magento/ProductAlert/sql/productalert_setup/install-1.6.0.0.php index 8aee55762f691270895a513a067e7711971cb50c..8c512afa7abe3c488d18efddf2c3245c982ed713 100644 --- a/app/code/Magento/ProductAlert/sql/productalert_setup/install-1.6.0.0.php +++ b/app/code/Magento/ProductAlert/sql/productalert_setup/install-1.6.0.0.php @@ -32,7 +32,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); /** @@ -118,9 +118,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('product_alert_price', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('product_alert_price', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -192,9 +192,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('product_alert_stock', array('website_id')), array('website_id') )->addForeignKey( - $installer->getFkName('product_alert_stock', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('product_alert_stock', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php deleted file mode 100644 index cbfb6f9426a095099c1afb485fd376d9a09730e4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Options.php +++ /dev/null @@ -1,102 +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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Rating\Block\Adminhtml\Edit\Tab; - -class Options extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Rating option factory - * - * @var \Magento\Rating\Model\Rating\OptionFactory - */ - protected $_optionFactory; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Registry $registry - * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Registry $registry, - \Magento\Data\FormFactory $formFactory, - \Magento\Rating\Model\Rating\OptionFactory $optionFactory, - array $data = array() - ) { - $this->_optionFactory = $optionFactory; - parent::__construct($context, $registry, $formFactory, $data); - } - - /** - * @return $this - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(); - - $fieldset = $form->addFieldset('options_form', array('legend' => __('Assigned Options'))); - - if ($this->_coreRegistry->registry('rating_data')) { - $collection = $this->_optionFactory->create()->getResourceCollection()->addRatingFilter( - $this->_coreRegistry->registry('rating_data')->getId() - )->load(); - - $i = 1; - foreach ($collection->getItems() as $item) { - $fieldset->addField( - 'option_code_' . $item->getId(), - 'text', - array( - 'label' => __('Option Label'), - 'required' => true, - 'name' => 'option_title[' . $item->getId() . ']', - 'value' => $item->getCode() ? $item->getCode() : $i - ) - ); - $i++; - } - } else { - for ($i = 1; $i <= 5; $i++) { - $fieldset->addField( - 'option_code_' . $i, - 'text', - array( - 'label' => __('Option Title'), - 'required' => true, - 'name' => 'option_title[add_' . $i . ']', - 'value' => $i - ) - ); - } - } - - $this->setForm($form); - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Rating/Model/Observer.php b/app/code/Magento/Rating/Model/Observer.php deleted file mode 100644 index b32be5153026999cb94793cadeb24c356f3f4822..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/Model/Observer.php +++ /dev/null @@ -1,60 +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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Rating\Model; - -/** - * Rating Observer Model - */ -class Observer -{ - /** - * @var \Magento\Rating\Model\Resource\Rating - */ - protected $_resourceRating; - - /** - * @param \Magento\Rating\Model\Resource\Rating $resourceRating - */ - public function __construct(\Magento\Rating\Model\Resource\Rating $resourceRating) - { - $this->_resourceRating = $resourceRating; - } - - /** - * Cleanup product ratings after product delete - * - * @param \Magento\Event\Observer $observer - * @return $this - */ - public function processProductAfterDeleteEvent(\Magento\Event\Observer $observer) - { - $eventProduct = $observer->getEvent()->getProduct(); - if ($eventProduct && $eventProduct->getId()) { - $this->_resourceRating->deleteAggregatedRatingsByProductId($eventProduct->getId()); - } - return $this; - } -} diff --git a/app/code/Magento/Rating/data/rating_setup/data-install-1.6.0.0.php b/app/code/Magento/Rating/data/rating_setup/data-install-1.6.0.0.php deleted file mode 100644 index cd77c6318d9daa20424fe0dd29e932e8a3affc9a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/data/rating_setup/data-install-1.6.0.0.php +++ /dev/null @@ -1,66 +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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Rating data install - * - * @category Magento - * @package Magento_Rating - * @author Magento Core Team <core@magentocommerce.com> - */ - -/* @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; - -$data = array( - \Magento\Rating\Model\Rating::ENTITY_PRODUCT_CODE => array( - array('rating_code' => 'Quality', 'position' => 0), - array('rating_code' => 'Value', 'position' => 0), - array('rating_code' => 'Price', 'position' => 0) - ), - \Magento\Rating\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => array(), - \Magento\Rating\Model\Rating::ENTITY_REVIEW_CODE => array() -); - -foreach ($data as $entityCode => $ratings) { - //Fill table rating/rating_entity - $installer->getConnection()->insert($installer->getTable('rating_entity'), array('entity_code' => $entityCode)); - $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); - - foreach ($ratings as $bind) { - //Fill table rating/rating - $bind['entity_id'] = $entityId; - $installer->getConnection()->insert($installer->getTable('rating'), $bind); - - //Fill table rating/rating_option - $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); - $optionData = array(); - for ($i = 1; $i <= 5; $i++) { - $optionData[] = array('rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i); - } - $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); - } -} diff --git a/app/code/Magento/Rating/etc/adminhtml/acl.xml b/app/code/Magento/Rating/etc/adminhtml/acl.xml deleted file mode 100644 index 5d564ea61d72c0e4bd73e8b56061b057aa5f0420..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/etc/adminhtml/acl.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Acl/etc/acl.xsd"> - <acl> - <resources> - <resource id="Magento_Adminhtml::admin"> - <resource id="Magento_Adminhtml::stores"> - <resource id="Magento_Adminhtml::stores_attributes"> - <resource id="Magento_Rating::ratings" title="Ratings" sortOrder="60" /> - </resource> - </resource> - </resource> - </resources> - </acl> -</config> diff --git a/app/code/Magento/Rating/etc/adminhtml/routes.xml b/app/code/Magento/Rating/etc/adminhtml/routes.xml deleted file mode 100644 index 34d45fc2fb4e8bcab07ca5bd2cdeb66862c591a9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/etc/adminhtml/routes.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> - <router id="admin"> - <route id="rating" frontName="rating"> - <module name="Magento_Rating" before="Magento_Adminhtml" /> - </route> - </router> -</config> \ No newline at end of file diff --git a/app/code/Magento/Rating/i18n/de_DE.csv b/app/code/Magento/Rating/i18n/de_DE.csv deleted file mode 100644 index ac7ce336743315e22ace3d68eb6551803b6c4cad..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/de_DE.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 Stern" -"2 stars","2 Sterne" -"3 stars","3 Sterne" -"4 stars","4 Sterne" -"5 stars","5 Sterne" -"Add New Rating","Neue Bewertung hinzufügen" -"Assigned Options","Zugewiesene Optionen" -"Be the first to review this product","Bewerten Sie dieses Produkt als Erster" -"Default Value","Vorgegebener Wert" -"Delete Rating","Vorgegebene Bewertung" -"Edit Rating","Bewertung bearbeiten" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","Wenn Sie keinen Bewertungstitel für einen Store spezifizieren, wird der vorgegebene Wert genutzt." -"Manage Ratings","Bewertungen verwalten" -"New Rating","Neue Bewertung" -"Option Label","Option Label" -"Option Title","Option Titel" -"Option Title:","Option Titel:" -"Please select one of each ratings above","Bitte wählen Sie oben eine Bewertung" -"Rating Information","Bewertungsinformation" -"Rating","Bewertungsname" -"Rating Options","Bewertungsoptionen" -"Rating Title","Bewertungstitel" -"Rating Visibility","Sichtbarkeit der Bewertung" -"Rating isn't Available","Bewertung ist nicht verfügbar" -"Rating with the same title","Bewertung mit gleichem Titel" -"Save Rating","Bewertung speichern" -"Sort Order","Sortierfolge" -"Visibility","Sichtbar in" diff --git a/app/code/Magento/Rating/i18n/en_US.csv b/app/code/Magento/Rating/i18n/en_US.csv deleted file mode 100644 index 2e89fe40a1e495b1262eb4b139277b63f9c1b466..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/en_US.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 star" -"2 stars","2 stars" -"3 stars","3 stars" -"4 stars","4 stars" -"5 stars","5 stars" -"Add New Rating","Add New Rating" -"Assigned Options","Assigned Options" -"Be the first to review this product","Be the first to review this product" -"Default Value","Default Value" -"Delete Rating","Delete Rating" -"Edit Rating","Edit Rating" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","If you do not specify a rating title for a store, the default value will be used." -"Manage Ratings","Manage Ratings" -"New Rating","New Rating" -"Option Label","Option Label" -"Option Title","Option Title" -"Option Title:","Option Title:" -"Please select one of each ratings above","Please select one of each ratings above" -"Rating Information","Rating Information" -"Rating","Rating" -"Rating Options","Rating Options" -"Rating Title","Rating Title" -"Rating Visibility","Rating Visibility" -"Rating isn't Available","Rating isn't Available" -"Rating with the same title","Rating with the same title" -"Save Rating","Save Rating" -"Sort Order","Sort Order" -"Visibility","Visibility" diff --git a/app/code/Magento/Rating/i18n/es_ES.csv b/app/code/Magento/Rating/i18n/es_ES.csv deleted file mode 100644 index 0a8049dcfa4985d3c233a2c2999c33eb7cadf359..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/es_ES.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 estrella" -"2 stars","2 estrellas" -"3 stars","3 estrellas" -"4 stars","4 estrellas" -"5 stars","5 estrellas" -"Add New Rating","Agregar nueva puntuación" -"Assigned Options","Opciones asignadas" -"Be the first to review this product","Sea el primero en dejar una reseña para este producto" -"Default Value","Valor predeterminado" -"Delete Rating","Eliminar puntuación" -"Edit Rating","Editar puntuación" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","Si no especifica un tÃtulo para la puntuación de una tienda, se utilizará el valor predeterminado." -"Manage Ratings","Administrar puntuaciones" -"New Rating","Nueva puntuación" -"Option Label","Etiqueta de opciones" -"Option Title","TÃtulo de opciones" -"Option Title:","TÃtulo de opciones:" -"Please select one of each ratings above","Seleccione una de las puntuaciones que aparecen más arriba" -"Rating Information","Información sobre la puntuación" -"Rating","Nombre de la puntuación" -"Rating Options","Opciones de puntuación" -"Rating Title","Visibilidad de la puntuación" -"Rating Visibility","Visibilidad de la puntuación" -"Rating isn't Available","La puntuación no está disponible" -"Rating with the same title","Puntuación con el mismo tÃtulo" -"Save Rating","Guardar puntuación" -"Sort Order","Orden de selección" -"Visibility","Visible en" diff --git a/app/code/Magento/Rating/i18n/fr_FR.csv b/app/code/Magento/Rating/i18n/fr_FR.csv deleted file mode 100644 index 8a388c7973b67782eaf2660aed512523b5fc1cab..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/fr_FR.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 étoile" -"2 stars","2 étoiles" -"3 stars","3 étoiles" -"4 stars","4 étoiles" -"5 stars","5 étoiles" -"Add New Rating","Ajouter une note" -"Assigned Options","Options Spécifiques" -"Be the first to review this product","Soyez le premier à évaluer ce produit" -"Default Value","Valeur par Défaut" -"Delete Rating","Supprimer la note" -"Edit Rating","Modifier la note" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","Si vous ne spécifiez pas de titre pour votre note dans une boutique, la valeur par défaut sera utilisée." -"Manage Ratings","Gérer les Notes" -"New Rating","Nouvelle note" -"Option Label","Nom de l'option" -"Option Title","Titre de l'option" -"Option Title:","Titre de l'option:" -"Please select one of each ratings above","Veuillez choisir une de chacune des notes au-dessus" -"Rating Information","Informations sur la note" -"Rating","Nom de la note" -"Rating Options","Options de la note" -"Rating Title","Titre de la note" -"Rating Visibility","Visiblité de la note" -"Rating isn't Available","Pas de note disponible" -"Rating with the same title","Note portant le même titre" -"Save Rating","Sauver la note" -"Sort Order","Trier la commande" -"Visibility","Visible dans" diff --git a/app/code/Magento/Rating/i18n/nl_NL.csv b/app/code/Magento/Rating/i18n/nl_NL.csv deleted file mode 100644 index 4bfeda6e68de1693ba0bf838560c0a86b15cf17a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/nl_NL.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 ster" -"2 stars","2 sterren" -"3 stars","3 sterren" -"4 stars","4 sterren" -"5 stars","5 sterren" -"Add New Rating","Voeg Nieuwe Rating toe" -"Assigned Options","Toegewezen Opties" -"Be the first to review this product","Wees de eerste om dit product te waarderen" -"Default Value","Vaststaande Waarde" -"Delete Rating","Verwijder Rating" -"Edit Rating","Bewerk Rating" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","Als u geen rating titel voor een winkel specificeert, zal de vaststaande waarde worden gebruikt." -"Manage Ratings","Beheer Ratings" -"New Rating","Nieuwe beoordeling" -"Option Label","Optie Label" -"Option Title","Optie Tiel" -"Option Title:","Optie Titel:" -"Please select one of each ratings above","Selecteer een van bovenstaande ratings" -"Rating Information","Rating Informatie" -"Rating","Rating Naam" -"Rating Options","Rating Opties" -"Rating Title","Rating Titel" -"Rating Visibility","Rating Zichtbaarheid" -"Rating isn't Available","Rating is niet Beschikbaar" -"Rating with the same title","Beoordeling met dezelfde titel" -"Save Rating","Beoordeling opslaan" -"Sort Order","Sorteer Bestelling" -"Visibility","Zichtbaar in" diff --git a/app/code/Magento/Rating/i18n/pt_BR.csv b/app/code/Magento/Rating/i18n/pt_BR.csv deleted file mode 100644 index b18a66ba47024d7c3987e05133f6858febe98623..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/pt_BR.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 estrela" -"2 stars","2 estrelas" -"3 stars","3 estrelas" -"4 stars","4 estrelas" -"5 stars","5 estrelas" -"Add New Rating","Adicionar nova avaliação" -"Assigned Options","Opções especificadas" -"Be the first to review this product","Seja a primeira pessoa a avaliar este produto" -"Default Value","Valor Predifinido" -"Delete Rating","Exclui avaliação" -"Edit Rating","Editar avaliação" -"ID","Identidade" -"If you do not specify a rating title for a store, the default value will be used.","Caso o tÃtulo de avaliação não seja especificado, o valor padrão será utilizado." -"Manage Ratings","Gerenciar Classificações" -"New Rating","Nova avaliação" -"Option Label","Marca de opção" -"Option Title","TÃtulo da opção" -"Option Title:","TÃtulo da opção:" -"Please select one of each ratings above","Escolha uma de cada avaliação acima" -"Rating Information","Informações de avaliação" -"Rating","Nome da avaliação" -"Rating Options","Opções de avaliação" -"Rating Title","TÃtulo da avaliação" -"Rating Visibility","Visibilidade da avaliação" -"Rating isn't Available","A avaliação não está disponÃvel" -"Rating with the same title","Avaliar com o mesmo tÃtulo" -"Save Rating","Salvar avaliação" -"Sort Order","Classificar pedido" -"Visibility","VisÃvel em" diff --git a/app/code/Magento/Rating/i18n/zh_CN.csv b/app/code/Magento/Rating/i18n/zh_CN.csv deleted file mode 100644 index 2a4b126264500018f7c2965002a1a8b32cc3ccfb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/i18n/zh_CN.csv +++ /dev/null @@ -1,29 +0,0 @@ -"1 star","1 星" -"2 stars","2 星" -"3 stars","3 星" -"4 stars","4 星" -"5 stars","5 星" -"Add New Rating","æ·»åŠ æ–°è¯„çº§" -"Assigned Options","分é…的选项" -"Be the first to review this product","作为评论该产å“的第一人" -"Default Value","默认值" -"Delete Rating","åˆ é™¤è¯„çº§" -"Edit Rating","编辑评级" -"ID","ID" -"If you do not specify a rating title for a store, the default value will be used.","如果您ä¸ä¸ºå•†åº—æŒ‡å®šè¯„çº§æ ‡é¢˜ï¼Œåˆ™å°†ä½¿ç”¨é»˜è®¤å€¼ã€‚" -"Manage Ratings","管ç†è¯„级" -"New Rating","新评级" -"Option Label","é€‰é¡¹æ ‡ç¾" -"Option Title","é€‰é¡¹æ ‡é¢˜" -"Option Title:","é€‰é¡¹æ ‡é¢˜ï¼š" -"Please select one of each ratings above","请选择上述评级" -"Rating Information","评级信æ¯" -"Rating","评级åç§°" -"Rating Options","评级选项" -"Rating Title","è¯„çº§æ ‡é¢˜" -"Rating Visibility","评级能è§åº¦" -"Rating isn't Available","评级ä¸å¯ç”¨" -"Rating with the same title","对åŒä¸€å称打分" -"Save Rating","ä¿å˜è¯„分" -"Sort Order","排åºé¡ºåº" -"Visibility","å¯è§æ€§" diff --git a/app/code/Magento/Rating/sql/rating_setup/install-1.6.0.0.php b/app/code/Magento/Rating/sql/rating_setup/install-1.6.0.0.php deleted file mode 100644 index 6a2bcd0c9687fd4300a6bc3ba4e21e9b99f4e2c6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/sql/rating_setup/install-1.6.0.0.php +++ /dev/null @@ -1,423 +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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Rating install - * - * @category Magento - * @package Magento_Rating - * @author Magento Core Team <core@magentocommerce.com> - */ -$installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ - -$installer->startSetup(); - -/** - * Create table 'rating_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_entity') -)->addColumn( - 'entity_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity Id' -)->addColumn( - 'entity_code', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 64, - array('nullable' => false), - 'Entity Code' -)->addIndex( - $installer->getIdxName( - 'rating_entity', - array('entity_code'), - \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_code'), - array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->setComment( - 'Rating entities' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating') -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Rating Id' -)->addColumn( - 'entity_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Entity Id' -)->addColumn( - 'rating_code', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 64, - array('nullable' => false), - 'Rating Code' -)->addColumn( - 'position', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Rating Position On Frontend' -)->addIndex( - $installer->getIdxName('rating', array('rating_code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - array('rating_code'), - array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('rating', array('entity_id')), - array('entity_id') -)->addForeignKey( - $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), - 'entity_id', - $installer->getTable('rating_entity'), - 'entity_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Ratings' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_option') -)->addColumn( - 'option_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Rating Option Id' -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Rating Id' -)->addColumn( - 'code', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => false), - 'Rating Option Code' -)->addColumn( - 'value', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Rating Option Value' -)->addColumn( - 'position', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Ration option position on frontend' -)->addIndex( - $installer->getIdxName('rating_option', array('rating_id')), - array('rating_id') -)->addForeignKey( - $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Rating options' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option_vote' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_option_vote') -)->addColumn( - 'vote_id', - \Magento\DB\Ddl\Table::TYPE_BIGINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Vote id' -)->addColumn( - 'option_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Vote option id' -)->addColumn( - 'remote_ip', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 16, - array('nullable' => false), - 'Customer IP' -)->addColumn( - 'remote_ip_long', - \Magento\DB\Ddl\Table::TYPE_BIGINT, - null, - array('nullable' => false, 'default' => 0), - 'Customer IP converted to long integer format' -)->addColumn( - 'customer_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'default' => 0), - 'Customer Id' -)->addColumn( - 'entity_pk_value', - \Magento\DB\Ddl\Table::TYPE_BIGINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Product id' -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Rating id' -)->addColumn( - 'review_id', - \Magento\DB\Ddl\Table::TYPE_BIGINT, - null, - array('unsigned' => true), - 'Review id' -)->addColumn( - 'percent', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false, 'default' => 0), - 'Percent amount' -)->addColumn( - 'value', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false, 'default' => 0), - 'Vote option value' -)->addIndex( - $installer->getIdxName('rating_option_vote', array('option_id')), - array('option_id') -)->addForeignKey( - $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), - 'option_id', - $installer->getTable('rating_option'), - 'option_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Rating option values' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_option_vote_aggregated' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_option_vote_aggregated') -)->addColumn( - 'primary_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Vote aggregation id' -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Rating id' -)->addColumn( - 'entity_pk_value', - \Magento\DB\Ddl\Table::TYPE_BIGINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Product id' -)->addColumn( - 'vote_count', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Vote dty' -)->addColumn( - 'vote_value_sum', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'General vote sum' -)->addColumn( - 'percent', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false, 'default' => 0), - 'Vote percent' -)->addColumn( - 'percent_approved', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('default' => '0'), - 'Vote percent approved by admin' -)->addColumn( - 'store_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Store Id' -)->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', array('rating_id')), - array('rating_id') -)->addIndex( - $installer->getIdxName('rating_option_vote_aggregated', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'core_store', 'store_id'), - 'store_id', - $installer->getTable('core_store'), - 'store_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Rating vote aggregated' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_store' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_store') -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), - 'Rating id' -)->addColumn( - 'store_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), - 'Store id' -)->addIndex( - $installer->getIdxName('rating_store', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('rating_store', 'store_id', 'core_store', 'store_id'), - 'store_id', - $installer->getTable('core_store'), - 'store_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_NO_ACTION -)->setComment( - 'Rating Store' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'rating_title' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('rating_title') -)->addColumn( - 'rating_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), - 'Rating Id' -)->addColumn( - 'store_id', - \Magento\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), - 'Store Id' -)->addColumn( - 'value', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => false), - 'Rating Label' -)->addIndex( - $installer->getIdxName('rating_title', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), - 'rating_id', - $installer->getTable('rating'), - 'rating_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('rating_title', 'store_id', 'core_store', 'store_id'), - 'store_id', - $installer->getTable('core_store'), - 'store_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Rating Title' -); -$installer->getConnection()->createTable($table); - -/** - * Review/Rating module upgrade. - * Create FK for 'rating_option_vote' - */ -$table = $installer->getConnection()->addForeignKey( - $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), - $installer->getTable('rating_option_vote'), - 'review_id', - $installer->getTable('review'), - 'review_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE -); - -$installer->endSetup(); diff --git a/app/code/Magento/Rating/sql/rating_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Rating/sql/rating_setup/upgrade-1.6.0.0-1.6.0.1.php deleted file mode 100644 index 6dc17afd0bc7ca7d610c739cd89f6090f72c946e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Rating/sql/rating_setup/upgrade-1.6.0.0-1.6.0.1.php +++ /dev/null @@ -1,39 +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 Magento - * @package Magento_Rating - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/* @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; - -$installer->getConnection()->addColumn( - $installer->getTable('rating'), - 'is_active', - array( - 'type' => \Magento\DB\Ddl\Table::TYPE_SMALLINT, - 'nullable' => false, - 'default' => '1', - 'comment' => 'Rating is active.' - ) -); diff --git a/app/code/Magento/RecurringPayment/Model/Observer.php b/app/code/Magento/RecurringPayment/Model/Observer.php index b1d2696388b1d8f76874ca117918fa4a7267190c..a4e02e639bd0db29639375cea501d032e40d769a 100644 --- a/app/code/Magento/RecurringPayment/Model/Observer.php +++ b/app/code/Magento/RecurringPayment/Model/Observer.php @@ -38,7 +38,7 @@ class Observer /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -56,13 +56,13 @@ class Observer /** * @param \Magento\LocaleInterface $locale - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\RecurringPayment\Model\RecurringPaymentFactory $recurringPaymentFactory * @param \Magento\RecurringPayment\Block\Fields $fields */ public function __construct( \Magento\LocaleInterface $locale, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\RecurringPayment\Model\RecurringPaymentFactory $recurringPaymentFactory, \Magento\RecurringPayment\Block\Fields $fields ) { diff --git a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php index 7bb51257c5627eb9bdf264efed5276e793d646aa..f1377065ff940117e906ec1930aba680aa81d1df 100644 --- a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php @@ -65,7 +65,7 @@ class RecurringPayment extends \Magento\Model\AbstractModel /** * Store instance used by locale or method instance * - * @var \Magento\Core\Model\Store|null + * @var \Magento\Store\Model\Store|null */ protected $_store = null; @@ -395,10 +395,10 @@ class RecurringPayment extends \Magento\Model\AbstractModel /** * Store instance setter * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return $this */ - public function setStore(\Magento\Core\Model\Store $store) + public function setStore(\Magento\Store\Model\Store $store) { $this->_store = $store; return $this; diff --git a/app/code/Magento/RecurringPayment/etc/module.xml b/app/code/Magento/RecurringPayment/etc/module.xml index 1f3b8457956eabd1653ef5ff53b69de78f6b9c2b..ce682d52e5095ceb0d4f64df3e528ccfbf28dddb 100644 --- a/app/code/Magento/RecurringPayment/etc/module.xml +++ b/app/code/Magento/RecurringPayment/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_User"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Catalog"/> diff --git a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php index 9bf7cfd933049d7be238338a86d567ec59f12713..a7215f7969f9609075c34421938a7258eefddd0b 100644 --- a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php +++ b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php @@ -249,9 +249,9 @@ $table = $this->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('recurring_payment', 'store_id', 'core_store', 'store_id'), + $this->getFkName('recurring_payment', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('core_store'), + $this->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php index 556d415576006c88db3d00c5a98ddf131cac3964..4dda67e49bf7cc234738cca208c8c5acea866c44 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Downloads.php @@ -43,43 +43,4 @@ class Downloads extends \Magento\Backend\Block\Widget\Grid\Container parent::_construct(); $this->_removeButton('add'); } - - /** - * @return \Magento\View\Element\AbstractBlock - */ - protected function _prepareLayout() - { - $this->setChild( - 'store_switcher', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Store\Switcher' - )->setUseConfirm( - false - )->setSwitchUrl( - $this->getUrl('*/*/*', array('store' => null)) - )->setTemplate( - 'Magento_Reports::store/switcher.phtml' - ) - ); - return parent::_prepareLayout(); - } - - /** - * @return string - */ - public function getStoreSwitcherHtml() - { - if (!$this->_storeManager->isSingleStoreMode()) { - return $this->getChildHtml('store_switcher'); - } - return ''; - } - - /** - * @return string - */ - public function getGridHtml() - { - return $this->getStoreSwitcherHtml() . parent::getGridHtml(); - } } diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php index e3d4d5a9bf64882b619117b0825a8753e9bc2523..8921849bda92e87c8052a28aa261f71ff2f6936d 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock.php @@ -43,44 +43,4 @@ class Lowstock extends \Magento\Backend\Block\Widget\Grid\Container parent::_construct(); $this->_removeButton('add'); } - - /** - * @return \Magento\View\Element\AbstractBlock - */ - protected function _prepareLayout() - { - $this->setChild( - 'store_switcher', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Store\Switcher' - )->setUseConfirm( - false - )->setSwitchUrl( - $this->getUrl('*/*/*', array('store' => null)) - )->setTemplate( - 'Magento_Reports::store/switcher.phtml' - ) - ); - - return parent::_prepareLayout(); - } - - /** - * @return string - */ - public function getStoreSwitcherHtml() - { - if ($this->_storeManager->isSingleStoreMode()) { - return ''; - } - return $this->getChildHtml('store_switcher'); - } - - /** - * @return string - */ - public function getGridHtml() - { - return $this->getStoreSwitcherHtml() . parent::getGridHtml(); - } } diff --git a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php index 49d5806603924e6860dcad14cf7121013283a1b0..83546c79f717d4263dd1a21360d8faecfd57b151 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned.php @@ -43,44 +43,4 @@ class Abandoned extends \Magento\Backend\Block\Widget\Grid\Container parent::_construct(); $this->_removeButton('add'); } - - /** - * @return \Magento\View\Element\AbstractBlock - */ - protected function _prepareLayout() - { - $this->setChild( - 'store_switcher', - $this->getLayout()->createBlock( - 'Magento\Backend\Block\Store\Switcher' - )->setUseConfirm( - false - )->setSwitchUrl( - $this->getUrl('*/*/*', array('store' => null)) - )->setTemplate( - 'Magento_Reports::store/switcher.phtml' - ) - ); - - return parent::_prepareLayout(); - } - - /** - * @return string - */ - public function getStoreSwitcherHtml() - { - if ($this->_storeManager->isSingleStoreMode()) { - return ''; - } - return $this->getChildHtml('store_switcher'); - } - - /** - * @return string - */ - public function getGridHtml() - { - return $this->getStoreSwitcherHtml() . parent::getGridHtml(); - } } diff --git a/app/code/Magento/Reports/Block/Product/Compared.php b/app/code/Magento/Reports/Block/Product/Compared.php index 78ee07131023ed89111b21026366d58c21365f68..1b0003e15b370d9094076f6f465cfa048d443e53 100644 --- a/app/code/Magento/Reports/Block/Product/Compared.php +++ b/app/code/Magento/Reports/Block/Product/Compared.php @@ -51,7 +51,7 @@ class Compared extends \Magento\Reports\Block\Product\AbstractProduct if ($this->hasData('page_size')) { return $this->getData('page_size'); } - return $this->_storeConfig->getConfig(self::XML_PATH_RECENTLY_COMPARED_COUNT); + return $this->_scopeConfig->getValue(self::XML_PATH_RECENTLY_COMPARED_COUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Reports/Block/Product/Viewed.php b/app/code/Magento/Reports/Block/Product/Viewed.php index fdbc4313f0e02685c2de816ed67c92642c67f208..52bb79be409f244a297e018cacaa97943fbf050b 100644 --- a/app/code/Magento/Reports/Block/Product/Viewed.php +++ b/app/code/Magento/Reports/Block/Product/Viewed.php @@ -51,7 +51,7 @@ class Viewed extends \Magento\Reports\Block\Product\AbstractProduct implements \ if ($this->hasData('page_size')) { return $this->getData('page_size'); } - return $this->_storeConfig->getConfig(self::XML_PATH_RECENTLY_VIEWED_COUNT); + return $this->_scopeConfig->getValue(self::XML_PATH_RECENTLY_VIEWED_COUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php index 87baff472bc1cdfbee734e4fc5841c69af3f0e34..9f03547488aa23e0679c4436fd841180344fabca 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php @@ -153,7 +153,7 @@ class Customer extends \Magento\Backend\App\Action $fileName = 'customers_orders.csv'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile()); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -167,7 +167,11 @@ class Customer extends \Magento\Backend\App\Action $fileName = 'customers_orders.xml'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile($fileName)); + return $this->_fileFactory->create( + $fileName, + $exportBlock->getExcelFile($fileName), + \Magento\App\Filesystem::VAR_DIR + ); } /** @@ -199,7 +203,7 @@ class Customer extends \Magento\Backend\App\Action $fileName = 'customer_totals.csv'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile()); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -213,7 +217,11 @@ class Customer extends \Magento\Backend\App\Action $fileName = 'customer_totals.xml'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile($fileName)); + return $this->_fileFactory->create( + $fileName, + $exportBlock->getExcelFile($fileName), + \Magento\App\Filesystem::VAR_DIR + ); } /** diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Product.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Product.php index 4d9eb33b95c3c96a44394fb44b839bac99958194..b7ff27d704bced72d850a5668adbef451ed38223 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Product.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Product.php @@ -80,7 +80,7 @@ class Product extends AbstractReport $fileName = 'products_ordered.csv'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile()); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -94,7 +94,11 @@ class Product extends AbstractReport $fileName = 'products_ordered.xml'; /** @var ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile($fileName)); + return $this->_fileFactory->create( + $fileName, + $exportBlock->getExcelFile($fileName), + \Magento\App\Filesystem::VAR_DIR + ); } /** @@ -133,7 +137,7 @@ class Product extends AbstractReport $fileName = 'products_mostviewed.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Product\Viewed\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -146,7 +150,7 @@ class Product extends AbstractReport $fileName = 'products_mostviewed.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Product\Viewed\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -180,7 +184,7 @@ class Product extends AbstractReport 'adminhtml.block.report.product.lowstock.grid', 'grid.export' ); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile()); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -196,7 +200,7 @@ class Product extends AbstractReport 'adminhtml.block.report.product.lowstock.grid', 'grid.export' ); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile()); + return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile(), \Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php index 3c9ec124fc5eea04515eb730496cd5b78945bfaa..6cc81da44e10a826288cb16c884593c929094588 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Sales.php @@ -112,7 +112,7 @@ class Sales extends AbstractReport $fileName = 'bestsellers.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Bestsellers\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -125,7 +125,7 @@ class Sales extends AbstractReport $fileName = 'bestsellers.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Bestsellers\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -158,7 +158,7 @@ class Sales extends AbstractReport $fileName = 'sales.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Sales\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -171,7 +171,7 @@ class Sales extends AbstractReport $fileName = 'sales.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Sales\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -210,7 +210,7 @@ class Sales extends AbstractReport $fileName = 'tax.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Tax\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -223,7 +223,7 @@ class Sales extends AbstractReport $fileName = 'tax.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Tax\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -262,7 +262,7 @@ class Sales extends AbstractReport $fileName = 'shipping.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Shipping\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -275,7 +275,7 @@ class Sales extends AbstractReport $fileName = 'shipping.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Shipping\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -314,7 +314,7 @@ class Sales extends AbstractReport $fileName = 'invoiced.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Invoiced\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -327,7 +327,7 @@ class Sales extends AbstractReport $fileName = 'invoiced.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Invoiced\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -366,7 +366,7 @@ class Sales extends AbstractReport $fileName = 'refunded.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Refunded\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -379,7 +379,7 @@ class Sales extends AbstractReport $fileName = 'refunded.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Refunded\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** @@ -418,7 +418,7 @@ class Sales extends AbstractReport $fileName = 'coupons.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Coupons\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -431,7 +431,7 @@ class Sales extends AbstractReport $fileName = 'coupons.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Sales\Coupons\Grid'); $this->_initReportAction($grid); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Shopcart.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Shopcart.php index d2b8ed2fb67e0c192281074efcae4bf0d0998894..7580696fd92cc61e7047096ea8cd42b4dc7cf8f3 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Shopcart.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Shopcart.php @@ -151,7 +151,7 @@ class Shopcart extends \Magento\Backend\App\Action 'Magento\Reports\Block\Adminhtml\Shopcart\Product\Grid' )->getCsvFile(); - return $this->_fileFactory->create($fileName, $content); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -168,7 +168,7 @@ class Shopcart extends \Magento\Backend\App\Action $fileName ); - return $this->_fileFactory->create($fileName, $content); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -203,7 +203,7 @@ class Shopcart extends \Magento\Backend\App\Action 'Magento\Reports\Block\Adminhtml\Shopcart\Abandoned\Grid' )->getCsvFile(); - return $this->_fileFactory->create($fileName, $content); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -220,7 +220,7 @@ class Shopcart extends \Magento\Backend\App\Action $fileName ); - return $this->_fileFactory->create($fileName, $content); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Reports/Model/Config.php b/app/code/Magento/Reports/Model/Config.php index fa1e7a4c68bcf40b7b119819d350771a2836fcdb..1beebd808c714280204ecdbd4b1d2827daa37182 100644 --- a/app/code/Magento/Reports/Model/Config.php +++ b/app/code/Magento/Reports/Model/Config.php @@ -36,18 +36,18 @@ class Config extends \Magento\Object protected $_moduleReader; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( \Magento\Module\Dir\Reader $moduleReader, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { parent::__construct($data); diff --git a/app/code/Magento/Reports/Model/Event/Observer.php b/app/code/Magento/Reports/Model/Event/Observer.php index 53115ba3bdf64eb3daf9a3e0289a4886aac2f536..d14bc4cc47c6a1682ca5c8734bfa0de1e33d1df9 100644 --- a/app/code/Magento/Reports/Model/Event/Observer.php +++ b/app/code/Magento/Reports/Model/Event/Observer.php @@ -31,7 +31,7 @@ namespace Magento\Reports\Model\Event; class Observer { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -61,7 +61,7 @@ class Observer protected $_logVisitor; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Reports\Model\EventFactory $event * @param \Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory * @param \Magento\Reports\Model\Product\Index\ViewedFactory $productIndxFactory @@ -69,7 +69,7 @@ class Observer * @param \Magento\Log\Model\Visitor $logVisitor */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Reports\Model\EventFactory $event, \Magento\Reports\Model\Product\Index\ComparedFactory $productCompFactory, \Magento\Reports\Model\Product\Index\ViewedFactory $productIndxFactory, diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php index a8da1919015549da861bacdfc644e5b9fa6d09e7..818cfefb1c1890f80aa7a7c2a5a6b23eb6394ca9 100644 --- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php @@ -38,7 +38,7 @@ abstract class AbstractIndex extends \Magento\Model\AbstractModel protected $_countCacheKey; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -70,7 +70,7 @@ abstract class AbstractIndex extends \Magento\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Session\Generic $reportSession @@ -83,7 +83,7 @@ abstract class AbstractIndex extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Session\Generic $reportSession, diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php index 3994a86183fe9de84b2254dbf771534af123f22d..c80c0e4234776edee9611fc121599501b57f3b48 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Compared.php +++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php @@ -61,7 +61,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Session\Generic $reportSession @@ -75,7 +75,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Session\Generic $reportSession, diff --git a/app/code/Magento/Reports/Model/Resource/Event.php b/app/code/Magento/Reports/Model/Resource/Event.php index 423ae58eb5df2fa9c357f42d688269b69d8e53fd..80a203c6c31dafe82d5765ba6086f002ae6032ab 100644 --- a/app/code/Magento/Reports/Model/Resource/Event.php +++ b/app/code/Magento/Reports/Model/Resource/Event.php @@ -39,27 +39,27 @@ class Event extends \Magento\Model\Resource\Db\AbstractDb /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager ) { parent::__construct($resource); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; } @@ -172,7 +172,10 @@ class Event extends \Magento\Model\Resource\Db\AbstractDb } } else { // get all stores, required by configuration in current store scope - switch ($this->_coreStoreConfig->getConfig('catalog/recently_products/scope')) { + switch ($this->_scopeConfig->getValue( + 'catalog/recently_products/scope', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )) { case 'website': $resourceStore = $this->_storeManager->getStore()->getWebsite()->getStores(); break; diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index bd94f6612a6113eea82a1d28813f024b554c01e6..850473854f09f356795488e1196d94258cb94fe4 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -51,12 +51,12 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -81,8 +81,8 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\DB\Helper $coreResourceHelper - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Sales\Model\Order\Config $orderConfig * @param \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory @@ -97,8 +97,8 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\DB\Helper $coreResourceHelper, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory, @@ -114,7 +114,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection $connection, $resource ); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_localeDate = $localeDate; $this->_orderConfig = $orderConfig; @@ -129,7 +129,10 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection */ public function checkIsLive($range) { - $this->_isLive = (bool)(!$this->_coreStoreConfig->getConfig('sales/dashboard/use_aggregated_data')); + $this->_isLive = (bool)(!$this->_scopeConfig->getValue( + 'sales/dashboard/use_aggregated_data', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )); return $this; } @@ -431,7 +434,12 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection break; case '1m': - $dateStart->setDay($this->_coreStoreConfig->getConfig('reports/dashboard/mtd_start')); + $dateStart->setDay( + $this->_scopeConfig->getValue( + 'reports/dashboard/mtd_start', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); break; case 'custom': @@ -441,7 +449,13 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection case '1y': case '2y': - $startMonthDay = explode(',', $this->_coreStoreConfig->getConfig('reports/dashboard/ytd_start')); + $startMonthDay = explode( + ',', + $this->_scopeConfig->getValue( + 'reports/dashboard/ytd_start', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); $startMonth = isset($startMonthDay[0]) ? (int)$startMonthDay[0] : 1; $startDay = isset($startMonthDay[1]) ? (int)$startMonthDay[1] : 1; $dateStart->setMonth($startMonth); @@ -587,7 +601,11 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection } $adapter = $this->getConnection(); - if ($this->_coreStoreConfig->getConfig('sales/dashboard/use_aggregated_data')) { + if ($this->_scopeConfig->getValue( + 'sales/dashboard/use_aggregated_data', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { $this->setMainTable('sales_order_aggregated_created'); $this->removeAllFieldsFromSelect(); $averageExpr = $adapter->getCheckSql( @@ -602,7 +620,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection if (!$isFilter) { $this->addFieldToFilter( 'store_id', - array('eq' => $this->_storeManager->getStore(\Magento\Core\Model\Store::ADMIN_CODE)->getId()) + array('eq' => $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId()) ); } $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses); diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php index 05525de2e3f0a9fd18555fe9d523766798ae51b1..805016dedd9bd8295ce1ce2b925eb04509f70989 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php @@ -86,10 +86,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -112,10 +112,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -142,7 +142,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php index e5d533865bd8ecb1a1925d86fc90f8ce92940195..ae0df570ce4c4634a835470fa79bd545d50e12dd 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/Collection/AbstractCollection.php @@ -58,10 +58,10 @@ abstract class AbstractCollection extends \Magento\Catalog\Model\Resource\Produc * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -82,10 +82,10 @@ abstract class AbstractCollection extends \Magento\Catalog\Model\Resource\Produc \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -107,7 +107,7 @@ abstract class AbstractCollection extends \Magento\Catalog\Model\Resource\Produc $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php index 7df5ea0568a5bc03983fe40a46290f15a9099775..9e199b5c63c532ae0c00bdb2d0304f2be8e07b22 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -72,10 +72,10 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate @@ -100,10 +100,10 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, @@ -129,7 +129,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, @@ -284,8 +284,9 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection $this->joinInventoryItem(); $manageStockExpr = $this->getConnection()->getCheckSql( $this->_getInventoryItemField('use_config_manage_stock') . ' = 1', - (int)$this->_coreStoreConfig->getConfig( + (int)$this->_scopeConfig->getValue( \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ), $this->_getInventoryItemField('manage_stock') @@ -305,8 +306,9 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection $this->joinInventoryItem(array('qty')); $notifyStockExpr = $this->getConnection()->getCheckSql( $this->_getInventoryItemField('use_config_notify_stock_qty') . ' = 1', - (int)$this->_coreStoreConfig->getConfig( + (int)$this->_scopeConfig->getValue( \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_NOTIFY_STOCK_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ), $this->_getInventoryItemField('notify_stock_qty') diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index 63050477abb0b47ad8cd39fcbdb251c175efbf0e..6a81ea620889bcb68c000b23a66d13294d41bfa5 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -172,7 +172,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection )->joinInner( array('product_name' => $productAttrNameTable), "product_name.entity_id = e.entity_id\n AND product_name.attribute_id = {$productAttrNameId}\n AND product_name.store_id = " . - \Magento\Core\Model\Store::DEFAULT_STORE_ID, + \Magento\Store\Model\Store::DEFAULT_STORE_ID, array('name' => 'product_name.value') )->joinInner( array('product_price' => $productAttrPriceTable), diff --git a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php index 7ba5d1c5fdc6bacfd6d9691f8eccebce5df2b71f..0456aad26150d600cf8dfb0742b00153e18488f9 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php @@ -387,7 +387,7 @@ abstract class AbstractReport extends \Magento\Model\Resource\Db\AbstractDb * @param string $column * @param null|mixed $from * @param null|mixed $to - * @param null|int|string|\Magento\Core\Model\Store $store + * @param null|int|string|\Magento\Store\Model\Store $store * @return string */ public function getStoreTZOffsetQuery($table, $column, $from = null, $to = null, $store = null) @@ -461,7 +461,7 @@ abstract class AbstractReport extends \Magento\Model\Resource\Db\AbstractDb $tr = $transitions[$i]; try { $this->timezoneValidator->validate($tr['ts'], $to); - } catch (Exception $e) { + } catch (\Exception $e) { continue; } diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php index 490c5aa0cb4d9e1113ff809235d83c8882a70720..bac97bcaa3da3d16973660c8c011f7224b1988fc 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php @@ -220,8 +220,8 @@ class Collection extends \Magento\Reports\Model\Resource\Report\Collection\Abstr $currentStoreIds = $this->_storesIds; if (isset( $currentStoreIds - ) && $currentStoreIds != \Magento\Core\Model\Store::DEFAULT_STORE_ID && $currentStoreIds != array( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + ) && $currentStoreIds != \Magento\Store\Model\Store::DEFAULT_STORE_ID && $currentStoreIds != array( + \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ) { if (!is_array($currentStoreIds)) { diff --git a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php index 77fdb60fc71a92e2ac18442cb9aaf9a0d787feed..cc02cc7b4f51e8db505b25cd7bb00be719a123a7 100644 --- a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php @@ -47,8 +47,8 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Review\Helper\Data $reviewData - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource @@ -59,8 +59,8 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Review\Helper\Data $reviewData, - \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Resource\Customer $customerResource, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Reports/Model/Resource/Setup.php b/app/code/Magento/Reports/Model/Resource/Setup.php index 7b4de2a2f94c9831d495711c906a0a8637748618..fe108e4e5816d0bb93d87b048932b5620e4d47cd 100644 --- a/app/code/Magento/Reports/Model/Resource/Setup.php +++ b/app/code/Magento/Reports/Model/Resource/Setup.php @@ -29,7 +29,7 @@ */ namespace Magento\Reports\Model\Resource; -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * @var \Magento\Cms\Model\PageFactory @@ -37,18 +37,18 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_pageFactory; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\Cms\Model\PageFactory $pageFactory * @param string $moduleName * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\Cms\Model\PageFactory $pageFactory, $moduleName = 'Magento_Reports', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { parent::__construct($context, $resourceName, $moduleName, $connectionName); $this->_pageFactory = $pageFactory; diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index ac2e3e0d987701caaf59d728197dc43a80b87bcb..304b3d15f640d174058b5571604c7e3feb8e1849 100644 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -32,6 +32,7 @@ <module name="Magento_Cms"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Eav"/> <module name="Magento_Customer"/> <module name="Magento_Catalog"/> @@ -46,7 +47,6 @@ <module name="Magento_Review"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Tax"/> - <module name="Magento_Rating"/> <module name="Magento_Downloadable"/> <module name="Magento_SalesRule"/> </depends> diff --git a/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php b/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php index 5bc104c858f0c581119aacf136cc7e58ff724f35..e3a6a276ce3ae88fefab929944307a3aef52de18 100644 --- a/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php +++ b/app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; /* * Prepare database for tables install @@ -121,9 +121,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('report_event', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('report_event', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('report_event', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -215,9 +215,9 @@ if (!$installer->tableExists($tableName)) { \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('report_compared_product_index', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -303,9 +303,9 @@ if (!$installer->tableExists($tableName)) { \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('report_viewed_product_index', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php b/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php index 8d2bb6c7f546ca3f32ff9be736dc96beae63c138..3d793e1d2a1c5141af35f4f2c6a2a70db5bc3c3a 100644 --- a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php +++ b/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $this \Magento\Core\Model\Resource\Setup */ +/** @var $this \Magento\Module\Setup */ /** * Create table 'report_compared_product_index'. @@ -109,9 +109,9 @@ $table = $this->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('report_compared_product_index', 'store_id', 'core_store', 'store_id'), + $this->getFkName('report_compared_product_index', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('core_store'), + $this->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -203,9 +203,9 @@ $table = $this->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $this->getFkName('report_viewed_product_index', 'store_id', 'core_store', 'store_id'), + $this->getFkName('report_viewed_product_index', 'store_id', 'store', 'store_id'), 'store_id', - $this->getTable('core_store'), + $this->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php index c384f825cdaea394d497ba0cc0f35ab70793c56a..2a8533a317af91a45d35cdd917c13df3b2604614 100644 --- a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php +++ b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; /* * Prepare database for tables install @@ -108,9 +108,9 @@ for ($i = 0; $i < 3; ++$i) { $installer->getIdxName($aggregationTables[$i], array('product_id')), array('product_id') )->addForeignKey( - $installer->getFkName($aggregationTables[$i], 'store_id', 'core_store', 'store_id'), + $installer->getFkName($aggregationTables[$i], 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php index 68541b677ca74d3db05b6e7c26e559fa263377af..99bf226011b8442025c6161b4b9b79b4247cfbca 100644 --- a/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php +++ b/app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; /* * Rename incorrectly named tables in early magento 2 development version diff --git a/app/code/Magento/Reports/view/adminhtml/grid.phtml b/app/code/Magento/Reports/view/adminhtml/grid.phtml index 1e44e56f263dddf21b147f62184f49e5a08d2e38..b8327242939388d1424f259adb07205c7b7028e9 100644 --- a/app/code/Magento/Reports/view/adminhtml/grid.phtml +++ b/app/code/Magento/Reports/view/adminhtml/grid.phtml @@ -35,9 +35,6 @@ $numColumns = sizeof($this->getColumns()); <?php echo $this->getLayout()->getMessagesBlock()->getGroupedHtml() ?> <?php endif; ?> <?php if ($this->getStoreSwitcherVisibility() || $this->getDateFilterVisibility()): ?> - <?php if ($this->getStoreSwitcherVisibility()): ?> - <?php echo $this->getStoreSwitcherHtml() ?> - <?php endif ?> <div class="grid-actions"> <?php if ($this->getChildBlock('grid.export')): ?> <div class="export"> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml index 1682da3d7d7bc3f2621072d860100bc9ae40f8cb..45ed66ed6305c7bd80d431d2a85d5e6bcf91a34a 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_grid.xml @@ -24,6 +24,22 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="adminhtml.report.grid.store_switcher" + as="store_switcher"> + <arguments> + <argument name="use_confirm" xsi:type="string">0</argument> + <argument name="switch_url" xsi:type="url" path="*/*/*"> + <param name="store">null</param> + </argument> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceBlock name="adminhtml.report.grid.container"> <block class="Magento\Reports\Block\Adminhtml\Grid" name="adminhtml.report.grid" as="grid"> <arguments> @@ -32,14 +48,6 @@ <argument name="id" xsi:type="string">gridReport</argument> <argument name="dataSource" xsi:type="object">Magento\Reports\Model\Resource\Report\Collection</argument> </arguments> - <block class="Magento\Backend\Block\Store\Switcher" name="adminhtml.report.grid.store_switcher" as="store_switcher" template="Magento_Reports::store/switcher.phtml"> - <arguments> - <argument name="use_confirm" xsi:type="string">0</argument> - <argument name="switch_url" xsi:type="url" path="*/*/*"> - <param name="store">null</param> - </argument> - </arguments> - </block> <block class="Magento\Backend\Block\Widget\Grid\Export" name="adminhtml.report.grid.export" as="grid.export"> <arguments> <argument name="exportTypes" xsi:type="array"> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_downloads.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_downloads.xml new file mode 100644 index 0000000000000000000000000000000000000000..e316ce9af81985c0d2ee24a005ff6e7321a1b665 --- /dev/null +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_downloads.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="adminhtml.report.product.downloads.store_switcher" + template="Magento_Backend::store/switcher.phtml"> + <arguments> + <argument name="use_confirm" xsi:type="string">0</argument> + <argument name="switch_url" xsi:type="url" path="*/*/*"> + <param name="store">null</param> + </argument> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> +</layout> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock.xml index 8490c083f88506f6fab2e90846580c324967f265..0acd0ecd31ecfb8b12de5341b12a17d3b89500b7 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_lowstock.xml @@ -25,6 +25,22 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_report_product_lowstock_grid"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="adminhtml.report.product.lowstock.store_switcher" + template="Magento_Backend::store/switcher.phtml"> + <arguments> + <argument name="use_confirm" xsi:type="string">0</argument> + <argument name="switch_url" xsi:type="url" path="*/*/*"> + <param name="store">null</param> + </argument> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Product\Lowstock" name="adminhtml.report.grid.container"/> </referenceContainer> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_viewed.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_viewed.xml index 3fdc6339910acd267b07943eec3f7f0eb95c8ee2..88ee522a264c4b274b41f99cec2be040b61787fd 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_viewed.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_viewed.xml @@ -29,13 +29,23 @@ <argument translate="true" name="message" xsi:type="string">This report uses timezone configuration data. Be sure to refresh lifetime statistics any time you change store timezone.</argument> </action> </referenceBlock> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Product\Viewed" template="report/grid/container.phtml" name="product.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Reports\Block\Adminhtml\Filter\Form" name="grid.filter.form"> <action method="setFieldVisibility"> <argument name="field" xsi:type="string">report_type</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_bestsellers.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_bestsellers.xml index e310e477553f288f845e17955912fa947b1bb930..4eee528290e3b1bbc824f378003d515e67760b98 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_bestsellers.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_bestsellers.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Bestsellers" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form"> <action method="setFieldVisibility"> <argument name="field" xsi:type="string">report_type</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_coupons.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_coupons.xml index 2a4dae48e0a67921919bd0aacd90c7d28fe0aaea..3b46f758b21c8fa11926bee2d8fe6f543f7301aa 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_coupons.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_coupons.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Coupons" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_invoiced.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_invoiced.xml index 17161e1b5787a0037d0528964280ce1e71aa43f6..b21bd0905977c8d7233b71f28758f22a037eaf7e 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_invoiced.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_invoiced.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Invoiced" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_refunded.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_refunded.xml index a513b55dc33ba93c60a4f5a01413db32a9ecbd6b..d31158b21c0267814cdbca0f0b19656b03c65dc4 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_refunded.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_refunded.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Refunded" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_sales.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_sales.xml index 56efa2310321850f1c75de2d5b9c6f296b1b8b6c..44241d49e5de72ab33f8be17d7598b95bf9b86c0 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_sales.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_sales.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Sales" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form\Order" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_shipping.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_shipping.xml index cdf9d578ed2243ade98aaa0728dec0a46272b885..5f6518f8dbeef8ba60be5df84aa45339ce489eb2 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_shipping.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_shipping.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + template="Magento_Backend::store/switcher.phtml" + name="store.switcher"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Shipping" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_tax.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_tax.xml index 4993bd1341d927a4e4686d124171395d3528dd7d..552c2897d583f45ea8c251707dce4b4666e151da 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_tax.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_sales_tax.xml @@ -25,13 +25,23 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <update handle="reports_sales"/> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="store.switcher" + template="Magento_Backend::store/switcher.phtml"> + <action method="setStoreVarName"> + <argument name="var_name" xsi:type="string">store_ids</argument> + </action> + <arguments> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> + </arguments> + </block> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Reports\Block\Adminhtml\Sales\Tax" template="report/grid/container.phtml" name="sales.report.grid.container"> - <block class="Magento\Backend\Block\Store\Switcher" template="Magento_Reports::store/switcher/enhanced.phtml" name="store.switcher"> - <action method="setStoreVarName"> - <argument name="var_name" xsi:type="string">store_ids</argument> - </action> - </block> <block class="Magento\Sales\Block\Adminhtml\Report\Filter\Form" name="grid.filter.form"> <action method="addReportTypeOption"> <argument name="key" xsi:type="string">created_at_order</argument> diff --git a/app/code/Magento/Core/view/frontend/layout/default.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_shopcart_abandoned.xml similarity index 65% rename from app/code/Magento/Core/view/frontend/layout/default.xml rename to app/code/Magento/Reports/view/adminhtml/layout/reports_report_shopcart_abandoned.xml index 3f086ca64b2e83a36e8214352bb90dfa78beca72..7866b4a380f5076907c931ac226fb0f9c18c7fa5 100644 --- a/app/code/Magento/Core/view/frontend/layout/default.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_shopcart_abandoned.xml @@ -24,14 +24,16 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <referenceContainer name="content"> - <block class="Magento\Core\Block\Formkey" name="formkey" template="Magento_Core::formkey.phtml"/> - </referenceContainer> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-msg-box-js" after="jquery-jquery-ui-js"> + <referenceContainer name="page.main.actions"> + <block class="Magento\Backend\Block\Store\Switcher" + name="adminhtml.report.shopcart.abandoned.store_switcher"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::js/msg-box.js</argument> + <argument name="switch_websites" xsi:type="string">1</argument> + <argument name="switch_store_groups" xsi:type="string">1</argument> + <argument name="switch_store_views" xsi:type="string">1</argument> + <argument name="use_confirm" xsi:type="string">0</argument> + <argument name="default_selection_name" xsi:type="string" translate="true">All Websites</argument> </arguments> </block> - </referenceBlock> + </referenceContainer> </layout> diff --git a/app/code/Magento/Reports/view/adminhtml/report/grid/container.phtml b/app/code/Magento/Reports/view/adminhtml/report/grid/container.phtml index 94f5b80a4676d625cf33298311c8bdf099ea907f..247ad901837cc5a1a34ecc9da1084ea54c606086 100644 --- a/app/code/Magento/Reports/view/adminhtml/report/grid/container.phtml +++ b/app/code/Magento/Reports/view/adminhtml/report/grid/container.phtml @@ -24,10 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="reports-title"> - <div class="page-actions"><?php echo $this->getButtonsHtml() ?></div> - <?php echo $this->getChildHtml('store.switcher') ?> -</div> <div class="reports-content"> <?php echo $this->getChildHtml('grid.filter.form') ?> diff --git a/app/code/Magento/Reports/view/frontend/product/widget/viewed/item.phtml b/app/code/Magento/Reports/view/frontend/product/widget/viewed/item.phtml index c60c92704d959d5f8a04457ac35e8ce9fe97793d..c8c2ba7652284573da7481fc9463b1f84f9eb693 100644 --- a/app/code/Magento/Reports/view/frontend/product/widget/viewed/item.phtml +++ b/app/code/Magento/Reports/view/frontend/product/widget/viewed/item.phtml @@ -47,7 +47,7 @@ $rating = 'short'; <?php echo $this->getPriceHtml($item, true, '-' . $type) ?> - <?php if ($item->getRatingSummary() && $rating): ?> + <?php if ($rating): ?> <?php echo $this->getReviewsSummaryHtml($item, $rating) ?> <?php endif; ?> @@ -99,4 +99,4 @@ $rating = 'short'; </div> </div> </li> -</div> \ No newline at end of file +</div> diff --git a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml index ca38e1935b8ae372406cf2b01b43901bd580e407..7632c0766f0bfa03b538b95c1dd9d62a5783df26 100644 --- a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml @@ -69,8 +69,8 @@ if ($exist = $this->getRecentlyComparedProducts()) { </a> </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($rating): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> <div class="product actions"> diff --git a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml index 0a1eb01a27a6948f5f2aa98638148e327db6d783..57989a3be013c652db2077e23dd3a426aeb44e56 100644 --- a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml @@ -69,8 +69,8 @@ if ($exist = $this->getRecentlyComparedProducts()) { </a> </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($rating): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> <div class="product actions"> diff --git a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml index 33cd6f79093fd6eb5ce8608bf57327549ad3dd65..97727e88bad4bb047a0f2b2c49f245675372174e 100644 --- a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml @@ -71,8 +71,8 @@ if ($exist = $this->getRecentlyViewedProducts()) { </a> </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($rating): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> <div class="product actions"> diff --git a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml index f6d2f36c96da026b22740ef0b29f28528f196b87..67cc63671546532c5e6799dd6ba288242dd64df9 100644 --- a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml @@ -72,8 +72,8 @@ if ($exist = $this->getRecentlyViewedProducts()) { </a> </strong> <?php echo $this->getPriceHtml($_item, true, '-' . $type) ?> - <?php if ($_item->getRatingSummary() && $rating): ?> - <?php echo $this->getReviewsSummaryHtml($_item,$rating) ?> + <?php if ($rating): ?> + <?php echo $this->getReviewsSummaryHtml($_item, $rating) ?> <?php endif; ?> <?php if($showWishlist || $showCompare || $showCart): ?> <div class="product actions"> diff --git a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php index 22c5586b5dcb5641dc60d7dbf6a1cd255d64d548..54702382a9b636ec411b440cf239c3c0d82512b9 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Core system store model * - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -52,7 +52,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Review\Helper\Data $reviewData * @param array $data */ @@ -60,7 +60,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Review\Helper\Data $reviewData, array $data = array() ) { diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php index 58407479827fcc175fe428ed82a62221f45431c3..d4e09338cb3bc2a87a915966da56f2188b8d4d62 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php @@ -53,7 +53,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Core system store model * - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -61,7 +61,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Helper\Data $reviewData @@ -71,7 +71,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Helper\Data $reviewData, @@ -140,7 +140,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $this->escapeHtml($customer->getEmail()) ); } catch (\Magento\Exception\NoSuchEntityException $e) { - $customerText = ($review->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) + $customerText = ($review->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) ? __('Administrator') : __('Guest'); } diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php index 088e3346dcaf2980acc8fb9c3f99884e382b7bdb..17a3136ce9d9548eb54a751b06daa4a4a743fcc3 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid/Renderer/Type.php @@ -45,7 +45,7 @@ class Type extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe if ($row->getCustomerId()) { return __('Customer'); } - if ($row->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { + if ($row->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { return __('Administrator'); } return __('Guest'); diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index 91e3d9e2266ffb7dc029805821b3802bce052cc8..34a5a4a5d4e6e85960d455c0fcc22b0c38beac08 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -35,36 +35,36 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid /** * Website collection * - * @var \Magento\Core\Model\Resource\Website\CollectionFactory + * @var \Magento\Store\Model\Resource\Website\CollectionFactory */ protected $_websitesFactory; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Type $type * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $status * @param \Magento\Catalog\Model\Product\Visibility $visibility * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory + * @param \Magento\Store\Model\Resource\Website\CollectionFactory $websitesFactory * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, - \Magento\Core\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setsFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Type $type, \Magento\Catalog\Model\Product\Attribute\Source\Status $status, \Magento\Catalog\Model\Product\Visibility $visibility, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory, + \Magento\Store\Model\Resource\Website\CollectionFactory $websitesFactory, array $data = array() ) { $this->_websitesFactory = $websitesFactory; diff --git a/app/code/Magento/Rating/Block/Adminhtml/Rating.php b/app/code/Magento/Review/Block/Adminhtml/Rating.php similarity index 90% rename from app/code/Magento/Rating/Block/Adminhtml/Rating.php rename to app/code/Magento/Review/Block/Adminhtml/Rating.php index f193bcfbd32606b0a9de03edb5d125cd39382c8b..d1583363ee4ff49e1f4c9b9d1e4bc5ba2fed4e6b 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Rating.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml; +namespace Magento\Review\Block\Adminhtml; /** * Ratings grid * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Rating extends \Magento\Backend\Block\Widget\Grid\Container @@ -40,7 +40,7 @@ class Rating extends \Magento\Backend\Block\Widget\Grid\Container protected function _construct() { $this->_controller = 'adminhtml'; - $this->_blockGroup = 'Magento_Rating'; + $this->_blockGroup = 'Magento_Review'; $this->_headerText = __('Manage Ratings'); $this->_addButtonLabel = __('Add New Rating'); parent::_construct(); diff --git a/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php index 8059c6a1b56407195d6e9a486e56e004d6ee0d67..49a2692424084ead9f33c51f8d7a188b57f752b1 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Detailed.php @@ -25,10 +25,10 @@ */ namespace Magento\Review\Block\Adminhtml\Rating; -use Magento\Rating\Model\Rating; -use Magento\Rating\Model\Rating\Option; -use Magento\Rating\Model\Resource\Rating\Collection as RatingCollection; -use Magento\Rating\Model\Resource\Rating\Option\Vote\Collection as VoteCollection; +use Magento\Review\Model\Rating; +use Magento\Review\Model\Rating\Option; +use Magento\Review\Model\Resource\Rating\Collection as RatingCollection; +use Magento\Review\Model\Resource\Rating\Option\Vote\Collection as VoteCollection; /** * Adminhtml detailed rating stars @@ -47,7 +47,7 @@ class Detailed extends \Magento\Backend\Block\Template * * @var string */ - protected $_template = 'Magento_Rating::rating/detailed.phtml'; + protected $_template = 'Magento_Review::rating/detailed.phtml'; /** * Core registry @@ -59,28 +59,28 @@ class Detailed extends \Magento\Backend\Block\Template /** * Rating resource model * - * @var \Magento\Rating\Model\Resource\Rating\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\CollectionFactory */ protected $_ratingsFactory; /** * Rating resource option model * - * @var \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory */ protected $_votesFactory; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Rating\Model\Resource\Rating\CollectionFactory $ratingsFactory - * @param \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory + * @param \Magento\Review\Model\Resource\Rating\CollectionFactory $ratingsFactory + * @param \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Rating\Model\Resource\Rating\CollectionFactory $ratingsFactory, - \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory, + \Magento\Review\Model\Resource\Rating\CollectionFactory $ratingsFactory, + \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory, \Magento\Registry $registry, array $data = array() ) { @@ -167,7 +167,7 @@ class Detailed extends \Magento\Backend\Block\Template * Indicator of whether or not a rating is selected * * @param Option $option - * @param Rating $rating + * @param \Magento\Review\Model\Rating $rating * @return bool */ public function isSelected($option, $rating) diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit.php similarity index 86% rename from app/code/Magento/Rating/Block/Adminhtml/Edit.php rename to app/code/Magento/Review/Block/Adminhtml/Rating/Edit.php index 4b7447a13d69515f3b068d82d1b98e6dd2363bc9..0006d9af8be49affd9bdb95de96d6e67f1597178 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml; +namespace Magento\Review\Block\Adminhtml\Rating; /** * Rating edit form @@ -40,24 +40,24 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container /** * Rating factory * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; /** * @var string */ - protected $_blockGroup = 'Magento_Rating'; + protected $_blockGroup = 'Magento_Review'; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Registry $registry, array $data = array() ) { @@ -73,8 +73,8 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container { parent::_construct(); $this->_objectId = 'id'; - $this->_controller = 'adminhtml'; - $this->_blockGroup = 'Magento_Rating'; + $this->_controller = 'adminhtml_rating'; + $this->_blockGroup = 'Magento_Review'; $this->_updateButton('save', 'label', __('Save Rating')); $this->_updateButton('delete', 'label', __('Delete Rating')); diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Form.php similarity index 88% rename from app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php rename to app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Form.php index 93d72bc883f14a18b9ceba08d3be7c8582151d71..2e3845c76bfdef9ddd8b30e0bba2a538046a1242 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Form.php @@ -19,11 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml\Edit; +namespace Magento\Review\Block\Adminhtml\Rating\Edit; /** * Rating edit form block @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic array( 'data' => array( 'id' => 'edit_form', - 'action' => $this->getUrl('rating/*/save', array('id' => $this->getRequest()->getParam('id'))), + 'action' => $this->getUrl('review/rating/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post' ) ) diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tab/Form.php similarity index 94% rename from app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php rename to app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tab/Form.php index b6cec40100cfc06edfc207eb29f5256434c461dd..5b779c560f81d1bf3add05d5f5d4b6c0986a7ab5 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tab/Form.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml\Edit\Tab; +namespace Magento\Review\Block\Adminhtml\Rating\Edit\Tab; class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** * System store * - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** * Option factory * - * @var \Magento\Rating\Model\Rating\OptionFactory + * @var \Magento\Review\Model\Rating\OptionFactory */ protected $_optionFactory; @@ -52,18 +52,18 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory + * @param \Magento\Review\Model\Rating\OptionFactory $optionFactory * @param \Magento\Session\SessionManagerInterface $session - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Rating\Model\Rating\OptionFactory $optionFactory, + \Magento\Review\Model\Rating\OptionFactory $optionFactory, \Magento\Session\SessionManagerInterface $session, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_optionFactory = $optionFactory; diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tabs.php similarity index 70% rename from app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php rename to app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tabs.php index 25f15470e694edf0db1ddb2b3e9413f00ff4380b..d2901796df30cfe240c765b4f80d7b9723bafca9 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tabs.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tabs.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml\Edit; +namespace Magento\Review\Block\Adminhtml\Rating\Edit; /** * Admin rating left menu * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Tabs extends \Magento\Backend\Block\Widget\Tabs @@ -55,17 +55,11 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs array( 'label' => __('Rating Information'), 'title' => __('Rating Information'), - 'content' => $this->getLayout()->createBlock('Magento\Rating\Block\Adminhtml\Edit\Tab\Form')->toHtml() + 'content' => $this->getLayout() + ->createBlock('Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form') + ->toHtml() ) ); - /* - $this->addTab('answers_section', array( - 'label' => __('Rating Options'), - 'title' => __('Rating Options'), - 'content' => $this->getLayout()->createBlock('Magento\Rating\Block\Adminhtml\Edit\Tab\Options') - ->append($this->getLayout()->createBlock('Magento\Rating\Block\Adminhtml\Edit\Tab\Options')) - ->toHtml(), - ));*/ return parent::_beforeToHtml(); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php b/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php index 91a3877562e4f942ae163e9b43d4e8b1ff87be83..6b9db879f4676f0d79cb315413755c4292aefe94 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php +++ b/app/code/Magento/Review/Block/Adminhtml/Rating/Summary.php @@ -25,7 +25,7 @@ */ namespace Magento\Review\Block\Adminhtml\Rating; -use Magento\Rating\Model\Resource\Rating\Collection as RatingCollection; +use Magento\Review\Model\Resource\Rating\Collection as RatingCollection; /** * Adminhtml summary rating stars @@ -37,7 +37,7 @@ class Summary extends \Magento\Backend\Block\Template * * @var string */ - protected $_template = 'Magento_Rating::rating/stars/summary.phtml'; + protected $_template = 'Magento_Review::rating/stars/summary.phtml'; /** * Core registry @@ -49,28 +49,28 @@ class Summary extends \Magento\Backend\Block\Template /** * Rating resource option model * - * @var \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory */ protected $_votesFactory; /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Rating\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\Resource\Rating\Option\Vote\CollectionFactory $votesFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Registry $registry, array $data = array() ) { diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 125bd917c0e38141a476dd0d44381530d26c6ed9..b1124e045f5dee4dfbf2ef58413b7513d7feade1 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -26,7 +26,7 @@ namespace Magento\Review\Block\Customer; use Magento\Catalog\Model\Product; -use Magento\Rating\Model\Resource\Rating\Option\Vote\Collection as VoteCollection; +use Magento\Review\Model\Resource\Rating\Option\Vote\Collection as VoteCollection; use Magento\Review\Model\Review; /** @@ -62,14 +62,14 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct /** * Rating option model * - * @var \Magento\Rating\Model\Rating\Option\VoteFactory + * @var \Magento\Review\Model\Rating\Option\VoteFactory */ protected $_voteFactory; /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; @@ -82,8 +82,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data * @param array $priceBlockTypes @@ -92,8 +92,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, - \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer, array $data = array(), array $priceBlockTypes = array() @@ -238,4 +238,24 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct { return ($this->getReviewData()->getCustomerId() == $this->currentCustomer->getCustomerId()); } + + + /** + * Get product reviews summary + * + * @param \Magento\Catalog\Model\Product $product + * @param bool $templateType + * @param bool $displayIfNoReviews + * @return string + */ + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = false, + $displayIfNoReviews = false + ) { + if (!$product->getRatingSummary()) { + $this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId()); + } + return parent::getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews); + } } diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index 21434fda40b7570ada9608ee13cf7095167a1392..061fdc8efb85d90e069dc363b3e4ef2233e36775 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -26,7 +26,7 @@ namespace Magento\Review\Block; use Magento\Catalog\Model\Product; -use Magento\Rating\Model\Resource\Rating\Collection as RatingCollection; +use Magento\Review\Model\Resource\Rating\Collection as RatingCollection; /** * Review form block @@ -61,7 +61,7 @@ class Form extends \Magento\View\Element\Template /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; @@ -98,7 +98,7 @@ class Form extends \Magento\View\Element\Template * @param \Magento\Review\Helper\Data $reviewData * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Message\ManagerInterface $messageManager * @param \Magento\App\Http\Context $httpContext * @param array $data @@ -110,7 +110,7 @@ class Form extends \Magento\View\Element\Template \Magento\Review\Helper\Data $reviewData, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Message\ManagerInterface $messageManager, \Magento\App\Http\Context $httpContext, array $data = array() diff --git a/app/code/Magento/Review/Block/Product/Compare/ListCompare/Plugin/Review.php b/app/code/Magento/Review/Block/Product/Compare/ListCompare/Plugin/Review.php new file mode 100644 index 0000000000000000000000000000000000000000..aa0a64ee94bfdacd13c9eee1ee43a7ddd40da537 --- /dev/null +++ b/app/code/Magento/Review/Block/Product/Compare/ListCompare/Plugin/Review.php @@ -0,0 +1,76 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Product\Compare\ListCompare\Plugin; + +class Review +{ + /** + * Review model + * + * @var \Magento\Review\Model\ReviewFactory + */ + protected $reviewFactory; + + /** + * Store manager + * + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $storeManager; + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\ReviewFactory $reviewFactory + */ + public function __construct( + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\ReviewFactory $reviewFactory + ) { + $this->storeManager = $storeManager; + $this->reviewFactory = $reviewFactory; + } + + /** + * Initialize product review + * + * @param \Magento\Catalog\Block\Product\Compare\ListCompare $subject + * @param \Magento\Catalog\Model\Product $product + * @param bool $templateType + * @param bool $displayIfNoReviews + * + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeGetReviewsSummaryHtml( + \Magento\Catalog\Block\Product\Compare\ListCompare $subject, + \Magento\Catalog\Model\Product $product, + $templateType = false, + $displayIfNoReviews = false + ) { + if (!$product->getRatingSummary()) { + $this->reviewFactory->create()->getEntitySummary($product, $this->storeManager->getStore()->getId()); + } + } +} diff --git a/app/code/Magento/Review/Block/Product/ReviewRenderer.php b/app/code/Magento/Review/Block/Product/ReviewRenderer.php index 722f5e507dd774bd1915b9af253fe4d12e6ab744..b50cd1e82a3fe72e6cee53bdb3a6abda4e66f285 100644 --- a/app/code/Magento/Review/Block/Product/ReviewRenderer.php +++ b/app/code/Magento/Review/Block/Product/ReviewRenderer.php @@ -36,8 +36,8 @@ class ReviewRenderer extends \Magento\View\Element\Template implements ReviewRen * @var array */ protected $_availableTemplates = array( - self::DEFAULT_REVIEW => 'helper/summary.phtml', - self::SHORT_REVIEW => 'helper/summary_short.phtml' + self::FULL_VIEW => 'helper/summary.phtml', + self::SHORT_VIEW => 'helper/summary_short.phtml' ); /** @@ -72,12 +72,16 @@ class ReviewRenderer extends \Magento\View\Element\Template implements ReviewRen */ public function getReviewsSummaryHtml( \Magento\Catalog\Model\Product $product, - $templateType = self::DEFAULT_REVIEW, + $templateType = self::DEFAULT_VIEW, $displayIfNoReviews = false ) { + + if (!$product->getRatingSummary() && !$displayIfNoReviews) { + return ''; + } // pick template among available if (empty($this->_availableTemplates[$templateType])) { - $templateType = self::DEFAULT_REVIEW; + $templateType = self::DEFAULT_VIEW; } $this->setTemplate($this->_availableTemplates[$templateType]); diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index 300b0de852dcd4b37a758632803f1b1818731c6e..5db48b51c6a272038d7f0c77dd02c538dbd5d45a 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -121,7 +121,7 @@ class View extends \Magento\Catalog\Block\Product\View $displayIfNoReviews = false ) { return $this->getLayout()->createBlock( - 'Magento\Rating\Block\Entity\Detailed' + 'Magento\Review\Block\Rating\Entity\Detailed' )->setEntityId( $this->getProduct()->getId() )->toHtml() . $this->getLayout()->getBlock( diff --git a/app/code/Magento/Rating/Block/Entity/Detailed.php b/app/code/Magento/Review/Block/Rating/Entity/Detailed.php similarity index 90% rename from app/code/Magento/Rating/Block/Entity/Detailed.php rename to app/code/Magento/Review/Block/Rating/Entity/Detailed.php index 397fb5a7f8281c024f4f1a95e0d124b11ec7ae23..fa1f31e17a7778688a8974f1a1f1946faa1d6f60 100644 --- a/app/code/Magento/Rating/Block/Entity/Detailed.php +++ b/app/code/Magento/Review/Block/Rating/Entity/Detailed.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Entity; +namespace Magento\Review\Block\Rating\Entity; /** * Entity rating block * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Detailed extends \Magento\View\Element\Template @@ -40,18 +40,18 @@ class Detailed extends \Magento\View\Element\Template protected $_template = 'detailed.phtml'; /** - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, array $data = array() ) { $this->_ratingFactory = $ratingFactory; diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php index 09c5f44cd002d2a881085ff530e58d12925555ed..6e16ff6c42f277e7cbb73429449ab3713e285119 100644 --- a/app/code/Magento/Review/Block/View.php +++ b/app/code/Magento/Review/Block/View.php @@ -42,14 +42,14 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct /** * Rating option model * - * @var \Magento\Rating\Model\Rating\Option\VoteFactory + * @var \Magento\Review\Model\Rating\Option\VoteFactory */ protected $_voteFactory; /** * Rating model factory * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; @@ -62,16 +62,16 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct /** * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory - * @param \Magento\Rating\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param array $data * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, - \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, - \Magento\Rating\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, array $data = array(), array $priceBlockTypes = array() @@ -119,7 +119,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct /** * Retrieve collection of ratings * - * @return \Magento\Rating\Model\Resource\Rating\Option\Vote\Collection + * @return \Magento\Review\Model\Resource\Rating\Option\Vote\Collection */ public function getRating() { @@ -180,4 +180,23 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct { return $this->formatDate($date, \Magento\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_LONG); } + + /** + * Get product reviews summary + * + * @param \Magento\Catalog\Model\Product $product + * @param bool $templateType + * @param bool $displayIfNoReviews + * @return string + */ + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = false, + $displayIfNoReviews = false + ) { + if (!$product->getRatingSummary()) { + $this->_reviewFactory->create()->getEntitySummary($product, $this->_storeManager->getStore()->getId()); + } + return parent::getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews); + } } diff --git a/app/code/Magento/Review/Controller/Adminhtml/Product.php b/app/code/Magento/Review/Controller/Adminhtml/Product.php index 233b1fb9121eafd84d43a1bb5ec9072f8556532a..a8d8954209f9a8a59c70fd1cc8d0121c1fb21bfc 100644 --- a/app/code/Magento/Review/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product.php @@ -149,14 +149,14 @@ class Product extends \Magento\Backend\App\Action $arrRatingId = $this->getRequest()->getParam('ratings', array()); $votes = $this->_objectManager->create( - 'Magento\Rating\Model\Rating\Option\Vote' + 'Magento\Review\Model\Rating\Option\Vote' )->getResourceCollection()->setReviewFilter( $reviewId )->addOptionInfo()->load()->addRatingOptions(); foreach ($arrRatingId as $ratingId => $optionId) { if ($vote = $votes->getItemByColumnValue('rating_id', $ratingId)) { $this->_objectManager->create( - 'Magento\Rating\Model\Rating' + 'Magento\Review\Model\Rating' )->setVoteId( $vote->getId() )->setReviewId( @@ -166,7 +166,7 @@ class Product extends \Magento\Backend\App\Action ); } else { $this->_objectManager->create( - 'Magento\Rating\Model\Rating' + 'Magento\Review\Model\Rating' )->setRatingId( $ratingId )->setReviewId( @@ -363,9 +363,9 @@ class Product extends \Magento\Backend\App\Action $productId = $this->getRequest()->getParam('product_id', false); if ($data = $this->getRequest()->getPost()) { - if ($this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->hasSingleStore()) { + if ($this->_objectManager->get('Magento\Store\Model\StoreManagerInterface')->hasSingleStore()) { $data['stores'] = array( - $this->_objectManager->get('Magento\Core\Model\StoreManager')->getStore(true)->getId() + $this->_objectManager->get('Magento\Store\Model\StoreManager')->getStore(true)->getId() ); } elseif (isset($data['select_stores'])) { $data['stores'] = $data['select_stores']; @@ -386,7 +386,7 @@ class Product extends \Magento\Backend\App\Action $arrRatingId = $this->getRequest()->getParam('ratings', array()); foreach ($arrRatingId as $ratingId => $optionId) { $this->_objectManager->create( - 'Magento\Rating\Model\Rating' + 'Magento\Review\Model\Rating' )->setRatingId( $ratingId )->setReviewId( diff --git a/app/code/Magento/Rating/Controller/Adminhtml/Index.php b/app/code/Magento/Review/Controller/Adminhtml/Rating.php similarity index 84% rename from app/code/Magento/Rating/Controller/Adminhtml/Index.php rename to app/code/Magento/Review/Controller/Adminhtml/Rating.php index 8452906f06b1afa9cc77ce2c8f4f8e49899e45b5..3defb76435277d10a3400d2bcc0316b5709ca3f6 100644 --- a/app/code/Magento/Rating/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Rating.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Controller\Adminhtml; +namespace Magento\Review\Controller\Adminhtml; use Magento\Backend\App\Action; /** * Admin ratings controller */ -class Index extends \Magento\Backend\App\Action +class Rating extends \Magento\Backend\App\Action { /** * Core registry @@ -71,7 +71,7 @@ class Index extends \Magento\Backend\App\Action $this->_initEnityId(); $this->_view->loadLayout(); - $ratingModel = $this->_objectManager->create('Magento\Rating\Model\Rating'); + $ratingModel = $this->_objectManager->create('Magento\Review\Model\Rating'); if ($this->getRequest()->getParam('id')) { $ratingModel->load($this->getRequest()->getParam('id')); } @@ -82,9 +82,9 @@ class Index extends \Magento\Backend\App\Action $this->_addBreadcrumb(__('Manage Ratings'), __('Manage Ratings')); $this->_addContent( - $this->_view->getLayout()->createBlock('Magento\Rating\Block\Adminhtml\Edit') + $this->_view->getLayout()->createBlock('Magento\Review\Block\Adminhtml\Rating\Edit') )->_addLeft( - $this->_view->getLayout()->createBlock('Magento\Rating\Block\Adminhtml\Edit\Tabs') + $this->_view->getLayout()->createBlock('Magento\Review\Block\Adminhtml\Rating\Edit\Tabs') ); $this->_view->renderLayout(); } @@ -108,7 +108,7 @@ class Index extends \Magento\Backend\App\Action if ($this->getRequest()->getPost()) { try { - $ratingModel = $this->_objectManager->create('Magento\Rating\Model\Rating'); + $ratingModel = $this->_objectManager->create('Magento\Review\Model\Rating'); $stores = $this->getRequest()->getParam('stores'); $position = (int)$this->getRequest()->getParam('position'); @@ -135,7 +135,7 @@ class Index extends \Magento\Backend\App\Action if (is_array($options)) { $i = 1; foreach ($options as $key => $optionCode) { - $optionModel = $this->_objectManager->create('Magento\Rating\Model\Rating\Option'); + $optionModel = $this->_objectManager->create('Magento\Review\Model\Rating\Option'); if (!preg_match("/^add_([0-9]*?)$/", $key)) { $optionModel->setId($key); } @@ -156,7 +156,7 @@ class Index extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You saved the rating.')); $this->_objectManager->get('Magento\Backend\Model\Session')->setRatingData(false); - $this->_redirect('rating/*/'); + $this->_redirect('review/rating/'); return; } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); @@ -165,11 +165,11 @@ class Index extends \Magento\Backend\App\Action )->setRatingData( $this->getRequest()->getPost() ); - $this->_redirect('rating/*/edit', array('id' => $this->getRequest()->getParam('id'))); + $this->_redirect('review/rating/edit', array('id' => $this->getRequest()->getParam('id'))); return; } } - $this->_redirect('rating/*/'); + $this->_redirect('review/rating/'); } /** @@ -179,17 +179,17 @@ class Index extends \Magento\Backend\App\Action { if ($this->getRequest()->getParam('id') > 0) { try { - $model = $this->_objectManager->create('Magento\Rating\Model\Rating'); - /* @var $model \Magento\Rating\Model\Rating */ + $model = $this->_objectManager->create('Magento\Review\Model\Rating'); + /* @var $model \Magento\Review\Model\Rating */ $model->load($this->getRequest()->getParam('id'))->delete(); $this->messageManager->addSuccess(__('You deleted the rating.')); - $this->_redirect('rating/*/'); + $this->_redirect('review/rating/'); } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); - $this->_redirect('rating/*/edit', array('id' => $this->getRequest()->getParam('id'))); + $this->_redirect('review/rating/edit', array('id' => $this->getRequest()->getParam('id'))); } } - $this->_redirect('rating/*/'); + $this->_redirect('review/rating/'); } /** @@ -201,7 +201,7 @@ class Index extends \Magento\Backend\App\Action $this->_coreRegistry->register( 'entityId', - $this->_objectManager->create('Magento\Rating\Model\Rating\Entity')->getIdByCode('product') + $this->_objectManager->create('Magento\Review\Model\Rating\Entity')->getIdByCode('product') ); } @@ -210,6 +210,6 @@ class Index extends \Magento\Backend\App\Action */ protected function _isAllowed() { - return $this->_authorization->isAllowed('Magento_Rating::ratings'); + return $this->_authorization->isAllowed('Magento_Review::ratings'); } } diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index 75e113fe84a11f832d71f135fdd24e0a3c711e2f..dc7ef93a5d128ea937674f83f3af44b1da03c23b 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -88,17 +88,10 @@ class Product extends \Magento\App\Action\Action /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; - /** - * Core session model - * - * @var \Magento\Core\Model\Session - */ - protected $_session; - /** * Catalog design model * @@ -109,7 +102,7 @@ class Product extends \Magento\App\Action\Action /** * Core model store manager interface * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -128,11 +121,10 @@ class Product extends \Magento\App\Action\Action * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory - * @param \Magento\Rating\Model\RatingFactory $ratingFactory - * @param \Magento\Core\Model\Session $session + * @param \Magento\Review\Model\RatingFactory $ratingFactory * @param \Magento\Catalog\Model\Design $catalogDesign * @param \Magento\Session\Generic $reviewSession - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( @@ -143,11 +135,10 @@ class Product extends \Magento\App\Action\Action \Magento\Logger $logger, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, - \Magento\Rating\Model\RatingFactory $ratingFactory, - \Magento\Core\Model\Session $session, + \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Catalog\Model\Design $catalogDesign, \Magento\Session\Generic $reviewSession, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; @@ -159,7 +150,6 @@ class Product extends \Magento\App\Action\Action $this->_productFactory = $productFactory; $this->_reviewFactory = $reviewFactory; $this->_ratingFactory = $ratingFactory; - $this->_session = $session; $this->_catalogDesign = $catalogDesign; $this->_formKeyValidator = $formKeyValidator; @@ -312,8 +302,6 @@ class Product extends \Magento\App\Action\Action } if (($product = $this->_initProduct()) && !empty($data)) { - $session = $this->_session; - /* @var $session \Magento\Core\Model\Session */ $review = $this->_reviewFactory->create()->setData($data); /* @var $review Review */ @@ -350,11 +338,11 @@ class Product extends \Magento\App\Action\Action $review->aggregate(); $this->messageManager->addSuccess(__('Your review has been accepted for moderation.')); } catch (\Exception $e) { - $session->setFormData($data); + $this->_reviewSession->setFormData($data); $this->messageManager->addError(__('We cannot post the review.')); } } else { - $session->setFormData($data); + $this->_reviewSession->setFormData($data); if (is_array($validate)) { foreach ($validate as $errorMessage) { $this->messageManager->addError($errorMessage); diff --git a/app/code/Magento/Review/Helper/Data.php b/app/code/Magento/Review/Helper/Data.php index 2b22eb70523698712bbe16431999c6ed0c32b5ae..47d429d97e0a62af23400b8a00f7f9808c2191da 100644 --- a/app/code/Magento/Review/Helper/Data.php +++ b/app/code/Magento/Review/Helper/Data.php @@ -42,9 +42,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * Escaper @@ -55,17 +55,17 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filter */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filter ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_escaper = $escaper; $this->filter = $filter; parent::__construct($context); @@ -100,7 +100,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getIsGuestAllowToWrite() { - return $this->_coreStoreConfig->getConfigFlag(self::XML_REVIEW_GUETS_ALLOW); + return $this->_scopeConfig->isSetFlag(self::XML_REVIEW_GUETS_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Review/Model/Observer.php b/app/code/Magento/Review/Model/Observer.php index 1c9ea4c5d58f9cfd8e374cab2acbf7ca65c20afc..30ccae2e68d7c711632f6404355a2cc3f3be16a9 100644 --- a/app/code/Magento/Review/Model/Observer.php +++ b/app/code/Magento/Review/Model/Observer.php @@ -49,15 +49,23 @@ class Observer protected $_resourceReview; /** - * @param \Magento\Review\Model\ReviewFactory $reviewFactory - * @param \Magento\Review\Model\Resource\Review $resourceReview + * @var \Magento\Review\Model\Resource\Rating + */ + protected $_resourceRating; + + /** + * @param ReviewFactory $reviewFactory + * @param Resource\Review $resourceReview + * @param Resource\Rating $resourceRating */ public function __construct( \Magento\Review\Model\ReviewFactory $reviewFactory, - \Magento\Review\Model\Resource\Review $resourceReview + \Magento\Review\Model\Resource\Review $resourceReview, + \Magento\Review\Model\Resource\Rating $resourceRating ) { $this->_reviewFactory = $reviewFactory; $this->_resourceReview = $resourceReview; + $this->_resourceRating = $resourceRating; } /** @@ -85,6 +93,7 @@ class Observer $eventProduct = $observer->getEvent()->getProduct(); if ($eventProduct && $eventProduct->getId()) { $this->_resourceReview->deleteReviewsByProductId($eventProduct->getId()); + $this->_resourceRating->deleteAggregatedRatingsByProductId($eventProduct->getId()); } return $this; diff --git a/app/code/Magento/Rating/Model/Rating.php b/app/code/Magento/Review/Model/Rating.php similarity index 85% rename from app/code/Magento/Rating/Model/Rating.php rename to app/code/Magento/Review/Model/Rating.php index b1263291b3429fcdbb190934cc9b63143543850c..968226543d1a4314e7e63c62d5a9762929c98997 100644 --- a/app/code/Magento/Rating/Model/Rating.php +++ b/app/code/Magento/Review/Model/Rating.php @@ -19,25 +19,25 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model; +namespace Magento\Review\Model; /** * Rating model * - * @method \Magento\Rating\Model\Resource\Rating getResource() - * @method \Magento\Rating\Model\Resource\Rating _getResource() + * @method Resource\Rating getResource() + * @method Resource\Rating _getResource() * @method array getRatingCodes() - * @method \Magento\Rating\Model\Rating setRatingCodes(array $value) + * @method \Magento\Review\Model\Rating setRatingCodes(array $value) * @method array getStores() - * @method \Magento\Rating\Model\Rating setStores(array $value) + * @method \Magento\Review\Model\Rating setStores(array $value) * @method string getRatingCode() * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Rating extends \Magento\Model\AbstractModel @@ -52,20 +52,20 @@ class Rating extends \Magento\Model\AbstractModel const ENTITY_REVIEW_CODE = 'review'; /** - * @var \Magento\Rating\Model\Rating\OptionFactory + * @var \Magento\Review\Model\Rating\OptionFactory */ protected $_ratingOptionFactory; /** - * @var \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\Option\CollectionFactory */ protected $_ratingCollectionF; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory - * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF + * @param \Magento\Review\Model\Rating\OptionFactory $ratingOptionFactory + * @param \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -73,8 +73,8 @@ class Rating extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory, - \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, + \Magento\Review\Model\Rating\OptionFactory $ratingOptionFactory, + \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -91,7 +91,7 @@ class Rating extends \Magento\Model\AbstractModel */ protected function _construct() { - $this->_init('Magento\Rating\Model\Resource\Rating'); + $this->_init('Magento\Review\Model\Resource\Rating'); } /** diff --git a/app/code/Magento/Rating/Model/Rating/Entity.php b/app/code/Magento/Review/Model/Rating/Entity.php similarity index 80% rename from app/code/Magento/Rating/Model/Rating/Entity.php rename to app/code/Magento/Review/Model/Rating/Entity.php index 1fdfd8be8307efcc7c2dc3f94263b6038ce73229..83cf4204111a9a43debcf97e6bdbad7268a858a1 100644 --- a/app/code/Magento/Rating/Model/Rating/Entity.php +++ b/app/code/Magento/Review/Model/Rating/Entity.php @@ -19,22 +19,22 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Rating; +namespace Magento\Review\Model\Rating; /** * Ratings entity model * - * @method \Magento\Rating\Model\Resource\Rating\Entity _getResource() - * @method \Magento\Rating\Model\Resource\Rating\Entity getResource() + * @method \Magento\Review\Model\Resource\Rating\Entity _getResource() + * @method \Magento\Review\Model\Resource\Rating\Entity getResource() * @method string getEntityCode() - * @method \Magento\Rating\Model\Rating\Entity setEntityCode(string $value) + * @method \Magento\Review\Model\Rating\Entity setEntityCode(string $value) * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Entity extends \Magento\Model\AbstractModel @@ -44,7 +44,7 @@ class Entity extends \Magento\Model\AbstractModel */ protected function _construct() { - $this->_init('Magento\Rating\Model\Resource\Rating\Entity'); + $this->_init('Magento\Review\Model\Resource\Rating\Entity'); } /** diff --git a/app/code/Magento/Rating/Model/Rating/Option.php b/app/code/Magento/Review/Model/Rating/Option.php similarity index 75% rename from app/code/Magento/Rating/Model/Rating/Option.php rename to app/code/Magento/Review/Model/Rating/Option.php index d9011e622a630f4cb08818e3ec30b8cad3515685..a9261aab44840a95d314adaf4b9d816caf566690 100644 --- a/app/code/Magento/Rating/Model/Rating/Option.php +++ b/app/code/Magento/Review/Model/Rating/Option.php @@ -19,28 +19,28 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Rating; +namespace Magento\Review\Model\Rating; /** * Rating option model * - * @method \Magento\Rating\Model\Resource\Rating\Option _getResource() - * @method \Magento\Rating\Model\Resource\Rating\Option getResource() + * @method \Magento\Review\Model\Resource\Rating\Option _getResource() + * @method \Magento\Review\Model\Resource\Rating\Option getResource() * @method int getRatingId() - * @method \Magento\Rating\Model\Rating\Option setRatingId(int $value) + * @method \Magento\Review\Model\Rating\Option setRatingId(int $value) * @method string getCode() - * @method \Magento\Rating\Model\Rating\Option setCode(string $value) + * @method \Magento\Review\Model\Rating\Option setCode(string $value) * @method int getValue() - * @method \Magento\Rating\Model\Rating\Option setValue(int $value) + * @method \Magento\Review\Model\Rating\Option setValue(int $value) * @method int getPosition() - * @method \Magento\Rating\Model\Rating\Option setPosition(int $value) + * @method \Magento\Review\Model\Rating\Option setPosition(int $value) * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Option extends \Magento\Model\AbstractModel @@ -50,7 +50,7 @@ class Option extends \Magento\Model\AbstractModel */ protected function _construct() { - $this->_init('Magento\Rating\Model\Resource\Rating\Option'); + $this->_init('Magento\Review\Model\Resource\Rating\Option'); } /** diff --git a/app/code/Magento/Rating/Model/Rating/Option/Vote.php b/app/code/Magento/Review/Model/Rating/Option/Vote.php similarity index 87% rename from app/code/Magento/Rating/Model/Rating/Option/Vote.php rename to app/code/Magento/Review/Model/Rating/Option/Vote.php index 823a655a25726dd24c1611d880881e8d40b3668c..ab517b4802963d0021f84d47ab4eadc5d9cda8cc 100644 --- a/app/code/Magento/Rating/Model/Rating/Option/Vote.php +++ b/app/code/Magento/Review/Model/Rating/Option/Vote.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Rating\Option; +namespace Magento\Review\Model\Rating\Option; /** * Rating vote model * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Vote extends \Magento\Model\AbstractModel @@ -39,6 +39,6 @@ class Vote extends \Magento\Model\AbstractModel */ protected function _construct() { - $this->_init('Magento\Rating\Model\Resource\Rating\Option\Vote'); + $this->_init('Magento\Review\Model\Resource\Rating\Option\Vote'); } } diff --git a/app/code/Magento/Rating/Model/Resource/Rating.php b/app/code/Magento/Review/Model/Resource/Rating.php similarity index 93% rename from app/code/Magento/Rating/Model/Resource/Rating.php rename to app/code/Magento/Review/Model/Resource/Rating.php index 2e8911c20cf790fb9099ef93aaf14dee27c4846b..9e9ffeb059501843f8e7b2a85e2f251c7cb9938e 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating.php +++ b/app/code/Magento/Review/Model/Resource/Rating.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource; +namespace Magento\Review\Model\Resource; /** * Rating resource model * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Rating extends \Magento\Model\Resource\Db\AbstractDb @@ -39,14 +39,14 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Rating data * - * @var \Magento\Rating\Helper\Data + * @var \Magento\Review\Helper\Data */ protected $_ratingData = null; @@ -58,15 +58,15 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource * @param \Magento\Logger $logger - * @param \Magento\Rating\Helper\Data $ratingData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Helper\Data $ratingData + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Review\Model\Resource\Review\Summary $reviewSummary */ public function __construct( \Magento\App\Resource $resource, \Magento\Logger $logger, - \Magento\Rating\Helper\Data $ratingData, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Review\Helper\Data $ratingData, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Review\Model\Resource\Review\Summary $reviewSummary ) { $this->_ratingData = $ratingData; @@ -93,12 +93,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb */ protected function _initUniqueFields() { - $this->_uniqueFields = array( - array( - 'field' => 'rating_code', - 'title' => '' /* __('Rating with the same title')*/ - ) - ); + $this->_uniqueFields = array(array('field' => 'rating_code', 'title' => '')); return $this; } @@ -107,7 +102,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Rating\Model\Rating $object + * @param \Magento\Review\Model\Rating $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) @@ -115,7 +110,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb $adapter = $this->_getReadAdapter(); $table = $this->getMainTable(); - $storeId = (int)$this->_storeManager->getStore(\Magento\Core\Model\Store::ADMIN_CODE)->getId(); + $storeId = (int)$this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId(); $select = parent::_getLoadSelect($field, $value, $object); $codeExpr = $adapter->getIfNullSql('title.value', "{$table}.rating_code"); @@ -131,7 +126,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Actions after load * - * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Review\Model\Rating $object * @return $this */ protected function _afterLoad(\Magento\Model\AbstractModel $object) @@ -184,7 +179,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Actions after save * - * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Review\Model\Rating $object * @return $this */ protected function _afterSave(\Magento\Model\AbstractModel $object) @@ -296,7 +291,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Return array of rating summary * - * @param \Magento\Rating\Model\Rating $object + * @param \Magento\Review\Model\Rating $object * @param boolean $onlyForCurrentStore * @return array */ @@ -338,7 +333,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Return data of rating summary * - * @param \Magento\Rating\Model\Rating $object + * @param \Magento\Review\Model\Rating $object * @return array */ protected function _getEntitySummaryData($object) @@ -392,7 +387,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb /** * Review summary * - * @param \Magento\Rating\Model\Rating $object + * @param \Magento\Review\Model\Rating $object * @param boolean $onlyForCurrentStore * @return array */ @@ -487,7 +482,7 @@ class Rating extends \Magento\Model\Resource\Db\AbstractDb */ public function deleteAggregatedRatingsByProductId($productId) { - $entityId = $this->getEntityIdByCode(\Magento\Rating\Model\Rating::ENTITY_PRODUCT_CODE); + $entityId = $this->getEntityIdByCode(\Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE); $adapter = $this->_getWriteAdapter(); $select = $adapter->select()->from($this->getMainTable(), 'rating_id')->where('entity_id = :entity_id'); $ratingIds = $adapter->fetchCol($select, array(':entity_id' => $entityId)); diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php b/app/code/Magento/Review/Model/Resource/Rating/Collection.php similarity index 94% rename from app/code/Magento/Rating/Model/Resource/Rating/Collection.php rename to app/code/Magento/Review/Model/Resource/Rating/Collection.php index 4d987a1940880c41562ec90439c2f568147f83f2..ef5352e67d44e98de2f720efb65cf01c5f02cba0 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Collection.php @@ -19,28 +19,28 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating; +namespace Magento\Review\Model\Resource\Rating; /** * Rating collection resource model * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\Option\CollectionFactory */ protected $_ratingCollectionF; @@ -55,8 +55,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -65,8 +65,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -87,7 +87,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ protected function _construct() { - $this->_init('Magento\Rating\Model\Rating', 'Magento\Rating\Model\Resource\Rating'); + $this->_init('Magento\Review\Model\Rating', 'Magento\Review\Model\Resource\Rating'); } /** @@ -179,7 +179,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio $arrRatingId = $this->getColumnValues('rating_id'); if (!empty($arrRatingId)) { - /** @var \Magento\Rating\Model\Resource\Rating\Option\Collection $collection */ + /** @var \Magento\Review\Model\Resource\Rating\Option\Collection $collection */ $collection = $this->_ratingCollectionF->create()->addRatingFilter( $arrRatingId )->setPositionOrder()->load(); diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php b/app/code/Magento/Review/Model/Resource/Rating/Entity.php similarity index 94% rename from app/code/Magento/Rating/Model/Resource/Rating/Entity.php rename to app/code/Magento/Review/Model/Resource/Rating/Entity.php index a20d688c1d75b2121f376174ed50dc10ebd3b7fb..8393743d107020d33cbb91fb4deb551811872e32 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Entity.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating; +namespace Magento\Review\Model\Resource\Rating; /** * Rating entity resource * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Entity extends \Magento\Model\Resource\Db\AbstractDb diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php b/app/code/Magento/Review/Model/Resource/Rating/Grid/Collection.php similarity index 85% rename from app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php rename to app/code/Magento/Review/Model/Resource/Rating/Grid/Collection.php index 83e37040cfcd13c28400f75b7dfec1edb98ecd82..2f7849bc82abcf37ad3d3ef46f4ec83be26c0ebd 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Grid/Collection.php @@ -19,20 +19,20 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating\Grid; +namespace Magento\Review\Model\Resource\Rating\Grid; /** * Rating grid collection * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Rating\Model\Resource\Rating\Collection +class Collection extends \Magento\Review\Model\Resource\Rating\Collection { /** * Core registry @@ -46,8 +46,8 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param \Magento\Registry $coreRegistry * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource @@ -57,8 +57,8 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, \Magento\Registry $coreRegistry, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option.php b/app/code/Magento/Review/Model/Resource/Rating/Option.php similarity index 95% rename from app/code/Magento/Rating/Model/Resource/Rating/Option.php rename to app/code/Magento/Review/Model/Resource/Rating/Option.php index b1f8172851ba581ffd363314f3ab79b889b26b7b..0204805e06bbe78ca2ed03f9a37720e6d45f1b96 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Option.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating; +namespace Magento\Review\Model\Resource\Rating; /** * Rating option resource model * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Option extends \Magento\Model\Resource\Db\AbstractDb @@ -96,20 +96,20 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb protected $_customerSession; /** - * @var \Magento\Rating\Model\Rating\Option\VoteFactory + * @var \Magento\Review\Model\Rating\Option\VoteFactory */ protected $_ratingOptionVoteF; /** * @param \Magento\App\Resource $resource * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $ratingOptionVoteF + * @param \Magento\Review\Model\Rating\Option\VoteFactory $ratingOptionVoteF * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress */ public function __construct( \Magento\App\Resource $resource, \Magento\Customer\Model\Session $customerSession, - \Magento\Rating\Model\Rating\Option\VoteFactory $ratingOptionVoteF, + \Magento\Review\Model\Rating\Option\VoteFactory $ratingOptionVoteF, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { $this->_customerSession = $customerSession; @@ -138,7 +138,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb /** * Add vote * - * @param \Magento\Rating\Model\Rating\Option $option + * @param \Magento\Review\Model\Rating\Option $option * @return $this */ public function addVote($option) @@ -182,7 +182,7 @@ class Option extends \Magento\Model\Resource\Db\AbstractDb /** * Aggregate options * - * @param \Magento\Rating\Model\Rating\Option $option + * @param \Magento\Review\Model\Rating\Option $option * @return void */ public function aggregate($option) diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php b/app/code/Magento/Review/Model/Resource/Rating/Option/Collection.php similarity index 90% rename from app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php rename to app/code/Magento/Review/Model/Resource/Rating/Option/Collection.php index d0be239875288817d9bd043341a3774a6b2a369e..cd2945125fd2067001718de521d9090ea21865a9 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Option/Collection.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating\Option; +namespace Magento\Review\Model\Resource\Rating\Option; /** * Rating option collection * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection @@ -48,7 +48,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ protected function _construct() { - $this->_init('Magento\Rating\Model\Rating\Option', 'Magento\Rating\Model\Resource\Rating\Option'); + $this->_init('Magento\Review\Model\Rating\Option', 'Magento\Review\Model\Resource\Rating\Option'); $this->_ratingVoteTable = $this->getTable('rating_option_vote'); } diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php b/app/code/Magento/Review/Model/Resource/Rating/Option/Vote.php similarity index 91% rename from app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php rename to app/code/Magento/Review/Model/Resource/Rating/Option/Vote.php index 9612a6ecbc357fa7ccdf11871b60de34a9813e00..90683584447d79c8889edbf1d37423ce047ac060 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Option/Vote.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating\Option; +namespace Magento\Review\Model\Resource\Rating\Option; /** * Rating vote resource model * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Vote extends \Magento\Model\Resource\Db\AbstractDb diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php b/app/code/Magento/Review/Model/Resource/Rating/Option/Vote/Collection.php similarity index 89% rename from app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php rename to app/code/Magento/Review/Model/Resource/Rating/Option/Vote/Collection.php index 179fb83076ee6212e64baea2f1fb8c6f4414b500..d6d9d5475e1a9066d5fc62d72ede9aed1ae4579a 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Rating/Option/Vote/Collection.php @@ -19,17 +19,17 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Model\Resource\Rating\Option\Vote; +namespace Magento\Review\Model\Resource\Rating\Option\Vote; /** * Rating votes collection * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection @@ -37,12 +37,12 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store list manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory + * @var \Magento\Review\Model\Resource\Rating\Option\CollectionFactory */ protected $_ratingCollectionF; @@ -51,8 +51,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -61,8 +61,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -78,7 +78,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ protected function _construct() { - $this->_init('Magento\Rating\Model\Rating\Option\Vote', 'Magento\Rating\Model\Resource\Rating\Option\Vote'); + $this->_init('Magento\Review\Model\Rating\Option\Vote', 'Magento\Review\Model\Resource\Rating\Option\Vote'); } /** @@ -194,7 +194,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio return $this; } foreach ($this->getItems() as $item) { - /** @var \Magento\Rating\Model\Resource\Rating\Option\Collection $options */ + /** @var \Magento\Review\Model\Resource\Rating\Option\Collection $options */ $options = $this->_ratingCollectionF->create(); $options->addRatingFilter($item->getRatingId())->load(); diff --git a/app/code/Magento/Review/Model/Resource/Review.php b/app/code/Magento/Review/Model/Resource/Review.php index adbd31a2d64a206fb382d0a28f5125ae7c6ea876..33b59ca487617fbcc49b19cf79266072e7f54092 100644 --- a/app/code/Magento/Review/Model/Resource/Review.php +++ b/app/code/Magento/Review/Model/Resource/Review.php @@ -95,37 +95,37 @@ class Review extends \Magento\Model\Resource\Db\AbstractDb /** * Core model store manager interface * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; /** * Rating resource model * - * @var \Magento\Rating\Model\Resource\Rating\Option + * @var \Magento\Review\Model\Resource\Rating\Option */ protected $_ratingOptions; /** * @param \Magento\App\Resource $resource * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Rating\Model\RatingFactory $ratingFactory - * @param \Magento\Rating\Model\Resource\Rating\Option $ratingOptions + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\Resource\Rating\Option $ratingOptions */ public function __construct( \Magento\App\Resource $resource, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Rating\Model\RatingFactory $ratingFactory, - \Magento\Rating\Model\Resource\Rating\Option $ratingOptions + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\RatingFactory $ratingFactory, + Rating\Option $ratingOptions ) { $this->_date = $date; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Review/Model/Resource/Review/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Collection.php index 450e0955d3770a666f9462bc61a02492d52a93fb..dfa2466cce53d16a06272f726013c027288c3168 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Collection.php @@ -83,14 +83,14 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Rating option model * - * @var \Magento\Rating\Model\Rating\Option\VoteFactory + * @var \Magento\Review\Model\Rating\Option\VoteFactory */ protected $_voteFactory; /** * Core model store manager interface * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -100,8 +100,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Review\Helper\Data $reviewData - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -111,8 +111,8 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Review\Helper\Data $reviewData, - \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php index bf68532ae5326f92f4f1d81a9b30e9beb0d9cfe1..62f409e5d2cb05031efedd0ddf04d9000ca2855b 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Product/Collection.php @@ -65,14 +65,14 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection /** * Rating model * - * @var \Magento\Rating\Model\RatingFactory + * @var \Magento\Review\Model\RatingFactory */ protected $_ratingFactory; /** * Rating option vote model * - * @var \Magento\Rating\Model\Rating\Option\VoteFactory + * @var \Magento\Review\Model\Rating\Option\VoteFactory */ protected $_voteFactory; @@ -86,17 +86,17 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Rating\Model\RatingFactory $ratingFactory - * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory + * @param \Magento\Review\Model\RatingFactory $ratingFactory + * @param \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory * @param mixed $connection * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -111,17 +111,17 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection \Magento\Eav\Model\EntityFactory $eavEntityFactory, \Magento\Catalog\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Stdlib\DateTime $dateTime, - \Magento\Rating\Model\RatingFactory $ratingFactory, - \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, + \Magento\Review\Model\RatingFactory $ratingFactory, + \Magento\Review\Model\Rating\Option\VoteFactory $voteFactory, $connection = null ) { $this->_ratingFactory = $ratingFactory; @@ -139,7 +139,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $storeManager, $catalogData, $catalogProductFlatState, - $coreStoreConfig, + $scopeConfig, $productOptionFactory, $catalogUrl, $localeDate, @@ -487,7 +487,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $this->_getConditionSql('rdt.customer_id', array('is' => new \Zend_Db_Expr('NULL'))), $this->_getConditionSql( 'rdt.store_id', - array('eq' => \Magento\Core\Model\Store::DEFAULT_STORE_ID) + array('eq' => \Magento\Store\Model\Store::DEFAULT_STORE_ID) ) ); $conditionSql = implode(' AND ', $conditionParts); @@ -498,7 +498,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection $this->_getConditionSql('rdt.customer_id', array('is' => new \Zend_Db_Expr('NULL'))), $this->_getConditionSql( 'rdt.store_id', - array('neq' => \Magento\Core\Model\Store::DEFAULT_STORE_ID) + array('neq' => \Magento\Store\Model\Store::DEFAULT_STORE_ID) ) ); $conditionSql = implode(' AND ', $conditionParts); diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php index 7df4187ffa780ad27f4085ad32d86116036eb3d3..bd115f9a22ed6f1650f919874f5f463cd8af87c2 100644 --- a/app/code/Magento/Review/Model/Review.php +++ b/app/code/Magento/Review/Model/Review.php @@ -108,7 +108,7 @@ class Review extends \Magento\Model\AbstractModel /** * Core model store manager interface * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -127,7 +127,7 @@ class Review extends \Magento\Model\AbstractModel * @param \Magento\Review\Model\Resource\Review\Summary\CollectionFactory $summaryFactory * @param \Magento\Review\Model\Review\SummaryFactory $summaryModFactory * @param \Magento\Review\Model\Review\Summary $reviewSummary - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlModel * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -141,7 +141,7 @@ class Review extends \Magento\Model\AbstractModel \Magento\Review\Model\Resource\Review\Summary\CollectionFactory $summaryFactory, \Magento\Review\Model\Review\SummaryFactory $summaryModFactory, \Magento\Review\Model\Review\Summary $reviewSummary, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlModel, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -341,7 +341,7 @@ class Review extends \Magento\Model\AbstractModel /** * Check if current review available on passed store * - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @return bool */ public function isAvailableOnStore($store = null) diff --git a/app/code/Magento/Review/data/review_setup/data-install-1.6.0.0.php b/app/code/Magento/Review/data/review_setup/data-install-1.6.0.0.php index 4a075db760ee32c06e5247bd8b398a2c7f92a06b..97c45ae1416a5324d94c96f42e332f1a7c13cfaa 100644 --- a/app/code/Magento/Review/data/review_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Review/data/review_setup/data-install-1.6.0.0.php @@ -32,7 +32,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; //Fill table review/review_entity @@ -55,3 +55,33 @@ foreach ($reviewStatuses as $k => $v) { $bind = array('status_id' => $k, 'status_code' => $v); $installer->getConnection()->insertForce($installer->getTable('review_status'), $bind); } + +$data = array( + \Magento\Review\Model\Rating::ENTITY_PRODUCT_CODE => array( + array('rating_code' => 'Quality', 'position' => 0), + array('rating_code' => 'Value', 'position' => 0), + array('rating_code' => 'Price', 'position' => 0) + ), + \Magento\Review\Model\Rating::ENTITY_PRODUCT_REVIEW_CODE => array(), + \Magento\Review\Model\Rating::ENTITY_REVIEW_CODE => array() +); + +foreach ($data as $entityCode => $ratings) { + //Fill table rating/rating_entity + $installer->getConnection()->insert($installer->getTable('rating_entity'), array('entity_code' => $entityCode)); + $entityId = $installer->getConnection()->lastInsertId($installer->getTable('rating_entity')); + + foreach ($ratings as $bind) { + //Fill table rating/rating + $bind['entity_id'] = $entityId; + $installer->getConnection()->insert($installer->getTable('rating'), $bind); + + //Fill table rating/rating_option + $ratingId = $installer->getConnection()->lastInsertId($installer->getTable('rating')); + $optionData = array(); + for ($i = 1; $i <= 5; $i++) { + $optionData[] = array('rating_id' => $ratingId, 'code' => (string)$i, 'value' => $i, 'position' => $i); + } + $installer->getConnection()->insertMultiple($installer->getTable('rating_option'), $optionData); + } +} diff --git a/app/code/Magento/Review/etc/adminhtml/acl.xml b/app/code/Magento/Review/etc/adminhtml/acl.xml index 76fa88047196c4fdbbea4ac6208cd2a8a67bf652..423e117aba668102a5de91a0d6c7941069ccfafc 100644 --- a/app/code/Magento/Review/etc/adminhtml/acl.xml +++ b/app/code/Magento/Review/etc/adminhtml/acl.xml @@ -29,6 +29,11 @@ <acl> <resources> <resource id="Magento_Adminhtml::admin"> + <resource id="Magento_Adminhtml::stores"> + <resource id="Magento_Adminhtml::stores_attributes"> + <resource id="Magento_Review::ratings" title="Ratings" sortOrder="60" /> + </resource> + </resource> <resource id="Magento_Adminhtml::marketing"> <resource id="Magento_Adminhtml::marketing_user_content"> <resource id="Magento_Review::reviews_all" title="Reviews" sortOrder="10"/> diff --git a/app/code/Magento/Review/etc/adminhtml/di.xml b/app/code/Magento/Review/etc/adminhtml/di.xml index 73717d0590a5794a741be66826e1ba4152104f69..425bdccdab6ffc68b4e7a09f0bcfa14097a5c578 100644 --- a/app/code/Magento/Review/etc/adminhtml/di.xml +++ b/app/code/Magento/Review/etc/adminhtml/di.xml @@ -40,4 +40,9 @@ <argument name="reviewSession" xsi:type="object">Magento\Review\Model\Session</argument> </arguments> </type> + <type name="Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form"> + <arguments> + <argument name="session" xsi:type="object">Magento\Backend\Model\Session</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Review/etc/adminhtml/menu.xml b/app/code/Magento/Review/etc/adminhtml/menu.xml index a31a6e7f83f8645c85165091aa23a7afdc4c5bd8..bc9a409b2222f56bd70fe0ef63f7a7aaef72608c 100644 --- a/app/code/Magento/Review/etc/adminhtml/menu.xml +++ b/app/code/Magento/Review/etc/adminhtml/menu.xml @@ -27,7 +27,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd"> <menu> - <add id="Magento_Review::catalog_reviews_ratings_ratings" title="Rating" module="Magento_Review" sortOrder="60" parent="Magento_Backend::stores_attributes" action="rating/index/" resource="Magento_Rating::ratings"/> + <add id="Magento_Review::catalog_reviews_ratings_ratings" title="Rating" module="Magento_Review" sortOrder="60" parent="Magento_Backend::stores_attributes" action="review/rating/" resource="Magento_Review::ratings"/> <add id="Magento_Review::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Backend::marketing_user_content" sortOrder="10" action="review/product/index" resource="Magento_Review::reviews_all"/> <add id="Magento_Review::report_review" title="Reviews" module="Magento_Reports" sortOrder="20" parent="Magento_Reports::report" resource="Magento_Reports::review"/> <add id="Magento_Review::report_review_customer" title="By Customers" sortOrder="10" module="Magento_Review" parent="Magento_Review::report_review" action="reports/report_review/customer" resource="Magento_Reports::review_customer"/> diff --git a/app/code/Magento/Review/etc/di.xml b/app/code/Magento/Review/etc/di.xml index 639abe1f711050c83928d9fe9c51bbb3c9bab186..9ca49a436227f54006eb82d91ccab2b0fde8ae11 100644 --- a/app/code/Magento/Review/etc/di.xml +++ b/app/code/Magento/Review/etc/di.xml @@ -32,4 +32,11 @@ </argument> </arguments> </type> + <type name="Magento\Catalog\Model\Product\ReservedAttributeList"> + <arguments> + <argument name="allowedAttributes" xsi:type="array"> + <item name="rating_summary" xsi:type="string">rating_summary</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Review/etc/frontend/di.xml b/app/code/Magento/Review/etc/frontend/di.xml index 532496e9536ea40f857c957ef90a69d86e0db70a..f1f619670408f6a5da3feef433f23b5b83e7e091 100644 --- a/app/code/Magento/Review/etc/frontend/di.xml +++ b/app/code/Magento/Review/etc/frontend/di.xml @@ -52,4 +52,7 @@ </argument> </arguments> </type> + <type name="Magento\Catalog\Block\Product\Compare\ListCompare"> + <plugin name="reviewInitializer" type="Magento\Review\Block\Product\Compare\ListCompare\Plugin\Review" /> + </type> </config> diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 27e24a63542e1eca1441dd09df6c61cb39065f1d..815c538c2fe8d64135743eba8dc26d42453b35f6 100644 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -28,13 +28,14 @@ <sequence> <module name="Magento_Catalog"/> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Eav"/> - <module name="Magento_Rating"/> <module name="Magento_Theme"/> <module name="Magento_Backend"/> <module name="Magento_Tax"/> diff --git a/app/code/Magento/Review/i18n/de_DE.csv b/app/code/Magento/Review/i18n/de_DE.csv index a211543d41ee9ded4b4f87c0b30dbe887c726fec..b5d7b312d129c56d6ea4bb2ee256b0795986ad79 100644 --- a/app/code/Magento/Review/i18n/de_DE.csv +++ b/app/code/Magento/Review/i18n/de_DE.csv @@ -101,3 +101,32 @@ "Products Reviews","Artikelbewertungen" "Reviews","Bewertungen" "Customers Reviews","Berichte der Kunden" +"1 star","1 Stern" +"2 stars","2 Sterne" +"3 stars","3 Sterne" +"4 stars","4 Sterne" +"5 stars","5 Sterne" +"Add New Rating","Neue Bewertung hinzufügen" +"Assigned Options","Zugewiesene Optionen" +"Be the first to review this product","Bewerten Sie dieses Produkt als Erster" +"Default Value","Vorgegebener Wert" +"Delete Rating","Vorgegebene Bewertung" +"Edit Rating","Bewertung bearbeiten" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","Wenn Sie keinen Bewertungstitel für einen Store spezifizieren, wird der vorgegebene Wert genutzt." +"Manage Ratings","Bewertungen verwalten" +"New Rating","Neue Bewertung" +"Option Label","Option Label" +"Option Title","Option Titel" +"Option Title:","Option Titel:" +"Please select one of each ratings above","Bitte wählen Sie oben eine Bewertung" +"Rating Information","Bewertungsinformation" +"Rating","Bewertungsname" +"Rating Options","Bewertungsoptionen" +"Rating Title","Bewertungstitel" +"Rating Visibility","Sichtbarkeit der Bewertung" +"Rating isn't Available","Bewertung ist nicht verfügbar" +"Rating with the same title","Bewertung mit gleichem Titel" +"Save Rating","Bewertung speichern" +"Sort Order","Sortierfolge" +"Visibility","Sichtbar in" diff --git a/app/code/Magento/Review/i18n/en_US.csv b/app/code/Magento/Review/i18n/en_US.csv index bcd62bf78c70c240981fef7c4aba79d8bf335171..dc8f2834e8b1304b5062277f3a16d95ed2196b26 100644 --- a/app/code/Magento/Review/i18n/en_US.csv +++ b/app/code/Magento/Review/i18n/en_US.csv @@ -102,3 +102,32 @@ "Product Reviews","Product Reviews" "Products Reviews","Products Reviews" "Reviews","Reviews" +"1 star","1 star" +"2 stars","2 stars" +"3 stars","3 stars" +"4 stars","4 stars" +"5 stars","5 stars" +"Add New Rating","Add New Rating" +"Assigned Options","Assigned Options" +"Be the first to review this product","Be the first to review this product" +"Default Value","Default Value" +"Delete Rating","Delete Rating" +"Edit Rating","Edit Rating" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","If you do not specify a rating title for a store, the default value will be used." +"Manage Ratings","Manage Ratings" +"New Rating","New Rating" +"Option Label","Option Label" +"Option Title","Option Title" +"Option Title:","Option Title:" +"Please select one of each ratings above","Please select one of each ratings above" +"Rating Information","Rating Information" +"Rating","Rating" +"Rating Options","Rating Options" +"Rating Title","Rating Title" +"Rating Visibility","Rating Visibility" +"Rating isn't Available","Rating isn't Available" +"Rating with the same title","Rating with the same title" +"Save Rating","Save Rating" +"Sort Order","Sort Order" +"Visibility","Visibility" diff --git a/app/code/Magento/Review/i18n/es_ES.csv b/app/code/Magento/Review/i18n/es_ES.csv index 5c28b9230aecbf908c7b0fb8c873c8867bab0ede..d454f056076b1cb3468523e057ceafc96bb13db5 100644 --- a/app/code/Magento/Review/i18n/es_ES.csv +++ b/app/code/Magento/Review/i18n/es_ES.csv @@ -101,3 +101,32 @@ "Product Reviews","Opiniones de Producto" "Products Reviews","Opiniones de Productos" "Reviews","Reseñas" +"1 star","1 estrella" +"2 stars","2 estrellas" +"3 stars","3 estrellas" +"4 stars","4 estrellas" +"5 stars","5 estrellas" +"Add New Rating","Agregar nueva puntuación" +"Assigned Options","Opciones asignadas" +"Be the first to review this product","Sea el primero en dejar una reseña para este producto" +"Default Value","Valor predeterminado" +"Delete Rating","Eliminar puntuación" +"Edit Rating","Editar puntuación" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","Si no especifica un tÃtulo para la puntuación de una tienda, se utilizará el valor predeterminado." +"Manage Ratings","Administrar puntuaciones" +"New Rating","Nueva puntuación" +"Option Label","Etiqueta de opciones" +"Option Title","TÃtulo de opciones" +"Option Title:","TÃtulo de opciones:" +"Please select one of each ratings above","Seleccione una de las puntuaciones que aparecen más arriba" +"Rating Information","Información sobre la puntuación" +"Rating","Nombre de la puntuación" +"Rating Options","Opciones de puntuación" +"Rating Title","Visibilidad de la puntuación" +"Rating Visibility","Visibilidad de la puntuación" +"Rating isn't Available","La puntuación no está disponible" +"Rating with the same title","Puntuación con el mismo tÃtulo" +"Save Rating","Guardar puntuación" +"Sort Order","Orden de selección" +"Visibility","Visible en" diff --git a/app/code/Magento/Review/i18n/fr_FR.csv b/app/code/Magento/Review/i18n/fr_FR.csv index ba54b3f3943347c3f3d4c9d2405ba5a04432c319..6d3cb586ba07613d7567d167674b1394563c9c67 100644 --- a/app/code/Magento/Review/i18n/fr_FR.csv +++ b/app/code/Magento/Review/i18n/fr_FR.csv @@ -101,3 +101,32 @@ "Product Reviews","Avis sur le produit" "Products Reviews","Avis sur les produits" "Reviews","Commentaires" +"1 star","1 étoile" +"2 stars","2 étoiles" +"3 stars","3 étoiles" +"4 stars","4 étoiles" +"5 stars","5 étoiles" +"Add New Rating","Ajouter une note" +"Assigned Options","Options Spécifiques" +"Be the first to review this product","Soyez le premier à évaluer ce produit" +"Default Value","Valeur par Défaut" +"Delete Rating","Supprimer la note" +"Edit Rating","Modifier la note" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","Si vous ne spécifiez pas de titre pour votre note dans une boutique, la valeur par défaut sera utilisée." +"Manage Ratings","Gérer les Notes" +"New Rating","Nouvelle note" +"Option Label","Nom de l'option" +"Option Title","Titre de l'option" +"Option Title:","Titre de l'option:" +"Please select one of each ratings above","Veuillez choisir une de chacune des notes au-dessus" +"Rating Information","Informations sur la note" +"Rating","Nom de la note" +"Rating Options","Options de la note" +"Rating Title","Titre de la note" +"Rating Visibility","Visiblité de la note" +"Rating isn't Available","Pas de note disponible" +"Rating with the same title","Note portant le même titre" +"Save Rating","Sauver la note" +"Sort Order","Trier la commande" +"Visibility","Visible dans" diff --git a/app/code/Magento/Review/i18n/nl_NL.csv b/app/code/Magento/Review/i18n/nl_NL.csv index 44dadffa9f05bfc7f375cfaf0afa6f3c49cd47a7..d90a17447f6d41824d78f8fa83fbcae23b30e59a 100644 --- a/app/code/Magento/Review/i18n/nl_NL.csv +++ b/app/code/Magento/Review/i18n/nl_NL.csv @@ -101,3 +101,32 @@ "Product Reviews","Productbeoordelingen" "Products Reviews","Productrecensies" "Reviews","Reviews" +"1 star","1 ster" +"2 stars","2 sterren" +"3 stars","3 sterren" +"4 stars","4 sterren" +"5 stars","5 sterren" +"Add New Rating","Voeg Nieuwe Rating toe" +"Assigned Options","Toegewezen Opties" +"Be the first to review this product","Wees de eerste om dit product te waarderen" +"Default Value","Vaststaande Waarde" +"Delete Rating","Verwijder Rating" +"Edit Rating","Bewerk Rating" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","Als u geen rating titel voor een winkel specificeert, zal de vaststaande waarde worden gebruikt." +"Manage Ratings","Beheer Ratings" +"New Rating","Nieuwe beoordeling" +"Option Label","Optie Label" +"Option Title","Optie Tiel" +"Option Title:","Optie Titel:" +"Please select one of each ratings above","Selecteer een van bovenstaande ratings" +"Rating Information","Rating Informatie" +"Rating","Rating Naam" +"Rating Options","Rating Opties" +"Rating Title","Rating Titel" +"Rating Visibility","Rating Zichtbaarheid" +"Rating isn't Available","Rating is niet Beschikbaar" +"Rating with the same title","Beoordeling met dezelfde titel" +"Save Rating","Beoordeling opslaan" +"Sort Order","Sorteer Bestelling" +"Visibility","Zichtbaar in" diff --git a/app/code/Magento/Review/i18n/pt_BR.csv b/app/code/Magento/Review/i18n/pt_BR.csv index f9714f20faa947f6b4977f12f9a95e206ead3443..b9b8a779caaf92fff118af2055d05a63594cb107 100644 --- a/app/code/Magento/Review/i18n/pt_BR.csv +++ b/app/code/Magento/Review/i18n/pt_BR.csv @@ -101,3 +101,32 @@ "Product Reviews","Comentários sobre Produto" "Products Reviews","Comentários sobre Produtos" "Reviews","Resenhas" +"1 star","1 estrela" +"2 stars","2 estrelas" +"3 stars","3 estrelas" +"4 stars","4 estrelas" +"5 stars","5 estrelas" +"Add New Rating","Adicionar nova avaliação" +"Assigned Options","Opções especificadas" +"Be the first to review this product","Seja a primeira pessoa a avaliar este produto" +"Default Value","Valor Predifinido" +"Delete Rating","Exclui avaliação" +"Edit Rating","Editar avaliação" +"ID","Identidade" +"If you do not specify a rating title for a store, the default value will be used.","Caso o tÃtulo de avaliação não seja especificado, o valor padrão será utilizado." +"Manage Ratings","Gerenciar Classificações" +"New Rating","Nova avaliação" +"Option Label","Marca de opção" +"Option Title","TÃtulo da opção" +"Option Title:","TÃtulo da opção:" +"Please select one of each ratings above","Escolha uma de cada avaliação acima" +"Rating Information","Informações de avaliação" +"Rating","Nome da avaliação" +"Rating Options","Opções de avaliação" +"Rating Title","TÃtulo da avaliação" +"Rating Visibility","Visibilidade da avaliação" +"Rating isn't Available","A avaliação não está disponÃvel" +"Rating with the same title","Avaliar com o mesmo tÃtulo" +"Save Rating","Salvar avaliação" +"Sort Order","Classificar pedido" +"Visibility","VisÃvel em" diff --git a/app/code/Magento/Review/i18n/zh_CN.csv b/app/code/Magento/Review/i18n/zh_CN.csv index b42851ad102d30f4f584ab41ef7aed0661f97a17..c778a398ffedde1f04479b7ebcc906b2bea3746d 100644 --- a/app/code/Magento/Review/i18n/zh_CN.csv +++ b/app/code/Magento/Review/i18n/zh_CN.csv @@ -101,3 +101,32 @@ "Product Reviews","产å“评测" "Products Reviews","产å“评论" "Reviews","评测" +"1 star","1 星" +"2 stars","2 星" +"3 stars","3 星" +"4 stars","4 星" +"5 stars","5 星" +"Add New Rating","æ·»åŠ æ–°è¯„çº§" +"Assigned Options","分é…的选项" +"Be the first to review this product","作为评论该产å“的第一人" +"Default Value","默认值" +"Delete Rating","åˆ é™¤è¯„çº§" +"Edit Rating","编辑评级" +"ID","ID" +"If you do not specify a rating title for a store, the default value will be used.","如果您ä¸ä¸ºå•†åº—æŒ‡å®šè¯„çº§æ ‡é¢˜ï¼Œåˆ™å°†ä½¿ç”¨é»˜è®¤å€¼ã€‚" +"Manage Ratings","管ç†è¯„级" +"New Rating","新评级" +"Option Label","é€‰é¡¹æ ‡ç¾" +"Option Title","é€‰é¡¹æ ‡é¢˜" +"Option Title:","é€‰é¡¹æ ‡é¢˜ï¼š" +"Please select one of each ratings above","请选择上述评级" +"Rating Information","评级信æ¯" +"Rating","评级åç§°" +"Rating Options","评级选项" +"Rating Title","è¯„çº§æ ‡é¢˜" +"Rating Visibility","评级能è§åº¦" +"Rating isn't Available","评级ä¸å¯ç”¨" +"Rating with the same title","对åŒä¸€å称打分" +"Save Rating","ä¿å˜è¯„分" +"Sort Order","排åºé¡ºåº" +"Visibility","å¯è§æ€§" diff --git a/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php b/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php index 9c037557c7da7ab7ed58903957b4946a7fd8f95d..11b7361b91d7bbd3b76bfda053eb7247fea8df11 100644 --- a/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php +++ b/app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php @@ -32,7 +32,7 @@ * @author Magento Core Team <core@magentocommerce.com> */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); /** @@ -213,9 +213,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('review_detail', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('review_detail', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -269,9 +269,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('review_entity_summary', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('review_entity_summary', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('review_entity_summary', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -308,9 +308,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('review_store', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('review_store', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -319,4 +319,394 @@ $table = $installer->getConnection()->newTable( ); $installer->getConnection()->createTable($table); +/** + * Create table 'rating_entity' + */ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_entity') +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Entity Id' +)->addColumn( + 'entity_code', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 64, + array('nullable' => false), + 'Entity Code' +)->addIndex( + $installer->getIdxName( + 'rating_entity', + array('entity_code'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('entity_code'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->setComment( + 'Rating entities' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating') +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Rating Id' +)->addColumn( + 'entity_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Entity Id' +)->addColumn( + 'rating_code', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 64, + array('nullable' => false), + 'Rating Code' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Rating Position On Frontend' +)->addColumn( + 'is_active', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => 1), + 'Rating is active.' +)->addIndex( + $installer->getIdxName('rating', array('rating_code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + array('rating_code'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('rating', array('entity_id')), + array('entity_id') +)->addForeignKey( + $installer->getFkName('rating', 'entity_id', 'rating_entity', 'entity_id'), + 'entity_id', + $installer->getTable('rating_entity'), + 'entity_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Ratings' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating_option' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_option') +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Rating Option Id' +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Rating Id' +)->addColumn( + 'code', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 32, + array('nullable' => false), + 'Rating Option Code' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Rating Option Value' +)->addColumn( + 'position', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Ration option position on frontend' +)->addIndex( + $installer->getIdxName('rating_option', array('rating_id')), + array('rating_id') +)->addForeignKey( + $installer->getFkName('rating_option', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Rating options' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating_option_vote' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_option_vote') +)->addColumn( + 'vote_id', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Vote id' +)->addColumn( + 'option_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Vote option id' +)->addColumn( + 'remote_ip', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 16, + array('nullable' => false), + 'Customer IP' +)->addColumn( + 'remote_ip_long', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array('nullable' => false, 'default' => 0), + 'Customer IP converted to long integer format' +)->addColumn( + 'customer_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'default' => 0), + 'Customer Id' +)->addColumn( + 'entity_pk_value', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Product id' +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Rating id' +)->addColumn( + 'review_id', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array('unsigned' => true), + 'Review id' +)->addColumn( + 'percent', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => 0), + 'Percent amount' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => 0), + 'Vote option value' +)->addIndex( + $installer->getIdxName('rating_option_vote', array('option_id')), + array('option_id') +)->addForeignKey( + $installer->getFkName('rating_option_vote', 'option_id', 'rating_option', 'option_id'), + 'option_id', + $installer->getTable('rating_option'), + 'option_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Rating option values' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating_option_vote_aggregated' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_option_vote_aggregated') +)->addColumn( + 'primary_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('identity' => true, 'nullable' => false, 'primary' => true), + 'Vote aggregation id' +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Rating id' +)->addColumn( + 'entity_pk_value', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Product id' +)->addColumn( + 'vote_count', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Vote dty' +)->addColumn( + 'vote_value_sum', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'General vote sum' +)->addColumn( + 'percent', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('nullable' => false, 'default' => 0), + 'Vote percent' +)->addColumn( + 'percent_approved', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('default' => '0'), + 'Vote percent approved by admin' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0), + 'Store Id' +)->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', array('rating_id')), + array('rating_id') +)->addIndex( + $installer->getIdxName('rating_option_vote_aggregated', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('rating_option_vote_aggregated', 'store_id', 'core_store', 'store_id'), + 'store_id', + $installer->getTable('core_store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Rating vote aggregated' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating_store' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_store') +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), + 'Rating id' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), + 'Store id' +)->addIndex( + $installer->getIdxName('rating_store', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('rating_store', 'store_id', 'core_store', 'store_id'), + 'store_id', + $installer->getTable('core_store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('rating_store', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_NO_ACTION +)->setComment( + 'Rating Store' +); +$installer->getConnection()->createTable($table); + +/** +* Create table 'rating_title' +*/ +$table = $installer->getConnection()->newTable( + $installer->getTable('rating_title') +)->addColumn( + 'rating_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), + 'Rating Id' +)->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => 0, 'primary' => true), + 'Store Id' +)->addColumn( + 'value', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array('nullable' => false), + 'Rating Label' +)->addIndex( + $installer->getIdxName('rating_title', array('store_id')), + array('store_id') +)->addForeignKey( + $installer->getFkName('rating_title', 'rating_id', 'rating', 'rating_id'), + 'rating_id', + $installer->getTable('rating'), + 'rating_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('rating_title', 'store_id', 'core_store', 'store_id'), + 'store_id', + $installer->getTable('core_store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +)->setComment( + 'Rating Title' +); +$installer->getConnection()->createTable($table); + +/** +* Review/Rating module upgrade. +* Create FK for 'rating_option_vote' +*/ +$table = $installer->getConnection()->addForeignKey( + $installer->getFkName('rating_option_vote', 'review_id', 'review', 'review_id'), + $installer->getTable('rating_option_vote'), + 'review_id', + $installer->getTable('review'), + 'review_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE +); + $this->endSetup(); diff --git a/app/code/Magento/Catalog/view/adminhtml/js/rating.js b/app/code/Magento/Review/view/adminhtml/js/rating.js similarity index 100% rename from app/code/Magento/Catalog/view/adminhtml/js/rating.js rename to app/code/Magento/Review/view/adminhtml/js/rating.js diff --git a/app/code/Magento/Rating/view/adminhtml/layout/rating_block.xml b/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml similarity index 97% rename from app/code/Magento/Rating/view/adminhtml/layout/rating_block.xml rename to app/code/Magento/Review/view/adminhtml/layout/rating_block.xml index 8a05113adfc51ded8839533ac6b36a1118ce4e66..27fb8b56201de291fa59d6429b2d76cb0b92f964 100644 --- a/app/code/Magento/Rating/view/adminhtml/layout/rating_block.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/rating_block.xml @@ -28,7 +28,7 @@ <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.rating.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">ratingsGrid</argument> - <argument name="dataSource" xsi:type="object">Magento\Rating\Model\Resource\Rating\Grid\Collection</argument> + <argument name="dataSource" xsi:type="object">Magento\Review\Model\Resource\Rating\Grid\Collection</argument> <argument name="default_sort" xsi:type="string">rating_code</argument> <argument name="default_dir" xsi:type="string">ASC</argument> <argument name="save_parameters_in_session" xsi:type="string">1</argument> @@ -36,7 +36,7 @@ <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="adminhtml.rating.grid.columnSet" as="grid.columnSet"> <arguments> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">rating/*/edit</item> + <item name="path" xsi:type="string">review/rating/edit</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="id" xsi:type="string">getId</item> </item> diff --git a/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml index d820fefa0776e4ffae9cf0548f0887be0a44cbd2..ca496063907b7d1984df9dc79247a8417155547e 100644 --- a/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml @@ -27,7 +27,7 @@ <referenceBlock name="head"> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-catalog-js-rating-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Catalog::js/rating.js</argument> + <argument name="file" xsi:type="string">Magento_Review::js/rating.js</argument> </arguments> </block> </referenceBlock> diff --git a/app/code/Magento/Rating/view/adminhtml/layout/rating_index_index.xml b/app/code/Magento/Review/view/adminhtml/layout/review_rating_index.xml similarity index 95% rename from app/code/Magento/Rating/view/adminhtml/layout/rating_index_index.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_rating_index.xml index 620985029399fe3a094ab579e865c74a4eb198f1..90474ce810826a5876f42d1fbfe96dbd2e425d40 100644 --- a/app/code/Magento/Rating/view/adminhtml/layout/rating_index_index.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_rating_index.xml @@ -27,6 +27,6 @@ <update handle="formkey"/> <update handle="rating_block"/> <referenceContainer name="content"> - <block class="Magento\Rating\Block\Adminhtml\Rating" name="adminhtml.rating.container"/> + <block class="Magento\Review\Block\Adminhtml\Rating" name="adminhtml.rating.container"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml b/app/code/Magento/Review/view/adminhtml/rating/detailed.phtml similarity index 97% rename from app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml rename to app/code/Magento/Review/view/adminhtml/rating/detailed.phtml index fd24b1442ec2406d0690f17832b3f9f88fd3cca4..c67c169ef0e26687e41a67481df5c6722f1acc4d 100644 --- a/app/code/Magento/Rating/view/adminhtml/rating/detailed.phtml +++ b/app/code/Magento/Review/view/adminhtml/rating/detailed.phtml @@ -47,7 +47,7 @@ (function($) { "use strict"; $.mage.extend('validation', 'validation', - '<?php echo $this->getViewFileUrl('Magento_Rating::rating/validation-rules.js'); ?>'); + '<?php echo $this->getViewFileUrl('Magento_Review::rating/validation-rules.js'); ?>'); $('[data-widget="ratingControl"]').ratingControl(); })(jQuery); </script> diff --git a/app/code/Magento/Rating/view/adminhtml/rating/options.phtml b/app/code/Magento/Review/view/adminhtml/rating/options.phtml similarity index 100% rename from app/code/Magento/Rating/view/adminhtml/rating/options.phtml rename to app/code/Magento/Review/view/adminhtml/rating/options.phtml diff --git a/app/code/Magento/Rating/view/adminhtml/rating/stars/detailed.phtml b/app/code/Magento/Review/view/adminhtml/rating/stars/detailed.phtml similarity index 100% rename from app/code/Magento/Rating/view/adminhtml/rating/stars/detailed.phtml rename to app/code/Magento/Review/view/adminhtml/rating/stars/detailed.phtml diff --git a/app/code/Magento/Rating/view/adminhtml/rating/stars/summary.phtml b/app/code/Magento/Review/view/adminhtml/rating/stars/summary.phtml similarity index 100% rename from app/code/Magento/Rating/view/adminhtml/rating/stars/summary.phtml rename to app/code/Magento/Review/view/adminhtml/rating/stars/summary.phtml diff --git a/app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js b/app/code/Magento/Review/view/adminhtml/rating/validation-rules.js similarity index 98% rename from app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js rename to app/code/Magento/Review/view/adminhtml/rating/validation-rules.js index 6a4f582c77d9e933fe5306def2854e12e7808323..64390b7ce4b8a9f16bf05167536d41170a07d369 100644 --- a/app/code/Magento/Rating/view/adminhtml/rating/validation-rules.js +++ b/app/code/Magento/Review/view/adminhtml/rating/validation-rules.js @@ -20,7 +20,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Rating + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Rating/view/frontend/detailed.phtml b/app/code/Magento/Review/view/frontend/detailed.phtml similarity index 100% rename from app/code/Magento/Rating/view/frontend/detailed.phtml rename to app/code/Magento/Review/view/frontend/detailed.phtml diff --git a/app/code/Magento/Rating/view/frontend/empty.phtml b/app/code/Magento/Review/view/frontend/empty.phtml similarity index 100% rename from app/code/Magento/Rating/view/frontend/empty.phtml rename to app/code/Magento/Review/view/frontend/empty.phtml diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php index 3215e9cc64e31d22d5a80f8d6c51b709f6c18fde..f42447812049d9ff0aa74d2851241f80e015f7d5 100644 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php @@ -94,7 +94,11 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog $storeModel = $this->_storeManager->getStore($storeId); $newUrl = $this->_urlBuilder->getUrl('rss/catalog/new/store_id/' . $storeId); $title = __('New Products from %1', $storeModel->getFrontendName()); - $lang = $storeModel->getConfig('general/locale/code'); + $lang = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeModel + ); /** @var $rssObj \Magento\Rss\Model\Rss */ $rssObj = $this->_rssFactory->create(); diff --git a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php index 3f1fa556ab22fae80c6184119e54c5e503fa9540..f79d4e15d710ad64a39ae711340324275d77ba56 100644 --- a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php @@ -96,8 +96,9 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock array('title' => $title, 'description' => $title, 'link' => $newUrl, 'charset' => 'UTF-8') ); - $globalNotifyStockQty = (double)$this->_storeConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_NOTIFY_STOCK_QTY + $globalNotifyStockQty = (double)$this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_NOTIFY_STOCK_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); /* @var $product \Magento\Catalog\Model\Product */ $product = $this->_productFactory->create(); diff --git a/app/code/Magento/Rss/Block/Catalog/Review.php b/app/code/Magento/Rss/Block/Catalog/Review.php index 6cfe4d18b440e8b0fc7a8d633f14350de86987dc..11506ed02d5d375481acc78ddafaa28822e53f33 100644 --- a/app/code/Magento/Rss/Block/Catalog/Review.php +++ b/app/code/Magento/Rss/Block/Catalog/Review.php @@ -46,7 +46,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock protected $_reviewFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -55,7 +55,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Review\Model\ReviewFactory $reviewFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ public function __construct( @@ -63,7 +63,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Review\Model\ReviewFactory $reviewFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array() ) { $this->_rssFactory = $rssFactory; diff --git a/app/code/Magento/Rss/Block/Catalog/Salesrule.php b/app/code/Magento/Rss/Block/Catalog/Salesrule.php index 6545566461e7599a1e93cfe1b435dd1bc74fc8b2..6475dd7ad5639ccd9d7b6e56d3189fd912cb73cb 100644 --- a/app/code/Magento/Rss/Block/Catalog/Salesrule.php +++ b/app/code/Magento/Rss/Block/Catalog/Salesrule.php @@ -85,8 +85,12 @@ class Salesrule extends \Magento\Rss\Block\AbstractBlock $now = date('Y-m-d'); $url = $this->_urlBuilder->getUrl(''); $newUrl = $this->_urlBuilder->getUrl('rss/catalog/salesrule'); - $lang = $storeModel->getConfig('general/locale/code'); $title = __('%1 - Discounts and Coupons', $storeModel->getName()); + $lang = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeModel + ); /** @var $rssObject \Magento\Rss\Model\Rss */ $rssObject = $this->_rssFactory->create(); @@ -117,11 +121,8 @@ class Salesrule extends \Magento\Rss\Block\AbstractBlock /** @var $ruleModel \Magento\SalesRule\Model\Rule */ foreach ($collection as $ruleModel) { - $description = '<table><tr>' . - '<td style="text-decoration:none;">' . - $ruleModel->getDescription() . - '<br/>Discount Start Date: ' . - $this->formatDate( + $description = '<table><tr>' . '<td style="text-decoration:none;">' . $ruleModel->getDescription() + . '<br/>Discount Start Date: ' . $this->formatDate( $ruleModel->getFromDate(), 'medium' ); diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php index fcd0c1671a74331e0af7a439daa81d1082a817d0..f98103a4ed8f72b97fbb87630377365f8b56994a 100644 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ b/app/code/Magento/Rss/Block/Catalog/Special.php @@ -154,7 +154,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog $newUrl = $this->_urlBuilder->getUrl('rss/catalog/special/store_id/' . $storeId); $title = __('%1 - Special Products', $this->_storeManager->getStore()->getFrontendName()); - $lang = $this->_storeConfig->getConfig('general/locale/code'); + $lang = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); /** @var $rssObj \Magento\Rss\Model\Rss */ $rssObj = $this->_rssFactory->create(); $rssObj->_addHeader( diff --git a/app/code/Magento/Rss/Block/ListBlock.php b/app/code/Magento/Rss/Block/ListBlock.php index 1082aafb97cf09baf47478af3756347d98783e49..c9ee80b7a1ccb0f31799d0bd238539dbd7c776aa 100644 --- a/app/code/Magento/Rss/Block/ListBlock.php +++ b/app/code/Magento/Rss/Block/ListBlock.php @@ -179,7 +179,7 @@ class ListBlock extends \Magento\View\Element\Template public function newProductRssFeed() { $path = self::XML_PATH_RSS_METHODS . '/catalog/new'; - if ((bool)$this->_storeConfig->getConfig($path)) { + if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->addRssFeed($path, __('New Products')); } } @@ -192,7 +192,7 @@ class ListBlock extends \Magento\View\Element\Template public function specialProductRssFeed() { $path = self::XML_PATH_RSS_METHODS . '/catalog/special'; - if ((bool)$this->_storeConfig->getConfig($path)) { + if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->addRssFeed($path, __('Special Products'), array(), true); } } @@ -205,7 +205,7 @@ class ListBlock extends \Magento\View\Element\Template public function salesRuleProductRssFeed() { $path = self::XML_PATH_RSS_METHODS . '/catalog/salesrule'; - if ((bool)$this->_storeConfig->getConfig($path)) { + if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->addRssFeed($path, __('Coupons/Discounts'), array(), true); } } @@ -218,7 +218,7 @@ class ListBlock extends \Magento\View\Element\Template public function categoriesRssFeed() { $path = self::XML_PATH_RSS_METHODS . '/catalog/category'; - if ((bool)$this->_storeConfig->getConfig($path)) { + if ((bool)$this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { /** @var $category \Magento\Catalog\Model\Category */ $category = $this->_categoryFactory->create(); $treeModel = $category->getTreeModel()->loadNode($this->_storeManager->getStore()->getRootCategoryId()); diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php index e9111f755bebb80e7aaefe0032d6fd8e14d321f9..7e90e9260636b900b1c9e518e7244bedd611e4ca 100644 --- a/app/code/Magento/Rss/Block/Wishlist.php +++ b/app/code/Magento/Rss/Block/Wishlist.php @@ -87,13 +87,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_coreData = $coreData; $this->_wishlistFactory = $wishlistFactory; $this->_rssFactory = $rssFactory; - parent::__construct( - $context, - $httpContext, - $productFactory, - $data, - $priceBlockTypes - ); + parent::__construct($context, $httpContext, $productFactory, $data, $priceBlockTypes); } /** @@ -138,7 +132,10 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock array('code' => $this->_getWishlist()->getSharingCode()) ); $title = $this->_getTitle(); - $lang = $this->_storeConfig->getConfig('general/locale/code'); + $lang = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $rssObj->_addHeader( array( 'title' => $title, @@ -149,7 +146,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock ) ); - /** @var $wishlistItem \Magento\Wishlist\Model\Item*/ + /** @var $wishlistItem \Magento\Wishlist\Model\Item */ foreach ($this->getWishlistItems() as $wishlistItem) { /* @var $product \Magento\Catalog\Model\Product */ $product = $wishlistItem->getProduct(); diff --git a/app/code/Magento/Rss/Controller/Catalog.php b/app/code/Magento/Rss/Controller/Catalog.php index a20414e1d4f3eb3300f2c7af1e5b969541e384d9..d08d71d8ccf6c993cb967026f3d32e03f11eb0a3 100644 --- a/app/code/Magento/Rss/Controller/Catalog.php +++ b/app/code/Magento/Rss/Controller/Catalog.php @@ -31,17 +31,19 @@ namespace Magento\Rss\Controller; class Catalog extends \Magento\App\Action\Action { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\App\Action\Context $context, \Magento\Core\Model\Store\Config $storeConfig) - { - $this->_storeConfig = $storeConfig; + public function __construct( + \Magento\App\Action\Context $context, + \Magento\App\Config\ScopeConfigInterface $scopeConfig + ) { + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -100,7 +102,7 @@ class Catalog extends \Magento\App\Action\Action */ protected function _isEnabled($code) { - return $this->_storeConfig->getConfigFlag("rss/catalog/{$code}"); + return $this->_scopeConfig->isSetFlag("rss/catalog/{$code}", \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Rss/Controller/Index.php b/app/code/Magento/Rss/Controller/Index.php index 6192cdb4c84b19e4fe9253071fb34d4826fe09fd..f72f9517cc8aefff860bad96d6f45acfc3884d2c 100644 --- a/app/code/Magento/Rss/Controller/Index.php +++ b/app/code/Magento/Rss/Controller/Index.php @@ -30,9 +30,9 @@ use Magento\App\Action\NotFoundException; class Index extends \Magento\App\Action\Action { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\Rss\Helper\WishlistRss @@ -46,17 +46,17 @@ class Index extends \Magento\App\Action\Action /** * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Rss\Helper\WishlistRss $wishlistHelper * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Rss\Helper\WishlistRss $wishlistHelper, \Magento\Customer\Model\Session $customerSession ) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_wishlistHelper = $wishlistHelper; $this->_customerSession = $customerSession; parent::__construct($context); @@ -70,7 +70,7 @@ class Index extends \Magento\App\Action\Action */ public function indexAction() { - if ($this->_storeConfig->getConfig('rss/config/active')) { + if ($this->_scopeConfig->getValue('rss/config/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $this->_view->loadLayout(); $this->_view->renderLayout(); } else { @@ -107,11 +107,11 @@ class Index extends \Magento\App\Action\Action */ public function wishlistAction() { - if ($this->_storeConfig->getConfig('rss/wishlist/active')) { + if ($this->_scopeConfig->getValue('rss/wishlist/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $wishlist = $this->_wishlistHelper->getWishlist(); if ($wishlist && ($wishlist->getVisibility() - || $this->_customerSession->authenticate($this) - && $wishlist->getCustomerId() == $this->_wishlistHelper->getCustomer()->getId()) + || $this->_objectManager->get('Magento\Customer\Model\Session')->authenticate($this) + && $wishlist->getCustomerId() == $this->_wishlistHelper->getCustomer()->getId()) ) { $this->getResponse()->setHeader('Content-Type', 'text/xml; charset=UTF-8'); $this->_view->loadLayout(false); diff --git a/app/code/Magento/Rss/Helper/Order.php b/app/code/Magento/Rss/Helper/Order.php index 55cb4f4bd600f84982f2daa9a93bffef336b7da2..e0933a25d40229025899796daebb0a2e0902559f 100644 --- a/app/code/Magento/Rss/Helper/Order.php +++ b/app/code/Magento/Rss/Helper/Order.php @@ -33,9 +33,9 @@ namespace Magento\Rss\Helper; class Order extends \Magento\App\Helper\AbstractHelper { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\OrderFactory @@ -44,15 +44,15 @@ class Order extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\OrderFactory $orderFactory ) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_orderFactory = $orderFactory; parent::__construct($context); } @@ -64,7 +64,7 @@ class Order extends \Magento\App\Helper\AbstractHelper */ public function isStatusNotificationAllow() { - if ($this->_storeConfig->getConfig('rss/order/status_notified')) { + if ($this->_scopeConfig->getValue('rss/order/status_notified', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { return true; } return false; diff --git a/app/code/Magento/Rss/Helper/WishlistRss.php b/app/code/Magento/Rss/Helper/WishlistRss.php index e1482ca9db8a751ca61127c7914db66a230faf6a..414ab732519ebe2084c6b95f2461ac22441497bd 100644 --- a/app/code/Magento/Rss/Helper/WishlistRss.php +++ b/app/code/Magento/Rss/Helper/WishlistRss.php @@ -36,55 +36,42 @@ class WishlistRss extends \Magento\Wishlist\Helper\Data */ protected $_customerBuilder; - /** - * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface - */ - protected $_customerAccountService; - - /** - * @var \Magento\Customer\Helper\View - */ - protected $_customerViewHelper; - /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\PostData $postDataHelper * @param \Magento\Customer\Helper\View $customerViewHelper * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder - * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Registry $coreRegistry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Core\Helper\PostData $postDataHelper, \Magento\Customer\Helper\View $customerViewHelper, - \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, - \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder ) { - $this->_customerViewHelper = $customerViewHelper; $this->_customerBuilder = $customerBuilder; - $this->_customerAccountService = $customerAccountService; parent::__construct( $context, $coreData, $coreRegistry, - $coreStoreConfig, + $scopeConfig, $customerSession, $wishlistFactory, $storeManager, - $postDataHelper + $postDataHelper, + $customerViewHelper ); } @@ -130,29 +117,4 @@ class WishlistRss extends \Magento\Wishlist\Helper\Data return $this->_customer; } - - /** - * Set current customer - * - * @param \Magento\Customer\Model\Customer $customer - * @return void - */ - public function setCustomer(\Magento\Customer\Model\Customer $customer) - { - /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ - $this->_customer = $this->_customerAccountService->getCustomer($customer->getId()); - } - - /** - * Retrieve customer name - * - * @return string|void - */ - public function getCustomerName() - { - /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ - return $this->getCustomer() - ? $this->_customerViewHelper->getCustomerName($this->getCustomer()) - : null; - } } diff --git a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php index ae9e2fe2b5211ea8a8ceee4250b4bcb04af93120..48591e2ccfbefdcdfba51335efff0d5d607d4346 100644 --- a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php +++ b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php @@ -29,7 +29,7 @@ namespace Magento\Rss\Model\System\Config\Backend; * Cache cleaner backend model * */ -class Links extends \Magento\Core\Model\Config\Value +class Links extends \Magento\App\Config\Value { /** * @var \Magento\App\Cache\TypeListInterface @@ -39,8 +39,7 @@ class Links extends \Magento\Core\Model\Config\Value /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\App\Cache\TypeListInterface $cacheTypeList * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -49,15 +48,14 @@ class Links extends \Magento\Core\Model\Config\Value public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\App\Cache\TypeListInterface $cacheTypeList, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_cacheTypeList = $cacheTypeList; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index 774ccf502fc9a9d3cf4081f24f340deb63fea3be..31ff9ce34039dcc53631bdc5bb84a656a4e49053 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -35,6 +35,7 @@ <module name="Magento_Wishlist"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php index d084d1e7fac678700839bf8af3324cbb1b152078..cb853cf3c02053880e18f2b8ad64dcff64f625d2 100644 --- a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php +++ b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php @@ -100,7 +100,7 @@ abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\ /** * Limit rules collection by specific websites * - * @param int|int[]|\Magento\Core\Model\Website $websiteId + * @param int|int[]|\Magento\Store\Model\Website $websiteId * @return $this */ public function addWebsiteFilter($websiteId) @@ -108,7 +108,7 @@ abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\ $entityInfo = $this->_getAssociatedEntityInfo('website'); if (!$this->getFlag('is_website_table_joined')) { $this->setFlag('is_website_table_joined', true); - if ($websiteId instanceof \Magento\Core\Model\Website) { + if ($websiteId instanceof \Magento\Store\Model\Website) { $websiteId = $websiteId->getId(); } diff --git a/app/code/Magento/Rule/etc/module.xml b/app/code/Magento/Rule/etc/module.xml index c34c82d2fccc9946277b14cf42c158033e2ea3e7..8613257ee366b2431ba5a5bf559648bdcc44f3f3 100644 --- a/app/code/Magento/Rule/etc/module.xml +++ b/app/code/Magento/Rule/etc/module.xml @@ -27,9 +27,10 @@ <module name="Magento_Rule" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> - <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Eav"/> <module name="Magento_Catalog"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php index 3bff3d51549bf4a04494d81f901108ddb36bb12c..64216ce76f4da6593657b8f517e8993de04ba589 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php @@ -529,7 +529,11 @@ class AbstractItems extends \Magento\Backend\Block\Template */ public function canReturnToStock() { - if ($this->_storeConfig->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT)) { + if ($this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return true; } else { return false; @@ -544,8 +548,9 @@ class AbstractItems extends \Magento\Backend\Block\Template */ public function canReturnItemToStock($item = null) { - $canReturnToStock = $this->_storeConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT + $canReturnToStock = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!is_null($item)) { if (!$item->hasCanReturnToStock()) { @@ -569,8 +574,9 @@ class AbstractItems extends \Magento\Backend\Block\Template */ public function canParentReturnToStock($item = null) { - $canReturnToStock = $this->_storeConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT + $canReturnToStock = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!is_null($item)) { if ($item->getCreditmemo()->getOrder()->hasCanReturnToStock()) { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php index e2a8f127ec2df65ea42497e8c7775b543d52dedb..9eadaea45b45e61a23841fbf0dfb81aa6cc01333 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/AbstractCreate.php @@ -108,7 +108,7 @@ abstract class AbstractCreate extends \Magento\Backend\Block\Widget /** * Retrieve store model object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php index 951c6bc80a695dbcaa0d0ab3fecf7d49fc0b1f5b..d6253c4d1df54463a03001dd2df94b291e412a6b 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Form/Address.php @@ -120,7 +120,7 @@ class Address extends \Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractF */ public function getConfig($path) { - return $this->_storeConfig->getConfig($path); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php index 9995d28144fa5b85b18c6b7d40a401eaa9f804bf..3e9455e9c9924ffd7bbfbbced2227e5efc160a5d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php @@ -509,7 +509,7 @@ class Grid extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate /** * Get store * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php index 3d70bd5c6ea53a27309f6d6d550dc814ee7ef63f..042d85320bc9ce474c544df810e461477a675ae5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php @@ -109,7 +109,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended /** * Retrieve quote store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php index 109d44cb6452c913ab8ddd39d0d7f1e6bf2c63aa..2fcff5d41833245cac2cd379d6e14689b500a965 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Shipping/Method/Form.php @@ -108,7 +108,11 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate */ public function getCarrierName($carrierCode) { - if ($name = $this->_storeConfig->getConfig('carriers/' . $carrierCode . '/title', $this->getStore()->getId()) + if ($name = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore()->getId() + ) ) { return $name; } @@ -181,7 +185,6 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate $flag, $this->getAddress(), null, - //We should send exact quote store to prevent fetching default config for admin store. $this->getAddress()->getQuote()->getStore() ), true diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php index a001d3d3c4783d96e58f00a13cec8d27afe6015d..222426564e1f068d8df2f1132a0467e44210e810 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/DefaultTotals.php @@ -52,7 +52,7 @@ class DefaultTotals extends \Magento\Sales\Block\Adminhtml\Order\Create\Totals /** * Retrieve store model object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Table.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Table.php index 613a532a314eecc149ff6aae87b6b31203a252d7..95ca6b2a98c1bc2492236eecb265d6037deb2faf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Table.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals/Table.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Create\Totals; -use Magento\Core\Model\Resource\Website\Collection; +use Magento\Store\Model\Resource\Website\Collection; /** * Adminhtml sales order create totals table block diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php index c6ded3ff8bace6cee7ec1d9ea7e3426362e265ac..e5cbca35b706b370102fdda36d02db829c1d8fe3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/Create/Items.php @@ -214,8 +214,9 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ public function canReturnToStock() { - $canReturnToStock = $this->_storeConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT + $canReturnToStock = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if ($canReturnToStock) { return true; @@ -232,8 +233,9 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems public function canReturnItemsToStock() { if (is_null($this->_canReturnToStock)) { - $this->_canReturnToStock = $this->_storeConfig->getConfig( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT + $this->_canReturnToStock = $this->_scopeConfig->getValue( + \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_CAN_SUBTRACT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if ($this->_canReturnToStock) { $canReturnToStock = false; diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php index a251b3e6d741b63650e6df473d65c5397517b7c0..b132f8a0a1925266d7eee4eca9836fd0fac785c2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php @@ -92,6 +92,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'send_notification', array( 'label' => __('Send Email'), + 'class' => 'send-email', 'onclick' => 'confirmSetLocation(\'' . __( 'Are you sure you want to send a Credit memo email to customer?' ) . '\', \'' . $this->getEmailUrl() . '\')' @@ -104,7 +105,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'refund', array( 'label' => __('Refund'), - 'class' => 'save', + 'class' => 'refund', 'onclick' => 'setLocation(\'' . $this->getRefundUrl() . '\')' ) ); @@ -115,7 +116,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'void', array( 'label' => __('Void'), - 'class' => 'save', + 'class' => 'void', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')' ) ); @@ -126,7 +127,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'print', array( 'label' => __('Print'), - 'class' => 'save', + 'class' => 'print', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')' ) ); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php index 98cecac536cb2e80fa7de452d8ba74cc38c96557..b27b04ac7fa6f1ef450524ff5b3953988fe833f2 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/View.php @@ -113,6 +113,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'send_notification', array( 'label' => __('Send Email'), + 'class' => 'send-email', 'onclick' => 'confirmSetLocation(\'' . __( 'Are you sure you want to send an Invoice email to customer?' ) . '\', \'' . $this->getEmailUrl() . '\')' @@ -132,7 +133,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'capture', array( // capture? 'label' => __('Credit Memo'), - 'class' => 'go', + 'class' => 'credit-memo', 'onclick' => 'setLocation(\'' . $this->getCreditMemoUrl() . '\')' ) ); @@ -147,7 +148,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'capture', array( 'label' => __('Capture'), - 'class' => 'save', + 'class' => 'capture', 'onclick' => 'setLocation(\'' . $this->getCaptureUrl() . '\')' ) ); @@ -158,7 +159,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'void', array( 'label' => __('Void'), - 'class' => 'save', + 'class' => 'void', 'onclick' => 'setLocation(\'' . $this->getVoidUrl() . '\')' ) ); @@ -169,7 +170,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'print', array( 'label' => __('Print'), - 'class' => 'save', + 'class' => 'print', 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')' ) ); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php index 0993af6bd75d04d9f3c220c1538e47842af987f8..33f2a3c3d42e577ddc553269ea205723d5f17092 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php @@ -124,7 +124,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax /** * Get store object for process configuration settings * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index 6b52c104bcc51a3eb1c1188aa93339a998e263b5..07000e275271c6afb6617214316a2308f9ce8852 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -109,7 +109,10 @@ class View extends \Magento\Backend\Block\Widget\Form\Container $onclickJs = 'deleteConfirm(\'' . __( 'Are you sure? This order will be canceled and a new one will be created instead.' ) . '\', \'' . $this->getEditUrl() . '\');'; - $this->_addButton('order_edit', array('label' => __('Edit'), 'onclick' => $onclickJs)); + $this->_addButton( + 'order_edit', + array('label' => __('Edit'), 'class' => 'edit primary', 'onclick' => $onclickJs) + ); // see if order has non-editable products as items $nonEditableTypes = array_keys( $this->getOrder()->getResource()->aggregateProductsByTypes( @@ -123,7 +126,9 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'order_edit', 'onclick', 'if (!confirm(\'' . __( - 'This order contains (%1) items and therefore cannot be edited through the admin interface. If you wish to continue editing, the (%2) items will be removed, the order will be canceled and a new order will be placed.', + 'This order contains (%1) items and therefore cannot be edited through the admin interface. ' . + 'If you wish to continue editing, the (%2) items will be removed, ' . + ' the order will be canceled and a new order will be placed.', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes) ) . '\')) return false;' . $onclickJs @@ -137,6 +142,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'order_cancel', array( 'label' => __('Cancel'), + 'class' => 'cancel', 'onclick' => 'deleteConfirm(\'' . $message . '\', \'' . $this->getCancelUrl() . '\')' ) ); @@ -148,6 +154,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container 'send_notification', array( 'label' => __('Send Email'), + 'class' => 'send-email', 'onclick' => "confirmSetLocation('{$message}', '{$this->getEmailUrl()}')" ) ); @@ -155,7 +162,8 @@ class View extends \Magento\Backend\Block\Widget\Form\Container if ($this->_isAllowedAction('Magento_Sales::creditmemo') && $order->canCreditmemo()) { $message = __( - 'This will create an offline refund. To create an online refund, open an invoice and create credit memo for it. Do you want to continue?' + 'This will create an offline refund. ' . + 'To create an online refund, open an invoice and create credit memo for it. Do you want to continue?' ); $onClick = "setLocation('{$this->getCreditmemoUrl()}')"; if ($order->getPayment()->getMethodInstance()->isGateway()) { @@ -163,7 +171,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container } $this->_addButton( 'order_creditmemo', - array('label' => __('Credit Memo'), 'onclick' => $onClick, 'class' => 'go') + array('label' => __('Credit Memo'), 'onclick' => $onClick, 'class' => 'credit-memo') ); } @@ -182,14 +190,22 @@ class View extends \Magento\Backend\Block\Widget\Form\Container if ($this->_isAllowedAction('Magento_Sales::hold') && $order->canHold()) { $this->_addButton( 'order_hold', - array('label' => __('Hold'), 'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')') + array( + 'label' => __('Hold'), + 'class' => __('hold'), + 'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')' + ) ); } if ($this->_isAllowedAction('Magento_Sales::unhold') && $order->canUnhold()) { $this->_addButton( 'order_unhold', - array('label' => __('Unhold'), 'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')') + array( + 'label' => __('Unhold'), + 'class' => __('unhold'), + 'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')' + ) ); } @@ -230,7 +246,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container array( 'label' => $_label, 'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')', - 'class' => 'go' + 'class' => 'invoice' ) ); } @@ -244,7 +260,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container array( 'label' => __('Ship'), 'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')', - 'class' => 'go' + 'class' => 'ship' ) ); } @@ -260,7 +276,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container array( 'label' => __('Reorder'), 'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')', - 'class' => 'go' + 'class' => 'reorder' ) ); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index b77f9d95a7bee008f14983ef7b6f151f2c7fda6d..02c471f24deafe7c3cc81e2f19b0aa97e5bce69f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -229,7 +229,11 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder */ public function shouldDisplayCustomerIp() { - return !$this->_storeConfig->getConfigFlag('sales/general/hide_customer_ip', $this->getOrder()->getStoreId()); + return !$this->_scopeConfig->isSetFlag( + 'sales/general/hide_customer_ip', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getOrder()->getStoreId() + ); } /** diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo.php index dcdec9c85a89db5c43118260c754bdd661721720..1a3c8dc218daf67030abaf6e18ba792d8510a27c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo.php @@ -42,8 +42,10 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract public function exportCsvAction() { $fileName = 'creditmemos.csv'; + /** @var $grid \Magento\Sales\Block\Adminhtml\Creditmemo\Grid*/ $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Creditmemo\Grid'); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + $csvFile = $grid->getCsvFile(); + return $this->_fileFactory->create($fileName, $csvFile, \Magento\App\Filesystem::VAR_DIR); } /** @@ -55,7 +57,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract { $fileName = 'creditmemos.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Creditmemo\Grid'); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Invoice.php index e54b384790ea7f22e0c178e6af2597a800100b88..db0f5545fcbe0e82347621c7c26f64a2b67dac04 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Invoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Invoice.php @@ -43,7 +43,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic { $fileName = 'invoices.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Invoice\Grid'); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -55,6 +55,6 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic { $fileName = 'invoices.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Invoice\Grid'); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Shipment.php b/app/code/Magento/Sales/Controller/Adminhtml/Shipment.php index 5efa024adbc7ad432e5d15d89f8abaf2005b3a0d..392dd63b48f86fc7ad5bf7bd72971cc1398a7872 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Shipment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Shipment.php @@ -43,7 +43,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { $fileName = 'shipments.csv'; $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Shipment\Grid'); - return $this->_fileFactory->create($fileName, $grid->getCsvFile()); + return $this->_fileFactory->create($fileName, $grid->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -55,6 +55,6 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { $fileName = 'shipments.xml'; $grid = $this->_view->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Shipment\Grid'); - return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName)); + return $this->_fileFactory->create($fileName, $grid->getExcelFile($fileName), \Magento\App\Filesystem::VAR_DIR); } } diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index 116b145a9150ec3fb4171534f1b7807445bcdea7..45d4d2f2b82a05ce1ebd38683fec386d46f43d69 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -33,18 +33,18 @@ class Admin extends \Magento\App\Helper\AbstractHelper protected $_salesConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Config $salesConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Config $salesConfig ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Sales/Helper/Data.php b/app/code/Magento/Sales/Helper/Data.php index 4f605a4a2290d3ae78728eaa30155b15fb37bb24..cf08fd32c03dff5d895c9830ebb0ba45eb7645de 100644 --- a/app/code/Magento/Sales/Helper/Data.php +++ b/app/code/Magento/Sales/Helper/Data.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; /** * Sales module base helper @@ -65,7 +65,11 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendNewOrderConfirmationEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag(\Magento\Sales\Model\Order::XML_PATH_EMAIL_ENABLED, $store); + return $this->_scopeConfig->isSetFlag( + \Magento\Sales\Model\Order::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -87,8 +91,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendOrderCommentEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -101,8 +106,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendNewShipmentEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Shipment::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -115,8 +121,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendShipmentCommentEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Shipment::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -129,8 +136,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendNewInvoiceEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Invoice::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -143,8 +151,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendInvoiceCommentEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Invoice::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -157,8 +166,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendNewCreditmemoEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Creditmemo::XML_PATH_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -171,8 +181,9 @@ class Data extends \Magento\Core\Helper\Data */ public function canSendCreditmemoCommentEmail($store = null) { - return $this->_coreStoreConfig->getConfigFlag( + return $this->_scopeConfig->isSetFlag( \Magento\Sales\Model\Order\Creditmemo::XML_PATH_UPDATE_EMAIL_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } diff --git a/app/code/Magento/Sales/Helper/Guest.php b/app/code/Magento/Sales/Helper/Guest.php index 0a52637d51b370e40e50f56a8982f769829db8cf..c26c551ce26afc8153a3750821a79f1cc45df526 100644 --- a/app/code/Magento/Sales/Helper/Guest.php +++ b/app/code/Magento/Sales/Helper/Guest.php @@ -71,8 +71,8 @@ class Guest extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\Registry $coreRegistry * @param \Magento\Customer\Model\Session $customerSession @@ -84,8 +84,8 @@ class Guest extends \Magento\Core\Helper\Data */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\Registry $coreRegistry, \Magento\Customer\Model\Session $customerSession, @@ -101,7 +101,7 @@ class Guest extends \Magento\Core\Helper\Data $this->messageManager = $messageManager; $this->_orderFactory = $orderFactory; $this->_view = $view; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** diff --git a/app/code/Magento/Sales/Helper/Reorder.php b/app/code/Magento/Sales/Helper/Reorder.php index 45dc561a2b148ba0926361c632ee97c3709df43c..d24e914df1e7e854ce7ca12e17dc503864c563c6 100644 --- a/app/code/Magento/Sales/Helper/Reorder.php +++ b/app/code/Magento/Sales/Helper/Reorder.php @@ -39,22 +39,22 @@ class Reorder extends \Magento\Core\Helper\Data /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\Customer\Model\Session $customerSession * @param bool $dbCompatibleMode */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\Customer\Model\Session $customerSession, $dbCompatibleMode = true ) { $this->_customerSession = $customerSession; - parent::__construct($context, $coreStoreConfig, $storeManager, $appState, $dbCompatibleMode); + parent::__construct($context, $scopeConfig, $storeManager, $appState, $dbCompatibleMode); } /** @@ -68,12 +68,12 @@ class Reorder extends \Magento\Core\Helper\Data /** * Check if reorder is allowed for given store * - * @param \Magento\Core\Model\Store|int|null $store + * @param \Magento\Store\Model\Store|int|null $store * @return bool */ public function isAllowed($store = null) { - if ($this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_REORDER_ALLOW, $store)) { + if ($this->_scopeConfig->getValue(self::XML_PATH_SALES_REORDER_ALLOW, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)) { return true; } return false; diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index 16c30c276efe11b6380eae5722bb94241d49ddd7..74f4eec7f1e44c637c570779aa86ffb1d82d4570 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -67,7 +67,7 @@ abstract class AbstractModel extends \Magento\Model\AbstractModel /** * Get object store identifier * - * @return int | string | \Magento\Core\Model\Store + * @return int | string | \Magento\Store\Model\Store */ abstract public function getStore(); diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 913e4599f73f5d9fb207608ce294813f4d9729bf..a550b6e55afc63732df1bb6e2d50554806fed807 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -182,6 +182,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car */ protected $_customerGroupService; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Event\ManagerInterface $eventManager @@ -199,6 +204,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param CustomerBuilder $customerBuilder * @param \Magento\Customer\Helper\Data $customerHelper * @param CustomerGroupServiceInterface $customerGroupService + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data */ public function __construct( @@ -218,6 +224,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car CustomerBuilder $customerBuilder, \Magento\Customer\Helper\Data $customerHelper, CustomerGroupServiceInterface $customerGroupService, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $data = array() ) { $this->_objectManager = $objectManager; @@ -236,6 +243,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $this->_customerBuilder = $customerBuilder; $this->_customerHelper = $customerHelper; $this->_customerGroupService = $customerGroupService; + $this->_scopeConfig = $scopeConfig; parent::__construct($data); } @@ -1548,17 +1556,15 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car /** * Check whether we need to create new customer (for another website) during order creation * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return bool */ protected function _customerIsInStore($store) { $customerId = (int)$this->getSession()->getCustomerId(); $customerData = $this->_customerAccountService->getCustomer($customerId); - return $customerData->getWebsiteId() == $store->getWebsiteId() || $this->_customerHelper->isCustomerInStore( - $customerData->getWebsiteId(), - $store->getId() - ); + return $customerData->getWebsiteId() == $store->getWebsiteId() || + $this->_customerAccountService->isCustomerInStore($customerData->getWebsiteId(), $store->getId()); } /** @@ -1604,7 +1610,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if ($this->getQuote()->getCustomerIsGuest()) { return $this; } - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ $store = $this->getSession()->getStore(); $customerDataObject = $this->getQuote()->getCustomerData(); if ($customerDataObject->getId() && !$this->_customerIsInStore($store)) { @@ -1871,7 +1877,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car { $email = $this->getData('account/email'); if (empty($email)) { - $host = $this->getSession()->getStore()->getConfig(self::XML_PATH_DEFAULT_EMAIL_DOMAIN); + + $host = $this->_scopeConfig->getValue( + self::XML_PATH_DEFAULT_EMAIL_DOMAIN, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $account = time(); $email = $account . '@' . $host; $account = $this->getData('account'); diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 15085604d78d6580d4f99c7e253983c90c9b2ecf..c5be42d982f8f5a337e5660adb2be5be3c6fa1ad 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Config; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -abstract class Ordered extends \Magento\Core\Model\Config\Base +abstract class Ordered extends \Magento\App\Config\Base { /** * Cache key for collectors @@ -141,7 +141,7 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base * Prepare configuration array for total model * * @param string $code - * @param \Magento\Core\Model\Config\Element $totalConfig + * @param \Magento\App\Config\Element $totalConfig * @return array */ protected function _prepareConfigArray($code, $totalConfig) diff --git a/app/code/Magento/Sales/Model/Convert/Quote.php b/app/code/Magento/Sales/Model/Convert/Quote.php index f1c8905eee1631a16d31759893d2aae81d0a5a20..04acf2d219ecbf1228d241d5fe2034ef259d1b94 100644 --- a/app/code/Magento/Sales/Model/Convert/Quote.php +++ b/app/code/Magento/Sales/Model/Convert/Quote.php @@ -184,11 +184,9 @@ class Quote extends \Magento\Object */ public function paymentToOrderPayment(\Magento\Sales\Model\Quote\Payment $payment) { - $orderPayment = $this->_orderPaymentFactory->create()->setStoreId( - $payment->getStoreId() - )->setCustomerPaymentId( - $payment->getCustomerPaymentId() - ); + /** @var \Magento\Sales\Model\Order\Payment $orderPayment */ + $orderPayment = $this->_orderPaymentFactory->create()->setStoreId($payment->getStoreId()); + $orderPayment->setCustomerPaymentId($payment->getCustomerPaymentId()); $this->_objectCopyService->copyFieldsetToTarget( 'sales_convert_quote_payment', @@ -196,6 +194,10 @@ class Quote extends \Magento\Object $payment, $orderPayment ); + $orderPayment->setAdditionalInformation( + \Magento\Payment\Model\Method\Substitution::INFO_KEY_TITLE, + $payment->getMethodInstance()->getTitle() + ); return $orderPayment; } diff --git a/app/code/Magento/Sales/Model/Observer.php b/app/code/Magento/Sales/Model/Observer.php index 4f9893fa48202c72d6fffad2a6662e4e74ce0b8a..a5195b3e18bb934f6a088d5bd679b1140f2ef1e1 100644 --- a/app/code/Magento/Sales/Model/Observer.php +++ b/app/code/Magento/Sales/Model/Observer.php @@ -66,9 +66,9 @@ class Observer protected $_eventManager; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Store\Model\StoresConfig */ - protected $_storeConfig; + protected $_storesConfig; /** * @var \Magento\Sales\Model\Resource\Quote\CollectionFactory @@ -110,7 +110,7 @@ class Observer * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\Customer\Helper\Address $customerAddressHelper * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Store\Model\StoresConfig $storesConfig * @param \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param Resource\Report\OrderFactory $orderFactory @@ -124,7 +124,7 @@ class Observer \Magento\Customer\Helper\Data $customerData, \Magento\Customer\Helper\Address $customerAddressHelper, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Store\Model\StoresConfig $storesConfig, \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Sales\Model\Resource\Report\OrderFactory $orderFactory, @@ -137,7 +137,7 @@ class Observer $this->_customerData = $customerData; $this->_customerAddressHelper = $customerAddressHelper; $this->_catalogData = $catalogData; - $this->_storeConfig = $storeConfig; + $this->_storesConfig = $storesConfig; $this->_quoteCollectionFactory = $quoteFactory; $this->_localeDate = $localeDate; $this->_orderFactory = $orderFactory; @@ -157,7 +157,7 @@ class Observer { $this->_eventManager->dispatch('clear_expired_quotes_before', array('sales_observer' => $this)); - $lifetimes = $this->_storeConfig->getStoresConfigByPath('checkout/cart/delete_quote_after'); + $lifetimes = $this->_storesConfig->getStoresConfigByPath('checkout/cart/delete_quote_after'); foreach ($lifetimes as $storeId => $lifetime) { $lifetime *= 86400; @@ -320,7 +320,7 @@ class Observer * Retrieve sales address (order or quote) on which tax calculation must be based * * @param \Magento\Sales\Model\Order $order - * @param \Magento\Core\Model\Store|string|int|null $store + * @param \Magento\Store\Model\Store|string|int|null $store * @return \Magento\Sales\Model\Order\Address|null */ protected function _getVatRequiredSalesAddress($order, $store = null) diff --git a/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php b/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php index dda5e5ff4b0d0df2f8b97aadd3cd784b6643037e..80c923b6f442e9ee6b27c4c6a3d25f5664b3b360 100644 --- a/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php +++ b/app/code/Magento/Sales/Model/Observer/Backend/CustomerQuote.php @@ -33,7 +33,7 @@ class CustomerQuote protected $_config; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -43,12 +43,12 @@ class CustomerQuote protected $_quoteFactory; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Config\Share $config * @param \Magento\Sales\Model\QuoteFactory $quoteFactory */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Config\Share $config, \Magento\Sales\Model\QuoteFactory $quoteFactory ) { @@ -74,7 +74,7 @@ class CustomerQuote * It is needed to process customer's quotes for all websites * if customer accounts are shared between all of them */ - /** @var $websites \Magento\Core\Model\Website[] */ + /** @var $websites \Magento\Store\Model\Website[] */ $websites = $this->_config->isWebsiteScope() ? array( $this->_storeManager->getWebsite($customerDataObject->getWebsiteId()) ) : $this->_storeManager->getWebsites(); diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php index 01f00593a69e382ba2e517631c924541df053148..f0dd4d11e801a40152525b5e634f0da578b99a93 100644 --- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php +++ b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidator.php @@ -55,7 +55,7 @@ class VatValidator * Validate VAT number * * @param \Magento\Sales\Model\Quote\Address $quoteAddress - * @param \Magento\Core\Model\Store|int $store + * @param \Magento\Store\Model\Store|int $store * @return \Magento\Object */ public function validate(\Magento\Sales\Model\Quote\Address $quoteAddress, $store) @@ -108,7 +108,7 @@ class VatValidator * Check whether VAT ID validation is enabled * * @param \Magento\Sales\Model\Quote\Address $quoteAddress - * @param \Magento\Core\Model\Store|int $store + * @param \Magento\Store\Model\Store|int $store * @return bool */ public function isEnabled(\Magento\Sales\Model\Quote\Address $quoteAddress, $store) diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index e7a52eaec6b942fa722f93b05d4fb048432251b6..ec97087b506e7cf6605bda0c0a50a45cbc48e4c8 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -506,12 +506,12 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -612,8 +612,8 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Order\Config $orderConfig * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder @@ -643,8 +643,8 @@ class Order extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Helper\Data $salesData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, @@ -669,7 +669,7 @@ class Order extends \Magento\Sales\Model\AbstractModel ) { $this->_paymentData = $paymentData; $this->_salesData = $salesData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_orderConfig = $orderConfig; $this->_productFactory = $productFactory; @@ -793,7 +793,7 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * Retrieve store model instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -1291,8 +1291,9 @@ class Order extends \Magento\Sales\Model\AbstractModel $status = $this->getConfig()->getStateDefaultStatus($state); } $this->setStatus($status); - $history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again - $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility + $history = $this->addStatusHistoryComment($comment, false); + // no sense to set $status again + $history->setIsCustomerNotified($isCustomerNotified); } return $this; } @@ -1524,16 +1525,28 @@ class Order extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $paymentBlockHtml = $this->_paymentData->getInfoBlockHtml($this->getPayment(), $storeId); // Retrieve corresponding email template id and customer name if ($this->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $this->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $this->getCustomerName(); } @@ -1549,7 +1562,11 @@ class Order extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $this->getCustomerEmail(), $customerName @@ -1579,7 +1596,11 @@ class Order extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -1608,7 +1629,11 @@ class Order extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -1616,10 +1641,18 @@ class Order extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($this->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $this->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $this->getCustomerName(); } @@ -1636,7 +1669,11 @@ class Order extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $this->getCustomerEmail(), $customerName @@ -1668,7 +1705,11 @@ class Order extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -1684,7 +1725,11 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected function _getEmails($configPath) { - $data = $this->_coreStoreConfig->getConfig($configPath, $this->getStoreId()); + $data = $this->_scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); if (!empty($data)) { return explode(',', $data); } @@ -1810,7 +1855,6 @@ class Order extends \Magento\Sales\Model\AbstractModel $products )->setVisibility( $this->_productVisibility->getVisibleInSiteIds() - /* Price data is added to consider item stock status using price index */ )->addPriceData()->setPageSize( $limit )->load(); @@ -2444,10 +2488,6 @@ class Order extends \Magento\Sales\Model\AbstractModel if ($this->getState() !== self::STATE_COMPLETE) { $this->_setState(self::STATE_COMPLETE, true, '', $userNotification); } - /** - * Order can be closed just in case when we have refunded amount. - * In case of "0" grand total order checking ForcedCanCreditmemo flag - */ } elseif (floatval( $this->getTotalRefunded() ) || !$this->getTotalRefunded() && $this->hasForcedCanCreditmemo() @@ -2512,7 +2552,7 @@ class Order extends \Magento\Sales\Model\AbstractModel { $storeId = $this->getStoreId(); if (is_null($storeId)) { - return $this->getStoreName(1); // 0 - website name, 1 - store group name, 2 - store name + return $this->getStoreName(1); } return $this->getStore()->getGroup()->getName(); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index 51b0e516bc428ca37fc0764f50daf15ef5803890..f09db4f2a00d8396ab2e9d808d76edd0ecd57106 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -217,9 +217,9 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\Order\Creditmemo\Config @@ -242,7 +242,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel protected $_calculatorFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -268,12 +268,12 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param Creditmemo\Config $creditmemoConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory * @param \Magento\Math\CalculatorFactory $calculatorFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param Creditmemo\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder @@ -288,12 +288,12 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Helper\Data $salesData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory, \Magento\Math\CalculatorFactory $calculatorFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, @@ -303,7 +303,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel ) { $this->_paymentData = $paymentData; $this->_salesData = $salesData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_creditmemoConfig = $creditmemoConfig; $this->_orderFactory = $orderFactory; $this->_cmItemCollectionFactory = $cmItemCollectionFactory; @@ -338,7 +338,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel /** * Retrieve creditmemo store instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -883,7 +883,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -893,10 +897,18 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -915,7 +927,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -948,7 +964,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -978,7 +998,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -986,10 +1010,18 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -1007,7 +1039,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -1039,7 +1075,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -1055,7 +1095,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel */ protected function _getEmails($configPath) { - $data = $this->_coreStoreConfig->getConfig($configPath, $this->getStoreId()); + $data = $this->_scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); if (!empty($data)) { return explode(',', $data); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index 8f7aa96a43a415db6b9e45f0e61e12869f9311d6..5ac8096295f139ca346ff41b379cb7cc524a2729 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -49,7 +49,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel protected $_creditmemo; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,7 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -68,7 +68,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -112,7 +112,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel /** * Get store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php index 159a1fbe67041cb83899a5aff71516087930a827..72459e58fe98ea09469eb7e77879e285adac2d9f 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php @@ -31,7 +31,7 @@ namespace Magento\Sales\Model\Order\Creditmemo\Total; class Shipping extends AbstractTotal { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -41,12 +41,12 @@ class Shipping extends AbstractTotal protected $_taxConfig; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Tax\Model\Config $taxConfig * @param array $data */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Tax\Model\Config $taxConfig, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index 0a75ed42cdb2199d52cfc109bc4c601fa9097fca..ffda47854b11ab9907c4f3bd3a17e27d1178c06e 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -227,9 +227,9 @@ class Invoice extends \Magento\Sales\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\Order\Invoice\Config @@ -278,7 +278,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param Invoice\Config $invoiceConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory @@ -298,7 +298,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Helper\Data $salesData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory, @@ -313,7 +313,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel ) { $this->_paymentData = $paymentData; $this->_salesData = $salesData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_invoiceConfig = $invoiceConfig; $this->_orderFactory = $orderFactory; $this->_orderResourceFactory = $orderResourceFactory; @@ -365,7 +365,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel /** * Retrieve store model instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -893,7 +893,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -903,10 +907,18 @@ class Invoice extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -925,7 +937,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -958,7 +974,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -988,7 +1008,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -996,10 +1020,18 @@ class Invoice extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -1017,7 +1049,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -1049,7 +1085,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -1065,7 +1105,11 @@ class Invoice extends \Magento\Sales\Model\AbstractModel */ protected function _getEmails($configPath) { - $data = $this->_coreStoreConfig->getConfig($configPath, $this->getStoreId()); + $data = $this->_scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); if (!empty($data)) { return explode(',', $data); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index 40b03529fd8a0ccbee8d1a15e408a21b5c41f52a..486c1b5c891df34b3be237f4bcd4860634367a6a 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -49,7 +49,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel protected $_invoice; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,7 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -68,7 +68,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -112,7 +112,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel /** * Get store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Total/Tax.php b/app/code/Magento/Sales/Model/Order/Invoice/Total/Tax.php index 0d78b37d28d0d5c4bb614e0b7f499c4b5f72abc1..2a6894553b7e9f4afc9204e269ea09b830ab74bc 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Total/Tax.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Total/Tax.php @@ -47,7 +47,7 @@ class Tax extends AbstractTotal $orderItem = $item->getOrderItem(); $orderItemQty = $orderItem->getQtyOrdered(); - if ($orderItem->getTaxAmount() && $orderItemQty) { + if (($orderItem->getTaxAmount() || $orderItem->getHiddenTaxAmount()) && $orderItemQty) { if ($item->getOrderItem()->isDummy()) { continue; } diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 3828a0eb5f27cb8b505096f49537651fbcc95ade..a3b971097f9d69b736fbea1f1dacf2fe4817a662 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -202,7 +202,7 @@ class Payment extends \Magento\Payment\Model\Info protected $_transactionCollectionFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -214,7 +214,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory * @param \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -227,7 +227,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory, \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory, \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -393,10 +393,8 @@ class Payment extends \Magento\Payment\Model\Info if ($message) { $order->addStatusToHistory($order->getStatus(), $message, $isCustomerNotified); } - // add message to history if order state already declared } elseif ($order->getState() && ($orderStatus !== $order->getStatus() || $message)) { $order->setState($orderState, $orderStatus, $message, $isCustomerNotified); - // set order state } elseif ($order->getState() != $orderState || $order->getStatus() != $orderStatus || $message) { $order->setState($orderState, $orderStatus, $message, $isCustomerNotified); } @@ -423,7 +421,7 @@ class Payment extends \Magento\Payment\Model\Info if (is_null($invoice)) { $invoice = $this->_invoice(); $this->setCreatedInvoice($invoice); - return $this; // @see Invoice::capture() + return $this; } $amountToCapture = $this->_formatAmount($invoice->getBaseGrandTotal()); $order = $this->getOrder(); @@ -1041,7 +1039,6 @@ class Payment extends \Magento\Payment\Model\Info $transactionId ); } else { - // notification mechanism is responsible to update the payment object first } if ($this->getIsTransactionApproved()) { $result = true; @@ -1315,7 +1312,6 @@ class Payment extends \Magento\Payment\Model\Info $this->getOrder()->addRelatedObject($transaction); if ($salesDocument && $salesDocument instanceof \Magento\Sales\Model\AbstractModel) { $salesDocument->setTransactionId($transactionId); - // TODO: linking transaction with the sales document } // link with parent transaction diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index 5272ffd24debbda3237e267dc248cd7c053f6152..202deaa8dd6778c559ac1940c3c58a4021bc0516 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -169,12 +169,18 @@ class Transaction extends \Magento\Model\AbstractModel */ protected $_dateFactory; + /** + * @var TransactionFactory + */ + protected $_transactionFactory; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory + * @param TransactionFactory $transactionFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -185,6 +191,7 @@ class Transaction extends \Magento\Model\AbstractModel \Magento\Sales\Model\Order\PaymentFactory $paymentFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, + TransactionFactory $transactionFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -192,6 +199,7 @@ class Transaction extends \Magento\Model\AbstractModel $this->_paymentFactory = $paymentFactory; $this->_orderFactory = $orderFactory; $this->_dateFactory = $dateFactory; + $this->_transactionFactory = $transactionFactory; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -279,8 +287,7 @@ class Transaction extends \Magento\Model\AbstractModel $this->_parentTransaction = false; $parentId = $this->getParentId(); if ($parentId) { - $class = get_class($this); - $this->_parentTransaction = new $class(); + $this->_parentTransaction = $this->_transactionFactory->create(); if ($shouldLoad) { $this->_parentTransaction->setOrderPaymentObject($this->_paymentObject)->load($parentId); if (!$this->_parentTransaction->getId()) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 496d0641f9383b3828dc32bbbea51a9cd80be24b..1bf20f4414970d1df80a80b4d40e9becea7b3faf 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -89,9 +89,9 @@ abstract class AbstractPdf extends \Magento\Object /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Filesystem\Directory\WriteInterface @@ -126,7 +126,7 @@ abstract class AbstractPdf extends \Magento\Object /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -140,7 +140,7 @@ abstract class AbstractPdf extends \Magento\Object public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -152,7 +152,7 @@ abstract class AbstractPdf extends \Magento\Object $this->_paymentData = $paymentData; $this->_localeDate = $localeDate; $this->string = $string; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_pdfConfig = $pdfConfig; @@ -241,7 +241,11 @@ abstract class AbstractPdf extends \Magento\Object protected function insertLogo(&$page, $store = null) { $this->y = $this->y ? $this->y : 815; - $image = $this->_coreStoreConfig->getConfig('sales/identity/logo', $store); + $image = $this->_scopeConfig->getValue( + 'sales/identity/logo', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if ($image) { $imagePath = '/sales/store/logo/' . $image; if ($this->_mediaDirectory->isFile($imagePath)) { @@ -295,7 +299,14 @@ abstract class AbstractPdf extends \Magento\Object $page->setLineWidth(0); $this->y = $this->y ? $this->y : 815; $top = 815; - foreach (explode("\n", $this->_coreStoreConfig->getConfig('sales/identity/address', $store)) as $value) { + foreach (explode( + "\n", + $this->_scopeConfig->getValue( + 'sales/identity/address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) + ) as $value) { if ($value !== '') { $value = preg_replace('/<br[^>]*>/i', "\n", $value); foreach ($this->string->split($value, 45, true, true) as $_value) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 8fd9fad05c9642791dff2845a2103c33a1796e2c..605961525826701fea2f1c124ceab9b5b451e634 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -31,42 +31,38 @@ namespace Magento\Sales\Model\Order\Pdf; class Creditmemo extends AbstractPdf { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; - /** - * @var \Magento\Locale\ResolverInterface - */ - protected $_localeResolver; - /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @internal param \Magento\TranslateInterface $translate */ public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Translate\Inline\StateInterface $inlineTranslation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() ) { @@ -75,7 +71,7 @@ class Creditmemo extends AbstractPdf parent::__construct( $paymentData, $string, - $coreStoreConfig, + $scopeConfig, $filesystem, $pdfConfig, $pdfTotalFactory, @@ -115,28 +111,24 @@ class Creditmemo extends AbstractPdf 'text' => $this->string->split(__('Total (ex)'), 12, true, true), 'feed' => 330, 'align' => 'right' - //'width' => 50, ); $lines[0][] = array( 'text' => $this->string->split(__('Discount'), 12, true, true), 'feed' => 380, 'align' => 'right' - //'width' => 50, ); $lines[0][] = array( 'text' => $this->string->split(__('Qty'), 12, true, true), 'feed' => 445, 'align' => 'right' - //'width' => 30, ); $lines[0][] = array( 'text' => $this->string->split(__('Tax'), 12, true, true), 'feed' => 495, 'align' => 'right' - //'width' => 45, ); $lines[0][] = array( @@ -183,8 +175,9 @@ class Creditmemo extends AbstractPdf $this->insertOrder( $page, $order, - $this->_coreStoreConfig->getConfigFlag( + $this->_scopeConfig->isSetFlag( self::XML_PATH_SALES_PDF_CREDITMEMO_PUT_ORDER_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId() ) ); diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index e3755c7e5fde3dadafc0261f0bf047cc710c2fe2..40cef5d0618769a0baad19125ba1a925d25b49a3 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -31,7 +31,7 @@ namespace Magento\Sales\Model\Order\Pdf; class Invoice extends AbstractPdf { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -43,14 +43,14 @@ class Invoice extends AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data * @@ -59,14 +59,14 @@ class Invoice extends AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Translate\Inline\StateInterface $inlineTranslation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() ) { @@ -75,7 +75,7 @@ class Invoice extends AbstractPdf parent::__construct( $paymentData, $string, - $coreStoreConfig, + $scopeConfig, $filesystem, $pdfConfig, $pdfTotalFactory, @@ -154,8 +154,9 @@ class Invoice extends AbstractPdf $this->insertOrder( $page, $order, - $this->_coreStoreConfig->getConfigFlag( + $this->_scopeConfig->isSetFlag( self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId() ) ); diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index 3cbba9b75d978e9cab9fa4c441be531808c38454..01a3982d987dd760fc071948b70444b7544faf21 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -31,7 +31,7 @@ namespace Magento\Sales\Model\Order\Pdf; class Shipment extends AbstractPdf { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -43,14 +43,14 @@ class Shipment extends AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Translate\Inline\StateInterface $inlineTranslation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data * @@ -59,14 +59,14 @@ class Shipment extends AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Translate\Inline\StateInterface $inlineTranslation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() ) { @@ -75,7 +75,7 @@ class Shipment extends AbstractPdf parent::__construct( $paymentData, $string, - $coreStoreConfig, + $scopeConfig, $filesystem, $pdfConfig, $pdfTotalFactory, @@ -147,8 +147,9 @@ class Shipment extends AbstractPdf $this->insertOrder( $page, $shipment, - $this->_coreStoreConfig->getConfigFlag( + $this->_scopeConfig->isSetFlag( self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId() ) ); diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index e06df0dca3759104c63451657c3b234c98f93134..f66755af08f5b1a1e5c23238e0fa6711fed485ee 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -154,9 +154,9 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\OrderFactory @@ -195,7 +195,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Sales\Helper\Data $salesData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory @@ -213,7 +213,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Payment\Helper\Data $paymentData, \Magento\Sales\Helper\Data $salesData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, @@ -226,7 +226,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel ) { $this->_paymentData = $paymentData; $this->_salesData = $salesData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_orderFactory = $orderFactory; $this->_shipmentItemCollectionFactory = $shipmentItemCollectionFactory; $this->_trackCollectionFactory = $trackCollectionFactory; @@ -555,7 +555,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -565,10 +569,18 @@ class Shipment extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -587,7 +599,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -620,7 +636,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -650,7 +670,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel } // Get the destination email addresses to send copies to $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO); - $copyMethod = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, $storeId); + $copyMethod = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); // Check if at least one recipient is found if (!$notifyCustomer && !$copyTo) { return $this; @@ -658,10 +682,18 @@ class Shipment extends \Magento\Sales\Model\AbstractModel // Retrieve corresponding email template id and customer name if ($order->getCustomerIsGuest()) { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getBillingAddress()->getName(); } else { - $templateId = $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, $storeId); + $templateId = $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); $customerName = $order->getCustomerName(); } @@ -679,7 +711,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $order->getCustomerEmail(), $customerName @@ -711,7 +747,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel 'store' => $this->getStore() ) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId) + $this->_scopeConfig->getValue( + self::XML_PATH_UPDATE_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ) )->addTo( $email )->getTransport()->sendMessage(); @@ -727,7 +767,11 @@ class Shipment extends \Magento\Sales\Model\AbstractModel */ protected function _getEmails($configPath) { - $data = $this->_coreStoreConfig->getConfig($configPath, $this->getStoreId()); + $data = $this->_scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStoreId() + ); if (!empty($data)) { return explode(',', $data); } @@ -793,7 +837,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * Retrieve store model instance * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index 7d3ec25edc348b8040a358bf06fc32ea3ab14466..6afa32de77e670ae3892d9e107f622cd72524b6c 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -49,7 +49,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel protected $_shipment; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,7 +58,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -68,7 +68,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -112,7 +112,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel /** * Get store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index 71f30fccef1e1ecfb1e1f7a44e361383961fb34b..bf4297702f79fca59e1396fda5171b4a4c5c4271 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -74,7 +74,7 @@ class Track extends \Magento\Sales\Model\AbstractModel protected $_eventObject = 'track'; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -88,7 +88,7 @@ class Track extends \Magento\Sales\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -99,7 +99,7 @@ class Track extends \Magento\Sales\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -190,7 +190,7 @@ class Track extends \Magento\Sales\Model\AbstractModel /** * Get store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php index dccf30e00444c820a7a362b1ebfd49940526f0f3..30160d1b4df2c38d6c96c8942d0101a0d1269f4d 100644 --- a/app/code/Magento/Sales/Model/Order/Status.php +++ b/app/code/Magento/Sales/Model/Order/Status.php @@ -28,14 +28,14 @@ namespace Magento\Sales\Model\Order; class Status extends \Magento\Model\AbstractModel { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -43,7 +43,7 @@ class Status extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -121,7 +121,7 @@ class Status extends \Magento\Model\AbstractModel /** * Get status label by store * - * @param null|string|bool|int|\Magento\Core\Model\Store $store + * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return string */ public function getStoreLabel($store = null) diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index 754ead6f62d8173f9723dc942f262a81dd6dc74b..d77f10eb7230e211192c2744830c8ceab145c8af 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -64,7 +64,7 @@ class History extends \Magento\Sales\Model\AbstractModel protected $_eventObject = 'status_history'; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -73,7 +73,7 @@ class History extends \Magento\Sales\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -83,7 +83,7 @@ class History extends \Magento\Sales\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -165,7 +165,7 @@ class History extends \Magento\Sales\Model\AbstractModel /** * Get store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index 107be83eeac88aee3e60aa58f755dcdf1ef0f3c2..2dadfbd1f23c204688449bdab58ffe72a332d0ad 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -210,17 +210,17 @@ class Quote extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -304,9 +304,9 @@ class Quote extends \Magento\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Sales\Model\Quote\AddressFactory $quoteAddressFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param CustomerGroupServiceInterface $customerGroupService @@ -330,9 +330,9 @@ class Quote extends \Magento\Model\AbstractModel \Magento\Registry $registry, \Magento\Sales\Helper\Data $salesData, \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Sales\Model\Quote\AddressFactory $quoteAddressFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, CustomerGroupServiceInterface $customerGroupService, @@ -353,7 +353,7 @@ class Quote extends \Magento\Model\AbstractModel ) { $this->_salesData = $salesData; $this->_catalogProduct = $catalogProduct; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_config = $config; $this->_quoteAddressFactory = $quoteAddressFactory; @@ -399,7 +399,7 @@ class Quote extends \Magento\Model\AbstractModel /** * Get quote store model object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -409,10 +409,10 @@ class Quote extends \Magento\Model\AbstractModel /** * Declare quote store model * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return $this */ - public function setStore(\Magento\Core\Model\Store $store) + public function setStore(\Magento\Store\Model\Store $store) { $this->setStoreId($store->getId()); return $this; @@ -596,7 +596,6 @@ class Quote extends \Magento\Model\AbstractModel try { $defaultBillingAddress = $this->_addressService->getDefaultBillingAddress($customer->getId()); } catch (\Magento\Exception\NoSuchEntityException $e) { - /** Address does not exist */ } if (isset($defaultBillingAddress)) { /** @var \Magento\Sales\Model\Quote\Address $billingAddress */ @@ -610,7 +609,6 @@ class Quote extends \Magento\Model\AbstractModel try { $defaultShippingAddress = $this->_addressService->getDefaultShippingAddress($customer->getId()); } catch (\Magento\Exception\NoSuchEntityException $e) { - /** Address does not exist */ } if (isset($defaultShippingAddress)) { /** @var \Magento\Sales\Model\Quote\Address $shippingAddress */ @@ -2016,9 +2014,21 @@ class Quote extends \Magento\Model\AbstractModel public function validateMinimumAmount($multishipping = false) { $storeId = $this->getStoreId(); - $minOrderActive = $this->_coreStoreConfig->getConfigFlag('sales/minimum_order/active', $storeId); - $minOrderMulti = $this->_coreStoreConfig->getConfigFlag('sales/minimum_order/multi_address', $storeId); - $minAmount = $this->_coreStoreConfig->getConfig('sales/minimum_order/amount', $storeId); + $minOrderActive = $this->_scopeConfig->isSetFlag( + 'sales/minimum_order/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + $minOrderMulti = $this->_scopeConfig->isSetFlag( + 'sales/minimum_order/multi_address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); + $minAmount = $this->_scopeConfig->getValue( + 'sales/minimum_order/amount', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); if (!$minOrderActive) { return true; diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index 2aab04ed40734ba4f1c42796d24f72a1d9ac4cc4..a7b5a1037df7b1e786f5eaf34629cbd85a04a69f 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -45,8 +45,8 @@ use Magento\Customer\Service\V1\Data\AddressConverter; * @method Address setSaveInAddressBook(int $value) * @method int getCustomerAddressId() * @method Address setCustomerAddressId(int $value) - * @method \Magento\Customer\Model\Address getCustomerAddress() - * @method Address setCustomerAddress(\Magento\Customer\Model\Address $value) + * @method AddressDataObject|null getCustomerAddressData() + * @method Address setCustomerAddressData(AddressDataObject $value) * @method string getAddressType() * @method Address setAddressType(string $value) * @method string getEmail() @@ -208,14 +208,9 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; - - /** - * @var \Magento\Customer\Model\AddressFactory - */ - protected $_addressFactory; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\Quote\Address\ItemFactory @@ -257,11 +252,6 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress */ protected $_customerAdressService; - /** - * @var \Magento\Customer\Model\Address\Converter - */ - private $addressConverter; - /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry @@ -270,8 +260,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Customer\Model\Address\Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Customer\Model\AddressFactory $addressFactory + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\ItemFactory $addressItemFactory * @param \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Sales\Model\Quote\Address\RateFactory $addressRateFactory @@ -284,7 +273,6 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param CustomerAddressBuilder $customerAddressBuilder * @param CustomerAddressServiceInterface $customerAddressService - * @param \Magento\Customer\Model\Address\Converter $addressConverter * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -297,8 +285,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Customer\Model\AddressFactory $addressFactory, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\ItemFactory $addressItemFactory, \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollectionFactory, \Magento\Sales\Model\Quote\Address\RateFactory $addressRateFactory, @@ -311,13 +298,11 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, CustomerAddressBuilder $customerAddressBuilder, CustomerAddressServiceInterface $customerAddressService, - \Magento\Customer\Model\Address\Converter $addressConverter, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; - $this->_addressFactory = $addressFactory; + $this->_scopeConfig = $scopeConfig; $this->_addressItemFactory = $addressItemFactory; $this->_itemCollectionFactory = $itemCollectionFactory; $this->_addressRateFactory = $addressRateFactory; @@ -342,7 +327,6 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress $resourceCollection, $data ); - $this->addressConverter = $addressConverter; } /** @@ -512,28 +496,6 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress return $this; } - /** - * Export data to customer address object - * - * @return \Magento\Customer\Model\Address - * @deprecated Use \Magento\Sales\Model\Quote\Address::exportCustomerAddressData() instead - */ - public function exportCustomerAddress() - { - /** - * TODO: Remove this method when all dependencies are refactored to use exportCustomerAddressData() - * _addressFactory variable should be removed in scope of MAGETWO-21105 as well - */ - $address = $this->_addressFactory->create(); - $this->_objectCopyService->copyFieldsetToTarget( - 'sales_convert_quote_address', - 'to_customer_address', - $this, - $address - ); - return $address; - } - /** * Export data to customer address Data Object. * @@ -548,6 +510,12 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress ); $customerAddressDataWithRegion = array(); $customerAddressDataWithRegion['region']['region'] = $customerAddressData['region']; + if (isset($customerAddressData['region_code'])) { + $customerAddressDataWithRegion['region']['region_code'] = $customerAddressData['region_code']; + } + if ($customerAddressData['region_id']) { + $customerAddressDataWithRegion['region']['region_id'] = $customerAddressData['region_id']; + } $customerAddressData = array_merge($customerAddressData, $customerAddressDataWithRegion); return $this->_customerAddressBuilder->populateWithArray($customerAddressData)->create(); } @@ -1233,7 +1201,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress public function validateMinimumAmount() { $storeId = $this->getQuote()->getStoreId(); - if (!$this->_coreStoreConfig->getConfigFlag('sales/minimum_order/active', $storeId)) { + if (!$this->_scopeConfig->isSetFlag('sales/minimum_order/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)) { return true; } @@ -1243,7 +1211,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress return true; } - $amount = $this->_coreStoreConfig->getConfig('sales/minimum_order/amount', $storeId); + $amount = $this->_scopeConfig->getValue('sales/minimum_order/amount', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId); if ($this->getBaseSubtotalWithDiscount() < $amount) { return false; } @@ -1424,36 +1392,4 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress { return $this->getSubtotal() + $this->getDiscountAmount(); } - - /** - * Keep customer address - * - * @param AddressDataObject $address - * @return $this - * @todo refactor in scope of MAGETWO-20857 - */ - public function setCustomerAddressData(AddressDataObject $address) - { - return $this->setCustomerAddress($this->addressConverter->createAddressModel($address)); - } - - /** - * Get previously set customer address - * - * @return AddressDataObject|null - */ - public function getCustomerAddressData() - { - $address = $this->getCustomerAddress(); - - if ($address) { - return $this->addressConverter->createAddressFromModel( - $address, - $address->getIsDefaultBilling(), - $address->getIsDefaultShipping() - ); - } - - return null; - } } diff --git a/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php index 18ee7e57f5085f0487c9e08a555ae7ed248f1eee..fe5578c945f0c375c1e909b5697cf0aa794734ba 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php +++ b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php @@ -35,15 +35,15 @@ namespace Magento\Sales\Model\Quote\Address\RateResult; class Method extends AbstractResult { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager, array $data = array()) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager, array $data = array()) { $this->_storeManager = $storeManager; parent::__construct($data); diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php index 401dc1339b64ca08e35a1ea7249cc9a218d70f98..c4549d76948de4b36421ced36ea66a7f7b100985 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php @@ -45,7 +45,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered /** * Corresponding store object * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -71,9 +71,9 @@ class Collector extends \Magento\Sales\Model\Config\Ordered /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\Quote\Address\TotalFactory @@ -84,8 +84,8 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Logger $logger * @param \Magento\Sales\Model\Config $salesConfig - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Quote\Address\TotalFactory $totalFactory * @param mixed $sourceData * @param mixed $store @@ -94,13 +94,13 @@ class Collector extends \Magento\Sales\Model\Config\Ordered \Magento\App\Cache\Type\Config $configCacheType, \Magento\Logger $logger, \Magento\Sales\Model\Config $salesConfig, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Quote\Address\TotalFactory $totalFactory, $sourceData = null, $store = null ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_totalFactory = $totalFactory; parent::__construct($configCacheType, $logger, $salesConfig, $sourceData); $this->_store = $store ?: $storeManager->getStore(); @@ -161,7 +161,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered */ private function _initRetrievers() { - $sorts = $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_TOTALS_SORT, $this->_store); + $sorts = $this->_scopeConfig->getValue(self::XML_PATH_SALES_TOTALS_SORT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_store); foreach ($sorts as $code => $sortOrder) { if (isset($this->_models[$code])) { // Reserve enough space for collisions diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Discount.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Discount.php index 124163399da84b56478bd9a84e6fcc9817abc213..e29be3fe71caba1f0b4e6a5bcc7063b5320d5bed 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Discount.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Discount.php @@ -35,17 +35,17 @@ class Discount extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal protected $_eventManager = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_eventManager = $eventManager; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Tax.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Tax.php index b7ffca391b52eea245a7951a543dfb0530967ee9..880860efbbd3d45885ca568fd3a534094754a209 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Tax.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Tax.php @@ -42,9 +42,9 @@ class Tax extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Tax\Model\Calculation @@ -53,16 +53,16 @@ class Tax extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal /** * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Tax\Model\Calculation $calculation */ public function __construct( \Magento\Tax\Helper\Data $taxData, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Tax\Model\Calculation $calculation ) { $this->_taxData = $taxData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_calculation = $calculation; $this->setCode('tax'); } @@ -182,8 +182,9 @@ class Tax extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal } } - $shippingTaxClass = $this->_coreStoreConfig->getConfig( + $shippingTaxClass = $this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); @@ -268,7 +269,6 @@ class Tax extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal } } - if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) { $previouslyAppliedTaxes[$row['id']]['amount'] += $appliedAmount; $previouslyAppliedTaxes[$row['id']]['base_amount'] += $baseAppliedAmount; diff --git a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php index 9235a6e3136766d85bdb6affca21e74ba1fe6faa..eb8e7cb9c1cfe521e0d2742a3543c7a839772de5 100644 --- a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php +++ b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php @@ -297,7 +297,7 @@ abstract class AbstractItem extends \Magento\Model\AbstractModel implements /** * Retrieve store model object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Customer/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Customer/Collection.php index 581255160c8df69c4a9ec3d25776fba063d0e8bd..36a493258ea5b94aff348ae3c0c92aaaa42987ab 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Customer/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Customer/Collection.php @@ -69,7 +69,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection 'left' )->joinField( 'store_name', - 'core_store', + 'store', 'name', 'store_id=store_id', null, diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php index 6b8b37a381aae7106ffafbcd81a7ca5fc06788d9..faaeb66bb23019d36d60ff343fe96a7fbc8e5f23 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php @@ -135,7 +135,7 @@ class Transaction extends \Magento\Sales\Model\Resource\Order\AbstractOrder array('so' => $this->getTable('sales_flat_order')), 'cs.website_id' )->joinInner( - array('cs' => $this->getTable('core_store')), + array('cs' => $this->getTable('store')), 'cs.store_id = so.store_id' )->where( 'so.entity_id = :entity_id' diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php index a4cbdcd056fd7b9a25cdadf768134d8805f1a58c..cde8de3756107d1f0b8559079ec997705a7068ab 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php @@ -249,7 +249,7 @@ class Bestsellers extends AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'product_id' => 'product_id', 'product_name' => new \Zend_Db_Expr('MIN(product_name)'), 'product_price' => new \Zend_Db_Expr('MIN(product_price)'), @@ -262,7 +262,7 @@ class Bestsellers extends AbstractReport $columns )->where( 'store_id <> ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); if ($subSelect !== null) { diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php index 9328cf3edb79282f071f6e8836e3c5ccb12a23ce..e3a170a8c30a7bdbda1ae1345415fbce55888e95 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers/Collection.php @@ -219,8 +219,8 @@ class Collection extends \Magento\Sales\Model\Resource\Report\Collection\Abstrac $currentStoreIds = $this->_storesIds; if (isset( $currentStoreIds - ) && $currentStoreIds != \Magento\Core\Model\Store::DEFAULT_STORE_ID && $currentStoreIds != array( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + ) && $currentStoreIds != \Magento\Store\Model\Store::DEFAULT_STORE_ID && $currentStoreIds != array( + \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ) { if (!is_array($currentStoreIds)) { diff --git a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php index a9e72482901a836388ed092611760f3b4d8cb653..8742da172ba499b59fda69e716da4df999013af9 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php @@ -108,7 +108,6 @@ class Invoiced extends AbstractReport ) ); $columns = array( - // convert dates from UTC to current admin timezone 'period' => $periodExpr, 'store_id' => 'order_table.store_id', 'order_status' => 'order_table.status', @@ -163,7 +162,7 @@ class Invoiced extends AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'order_status' => 'order_status', 'orders_count' => new \Zend_Db_Expr('SUM(orders_count)'), 'orders_invoiced' => new \Zend_Db_Expr('SUM(orders_invoiced)'), @@ -172,7 +171,7 @@ class Invoiced extends AbstractReport 'invoiced_not_captured' => new \Zend_Db_Expr('SUM(invoiced_not_captured)') ); - $select->from($table, $columns)->where('store_id <> ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $select->from($table, $columns)->where('store_id <> ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); if ($subSelect !== null) { $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); @@ -261,7 +260,7 @@ class Invoiced extends AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'order_status' => 'order_status', 'orders_count' => new \Zend_Db_Expr('SUM(orders_count)'), 'orders_invoiced' => new \Zend_Db_Expr('SUM(orders_invoiced)'), @@ -270,7 +269,7 @@ class Invoiced extends AbstractReport 'invoiced_not_captured' => new \Zend_Db_Expr('SUM(invoiced_not_captured)') ); - $select->from($table, $columns)->where('store_id <> ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $select->from($table, $columns)->where('store_id <> ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); if ($subSelect !== null) { $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); diff --git a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php index 46d22e302d30ed3c11d72d4c215a1e650bc06b59..a582dbd8ff291f8073740e661036dab8be1931cb 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php @@ -100,7 +100,6 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport ); // Columns list $columns = array( - // convert dates from UTC to current admin timezone 'period' => $periodExpr, 'store_id' => 'o.store_id', 'order_status' => 'o.status', @@ -259,7 +258,7 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport $columns[$k] = new \Zend_Db_Expr('SUM(' . $k . ')'); } $columns['period'] = 'period'; - $columns['store_id'] = new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $columns['store_id'] = new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID); $columns['order_status'] = 'order_status'; $select->reset(); diff --git a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php index 12cccf8f838f49cf8174deb0da6a65c5e6dd6988..b477cd9059d2da50db0d6b976684c0fb98e872e4 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php @@ -130,7 +130,7 @@ class Shipping extends AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'order_status' => 'order_status', 'shipping_description' => 'shipping_description', 'orders_count' => new \Zend_Db_Expr('SUM(orders_count)'), @@ -138,7 +138,7 @@ class Shipping extends AbstractReport 'total_shipping_actual' => new \Zend_Db_Expr('SUM(total_shipping_actual)') ); - $select->from($table, $columns)->where('store_id != ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $select->from($table, $columns)->where('store_id != ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); if ($subSelect !== null) { $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); @@ -252,7 +252,7 @@ class Shipping extends AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'order_status' => 'order_status', 'shipping_description' => 'shipping_description', 'orders_count' => new \Zend_Db_Expr('SUM(orders_count)'), @@ -260,7 +260,7 @@ class Shipping extends AbstractReport 'total_shipping_actual' => new \Zend_Db_Expr('SUM(total_shipping_actual)') ); - $select->from($table, $columns)->where('store_id != ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $select->from($table, $columns)->where('store_id != ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); if ($subSelect !== null) { $select->where($this->_makeConditionFromDateRangeSelect($subSelect, 'period')); diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php index 37edca796222916edd21f32df7e69e3058eb0ea1..48a1fec1b00a0985defe849802b29e650699c539 100644 --- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php @@ -24,7 +24,7 @@ namespace Magento\Sales\Model\Resource\Sale; use Magento\Core\Model\EntityFactory; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Data\Collection\Db\FetchStrategyInterface; use Magento\Event\ManagerInterface; use Magento\Logger; @@ -76,7 +76,7 @@ class Collection extends \Magento\Data\Collection\Db protected $_orderResource; /** - * @var \Magento\Core\Model\Resource\Store\CollectionFactory + * @var \Magento\Store\Model\Resource\Store\CollectionFactory */ protected $_storeCollectionFactory; @@ -91,7 +91,7 @@ class Collection extends \Magento\Data\Collection\Db * @param FetchStrategyInterface $fetchStrategy * @param ManagerInterface $eventManager * @param Order $resource - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory + * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory * @param StoreManagerInterface $storeManager */ public function __construct( @@ -100,7 +100,7 @@ class Collection extends \Magento\Data\Collection\Db FetchStrategyInterface $fetchStrategy, ManagerInterface $eventManager, Order $resource, - \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory, + \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory, StoreManagerInterface $storeManager ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php index 57a02f051adbef73dd4c927768fe0234bfda3de7..505510be5c4cb8315855f23d11358e132cb18b91 100644 --- a/app/code/Magento/Sales/Model/Resource/Setup.php +++ b/app/code/Magento/Sales/Model/Resource/Setup.php @@ -31,7 +31,7 @@ namespace Magento\Sales\Model\Resource; class Setup extends \Magento\Eav\Model\Entity\Setup { /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -45,7 +45,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param string $resourceName * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param string $moduleName * @param string $connectionName */ @@ -54,9 +54,9 @@ class Setup extends \Magento\Eav\Model\Entity\Setup $resourceName, \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, $moduleName = 'Magento_Sales', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_config = $config; $this->_encryptor = $context->getEncryptor(); @@ -267,7 +267,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup /** * Get config model * - * @return \Magento\App\ConfigInterface + * @return \Magento\App\Config\ScopeConfigInterface */ public function getConfigModel() { diff --git a/app/code/Magento/Sales/Model/Service/Quote.php b/app/code/Magento/Sales/Model/Service/Quote.php index fd453a22aab814bf7cc429b78935cea7ea38bb85..02632c5defc9a1a82126249d98bc645ea1627234 100755 --- a/app/code/Magento/Sales/Model/Service/Quote.php +++ b/app/code/Magento/Sales/Model/Service/Quote.php @@ -183,107 +183,6 @@ class Quote return $this; } - /** - * Submit the quote. Quote submit process will create the order based on quote data - * - * @return \Magento\Sales\Model\Order - * @throws \Exception - * @deprecated in favor of submitOrderWithDataObject which is using Service Layer - */ - public function submitOrder() - { - $this->_deleteNominalItems(); - $this->_validate(); - $quote = $this->_quote; - $isVirtual = $quote->isVirtual(); - - $transaction = $this->_transactionFactory->create(); - if ($quote->getCustomerId()) { - $customer = $quote->getCustomer(); - $transaction->addObject($customer); - } - $transaction->addObject($quote); - - $quote->reserveOrderId(); - if ($isVirtual) { - $order = $this->_convertor->addressToOrder($quote->getBillingAddress()); - } else { - $order = $this->_convertor->addressToOrder($quote->getShippingAddress()); - } - $order->setBillingAddress($this->_convertor->addressToOrderAddress($quote->getBillingAddress())); - $order->getBillingAddress()->setCustomerAddressData($quote->getBillingAddress()->getCustomerAddressData()); - if (!$isVirtual) { - $order->setShippingAddress($this->_convertor->addressToOrderAddress($quote->getShippingAddress())); - $order->getShippingAddress()->setCustomerAddressData( - $quote->getShippingAddress()->getCustomerAddressData() - ); - } - $order->setPayment($this->_convertor->paymentToOrderPayment($quote->getPayment())); - - foreach ($this->_orderData as $key => $value) { - $order->setData($key, $value); - } - - foreach ($quote->getAllItems() as $item) { - $orderItem = $this->_convertor->itemToOrderItem($item); - if ($item->getParentItem()) { - $orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId())); - } - $order->addItem($orderItem); - } - - $order->setQuote($quote); - - $transaction->addObject($order); - $transaction->addCommitCallback(array($order, 'place')); - $transaction->addCommitCallback(array($order, 'save')); - - /** - * We can use configuration data for declare new order status - */ - $this->_eventManager->dispatch( - 'checkout_type_onepage_save_order', - array('order' => $order, 'quote' => $quote) - ); - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_before', - array('order' => $order, 'quote' => $quote) - ); - try { - $transaction->save(); - $this->_inactivateQuote(); - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_success', - array('order' => $order, 'quote' => $quote) - ); - } catch (\Exception $e) { - if (!$this->_customerSession->isLoggedIn()) { - // reset customer ID's on exception, because customer not saved - $quote->getCustomer()->setId(null); - } - - //reset order ID's on exception, because order not saved - $order->setId(null); - /** @var $item \Magento\Sales\Model\Order\Item */ - foreach ($order->getItemsCollection() as $item) { - $item->setOrderId(null); - $item->setItemId(null); - } - - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_failure', - array('order' => $order, 'quote' => $quote) - ); - throw $e; - } - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_after', - array('order' => $order, 'quote' => $quote) - ); - $this->_order = $order; - return $order; - } - /** * Submit the quote. Quote submit process will create the order based on quote data * @@ -306,15 +205,17 @@ class Quote if ($customerData->getId()) { $this->_customerAccountService->saveCustomer($customerData); $this->_customerAddressService->saveAddresses($customerData->getId(), $addresses); - } else { - //for new customers - $customerDetails = $this->_customerDetailsBuilder->setCustomer( - $customerData - )->setAddresses( - $addresses - )->create(); - $customerData = $this->_customerAccountService->createAccount($customerDetails); - $addresses = $this->_customerAddressService->getAddresses($customerData->getId()); + } else { //for new customers + $customerDetails = + $this->_customerDetailsBuilder->setCustomer($customerData)->setAddresses($addresses)->create(); + $customerData = $this->_customerAccountService->createAccount( + $customerDetails, + null, + $quote->getPasswordHash() + ); + $addresses = $this->_customerAddressService->getAddresses( + $customerData->getId() + ); //Update quote address information foreach ($addresses as $address) { if ($address->isDefaultBilling()) { @@ -430,34 +331,6 @@ class Quote $this->_deleteNominalItems(); } - /** - * Submit all available items - * All created items will be set to the object - * - * @return void - * @throws \Exception - * @deprecated in favor of submitAllWithDataObject which is using Service Layer - */ - public function submitAll() - { - // don't allow submitNominalItems() to inactivate quote - $inactivateQuoteOld = $this->_shouldInactivateQuote; - $this->_shouldInactivateQuote = false; - try { - $this->submitNominalItems(); - $this->_shouldInactivateQuote = $inactivateQuoteOld; - } catch (\Exception $e) { - $this->_shouldInactivateQuote = $inactivateQuoteOld; - throw $e; - } - // no need to submit the order if there are no normal items remained - if (!$this->_quote->getAllVisibleItems()) { - $this->_inactivateQuote(); - return; - } - $this->submitOrder(); - } - /** * Submit all available items * All created items will be set to the object diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index f3e2bd738efdd96f10e7a276539d17ff5c61343f..04965c8c3a868b4db100a3ed84075cb9abac3aee 100644 --- a/app/code/Magento/Sales/etc/module.xml +++ b/app/code/Magento/Sales/etc/module.xml @@ -32,6 +32,7 @@ <module name="Magento_Payment"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Payment"/> @@ -51,7 +52,6 @@ <module name="Magento_CatalogInventory"/> <module name="Magento_Wishlist"/> <module name="Magento_Email"/> - <module name="Magento_Service"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php index 68855b3dccf33707aae7afb45f30c14e192da56c..af47d5e8c7f9c6670c6634fdcc7aa6fc9580ce47 100644 --- a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php +++ b/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php @@ -877,9 +877,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_order', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_order', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1045,9 +1045,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_order_grid', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_order_grid', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -1685,9 +1685,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_order_item', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_order_item', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2156,9 +2156,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_shipment', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_shipment', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2273,9 +2273,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_shipment_grid', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_shipment_grid', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2825,9 +2825,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_invoice', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_invoice', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -2972,9 +2972,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_invoice_grid', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_invoice_grid', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -3527,9 +3527,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_creditmemo', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_creditmemo', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -3716,9 +3716,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_creditmemo_grid', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_creditmemo_grid', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -4258,9 +4258,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_flat_quote', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_flat_quote', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_quote', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -4912,9 +4912,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_flat_quote_item', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_flat_quote_item', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -5552,9 +5552,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_invoiced_aggregated', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -5635,9 +5635,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_invoiced_aggregated_order', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -5784,9 +5784,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_order_aggregated_created', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_order_aggregated_created', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -5970,9 +5970,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_refunded_aggregated', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_refunded_aggregated', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6047,9 +6047,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_refunded_aggregated_order', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6124,9 +6124,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_shipping_aggregated', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_shipping_aggregated', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6201,9 +6201,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_shipping_aggregated_order', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6281,9 +6281,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_bestsellers_aggregated_daily', array('product_id')), array('product_id') )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6368,9 +6368,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_bestsellers_aggregated_monthly', array('product_id')), array('product_id') )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6454,9 +6454,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sales_bestsellers_aggregated_yearly', array('product_id')), array('product_id') )->addForeignKey( - $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -6651,9 +6651,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('sales_order_status_label', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/abstract.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/abstract.phtml index fbf4a6a987b4c792de8e81b5fc5e7889efdfe589..b7456471d1bb0345de81b78a6f103f05ae0db263 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/abstract.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/abstract.phtml @@ -29,4 +29,5 @@ <span class="title"><?php echo $this->getHeaderText() ?></span> <div class="actions"><?php echo $this->getButtonsHtml() ?></div> </div> + <?php echo $this->getChildHtml('', true) ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/data.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/data.phtml index 79f2e3f54d4400e63dd6cf751371924512469392..7817f19814d04a15e4dc250109f4a94c6f0e566b 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/data.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/data.phtml @@ -69,7 +69,9 @@ </div> <?php if($this->getChildBlock('card_validation')): ?> - <div id="order-card_validation" class="order-card-validation"><?php echo $this->getChildHtml('card_validation') ?></div> + <div class="order-card-validation" id="order-card_validation"> + <?php echo $this->getChildHtml('card_validation') ?> + </div> <?php endif; ?> <?php echo $this->getChildHtml('gift_options') ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/creditmemo/create/form.phtml b/app/code/Magento/Sales/view/adminhtml/order/creditmemo/create/form.phtml index 10a7347f03ff5805aeda481961cfd3d4734a7677..729c98f2f428f50a699725044ffb37e8f8ea7022 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/creditmemo/create/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/creditmemo/create/form.phtml @@ -47,10 +47,7 @@ </div> <div><?php echo $this->getChildHtml('order_payment') ?></div> <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> - <?php /*if ($this->getCreditmemo()->canRefund()): ?> - <input type="checkbox" name="creditmemo[do_refund]" id="creditmemo_do_refund" value="1" checked/> - <label for="creditmemo_do_refund" class="normal"><?php echo __('Refund Amount') ?></label> - <?php endif;*/ ?> + <div class="order-payment-additional"><?php echo $this->getChildHtml('order_payment_additional'); ?></div> </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/order/creditmemo/view/form.phtml b/app/code/Magento/Sales/view/adminhtml/order/creditmemo/view/form.phtml index adb15fa4c7834b3194962397909ffef2a1573824..5417d3abf1dbf35933acad5777dfabc660e42bd9 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/creditmemo/view/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/creditmemo/view/form.phtml @@ -39,6 +39,7 @@ </div> <div><?php echo $this->getChildHtml('order_payment') ?></div> <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> + <div class="order-payment-additional"><?php echo $this->getChildHtml('order_payment_additional'); ?></div> </div> </div> <?php if (!$_order->getIsVirtual()): ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/invoice/create/form.phtml b/app/code/Magento/Sales/view/adminhtml/order/invoice/create/form.phtml index 2943d5c2acbf9f8bb121f8c8d35cdcb6a072d6ae..4fdd3a22aaaa4bf5264124c99d153504af01ee30 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/invoice/create/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/invoice/create/form.phtml @@ -39,6 +39,7 @@ </div> <div><?php echo $this->getChildHtml('order_payment') ?></div> <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> + <div class="order-payment-additional"><?php echo $this->getChildHtml('order_payment_additional'); ?></div> </div> </div> <?php if (!$_order->getIsVirtual()): ?> diff --git a/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml b/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml index beb07ff391f13a250ef1805c600b77e558455985..bf57db0b72e6057d1e89bd6006c31dfa8c4c0226 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/invoice/view/form.phtml @@ -42,6 +42,7 @@ </div> <div><?php echo $this->getChildHtml('order_payment') ?></div> <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> + <div class="order-payment-additional"><?php echo $this->getChildHtml('order_payment_additional'); ?></div> </div> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml b/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml index d4dd4208d06bfd3b01515bec2773a16c1fa346fa..f00d8e400d2bc5a2a748881a8264796b72e41379 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml @@ -46,6 +46,7 @@ </div> <div><?php echo $this->getPaymentHtml() ?></div> <div class="order-payment-currency"><?php echo __('The order was placed using %1.', $_order->getOrderCurrencyCode()) ?></div> + <div class="order-payment-additional"><?php echo $this->getChildHtml('order_payment_additional'); ?></div> </div> </div> diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php index 27fafddbfe00e097e1ffad0eb77de798696b02f8..5ace177e0c9dc6e4c7c32a03bc76d2b621b88d03 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php @@ -35,14 +35,19 @@ namespace Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; /** - * @var \Magento\Customer\Model\Resource\Group\CollectionFactory + * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface */ - protected $_customerGroup; + protected $_customerGroupService; + + /** + * @var \Magento\Convert\Object + */ + protected $_objectConverter; /** * @var \Magento\SalesRule\Model\RuleFactory @@ -54,8 +59,9 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\SalesRule\Model\RuleFactory $salesRule - * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService + * @param \Magento\Convert\Object $objectConverter + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( @@ -63,12 +69,14 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\SalesRule\Model\RuleFactory $salesRule, - \Magento\Customer\Model\Resource\Group\CollectionFactory $customerGroup, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService, + \Magento\Convert\Object $objectConverter, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; - $this->_customerGroup = $customerGroup; + $this->_customerGroupService = $customerGroupService; + $this->_objectConverter = $objectConverter; $this->_salesRule = $salesRule; parent::__construct($context, $registry, $formFactory, $data); } @@ -181,18 +189,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent $field->setRenderer($renderer); } - $customerGroups = $this->_customerGroup->create()->load()->toOptionArray(); - $found = false; - - foreach ($customerGroups as $group) { - if ($group['value'] == 0) { - $found = true; - } - } - if (!$found) { - array_unshift($customerGroups, array('value' => 0, 'label' => __('NOT LOGGED IN'))); - } - + $groups = $this->_customerGroupService->getGroups(); $fieldset->addField( 'customer_group_ids', 'multiselect', @@ -201,7 +198,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent 'label' => __('Customer Groups'), 'title' => __('Customer Groups'), 'required' => true, - 'values' => $this->_customerGroup->create()->toOptionArray() + 'values' => $this->_objectConverter->toOptionArray($groups, 'id', 'code') ) ); diff --git a/app/code/Magento/SalesRule/Helper/Coupon.php b/app/code/Magento/SalesRule/Helper/Coupon.php index 3442e68b6eb187524bf4d7d02f29cfbbdc365dd6..1c844342ce308071c88e1ac2106a25ae42d39ba8 100644 --- a/app/code/Magento/SalesRule/Helper/Coupon.php +++ b/app/code/Magento/SalesRule/Helper/Coupon.php @@ -69,21 +69,21 @@ class Coupon extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $couponParameters */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $couponParameters ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_couponParameters = $couponParameters; parent::__construct($context); } @@ -109,7 +109,7 @@ class Coupon extends \Magento\App\Helper\AbstractHelper */ public function getDefaultLength() { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_RULE_COUPON_LENGTH); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_SALES_RULE_COUPON_LENGTH, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -119,7 +119,7 @@ class Coupon extends \Magento\App\Helper\AbstractHelper */ public function getDefaultFormat() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_RULE_COUPON_FORMAT); + return $this->_scopeConfig->getValue(self::XML_PATH_SALES_RULE_COUPON_FORMAT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -129,7 +129,7 @@ class Coupon extends \Magento\App\Helper\AbstractHelper */ public function getDefaultPrefix() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_RULE_COUPON_PREFIX); + return $this->_scopeConfig->getValue(self::XML_PATH_SALES_RULE_COUPON_PREFIX, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -139,7 +139,7 @@ class Coupon extends \Magento\App\Helper\AbstractHelper */ public function getDefaultSuffix() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_RULE_COUPON_SUFFIX); + return $this->_scopeConfig->getValue(self::XML_PATH_SALES_RULE_COUPON_SUFFIX, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -149,7 +149,7 @@ class Coupon extends \Magento\App\Helper\AbstractHelper */ public function getDefaultDashInterval() { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_RULE_COUPON_DASH_INTERVAL); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_SALES_RULE_COUPON_DASH_INTERVAL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** diff --git a/app/code/Magento/SalesRule/Model/Plugin/QuoteConfigProductAttributes.php b/app/code/Magento/SalesRule/Model/Plugin/QuoteConfigProductAttributes.php index 1cdd7e196e4f0297c4ee6e899f01737396e3d893..f7455805aff6bc77ad552362043003762a989447 100644 --- a/app/code/Magento/SalesRule/Model/Plugin/QuoteConfigProductAttributes.php +++ b/app/code/Magento/SalesRule/Model/Plugin/QuoteConfigProductAttributes.php @@ -23,7 +23,7 @@ */ namespace Magento\SalesRule\Model\Plugin; -use Magento\Core\Model\StoreManagerInterface; +use Magento\Store\Model\StoreManagerInterface; use Magento\Customer\Model\Session; use Magento\SalesRule\Model\Resource\Rule; @@ -34,26 +34,12 @@ class QuoteConfigProductAttributes */ protected $_ruleResource; - /** - * @var Session - */ - protected $_customerSession; - - /** - * @var StoreManagerInterface - */ - protected $_storeManager; - /** * @param Rule $ruleResource - * @param Session $customerSession - * @param StoreManagerInterface $storeManager */ - public function __construct(Rule $ruleResource, Session $customerSession, StoreManagerInterface $storeManager) + public function __construct(Rule $ruleResource) { $this->_ruleResource = $ruleResource; - $this->_customerSession = $customerSession; - $this->_storeManager = $storeManager; } /** @@ -67,15 +53,10 @@ class QuoteConfigProductAttributes */ public function afterGetProductAttributes(\Magento\Sales\Model\Quote\Config $subject, array $attributeKeys) { - $attributes = $this->_ruleResource->getActiveAttributes( - $this->_storeManager->getWebsite()->getId(), - $this->_customerSession->getCustomer()->getGroupId() - ); - + $attributes = $this->_ruleResource->getActiveAttributes(); foreach ($attributes as $attribute) { $attributeKeys[] = $attribute['attribute_code']; } - return $attributeKeys; } } diff --git a/app/code/Magento/SalesRule/Model/Quote/Discount.php b/app/code/Magento/SalesRule/Model/Quote/Discount.php index 9a4d92d56ea43fd45e67dc24cde1d0c439f0eabc..d449c8d946b401db833489cdc5fba13586116365 100644 --- a/app/code/Magento/SalesRule/Model/Quote/Discount.php +++ b/app/code/Magento/SalesRule/Model/Quote/Discount.php @@ -45,18 +45,18 @@ class Discount extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal protected $_eventManager = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\SalesRule\Model\Validator $validator */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\SalesRule\Model\Validator $validator ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Rule.php index c864da287b325a329582b76c9b9b9becb8816568..8e72386f73b6f11469d36b5cdc5128d4653a175d 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule.php @@ -266,13 +266,11 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource } /** - * Return codes of all product attributes currently used in promo rules for specified customer group and website + * Return codes of all product attributes currently used in promo rules * - * @param mixed $websiteId - * @param int $customerGroupId - * @return mixed + * @return array */ - public function getActiveAttributes($websiteId, $customerGroupId) + public function getActiveAttributes() { $read = $this->_getReadAdapter(); $select = $read->select()->from( diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index bc164513f1cc0e85ddfd54fc6222bed396467d53..d1dda9ee3b2be39b5fa41243d8673ff0be58394b 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -195,7 +195,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel protected $_couponCollection; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -209,7 +209,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\SalesRule\Model\Rule\Condition\CombineFactory $condCombineFactory * @param \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF * @param \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -224,7 +224,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\SalesRule\Model\Rule\Condition\CombineFactory $condCombineFactory, \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF, \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -387,7 +387,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel /** * Get Rule label by specified store * - * @param \Magento\Core\Model\Store|int|bool|null $store + * @param \Magento\Store\Model\Store|int|bool|null $store * @return string|bool */ public function getStoreLabel($store = null) @@ -493,21 +493,26 @@ class Rule extends \Magento\Rule\Model\AbstractModel $ok = false; if (!$saveNewlyCreated) { $ok = true; - } else if ($this->getId()) { - for ($attemptNum = 0; $attemptNum < $saveAttemptCount; $attemptNum++) { - try { - $coupon->save(); - } catch (\Exception $e) { - if ($e instanceof \Magento\Model\Exception || $coupon->getId()) { - throw $e; + } else { + if ($this->getId()) { + for ($attemptNum = 0; $attemptNum < $saveAttemptCount; $attemptNum++) { + try { + $coupon->save(); + } catch (\Exception $e) { + if ($e instanceof \Magento\Model\Exception || $coupon->getId()) { + throw $e; + } + $coupon->setCode( + $couponCode . self::getCouponCodeGenerator()->getDelimiter() . sprintf( + '%04u', + rand(0, 9999) + ) + ); + continue; } - $coupon->setCode( - $couponCode . self::getCouponCodeGenerator()->getDelimiter() . sprintf('%04u', rand(0, 9999)) - ); - continue; + $ok = true; + break; } - $ok = true; - break; } } if (!$ok) { diff --git a/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php index 943e867ce75710a9d11987a5d91d81c5cde80d28..7cd99acc930a09f74022b0b4222f7485243a96f3 100644 --- a/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php +++ b/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php @@ -24,22 +24,22 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $this \Magento\SalesRule\Model\Resource\Setup */ -$installer = $this->getMigrationModel(); +/** @var $this \Magento\Module\Setup */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'salesrule', 'conditions_serialized', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, array('rule_id') ); $installer->appendClassAliasReplace( 'salesrule', 'actions_serialized', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED, array('rule_id') ); diff --git a/app/code/Magento/SalesRule/etc/di.xml b/app/code/Magento/SalesRule/etc/di.xml index 8f2000bfc37b77714cf7e1fab0e7fd981b08b52d..915531aed25aef31ec3868f83aa4983ca265f442 100644 --- a/app/code/Magento/SalesRule/etc/di.xml +++ b/app/code/Magento/SalesRule/etc/di.xml @@ -28,10 +28,10 @@ <type name="Magento\Sales\Model\Quote\Config"> <plugin name="append_sales_rule_keys_to_quote" type="Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes"/> </type> - <type name="Magento\Module\Updater\SetupFactory"> + <type name="Magento\Module\Setup\Migration"> <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="salesrule_setup" xsi:type="string">Magento\SalesRule\Model\Resource\Setup</item> + <argument name="compositeModules" xsi:type="array"> + <item name="salesrule" xsi:type="string">Magento_SalesRule</item> </argument> </arguments> </type> diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml index be2c85251a968b15e919960974a0b976241d6c62..5e47008a91a27e59d53e2d7612a283f8ebbccc73 100644 --- a/app/code/Magento/SalesRule/etc/module.xml +++ b/app/code/Magento/SalesRule/etc/module.xml @@ -31,6 +31,7 @@ <module name="Magento_Sales"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Rule"/> <module name="Magento_Catalog"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php index cb3c8b832554253339839c0b8fb77d3d9b23ae41..0546f756ff5d4e0c96419cd30b80be8cbe7e60bb 100644 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php +++ b/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -412,9 +412,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('salesrule_label', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -483,9 +483,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_NO_ACTION )->addForeignKey( - $installer->getFkName('salesrule_product_attribute', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_NO_ACTION @@ -583,9 +583,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('coupon_aggregated', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('coupon_aggregated', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('coupon_aggregated', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -665,9 +665,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('coupon_aggregated_order', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('coupon_aggregated_order', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('coupon_aggregated_order', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php index 93acb2706513936467e7935078cbc85524bf8550..9b8db2e52e839070f1b2faa9a9b57346307ca060 100644 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php @@ -25,7 +25,7 @@ */ $installer = $this; -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); $connection->createTable( diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php index 251c1da9653422b01e17db9c442cf1b516656d75..faffc242014f6c22aace001d1d0023a5ea7729e0 100644 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -25,7 +25,7 @@ */ /** - * @var $installer \Magento\Core\Model\Resource\Setup + * @var $installer \Magento\Module\Setup */ $installer = $this; diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php index 664d76c2ec68b4240b92104467d0b90b56b44db5..312327d0927a177c29954d2d709ee22599e5048c 100644 --- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php +++ b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php @@ -24,12 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); $rulesTable = $installer->getTable('salesrule'); -$websitesTable = $installer->getTable('core_website'); +$websitesTable = $installer->getTable('store_website'); $customerGroupsTable = $installer->getTable('customer_group'); $rulesWebsitesTable = $installer->getTable('salesrule_website'); $rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group'); diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php index 722509b8813f8bc6e3d3cffd555b5761ab7e58e3..10e2e5c4f6698c04e6a4c189e6503738dcbe224b 100644 --- a/app/code/Magento/Sendfriend/Controller/Product.php +++ b/app/code/Magento/Sendfriend/Controller/Product.php @@ -137,8 +137,8 @@ class Product extends \Magento\App\Action\Action /** @var \Magento\Stdlib\Cookie $cookie */ $cookie = $this->_objectManager->get('Magento\Stdlib\Cookie'); - /** @var \Magento\Core\Model\StoreManagerInterface $store */ - $store = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + /** @var \Magento\Store\Model\StoreManagerInterface $store */ + $store = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface'); /** @var \Magento\Sendfriend\Model\Sendfriend $model */ $model = $this->_objectManager->create('Magento\Sendfriend\Model\Sendfriend'); diff --git a/app/code/Magento/Sendfriend/Helper/Data.php b/app/code/Magento/Sendfriend/Helper/Data.php index fc25a27ef7f4344f11aa3f8bf04865542b1e6074..df62c0ba12f033077e7b7d4461f508fefab02734 100644 --- a/app/code/Magento/Sendfriend/Helper/Data.php +++ b/app/code/Magento/Sendfriend/Helper/Data.php @@ -55,19 +55,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -79,7 +79,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isEnabled($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ENABLED, $store); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_ENABLED, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** @@ -90,7 +90,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isAllowForGuest($store = null) { - return $this->_coreStoreConfig->getConfigFlag(self::XML_PATH_ALLOW_FOR_GUEST, $store); + return $this->_scopeConfig->isSetFlag(self::XML_PATH_ALLOW_FOR_GUEST, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** @@ -101,7 +101,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMaxRecipients($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_RECIPIENTS, $store); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_MAX_RECIPIENTS, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** @@ -112,7 +112,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMaxEmailPerPeriod($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_PER_HOUR, $store); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_MAX_PER_HOUR, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** @@ -133,7 +133,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getLimitBy($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::XML_PATH_LIMIT_BY, $store); + return (int)$this->_scopeConfig->getValue(self::XML_PATH_LIMIT_BY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** @@ -144,7 +144,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getEmailTemplate($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_TEMPLATE, $store); + return $this->_scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } /** diff --git a/app/code/Magento/Sendfriend/Model/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Sendfriend.php index da257a10f5a504c93d078236d100f0fd99ee63e8..4b0681d4499db4bc3c89774dfaa614495e386776 100644 --- a/app/code/Magento/Sendfriend/Model/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Sendfriend.php @@ -105,7 +105,7 @@ class Sendfriend extends \Magento\Model\AbstractModel protected $_transportBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -122,7 +122,7 @@ class Sendfriend extends \Magento\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Catalog\Helper\Image $catalogImage * @param \Magento\Sendfriend\Helper\Data $sendfriendData @@ -135,7 +135,7 @@ class Sendfriend extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Catalog\Helper\Image $catalogImage, \Magento\Sendfriend\Helper\Data $sendfriendData, diff --git a/app/code/Magento/Sendfriend/etc/module.xml b/app/code/Magento/Sendfriend/etc/module.xml index 3a197537d23921b09d1e385ff9299d55c078b514..5b54fbd7bb7fcd70f5e6fff7db96eb65f961b9e5 100644 --- a/app/code/Magento/Sendfriend/etc/module.xml +++ b/app/code/Magento/Sendfriend/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> diff --git a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-1.6.0.0.php b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-1.6.0.0.php index aa285737d87c9a1696dbf01b0299bdd6faf94ffd..93201d9d30e9bd5bbbecc6b16829535b5e4f3a69 100644 --- a/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-1.6.0.0.php +++ b/app/code/Magento/Sendfriend/sql/sendfriend_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php index c2ea271e662c04c66a0a177657bfdfea94c70439..8610fb13f8a2017e00fc73ac7456e98529484b7f 100644 --- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php @@ -114,18 +114,20 @@ class Packaging extends \Magento\Backend\Block\Template $itemsProductId[$item->getId()] = $item->getProductId(); $itemsOrderItemId[$item->getId()] = $item->getOrderItemId(); } - } else if ($orderId) { - $urlParams['order_id'] = $orderId; - $createLabelUrl = $this->getUrl('adminhtml/order_shipment/save', $urlParams); - $itemsGridUrl = $this->getUrl('adminhtml/order_shipment/getShippingItemsGrid', $urlParams); + } else { + if ($orderId) { + $urlParams['order_id'] = $orderId; + $createLabelUrl = $this->getUrl('adminhtml/order_shipment/save', $urlParams); + $itemsGridUrl = $this->getUrl('adminhtml/order_shipment/getShippingItemsGrid', $urlParams); - foreach ($this->getShipment()->getAllItems() as $item) { - $itemsQty[$item->getOrderItemId()] = $item->getQty() * 1; - $itemsPrice[$item->getOrderItemId()] = $item->getPrice(); - $itemsName[$item->getOrderItemId()] = $item->getName(); - $itemsWeight[$item->getOrderItemId()] = $item->getWeight(); - $itemsProductId[$item->getOrderItemId()] = $item->getProductId(); - $itemsOrderItemId[$item->getOrderItemId()] = $item->getOrderItemId(); + foreach ($this->getShipment()->getAllItems() as $item) { + $itemsQty[$item->getOrderItemId()] = $item->getQty() * 1; + $itemsPrice[$item->getOrderItemId()] = $item->getPrice(); + $itemsName[$item->getOrderItemId()] = $item->getName(); + $itemsWeight[$item->getOrderItemId()] = $item->getWeight(); + $itemsProductId[$item->getOrderItemId()] = $item->getProductId(); + $itemsOrderItemId[$item->getOrderItemId()] = $item->getOrderItemId(); + } } } $data = array( @@ -158,8 +160,9 @@ class Packaging extends \Magento\Backend\Block\Template $storeId = $this->getShipment()->getStoreId(); $address = $order->getShippingAddress(); $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); - $countryShipper = $this->_storeConfig->getConfig( + $countryShipper = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); if ($carrier) { @@ -266,8 +269,10 @@ class Packaging extends \Magento\Backend\Block\Template foreach ($items as $item) { if ($itemsOf == 'order' && $item->getOrderItemId() == $itemId) { return $item; - } else if ($itemsOf == 'shipment' && $item->getId() == $itemId) { - return $item; + } else { + if ($itemsOf == 'shipment' && $item->getId() == $itemId) { + return $item; + } } } return new \Magento\Object(); @@ -283,8 +288,9 @@ class Packaging extends \Magento\Backend\Block\Template $storeId = $this->getShipment()->getStoreId(); $order = $this->getShipment()->getOrder(); $address = $order->getShippingAddress(); - $shipperAddressCountryCode = $this->_storeConfig->getConfig( + $shipperAddressCountryCode = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); $recipientAddressCountryCode = $address->getCountryId(); @@ -360,8 +366,9 @@ class Packaging extends \Magento\Backend\Block\Template $storeId = $this->getShipment()->getStoreId(); $address = $order->getShippingAddress(); $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); - $countryShipper = $this->_storeConfig->getConfig( + $countryShipper = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); if ($carrier) { diff --git a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php index 42d0cc5621725a1d4913432a739b8ba51717eae6..01c776b44efd4669637baf163e41d3f4771a3093 100644 --- a/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php @@ -96,8 +96,9 @@ class Grid extends \Magento\Backend\Block\Template $storeId = $this->getShipment()->getStoreId(); $order = $this->getShipment()->getOrder(); $address = $order->getShippingAddress(); - $shipperAddressCountryCode = $this->_storeConfig->getConfig( + $shipperAddressCountryCode = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); $recipientAddressCountryCode = $address->getCountryId(); diff --git a/app/code/Magento/Shipping/Block/Tracking/Popup.php b/app/code/Magento/Shipping/Block/Tracking/Popup.php index d75870b19a90bcd250bf8375e8c2e7085db7dbe9..d08ded17823a18f542da20b7bf210c96e9d32fb9 100644 --- a/app/code/Magento/Shipping/Block/Tracking/Popup.php +++ b/app/code/Magento/Shipping/Block/Tracking/Popup.php @@ -109,7 +109,10 @@ class Popup extends \Magento\View\Element\Template */ public function getContactUsEnabled() { - return (bool)$this->_storeConfig->getConfig('contacts/contacts/enabled'); + return (bool)$this->_scopeConfig->getValue( + 'contacts/contacts/enabled', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -117,7 +120,10 @@ class Popup extends \Magento\View\Element\Template */ public function getStoreSupportEmail() { - return $this->_storeConfig->getConfig('trans_email/ident_support/email'); + return $this->_scopeConfig->getValue( + 'trans_email/ident_support/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -125,6 +131,6 @@ class Popup extends \Magento\View\Element\Template */ public function getContactUs() { - return $this->getUrl('contacts'); + return $this->getUrl('contact'); } } diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php index 674845c9ff85697a6bb88b680c63292590e93a82..9cbf29177463a6f5eb4f7d00dcd8f126034e8d38 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php @@ -500,10 +500,12 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment->setShippingLabel($outputPdf->render()); $carrierCode = $carrier->getCarrierCode(); $carrierTitle = $this->_objectManager->get( - 'Magento\Core\Model\Store\Config' - )->getConfig( + 'Magento\App\Config\ScopeConfigInterface', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )->getValue( 'carriers/' . $carrierCode . '/title', - $shipment->getStoreId() + $shipment->getStoreId(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if ($trackingNumbers) { foreach ($trackingNumbers as $trackingNumber) { diff --git a/app/code/Magento/Shipping/Helper/Carrier.php b/app/code/Magento/Shipping/Helper/Carrier.php index 22c7994aff96adf003293250c2cf8d964a2196ce..785a1a05fa6d44c8ac929c517b7e2e15e5d8614e 100644 --- a/app/code/Magento/Shipping/Helper/Carrier.php +++ b/app/code/Magento/Shipping/Helper/Carrier.php @@ -43,35 +43,39 @@ class Carrier extends \Magento\App\Helper\AbstractHelper /** * Store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeConfig; + protected $scopeConfig; /** * @param \Magento\App\Helper\Context $context * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\Store\ConfigInterface $storeConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->localeResolver = $localeResolver; - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; parent::__construct($context); } /** * Get online shipping carrier codes * - * @param int|\Magento\Core\Model\Store|null $store + * @param int|\Magento\Store\Model\Store|null $store * @return array */ public function getOnlineCarrierCodes($store = null) { $carriersCodes = array(); - foreach ($this->storeConfig->getConfig(self::XML_PATH_CARRIERS_ROOT, $store) as $carrierCode => $carrier) { + foreach ($this->scopeConfig->getValue( + self::XML_PATH_CARRIERS_ROOT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) as $carrierCode => $carrier) { if (isset($carrier['is_online']) && $carrier['is_online']) { $carriersCodes[] = $carrierCode; } @@ -89,8 +93,9 @@ class Carrier extends \Magento\App\Helper\AbstractHelper */ public function getCarrierConfigValue($carrierCode, $configPath, $store = null) { - return $this->storeConfig->getConfig( + return $this->scopeConfig->getValue( sprintf('%s/%s/%s', self::XML_PATH_CARRIERS_ROOT, $carrierCode, $configPath), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } diff --git a/app/code/Magento/Shipping/Helper/Data.php b/app/code/Magento/Shipping/Helper/Data.php index 4572c5a32b30f97db7c3a425d0717aad2bdb8b3c..d96093de746344aacf5a657108788b58c503d12c 100644 --- a/app/code/Magento/Shipping/Helper/Data.php +++ b/app/code/Magento/Shipping/Helper/Data.php @@ -48,29 +48,29 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_coreData = $coreData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; parent::__construct($context); } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index 0917ea8b89095fc99f7a6a580fdda7adc0ae4e62..dbf778f4544ff92afc8d8e0b8465f9bc56e9ab19 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -95,9 +95,9 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory @@ -110,19 +110,19 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie protected $_logAdapterFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, array $data = array() ) { parent::__construct($data); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_rateErrorFactory = $rateErrorFactory; $this->_logAdapterFactory = $logAdapterFactory; } @@ -139,7 +139,11 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie return false; } $path = 'carriers/' . $this->_code . '/' . $field; - return $this->_coreStoreConfig->getConfig($path, $this->getStore()); + return $this->_scopeConfig->getValue( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore() + ); } /** @@ -154,7 +158,11 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie return false; } $path = 'carriers/' . $this->_code . '/' . $field; - return $this->_coreStoreConfig->getConfigFlag($path, $this->getStore()); + return $this->_scopeConfig->isSetFlag( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getStore() + ); } /** @@ -231,10 +239,12 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID) { $direction = 'within_us'; - } else if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) { - $direction = 'from_us'; } else { - return $containersAll; + if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient != self::USA_COUNTRY_ID) { + $direction = 'from_us'; + } else { + return $containersAll; + } } foreach ($containersFilter as $dataItem) { diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index 9d9cdd0634cb2c4777ea1cbfea9d8b47c726d9f8..ac7dac8ea499162e0e34d8a11cc80a641a13f24e 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -108,7 +108,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier protected $_currencyFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory @@ -126,7 +126,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, @@ -151,7 +151,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier $this->_countryFactory = $countryFactory; $this->_currencyFactory = $currencyFactory; $this->_directoryData = $directoryData; - parent::__construct($coreStoreConfig, $rateErrorFactory, $logAdapterFactory, $data); + parent::__construct($scopeConfig, $rateErrorFactory, $logAdapterFactory, $data); } /** diff --git a/app/code/Magento/Shipping/Model/Carrier/Source/GenericDefault.php b/app/code/Magento/Shipping/Model/Carrier/Source/GenericDefault.php new file mode 100644 index 0000000000000000000000000000000000000000..afc909b67a6ceece8991ecd79f0b35628793844f --- /dev/null +++ b/app/code/Magento/Shipping/Model/Carrier/Source/GenericDefault.php @@ -0,0 +1,41 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Shipping\Model\Carrier\Source; + +/** + * Class GenericDefault + * Default implementation of generic carrier source + * + * @package Magento\Shipping\Model\Carrier\Source + */ +class GenericDefault implements GenericInterface +{ + /** + * {@inheritdoc} + */ + public function toOptionArray() + { + return array(); + } +} diff --git a/app/code/Magento/Shipping/Model/CarrierFactory.php b/app/code/Magento/Shipping/Model/CarrierFactory.php index 0f8439378504c72cde7291b02d4c243c09310448..345f658c4561b74d4abf86ab57305f25228e61a3 100644 --- a/app/code/Magento/Shipping/Model/CarrierFactory.php +++ b/app/code/Magento/Shipping/Model/CarrierFactory.php @@ -30,9 +30,9 @@ class CarrierFactory implements CarrierFactoryInterface /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\ObjectManager @@ -40,14 +40,14 @@ class CarrierFactory implements CarrierFactoryInterface protected $_objectManager; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\ObjectManager $objectManager */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\ObjectManager $objectManager ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_objectManager = $objectManager; } @@ -59,7 +59,10 @@ class CarrierFactory implements CarrierFactoryInterface */ public function get($carrierCode) { - $className = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/model'); + $className = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/model', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!$className) { return false; } @@ -77,7 +80,11 @@ class CarrierFactory implements CarrierFactoryInterface */ public function create($carrierCode, $storeId = null) { - $className = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/model', $storeId); + $className = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/model', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); if (!$className) { return false; } @@ -97,8 +104,9 @@ class CarrierFactory implements CarrierFactoryInterface */ public function getIfActive($carrierCode) { - return $this->_coreStoreConfig->getConfigFlag( - 'carriers/' . $carrierCode . '/active' + return $this->_scopeConfig->isSetFlag( + 'carriers/' . $carrierCode . '/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ? $this->get( $carrierCode ) : false; @@ -113,8 +121,9 @@ class CarrierFactory implements CarrierFactoryInterface */ public function createIfActive($carrierCode, $storeId = null) { - return $this->_coreStoreConfig->getConfigFlag( - 'carriers/' . $carrierCode . '/active' + return $this->_scopeConfig->isSetFlag( + 'carriers/' . $carrierCode . '/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) ? $this->create( $carrierCode, $storeId diff --git a/app/code/Magento/Shipping/Model/Config.php b/app/code/Magento/Shipping/Model/Config.php index 1c50fe06d08f30400483629432ac50e1b1d49d44..87bc48191b8ec485c87cc92db23fbc9f7e382b05 100644 --- a/app/code/Magento/Shipping/Model/Config.php +++ b/app/code/Magento/Shipping/Model/Config.php @@ -41,9 +41,9 @@ class Config extends \Magento\Object /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Shipping\Model\CarrierFactory @@ -53,16 +53,16 @@ class Config extends \Magento\Object /** * Constructor * - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_carrierFactory = $carrierFactory; parent::__construct($data); } @@ -76,9 +76,9 @@ class Config extends \Magento\Object public function getActiveCarriers($store = null) { $carriers = array(); - $config = $this->_coreStoreConfig->getConfig('carriers', $store); + $config = $this->_scopeConfig->getValue('carriers', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); foreach (array_keys($config) as $carrierCode) { - if ($this->_coreStoreConfig->getConfigFlag('carriers/' . $carrierCode . '/active', $store)) { + if ($this->_scopeConfig->isSetFlag('carriers/' . $carrierCode . '/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store)) { $carrierModel = $this->_carrierFactory->create($carrierCode, $store); if ($carrierModel) { $carriers[$carrierCode] = $carrierModel; @@ -97,7 +97,7 @@ class Config extends \Magento\Object public function getAllCarriers($store = null) { $carriers = array(); - $config = $this->_coreStoreConfig->getConfig('carriers', $store); + $config = $this->_scopeConfig->getValue('carriers', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); foreach (array_keys($config) as $carrierCode) { $model = $this->_carrierFactory->create($carrierCode, $store); if ($model) { diff --git a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php index 6a35161f4e5e0b2aaf43cedb7add08a7726a8b40..cd41929bc52b9bbb7f83b933d5f85d4239ff81f5 100644 --- a/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php +++ b/app/code/Magento/Shipping/Model/Config/Source/Allmethods.php @@ -30,9 +30,9 @@ class Allmethods implements \Magento\Option\ArrayInterface /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Shipping\Model\Config @@ -40,14 +40,14 @@ class Allmethods implements \Magento\Option\ArrayInterface protected $_shippingConfig; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Shipping\Model\Config $shippingConfig */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Shipping\Model\Config $shippingConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_shippingConfig = $shippingConfig; } @@ -70,7 +70,10 @@ class Allmethods implements \Magento\Option\ArrayInterface if (!$carrierMethods) { continue; } - $carrierTitle = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/title'); + $carrierTitle = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode . '/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $methods[$carrierCode] = array('label' => $carrierTitle, 'value' => array()); foreach ($carrierMethods as $methodCode => $methodTitle) { $methods[$carrierCode]['value'][] = array( diff --git a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index 37234cbc20696cfe1f161d8bc7dfb2f67787c7f6..8dfbcd584d7ff3f9a86185bfb65421c252f0c2a6 100644 --- a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -35,7 +35,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf protected $_carrierHelper; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -52,7 +52,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory @@ -60,7 +60,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Shipping\Helper\Carrier $carrierHelper - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data @@ -70,7 +70,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf public function __construct( \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, @@ -78,7 +78,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Translate\Inline\StateInterface $inlineTranslation, Carrier $carrierHelper, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -91,7 +91,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf parent::__construct( $paymentData, $string, - $coreStoreConfig, + $scopeConfig, $filesystem, $pdfConfig, $pdfTotalFactory, diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php index 3ae690d75a9db8b88bdab8440fd39aac8462c1b2..f5f97884a464ec820d54173bde5917f1fd168ee1 100644 --- a/app/code/Magento/Shipping/Model/Order/Track.php +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -59,7 +59,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param \Magento\Model\Resource\AbstractResource $resource @@ -73,7 +73,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Shipping\Model\CarrierFactory $carrierFactory, \Magento\Model\Resource\AbstractResource $resource = null, diff --git a/app/code/Magento/Shipping/Model/Rate/Result.php b/app/code/Magento/Shipping/Model/Rate/Result.php index c5a117f64bd1c69d059bba64daf0410c74c08c07..d6edde04ff238f4434eb0d434c5b59425e0a8317 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result.php +++ b/app/code/Magento/Shipping/Model/Rate/Result.php @@ -42,14 +42,14 @@ class Result protected $_error = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Shipping/Model/Shipping.php b/app/code/Magento/Shipping/Model/Shipping.php index ef174bac03fbc0bcccd023390c434d841747a598..f3e8bf2ca423dbc54711313cb5991b6926fbc086 100644 --- a/app/code/Magento/Shipping/Model/Shipping.php +++ b/app/code/Magento/Shipping/Model/Shipping.php @@ -54,12 +54,12 @@ class Shipping implements RateCollectorInterface /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -94,9 +94,9 @@ class Shipping implements RateCollectorInterface protected $mathDivision; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Shipping\Model\Config $shippingConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory @@ -104,16 +104,16 @@ class Shipping implements RateCollectorInterface * @param \Magento\Math\Division $mathDivision */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Shipping\Model\Config $shippingConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\CarrierFactory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Math\Division $mathDivision ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_shippingConfig = $shippingConfig; $this->_storeManager = $storeManager; $this->_carrierFactory = $carrierFactory; @@ -180,19 +180,39 @@ class Shipping implements RateCollectorInterface $storeId = $request->getStoreId(); if (!$request->getOrig()) { $request->setCountryId( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStore()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $request->getStore() + ) )->setRegionId( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $request->getStore()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_REGION_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $request->getStore() + ) )->setCity( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_CITY, $request->getStore()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_CITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $request->getStore() + ) )->setPostcode( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ZIP, $request->getStore()) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $request->getStore() + ) ); } $limitCarrier = $request->getLimitCarrier(); if (!$limitCarrier) { - $carriers = $this->_coreStoreConfig->getConfig('carriers', $storeId); + $carriers = $this->_scopeConfig->getValue( + 'carriers', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); foreach ($carriers as $carrierCode => $carrierConfig) { $this->collectCarrierRates($carrierCode, $request); @@ -202,7 +222,11 @@ class Shipping implements RateCollectorInterface $limitCarrier = array($limitCarrier); } foreach ($limitCarrier as $carrierCode) { - $carrierConfig = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode, $storeId); + $carrierConfig = $this->_scopeConfig->getValue( + 'carriers/' . $carrierCode, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); if (!$carrierConfig) { continue; } diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index a3d2e77ca165f0de06f85ae4f9a17bcf8bac6958..d5eb96a91f7e413c0c22bc40c4bee7c24768907a 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -43,9 +43,9 @@ class Labels extends \Magento\Shipping\Model\Shipping protected $_request; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Shipping\Model\Config $shippingConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory @@ -55,9 +55,9 @@ class Labels extends \Magento\Shipping\Model\Shipping * @param \Magento\Shipping\Model\Shipment\Request $request */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Shipping\Model\Config $shippingConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\CarrierFactory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, @@ -69,7 +69,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $this->_authSession = $authSession; $this->_request = $request; parent::__construct( - $coreStoreConfig, + $scopeConfig, $shippingConfig, $storeManager, $carrierFactory, @@ -99,33 +99,54 @@ class Labels extends \Magento\Shipping\Model\Shipping if (!$shipmentCarrier) { throw new \Magento\Model\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); } - $shipperRegionCode = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $shipmentStoreId); + $shipperRegionCode = $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_REGION_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ); if (is_numeric($shipperRegionCode)) { $shipperRegionCode = $this->_regionFactory->create()->load($shipperRegionCode)->getCode(); } $recipientRegionCode = $this->_regionFactory->create()->load($address->getRegionId())->getCode(); - $originStreet1 = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ADDRESS1, $shipmentStoreId); - $originStreet2 = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ADDRESS2, $shipmentStoreId); + $originStreet1 = $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_ADDRESS1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ); + $originStreet2 = $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_ADDRESS2, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ); $storeInfo = new \Magento\Object( - (array)$this->_coreStoreConfig->getConfig('general/store_information', $shipmentStoreId) + (array)$this->_scopeConfig->getValue( + 'general/store_information', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ) ); - if (!$admin->getFirstname() || - !$admin->getLastname() || - !$storeInfo->getName() || - !$storeInfo->getPhone() || - !$originStreet1 || - !$shipperRegionCode || - !$this->_coreStoreConfig->getConfig( + if (!$admin->getFirstname() + || !$admin->getLastname() + || !$storeInfo->getName() + || !$storeInfo->getPhone() + || !$originStreet1 + || !$shipperRegionCode + || !$this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_CITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shipmentStoreId - ) || !$this->_coreStoreConfig->getConfig( + ) + || !$this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shipmentStoreId - ) || !$this->_coreStoreConfig->getConfig( + ) + || !$this->_scopeConfig->getValue( Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $shipmentStoreId ) ) { @@ -149,14 +170,26 @@ class Labels extends \Magento\Shipping\Model\Shipping $request->setShipperAddressStreet1($originStreet1); $request->setShipperAddressStreet2($originStreet2); $request->setShipperAddressCity( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_CITY, $shipmentStoreId) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_CITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ) ); $request->setShipperAddressStateOrProvinceCode($shipperRegionCode); $request->setShipperAddressPostalCode( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ZIP, $shipmentStoreId) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ) ); $request->setShipperAddressCountryCode( - $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId) + $this->_scopeConfig->getValue( + Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $shipmentStoreId + ) ); $request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname())); $request->setRecipientContactPersonFirstName($address->getFirstname()); diff --git a/app/code/Magento/Shipping/etc/di.xml b/app/code/Magento/Shipping/etc/di.xml index 291fba714f220631a99e37b9422cf740116f677d..1724e3bc875d63979457de7e9e7f733ab6f268ce 100644 --- a/app/code/Magento/Shipping/etc/di.xml +++ b/app/code/Magento/Shipping/etc/di.xml @@ -26,4 +26,5 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\Sales\Model\Quote\Address\RateCollectorInterface" type="Magento\Shipping\Model\Shipping" /> <preference for="Magento\Sales\Model\Quote\Address\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> + <preference for="Magento\Shipping\Model\Carrier\Source\GenericInterface" type="\Magento\Shipping\Model\Carrier\Source\GenericDefault" /> </config> diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml index ca11c510a77d25a30f506ffcf275b1fc304b9734..f98d05dab2bd740ed857379a02c38cf0343e55b0 100644 --- a/app/code/Magento/Shipping/etc/module.xml +++ b/app/code/Magento/Shipping/etc/module.xml @@ -27,15 +27,17 @@ <module name="Magento_Shipping" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Catalog"/> <module name="Magento_Sales"/> <module name="Magento_Backend"/> <module name="Magento_Directory"/> - <module name="Magento_Contacts"/> + <module name="Magento_Contact"/> <module name="Magento_Customer"/> <module name="Magento_Payment"/> <module name="Magento_Theme"/> diff --git a/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml b/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml index 86bff6d8e99cb59b876d14f3c0745e06dec4c649..19aa1f16b2b94ae88aca64bea9d64fafb45e4576 100644 --- a/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml @@ -93,7 +93,7 @@ $girthEnabled = $this->isDisplayGirthValue() && $this->isGirthAllowed() ? 1 : 0; <?php endforeach; ?> </select> </td> - <?php if ($girthEnabled == 1): ?> + <?php if ($girthEnabled == 1 && !empty($sizeSource)): ?> <td> <select name="package_size" onchange="packaging.checkSizeAndGirthParameter(this, <?php echo $girthEnabled ?>);"> <?php foreach ($sizeSource as $key => $value): ?> diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php index a5dae2f6d25bda0f981ccfb663139eae3a05e77a..64727aba7095e3d2acce7446d1b1c36715f3b4ad 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php @@ -33,7 +33,7 @@ namespace Magento\Sitemap\Block\Adminhtml\Edit; class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_systemStore; @@ -41,14 +41,14 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $systemStore + * @param \Magento\Store\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $systemStore, + \Magento\Store\Model\System\Store $systemStore, array $data = array() ) { $this->_systemStore = $systemStore; diff --git a/app/code/Magento/Sitemap/Helper/Data.php b/app/code/Magento/Sitemap/Helper/Data.php index 265f14e9290e52473c88d9fe3e86b81fe8f134d9..4f1af5356f921b36c0c4f429ba88bd462cc9711d 100644 --- a/app/code/Magento/Sitemap/Helper/Data.php +++ b/app/code/Magento/Sitemap/Helper/Data.php @@ -76,19 +76,19 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\Store\Config $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -100,7 +100,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMaximumLinesNumber($storeId) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_LINES, $storeId); + return $this->_scopeConfig->getValue( + self::XML_PATH_MAX_LINES, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -111,7 +115,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getMaximumFileSize($storeId) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_MAX_FILE_SIZE, $storeId); + return $this->_scopeConfig->getValue( + self::XML_PATH_MAX_FILE_SIZE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -122,7 +130,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getCategoryChangefreq($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_CATEGORY_CHANGEFREQ, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_CATEGORY_CHANGEFREQ, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -133,7 +145,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getProductChangefreq($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_PRODUCT_CHANGEFREQ, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_PRODUCT_CHANGEFREQ, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -144,7 +160,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getPageChangefreq($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_PAGE_CHANGEFREQ, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_PAGE_CHANGEFREQ, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -155,7 +175,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getCategoryPriority($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_CATEGORY_PRIORITY, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_CATEGORY_PRIORITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -166,7 +190,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getProductPriority($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_PRODUCT_PRIORITY, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_PRODUCT_PRIORITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -177,7 +205,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getPagePriority($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_PAGE_PRIORITY, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_PAGE_PRIORITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -188,7 +220,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getEnableSubmissionRobots($storeId) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_SUBMISSION_ROBOTS, $storeId); + return $this->_scopeConfig->getValue( + self::XML_PATH_SUBMISSION_ROBOTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } /** @@ -199,6 +235,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getProductImageIncludePolicy($storeId) { - return (string)$this->_coreStoreConfig->getConfig(self::XML_PATH_PRODUCT_IMAGES_INCLUDE, $storeId); + return (string)$this->_scopeConfig->getValue( + self::XML_PATH_PRODUCT_IMAGES_INCLUDE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeId + ); } } diff --git a/app/code/Magento/Sitemap/Model/Config/Backend/Priority.php b/app/code/Magento/Sitemap/Model/Config/Backend/Priority.php index 45064b75dac851f9fe02d3b2738492795736de57..76073cf397511fc2cafbcbe886ba2c5f8c718331 100644 --- a/app/code/Magento/Sitemap/Model/Config/Backend/Priority.php +++ b/app/code/Magento/Sitemap/Model/Config/Backend/Priority.php @@ -25,7 +25,7 @@ */ namespace Magento\Sitemap\Model\Config\Backend; -class Priority extends \Magento\Core\Model\Config\Value +class Priority extends \Magento\App\Config\Value { /** * @return $this diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index ee0a80569fe1ec480748e7b2761f940a90110cb7..3ca7cd646cd80a80c6e0177f11508b12264115b1 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -60,9 +60,9 @@ class Observer /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory @@ -75,7 +75,7 @@ class Observer protected $_transportBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -85,20 +85,20 @@ class Observer protected $inlineTranslation; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param Resource\Sitemap\CollectionFactory $collectionFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory $collectionFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Translate\Inline\StateInterface $inlineTranslation ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_collectionFactory = $collectionFactory; $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; @@ -116,7 +116,11 @@ class Observer $errors = array(); // check if scheduled generation enabled - if (!$this->_coreStoreConfig->getConfigFlag(self::XML_PATH_GENERATION_ENABLED)) { + if (!$this->_scopeConfig->isSetFlag( + self::XML_PATH_GENERATION_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return; } @@ -132,11 +136,19 @@ class Observer } } - if ($errors && $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT)) { - $this->inlineTranslation->suspend(); + if ($errors && $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { + $translate = $this->_translateModel->getTranslateInline(); + $this->_translateModel->setTranslateInline(false); $this->_transportBuilder->setTemplateIdentifier( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_ADMIN, @@ -145,9 +157,15 @@ class Observer )->setTemplateVars( array('warnings' => join("\n", $errors)) )->setFrom( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_IDENTITY) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( - $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT) + $this->_scopeConfig->getValue( + self::XML_PATH_ERROR_RECIPIENT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index c2abe1e58f99a4646eca83221e2b2f4e027c8d86..ca6c0ecf37f828c4ef5001100141c48682a34b4e 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -47,7 +47,7 @@ class Category extends \Magento\Model\Resource\Db\AbstractDb protected $_attributesCache = array(); /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -58,12 +58,12 @@ class Category extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Category $categoryResource */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Category $categoryResource ) { $this->_storeManager = $storeManager; @@ -82,14 +82,14 @@ class Category extends \Magento\Model\Resource\Db\AbstractDb /** * Get category collection array * - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId * @return array|bool */ public function getCollection($storeId) { $categories = array(); - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $store = $this->_storeManager->getStore($storeId); if (!$store) { diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index 14b7f774cf5fa4abdfecc056d7d0b5e86e1cc07e..44ceca48f73dea2339198cfe765fd72ea4ce539f 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -70,7 +70,7 @@ class Product extends \Magento\Model\Resource\Db\AbstractDb protected $_productResource; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -103,7 +103,7 @@ class Product extends \Magento\Model\Resource\Db\AbstractDb * @param \Magento\App\Resource $resource * @param \Magento\Sitemap\Helper\Data $sitemapData * @param \Magento\Catalog\Model\Resource\Product $productResource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaAttribute @@ -114,7 +114,7 @@ class Product extends \Magento\Model\Resource\Db\AbstractDb \Magento\App\Resource $resource, \Magento\Sitemap\Helper\Data $sitemapData, \Magento\Catalog\Model\Resource\Product $productResource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaAttribute, @@ -202,7 +202,7 @@ class Product extends \Magento\Model\Resource\Db\AbstractDb array('t1_' . $attributeCode => $attribute['table']), 'e.entity_id = t1_' . $attributeCode . '.entity_id AND ' . $adapter->quoteInto( ' t1_' . $attributeCode . '.store_id = ?', - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ) . $adapter->quoteInto( ' AND t1_' . $attributeCode . '.attribute_id = ?', $attribute['attribute_id'] @@ -258,14 +258,14 @@ class Product extends \Magento\Model\Resource\Db\AbstractDb /** * Get category collection array * - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId * @return array|bool */ public function getCollection($storeId) { $products = array(); - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ $store = $this->_storeManager->getStore($storeId); if (!$store) { return false; diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 84870f3c64f3521a1755d5c3b73d137c346f242b..63ed96c9be8311c0d903a186abe166ae4f4e161f 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -145,7 +145,7 @@ class Sitemap extends \Magento\Model\AbstractModel protected $_dateModel; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -169,7 +169,7 @@ class Sitemap extends \Magento\Model\AbstractModel * @param \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory * @param \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory * @param \Magento\Stdlib\DateTime\DateTime $modelDate - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Model\Resource\AbstractResource $resource @@ -186,7 +186,7 @@ class Sitemap extends \Magento\Model\AbstractModel \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory, \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory, \Magento\Stdlib\DateTime\DateTime $modelDate, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Stdlib\DateTime $dateTime, \Magento\Model\Resource\AbstractResource $resource = null, diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index 40a73a26c80c6bf1524d37b6f1cd9739fde23d91..b52be6a3f3b36fc84e34a6599840b078ae4e36fd 100644 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/Sitemap/sql/sitemap_setup/install-1.6.0.0.php b/app/code/Magento/Sitemap/sql/sitemap_setup/install-1.6.0.0.php index 288b67dcbafacea37155f508b520c9a8d8a5f4cb..337173bd52787a5814cdbcde43db994a2db5a2a2 100644 --- a/app/code/Magento/Sitemap/sql/sitemap_setup/install-1.6.0.0.php +++ b/app/code/Magento/Sitemap/sql/sitemap_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; @@ -76,9 +76,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('sitemap', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('sitemap', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('sitemap', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Core/App/Action/Plugin/StoreCheck.php b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php similarity index 86% rename from app/code/Magento/Core/App/Action/Plugin/StoreCheck.php rename to app/code/Magento/Store/App/Action/Plugin/StoreCheck.php index 5c4e081512c0c46280cb8d7487d39f1abab4f775..c3d38eee0b61aeab7615c86e05f1b5cb8945f5be 100644 --- a/app/code/Magento/Core/App/Action/Plugin/StoreCheck.php +++ b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php @@ -22,19 +22,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\Action\Plugin; +namespace Magento\Store\App\Action\Plugin; class StoreCheck { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php b/app/code/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandler.php similarity index 91% rename from app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php rename to app/code/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandler.php index 0473f897b3aea0dcf84058f8569cc60c45f88fc0..9469b222cdf22ed43c8a43d6a67654e0910f9bc9 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php +++ b/app/code/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandler.php @@ -23,15 +23,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\FrontController\Plugin; +namespace Magento\Store\App\FrontController\Plugin; -use Magento\Core\Model\StoreManager; +use Magento\Store\Model\StoreManager; use Magento\App\Filesystem; class DispatchExceptionHandler { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -72,7 +72,7 @@ class DispatchExceptionHandler } catch (\Magento\Session\Exception $e) { header('Location: ' . $this->_storeManager->getStore()->getBaseUrl()); exit; - } catch (\Magento\Core\Model\Store\Exception $e) { + } catch (\Magento\Store\Model\Exception $e) { require $this->filesystem->getPath(Filesystem::PUB_DIR) . '/errors/404.php'; exit; } diff --git a/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php b/app/code/Magento/Store/App/FrontController/Plugin/RequestPreprocessor.php similarity index 82% rename from app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php rename to app/code/Magento/Store/App/FrontController/Plugin/RequestPreprocessor.php index 62caa8967e74253af8baa2566afc5811c559eba9..89860b0b652fb960c433572dadcacfde71f15a5e 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/RequestPreprocessor.php +++ b/app/code/Magento/Store/App/FrontController/Plugin/RequestPreprocessor.php @@ -21,14 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\FrontController\Plugin; +namespace Magento\Store\App\FrontController\Plugin; class RequestPreprocessor { /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\App\ResponseFactory @@ -46,28 +46,28 @@ class RequestPreprocessor protected $_appState; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\State $appState * @param \Magento\UrlInterface $url - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\ResponseFactory $responseFactory */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\State $appState, \Magento\UrlInterface $url, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\ResponseFactory $responseFactory ) { $this->_storeManager = $storeManager; $this->_appState = $appState; $this->_url = $url; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_responseFactory = $responseFactory; } @@ -98,8 +98,9 @@ class RequestPreprocessor $redirectUrl = $this->_url->getRedirectUrl( $this->_url->getUrl(ltrim($request->getPathInfo(), '/'), array('_nosid' => true)) ); - $redirectCode = (int)$this->_storeConfig->getConfig( - 'web/url/redirect_to_base' + $redirectCode = (int)$this->_scopeConfig->getValue( + 'web/url/redirect_to_base', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) !== 301 ? 302 : 301; $response = $this->_responseFactory->create(); @@ -120,7 +121,10 @@ class RequestPreprocessor */ protected function _isBaseUrlCheckEnabled() { - return (bool)$this->_storeConfig->getConfig('web/url/redirect_to_base'); + return (bool)$this->_scopeConfig->getValue( + 'web/url/redirect_to_base', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Core/App/Request/PathInfoProcessor.php b/app/code/Magento/Store/App/Request/PathInfoProcessor.php similarity index 89% rename from app/code/Magento/Core/App/Request/PathInfoProcessor.php rename to app/code/Magento/Store/App/Request/PathInfoProcessor.php index 62d82cd6d64d2bbd43bf6bc6f1ffdd48cdbfa203..bddcdc096314d73887b91cc03b82fcda85f19447 100644 --- a/app/code/Magento/Core/App/Request/PathInfoProcessor.php +++ b/app/code/Magento/Store/App/Request/PathInfoProcessor.php @@ -21,19 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\Request; +namespace Magento\Store\App\Request; class PathInfoProcessor implements \Magento\App\Request\PathInfoProcessorInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ private $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Core/App/Response/Redirect.php b/app/code/Magento/Store/App/Response/Redirect.php similarity index 96% rename from app/code/Magento/Core/App/Response/Redirect.php rename to app/code/Magento/Store/App/Response/Redirect.php index c08f22bdf824765e78f3fd84f806cb0dcb2a3dd1..d5ee274c0e9d023f810f75658e2ddba97001dbbd 100644 --- a/app/code/Magento/Core/App/Response/Redirect.php +++ b/app/code/Magento/Store/App/Response/Redirect.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\Response; +namespace Magento\Store\App\Response; class Redirect implements \Magento\App\Response\RedirectInterface { @@ -33,7 +33,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface protected $_request; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -64,7 +64,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface /** * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Encryption\UrlCoder $urlCoder * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver @@ -73,7 +73,7 @@ class Redirect implements \Magento\App\Response\RedirectInterface */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Encryption\UrlCoder $urlCoder, \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, diff --git a/app/code/Magento/Core/Block/Store/Switcher.php b/app/code/Magento/Store/Block/Store/Switcher.php similarity index 85% rename from app/code/Magento/Core/Block/Store/Switcher.php rename to app/code/Magento/Store/Block/Store/Switcher.php index a211c4b39d9c7c181b028756c42c0da0e6c7af91..58b128f2745c32527480327918a760c6fe31bbfc 100644 --- a/app/code/Magento/Core/Block/Store/Switcher.php +++ b/app/code/Magento/Store/Block/Store/Switcher.php @@ -18,20 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Store switcher block - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Block\Store; +namespace Magento\Store\Block\Store; class Switcher extends \Magento\View\Element\Template { @@ -53,27 +47,27 @@ class Switcher extends \Magento\View\Element\Template /** * Store factory * - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; /** * Store group factory * - * @var \Magento\Core\Model\Store\GroupFactory + * @var \Magento\Store\Model\GroupFactory */ protected $_storeGroupFactory; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Model\Store\GroupFactory $storeGroupFactory - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\GroupFactory $storeGroupFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Core\Model\Store\GroupFactory $storeGroupFactory, - \Magento\Core\Model\StoreFactory $storeFactory, + \Magento\Store\Model\GroupFactory $storeGroupFactory, + \Magento\Store\Model\StoreFactory $storeFactory, array $data = array() ) { $this->_storeGroupFactory = $storeGroupFactory; @@ -111,7 +105,7 @@ class Switcher extends \Magento\View\Element\Template if (!$store->getIsActive()) { continue; } - $store->setLocaleCode($this->_storeConfig->getConfig('general/locale/code', $store->getId())); + $store->setLocaleCode($this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store->getId())); $this->_stores[$store->getGroupId()][$store->getId()] = $store; } @@ -126,7 +120,7 @@ class Switcher extends \Magento\View\Element\Template public function getStoreCount() { $stores = array(); - $localeCode = $this->_storeConfig->getConfig('general/locale/code'); + $localeCode = $this->_scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); foreach ($this->_groups as $group) { if (!isset($this->_stores[$group->getId()])) { continue; diff --git a/app/code/Magento/Core/Block/Switcher.php b/app/code/Magento/Store/Block/Switcher.php similarity index 87% rename from app/code/Magento/Core/Block/Switcher.php rename to app/code/Magento/Store/Block/Switcher.php index 63ee175ffc81e627e5f9a6d8c04b99d83acdfa25..aabc823490acd78c5502c96ae59859e17fc64efc 100644 --- a/app/code/Magento/Core/Block/Switcher.php +++ b/app/code/Magento/Store/Block/Switcher.php @@ -24,15 +24,10 @@ /** * Store and language switcher block - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Block; +namespace Magento\Store\Block; -use Magento\Core\Model\Store\Group; -use Magento\Core\Model\Store; +use Magento\Store\Model\Group; class Switcher extends \Magento\View\Element\Template { @@ -112,12 +107,16 @@ class Switcher extends \Magento\View\Element\Template $websiteStores = $this->_storeManager->getWebsite()->getStores(); $stores = array(); foreach ($websiteStores as $store) { - /* @var $store Store */ + /* @var $store \Magento\Store\Model\Store */ if (!$store->getIsActive()) { continue; } - $store->setLocaleCode($store->getConfig('general/locale/code')); - + $localeCode = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); + $store->setLocaleCode($localeCode); $params = array('_query' => array()); if (!$this->isStoreInUrl()) { $params['_query']['___store'] = $store->getCode(); @@ -144,7 +143,10 @@ class Switcher extends \Magento\View\Element\Template $rawStores = $this->getRawStores(); $groups = array(); - $localeCode = $this->_storeConfig->getConfig('general/locale/code'); + $localeCode = $this->_scopeConfig->getValue( + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); foreach ($rawGroups as $group) { /* @var $group Group */ if (!isset($rawStores[$group->getId()])) { @@ -168,7 +170,7 @@ class Switcher extends \Magento\View\Element\Template } /** - * @return Store[] + * @return \Magento\Store\Model\Store[] */ public function getStores() { @@ -228,14 +230,11 @@ class Switcher extends \Magento\View\Element\Template /** * Returns target store post data * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return string */ - public function getTargetStorePostData(\Magento\Core\Model\Store $store) + public function getTargetStorePostData(\Magento\Store\Model\Store $store) { - return $this->_postDataHelper->getPostData( - $this->getHomeUrl(), - array('___store' => $store->getCode()) - ); + return $this->_postDataHelper->getPostData($this->getHomeUrl(), array('___store' => $store->getCode())); } } diff --git a/app/code/Magento/Core/Helper/Cookie.php b/app/code/Magento/Store/Helper/Cookie.php similarity index 76% rename from app/code/Magento/Core/Helper/Cookie.php rename to app/code/Magento/Store/Helper/Cookie.php index f3057657e31f5894b4884a4d2de0694b4c0b681d..16607768243347e649a32ec882d4ab0e21188cdb 100644 --- a/app/code/Magento/Core/Helper/Cookie.php +++ b/app/code/Magento/Store/Helper/Cookie.php @@ -18,15 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Helper; +namespace Magento\Store\Helper; /** - * Core Cookie helper + * Cookie helper */ class Cookie extends \Magento\App\Helper\AbstractHelper { @@ -46,37 +44,45 @@ class Cookie extends \Magento\App\Helper\AbstractHelper const XML_PATH_COOKIE_RESTRICTION_LIFETIME = 'web/cookie/cookie_restriction_lifetime'; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_currentStore; /** - * @var \Magento\Core\Model\Website + * @var \Magento\Store\Model\Website */ protected $_website; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param array $data - * + * * @throws \InvalidArgumentException */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, array $data = array() ) { parent::__construct($context); + $this->_scopeConfig = $scopeConfig; $this->_currentStore = isset($data['current_store']) ? $data['current_store'] : $storeManager->getStore(); - if (!$this->_currentStore instanceof \Magento\Core\Model\Store) { + if (!$this->_currentStore instanceof \Magento\Store\Model\Store) { throw new \InvalidArgumentException('Required store object is invalid'); } $this->_website = isset($data['website']) ? $data['website'] : $storeManager->getWebsite(); - if (!$this->_website instanceof \Magento\Core\Model\Website) { + if (!$this->_website instanceof \Magento\Store\Model\Website) { throw new \InvalidArgumentException('Required website object is invalid'); } } @@ -89,8 +95,10 @@ class Cookie extends \Magento\App\Helper\AbstractHelper public function isUserNotAllowSaveCookie() { $acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites(); - return $this->_currentStore->getConfig( - self::XML_PATH_COOKIE_RESTRICTION + return $this->_scopeConfig->getValue( + self::XML_PATH_COOKIE_RESTRICTION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_currentStore ) && empty($acceptedSaveCookiesWebsites[$this->_website->getId()]); } @@ -125,6 +133,10 @@ class Cookie extends \Magento\App\Helper\AbstractHelper */ public function getCookieRestrictionLifetime() { - return (int)$this->_currentStore->getConfig(self::XML_PATH_COOKIE_RESTRICTION_LIFETIME); + return (int)$this->_scopeConfig->getValue( + self::XML_PATH_COOKIE_RESTRICTION_LIFETIME, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_currentStore + ); } } diff --git a/app/code/Magento/Core/Model/Config/Scope/Store/Converter.php b/app/code/Magento/Store/Model/Config/Converter.php similarity index 71% rename from app/code/Magento/Core/Model/Config/Scope/Store/Converter.php rename to app/code/Magento/Store/Model/Config/Converter.php index 03953b8e69a43f86087bc9530cfb206507a41f27..dc47459b309efc3287abc8ecb6e81faef729312a 100644 --- a/app/code/Magento/Core/Model/Config/Scope/Store/Converter.php +++ b/app/code/Magento/Store/Model/Config/Converter.php @@ -1,6 +1,6 @@ <?php /** - * DB store configuration data converter. Converts associative array to tree array + * DB configuration data converter. Converts associative array to tree array * * Magento * @@ -23,19 +23,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Store; +namespace Magento\Store\Model\Config; class Converter extends \Magento\App\Config\Scope\Converter { /** - * @var \Magento\Core\Model\Config\Scope\Processor\Placeholder + * @var \Magento\Store\Model\Config\Processor\Placeholder */ protected $_processor; /** - * @param \Magento\Core\Model\Config\Scope\Processor\Placeholder $processor + * @param \Magento\Store\Model\Config\Processor\Placeholder $processor */ - public function __construct(\Magento\Core\Model\Config\Scope\Processor\Placeholder $processor) + public function __construct(\Magento\Store\Model\Config\Processor\Placeholder $processor) { $this->_processor = $processor; } @@ -49,7 +49,7 @@ class Converter extends \Magento\App\Config\Scope\Converter */ public function convert($source, $initialConfig = array()) { - $storeConfig = array_replace_recursive($initialConfig, parent::convert($source)); - return $this->_processor->process($storeConfig); + $config = array_replace_recursive($initialConfig, parent::convert($source)); + return $this->_processor->process($config); } } diff --git a/app/code/Magento/Core/Model/Config/Scope/Processor/Placeholder.php b/app/code/Magento/Store/Model/Config/Processor/Placeholder.php similarity index 83% rename from app/code/Magento/Core/Model/Config/Scope/Processor/Placeholder.php rename to app/code/Magento/Store/Model/Config/Processor/Placeholder.php index acab768c48bbe500a7fbb886757a0098c43754bc..863412fb97a72a57b52e0ba65a4ac03bc74fb6c7 100644 --- a/app/code/Magento/Core/Model/Config/Scope/Processor/Placeholder.php +++ b/app/code/Magento/Store/Model/Config/Processor/Placeholder.php @@ -23,21 +23,35 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Processor; +namespace Magento\Store\Model\Config\Processor; class Placeholder { /** * @var \Magento\App\RequestInterface */ - protected $_request; + protected $request; + + /** + * @var string[] + */ + protected $urlPaths; + + /** + * @var string + */ + protected $urlPlaceholder; /** * @param \Magento\App\RequestInterface $request + * @param string[] $urlPaths + * @param string $urlPlaceholder */ - public function __construct(\Magento\App\RequestInterface $request) + public function __construct(\Magento\App\RequestInterface $request, $urlPaths, $urlPlaceholder) { - $this->_request = $request; + $this->request = $request; + $this->urlPaths = $urlPaths; + $this->urlPlaceholder = $urlPlaceholder; } /** @@ -86,16 +100,16 @@ class Placeholder if ($placeholder) { $url = false; if ($placeholder == 'unsecure_base_url') { - $url = $this->_getValue(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, $data); + $url = $this->_getValue($this->urlPaths['unsecureBaseUrl'], $data); } elseif ($placeholder == 'secure_base_url') { - $url = $this->_getValue(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $data); + $url = $this->_getValue($this->urlPaths['secureBaseUrl'], $data); } if ($url) { $value = str_replace('{{' . $placeholder . '}}', $url, $value); - } elseif (strpos($value, \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER) !== false) { - $distroBaseUrl = $this->_request->getDistroBaseUrl(); - $value = str_replace(\Magento\Core\Model\Store::BASE_URL_PLACEHOLDER, $distroBaseUrl, $value); + } elseif (strpos($value, $this->urlPlaceholder) !== false) { + $distroBaseUrl = $this->request->getDistroBaseUrl(); + $value = str_replace($this->urlPlaceholder, $distroBaseUrl, $value); } if (null !== $this->_getPlaceholder($value)) { @@ -117,7 +131,7 @@ class Placeholder $placeholder = $matches[1]; if ($placeholder == 'unsecure_base_url' || $placeholder == 'secure_base_url' || strpos( $value, - \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER + $this->urlPlaceholder ) !== false ) { return $placeholder; diff --git a/app/code/Magento/Core/Model/Config/Scope/Reader/DefaultReader.php b/app/code/Magento/Store/Model/Config/Reader/DefaultReader.php similarity index 84% rename from app/code/Magento/Core/Model/Config/Scope/Reader/DefaultReader.php rename to app/code/Magento/Store/Model/Config/Reader/DefaultReader.php index 49f70112839021f73e2fadb5e91500f361a1041c..fa5ea39b792bc8873cb2bfb2c5048df4a892f6a1 100644 --- a/app/code/Magento/Core/Model/Config/Scope/Reader/DefaultReader.php +++ b/app/code/Magento/Store/Model/Config/Reader/DefaultReader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class DefaultReader implements \Magento\App\Config\Scope\ReaderInterface { @@ -38,7 +38,7 @@ class DefaultReader implements \Magento\App\Config\Scope\ReaderInterface protected $_converter; /** - * @var \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory + * @var \Magento\Store\Model\Resource\Config\Collection\ScopedFactory */ protected $_collectionFactory; @@ -50,13 +50,13 @@ class DefaultReader implements \Magento\App\Config\Scope\ReaderInterface /** * @param \Magento\App\Config\Initial $initialConfig * @param \Magento\App\Config\Scope\Converter $converter - * @param \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory + * @param \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory * @param \Magento\App\State $appState */ public function __construct( \Magento\App\Config\Initial $initialConfig, \Magento\App\Config\Scope\Converter $converter, - \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory, + \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory, \Magento\App\State $appState ) { $this->_initialConfig = $initialConfig; @@ -72,10 +72,10 @@ class DefaultReader implements \Magento\App\Config\Scope\ReaderInterface */ public function read() { - $config = $this->_initialConfig->getData(\Magento\BaseScopeInterface::SCOPE_DEFAULT); + $config = $this->_initialConfig->getData(\Magento\App\ScopeInterface::SCOPE_DEFAULT); if ($this->_appState->isInstalled()) { $collection = $this->_collectionFactory->create( - array('scope' => \Magento\BaseScopeInterface::SCOPE_DEFAULT) + array('scope' => \Magento\App\ScopeInterface::SCOPE_DEFAULT) ); $dbDefaultConfig = array(); foreach ($collection as $item) { diff --git a/app/code/Magento/Core/Model/Config/Scope/ReaderPool.php b/app/code/Magento/Store/Model/Config/Reader/ReaderPool.php similarity index 71% rename from app/code/Magento/Core/Model/Config/Scope/ReaderPool.php rename to app/code/Magento/Store/Model/Config/Reader/ReaderPool.php index 7f2673f1a1ae170749225d1b7d12d58f752768d1..7fbb98c4cabd3d0af41c673a29d64f90baf07605 100644 --- a/app/code/Magento/Core/Model/Config/Scope/ReaderPool.php +++ b/app/code/Magento/Store/Model/Config/Reader/ReaderPool.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope; +namespace Magento\Store\Model\Config\Reader; class ReaderPool implements \Magento\App\Config\Scope\ReaderPoolInterface { @@ -33,22 +33,12 @@ class ReaderPool implements \Magento\App\Config\Scope\ReaderPoolInterface protected $_readers = array(); /** - * @param ReaderInterface $default - * @param ReaderInterface $website - * @param ReaderInterface $store + * @param \Magento\App\Config\Scope\ReaderInterface[] $readers */ public function __construct( - \Magento\App\Config\Scope\ReaderInterface $default, - \Magento\App\Config\Scope\ReaderInterface $website, - \Magento\App\Config\Scope\ReaderInterface $store + array $readers ) { - $this->_readers = array( - 'default' => $default, - 'website' => $website, - 'websites' => $website, - 'store' => $store, - 'stores' => $store - ); + $this->_readers = $readers; } /** diff --git a/app/code/Magento/Core/Model/Config/Scope/Reader/Store.php b/app/code/Magento/Store/Model/Config/Reader/Store.php similarity index 60% rename from app/code/Magento/Core/Model/Config/Scope/Reader/Store.php rename to app/code/Magento/Store/Model/Config/Reader/Store.php index d6b95b2de1c46663a566676bce8ee181abdc9102..91bc3f3fe2bdd946dda0f96c8d315234869f80bb 100644 --- a/app/code/Magento/Core/Model/Config/Scope/Reader/Store.php +++ b/app/code/Magento/Store/Model/Config/Reader/Store.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class Store implements \Magento\App\Config\Scope\ReaderInterface { @@ -36,17 +36,17 @@ class Store implements \Magento\App\Config\Scope\ReaderInterface protected $_scopePool; /** - * @var \Magento\Core\Model\Config\Scope\Store\Converter + * @var \Magento\Store\Model\Config\Converter */ protected $_converter; /** - * @var \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory + * @var \Magento\Store\Model\Resource\Config\Collection\ScopedFactory */ protected $_collectionFactory; /** - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; @@ -55,21 +55,28 @@ class Store implements \Magento\App\Config\Scope\ReaderInterface */ protected $_appState; + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $_storeManager; + /** * @param \Magento\App\Config\Initial $initialConfig * @param \Magento\App\Config\ScopePool $scopePool - * @param \Magento\Core\Model\Config\Scope\Store\Converter $converter - * @param \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Config\Converter $converter + * @param \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param \Magento\App\State $appState + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Config\Initial $initialConfig, \Magento\App\Config\ScopePool $scopePool, - \Magento\Core\Model\Config\Scope\Store\Converter $converter, - \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory, - \Magento\Core\Model\StoreFactory $storeFactory, - \Magento\App\State $appState + \Magento\Store\Model\Config\Converter $converter, + \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory, + \Magento\Store\Model\StoreFactory $storeFactory, + \Magento\App\State $appState, + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_initialConfig = $initialConfig; $this->_scopePool = $scopePool; @@ -77,6 +84,7 @@ class Store implements \Magento\App\Config\Scope\ReaderInterface $this->_collectionFactory = $collectionFactory; $this->_storeFactory = $storeFactory; $this->_appState = $appState; + $this->_storeManager = $storeManager; } /** @@ -88,12 +96,22 @@ class Store implements \Magento\App\Config\Scope\ReaderInterface public function read($code = null) { if ($this->_appState->isInstalled()) { - $store = $this->_storeFactory->create(); - $store->load($code); - $websiteConfig = $this->_scopePool->getScope('website', $store->getWebsite()->getCode())->getSource(); - $config = array_replace_recursive($websiteConfig, $this->_initialConfig->getData("sotres|{$code}")); + if (empty($code)) { + $store = $this->_storeManager->getStore(); + } else { + $store = $this->_storeFactory->create(); + $store->load($code); + } + + $websiteConfig = $this->_scopePool->getScope( + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, + $store->getWebsite()->getCode() + )->getSource(); + $config = array_replace_recursive($websiteConfig, $this->_initialConfig->getData("stores|{$code}")); - $collection = $this->_collectionFactory->create(array('scope' => 'stores', 'scopeId' => $store->getId())); + $collection = $this->_collectionFactory->create( + array('scope' => \Magento\Store\Model\ScopeInterface::SCOPE_STORES, 'scopeId' => $store->getId()) + ); $dbStoreConfig = array(); foreach ($collection as $item) { $dbStoreConfig[$item->getPath()] = $item->getValue(); @@ -101,8 +119,8 @@ class Store implements \Magento\App\Config\Scope\ReaderInterface $config = $this->_converter->convert($dbStoreConfig, $config); } else { $websiteConfig = $this->_scopePool->getScope( - 'website', - \Magento\BaseScopeInterface::SCOPE_DEFAULT + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, + \Magento\App\ScopeInterface::SCOPE_DEFAULT )->getSource(); $config = $this->_converter->convert($websiteConfig, $this->_initialConfig->getData("stores|{$code}")); } diff --git a/app/code/Magento/Core/Model/Config/Scope/Reader/Website.php b/app/code/Magento/Store/Model/Config/Reader/Website.php similarity index 82% rename from app/code/Magento/Core/Model/Config/Scope/Reader/Website.php rename to app/code/Magento/Store/Model/Config/Reader/Website.php index 69152af994458fa1915aed529c261923be843aef..2b6d690ff5c26bf05d6bbba29f96003e12c2e92e 100644 --- a/app/code/Magento/Core/Model/Config/Scope/Reader/Website.php +++ b/app/code/Magento/Store/Model/Config/Reader/Website.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class Website implements \Magento\App\Config\Scope\ReaderInterface { @@ -41,12 +41,12 @@ class Website implements \Magento\App\Config\Scope\ReaderInterface protected $_converter; /** - * @var \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory + * @var \Magento\Store\Model\Resource\Config\Collection\ScopedFactory */ protected $_collectionFactory; /** - * @var \Magento\Core\Model\WebsiteFactory + * @var \Magento\Store\Model\WebsiteFactory */ protected $_websiteFactory; @@ -59,16 +59,16 @@ class Website implements \Magento\App\Config\Scope\ReaderInterface * @param \Magento\App\Config\Initial $initialConfig * @param \Magento\App\Config\ScopePool $scopePool * @param \Magento\App\Config\Scope\Converter $converter - * @param \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory * @param \Magento\App\State $appState */ public function __construct( \Magento\App\Config\Initial $initialConfig, \Magento\App\Config\ScopePool $scopePool, \Magento\App\Config\Scope\Converter $converter, - \Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory $collectionFactory, - \Magento\Core\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\Resource\Config\Collection\ScopedFactory $collectionFactory, + \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\App\State $appState ) { $this->_initialConfig = $initialConfig; @@ -88,7 +88,7 @@ class Website implements \Magento\App\Config\Scope\ReaderInterface public function read($code = null) { $config = array_replace_recursive( - $this->_scopePool->getScope(\Magento\BaseScopeInterface::SCOPE_DEFAULT)->getSource(), + $this->_scopePool->getScope(\Magento\App\ScopeInterface::SCOPE_DEFAULT)->getSource(), $this->_initialConfig->getData("websites|{$code}") ); @@ -96,7 +96,7 @@ class Website implements \Magento\App\Config\Scope\ReaderInterface $website = $this->_websiteFactory->create(); $website->load($code); $collection = $this->_collectionFactory->create( - array('scope' => 'websites', 'scopeId' => $website->getId()) + array('scope' => \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES, 'scopeId' => $website->getId()) ); $dbWebsiteConfig = array(); foreach ($collection as $configValue) { diff --git a/app/code/Magento/Rating/Helper/Data.php b/app/code/Magento/Store/Model/Exception.php similarity index 85% rename from app/code/Magento/Rating/Helper/Data.php rename to app/code/Magento/Store/Model/Exception.php index 9c9b63345c662235bd0660ee7bf3441f422e6850..93a676ebfe910fb1e80da1e6aff82d70846dc51e 100644 --- a/app/code/Magento/Rating/Helper/Data.php +++ b/app/code/Magento/Store/Model/Exception.php @@ -18,17 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Rating * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * Rating data helper + * Store exception */ -namespace Magento\Rating\Helper; +namespace Magento\Store\Model; -class Data extends \Magento\App\Helper\AbstractHelper +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Core/Model/Store/Group.php b/app/code/Magento/Store/Model/Group.php similarity index 85% rename from app/code/Magento/Core/Model/Store/Group.php rename to app/code/Magento/Store/Model/Group.php index 39925dc331271aef05e1935d86ea8b4610b401c4..e25fce132b30b2c30eeb287e7130e48cb36c8085 100644 --- a/app/code/Magento/Core/Model/Store/Group.php +++ b/app/code/Magento/Store/Model/Group.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,18 +25,18 @@ /** * Store group model * - * @method \Magento\Core\Model\Resource\Store\Group _getResource() - * @method \Magento\Core\Model\Resource\Store\Group getResource() - * @method \Magento\Core\Model\Store\Group setWebsiteId(int $value) + * @method \Magento\Store\Model\Resource\Group _getResource() + * @method \Magento\Store\Model\Resource\Group getResource() + * @method \Magento\Store\Model\Store setWebsiteId(int $value) * @method string getName() * @method string getCode() - * @method \Magento\Core\Model\Store\Group setName(string $value) - * @method \Magento\Core\Model\Store\Group setRootCategoryId(int $value) - * @method \Magento\Core\Model\Store\Group setDefaultStoreId(int $value) + * @method \Magento\Store\Model\Store setName(string $value) + * @method \Magento\Store\Model\Store setRootCategoryId(int $value) + * @method \Magento\Store\Model\Store setDefaultStoreId(int $value) */ -namespace Magento\Core\Model\Store; +namespace Magento\Store\Model; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; class Group extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { @@ -64,7 +62,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Group Store collection array * - * @var \Magento\Core\Model\Resource\Store\Collection[] + * @var \Magento\Store\Model\Resource\Store\Collection[] */ protected $_stores; @@ -92,7 +90,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Group default store * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_defaultStore; @@ -107,12 +105,12 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden protected $_configDataResource; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -120,8 +118,8 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Resource\Config\Data $configDataResource - * @param \Magento\Core\Model\Store $store - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\Store $store + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -130,8 +128,8 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Resource\Config\Data $configDataResource, - \Magento\Core\Model\Store $store, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\Store $store, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -149,7 +147,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden */ protected function _construct() { - $this->_init('Magento\Core\Model\Resource\Store\Group'); + $this->_init('Magento\Store\Model\Resource\Group'); } /** @@ -175,7 +173,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Set website stores * - * @param \Magento\Core\Model\Store[] $stores + * @param \Magento\Store\Model\Store[] $stores * @return void */ public function setStores($stores) @@ -196,7 +194,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Retrieve new (not loaded) Store collection object with group filter * - * @return \Magento\Core\Model\Resource\Store\Collection + * @return \Magento\Store\Model\Resource\Store\Collection */ public function getStoreCollection() { @@ -206,7 +204,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Retrieve website store objects * - * @return \Magento\Core\Model\Resource\Store\Collection[] + * @return \Magento\Store\Model\Resource\Store\Collection[] */ public function getStores() { @@ -256,7 +254,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden /** * Retrieve default store model * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getDefaultStore() { @@ -275,7 +273,7 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden * If group has no stores - null is returned * * @param string $locale - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getDefaultStoreByLocale($locale) { @@ -295,13 +293,13 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden * Retrieve list of stores with given locale * * @param string $locale - * @return \Magento\Core\Model\Store[] + * @return \Magento\Store\Model\Store[] */ public function getStoresByLocale($locale) { $stores = array(); foreach ($this->getStores() as $store) { - /* @var $store \Magento\Core\Model\Store */ + /* @var $store \Magento\Store\Model\Store */ if ($store->getLocaleCode() == $locale) { $stores[] = $store; } @@ -376,7 +374,10 @@ class Group extends \Magento\Model\AbstractModel implements \Magento\Object\Iden */ protected function _beforeDelete() { - $this->_configDataResource->clearStoreData($this->getStoreIds()); + $this->_configDataResource->clearScopeData( + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $this->getStoreIds() + ); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Core/Model/Store/Group/Factory.php b/app/code/Magento/Store/Model/Group/Factory.php similarity index 91% rename from app/code/Magento/Core/Model/Store/Group/Factory.php rename to app/code/Magento/Store/Model/Group/Factory.php index 6eb9402734f049cfeed93100d1a3b96ecf179829..42a8351293152a814d502a6d76dbe39b8c0e0303 100644 --- a/app/code/Magento/Core/Model/Store/Group/Factory.php +++ b/app/code/Magento/Store/Model/Group/Factory.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,14 +25,14 @@ /** * Store Group factory */ -namespace Magento\Core\Model\Store\Group; +namespace Magento\Store\Model\Group; class Factory { /** * Store group model class name */ - const CLASS_NAME = 'Magento\Core\Model\Store\Group'; + const CLASS_NAME = 'Magento\Store\Model\Group'; /** * Object Manager diff --git a/app/code/Magento/Core/Model/BaseScopeResolver.php b/app/code/Magento/Store/Model/Resolver/Store.php similarity index 73% rename from app/code/Magento/Core/Model/BaseScopeResolver.php rename to app/code/Magento/Store/Model/Resolver/Store.php index 40e95e6bb513f32cffbe4db089adb4d1abd164a8..721550c00abec804b39eb01c0c1519e4c2fb8ab7 100644 --- a/app/code/Magento/Core/Model/BaseScopeResolver.php +++ b/app/code/Magento/Store/Model/Resolver/Store.php @@ -21,19 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model\Resolver; -class BaseScopeResolver implements \Magento\BaseScopeResolverInterface +class Store implements \Magento\App\ScopeResolverInterface { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; } @@ -44,8 +44,8 @@ class BaseScopeResolver implements \Magento\BaseScopeResolverInterface public function getScope($scopeId = null) { $scope = $this->_storeManager->getStore($scopeId); - if (!$scope instanceof \Magento\BaseScopeInterface) { - throw new \Magento\Exception('Invalid scope object'); + if (!$scope instanceof \Magento\App\ScopeInterface) { + throw new \Magento\Store\Model\Exception('Invalid scope object'); } return $scope; diff --git a/app/code/Magento/Core/Model/Store/StorageInterface.php b/app/code/Magento/Store/Model/Resolver/Website.php similarity index 54% rename from app/code/Magento/Core/Model/Store/StorageInterface.php rename to app/code/Magento/Store/Model/Resolver/Website.php index ff9bbec72897a2a7a64e295591b1458dd660eff3..d7408744771678c24c385e1c9267aabfdb6c9ec5 100644 --- a/app/code/Magento/Core/Model/Store/StorageInterface.php +++ b/app/code/Magento/Store/Model/Resolver/Website.php @@ -17,18 +17,38 @@ * 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. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store; +namespace Magento\Store\Model\Resolver; -interface StorageInterface extends \Magento\Core\Model\Store\ListInterface +class Website implements \Magento\App\ScopeResolverInterface { /** - * Initialize current application store - * - * @return void + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $_storeManager; + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function initCurrentStore(); + public function __construct( + \Magento\Store\Model\StoreManagerInterface $storeManager + ) { + $this->_storeManager = $storeManager; + } + + /** + * {@inheritdoc} + */ + public function getScope($scopeId = null) + { + $scope = $this->_storeManager->getWebsite($scopeId); + if (!($scope instanceof \Magento\App\ScopeInterface)) { + throw new \Magento\Store\Model\Exception('Invalid scope object'); + } + + return $scope; + } } diff --git a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php b/app/code/Magento/Store/Model/Resource/Config/Collection/Scoped.php similarity index 97% rename from app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php rename to app/code/Magento/Store/Model/Resource/Config/Collection/Scoped.php index c98899ec99f7742c6c72d0fa037d90334ed92c95..51d0b57b3ff45c899d8de203d13bc5bdf3caf545 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php +++ b/app/code/Magento/Store/Model/Resource/Config/Collection/Scoped.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Config\Value\Collection; +namespace Magento\Store\Model\Resource\Config\Collection; class Scoped extends \Magento\Model\Resource\Db\Collection\AbstractCollection { diff --git a/app/code/Magento/Core/Model/Resource/Store/Group.php b/app/code/Magento/Store/Model/Resource/Group.php similarity index 87% rename from app/code/Magento/Core/Model/Resource/Store/Group.php rename to app/code/Magento/Store/Model/Resource/Group.php index 2cf865d2b843daee08f1b35c5d95a1b10112ee3c..a335f083452702e71b9ca7c3284c113c307805c1 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group.php +++ b/app/code/Magento/Store/Model/Resource/Group.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Store; +namespace Magento\Store\Model\Resource; /** * Store group resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Group extends \Magento\Model\Resource\Db\AbstractDb { @@ -41,7 +35,7 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_store_group', 'group_id'); + $this->_init('store_group', 'group_id'); } /** @@ -79,7 +73,7 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb if ($count == 1) { $bind = array('default_group_id' => $groupId); $where = array('website_id = ?' => $websiteId); - $this->_getWriteAdapter()->update($this->getTable('core_website'), $bind, $where); + $this->_getWriteAdapter()->update($this->getTable('store_website'), $bind, $where); } return $this; } @@ -94,7 +88,7 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb { if ($model->getOriginalWebsiteId() && $model->getWebsiteId() != $model->getOriginalWebsiteId()) { $select = $this->_getWriteAdapter()->select()->from( - $this->getTable('core_website'), + $this->getTable('store_website'), 'default_group_id' )->where( 'website_id = :website_id' @@ -107,7 +101,7 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb if ($groupId == $model->getId()) { $bind = array('default_group_id' => 0); $where = array('website_id = ?' => $model->getOriginalWebsiteId()); - $this->_getWriteAdapter()->update($this->getTable('core_website'), $bind, $where); + $this->_getWriteAdapter()->update($this->getTable('store_website'), $bind, $where); } } return $this; @@ -124,7 +118,7 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb { $bind = array('website_id' => $websiteId); $where = array('group_id = ?' => $groupId); - $this->_getWriteAdapter()->update($this->getTable('core_store'), $bind, $where); + $this->_getWriteAdapter()->update($this->getTable('store'), $bind, $where); return $this; } @@ -158,8 +152,8 @@ class Group extends \Magento\Model\Resource\Db\AbstractDb $select = $adapter->select()->from(array('main' => $this->getMainTable()), 'COUNT(*)'); if (!$countAdmin) { $select->joinLeft( - array('core_website' => $this->getTable('core_website')), - 'core_website.website_id = main.website_id', + array('store_website' => $this->getTable('store_website')), + 'store_website.website_id = main.website_id', null )->where( sprintf('%s <> %s', $adapter->quoteIdentifier('code'), $adapter->quote('admin')) diff --git a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php b/app/code/Magento/Store/Model/Resource/Group/Collection.php similarity index 90% rename from app/code/Magento/Core/Model/Resource/Store/Group/Collection.php rename to app/code/Magento/Store/Model/Resource/Group/Collection.php index cda1e15bf3b40595a0ab26c0db50c0dfb9d7a8b9..08bcf7486b343253131554155c4d2e4658023bf5 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php +++ b/app/code/Magento/Store/Model/Resource/Group/Collection.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Store\Group; +namespace Magento\Store\Model\Resource\Group; /** * Store group collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { @@ -42,7 +36,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected function _construct() { $this->setFlag('load_default_store_group', false); - $this->_init('Magento\Core\Model\Store\Group', 'Magento\Core\Model\Resource\Store\Group'); + $this->_init('Magento\Store\Model\Group', 'Magento\Store\Model\Resource\Group'); } /** diff --git a/app/code/Magento/Core/Model/Resource/Store.php b/app/code/Magento/Store/Model/Resource/Store.php similarity index 87% rename from app/code/Magento/Core/Model/Resource/Store.php rename to app/code/Magento/Store/Model/Resource/Store.php index 4249f66164db992a3453bbccf62d890e1c42cbd4..8f7ac2ed50dc554095c571f0122163b18af20e91 100644 --- a/app/code/Magento/Core/Model/Resource/Store.php +++ b/app/code/Magento/Store/Model/Resource/Store.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Store\Model\Resource; /** - * Core Store Resource Model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Store Resource Model */ class Store extends \Magento\Model\Resource\Db\AbstractDb { @@ -41,7 +35,7 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_store', 'store_id'); + $this->_init('store', 'store_id'); } /** @@ -89,7 +83,7 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb } /** - * Remove core configuration data after delete store + * Remove configuration data after delete store * * @param \Magento\Model\AbstractModel $model * @return $this @@ -97,7 +91,7 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( - 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_STORES, + 'scope = ?' => \Magento\Store\Model\ScopeInterface::SCOPE_STORES, 'scope_id = ?' => $model->getStoreId() ); @@ -128,7 +122,7 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb if ($count == 1) { $bind = array('default_store_id' => (int)$storeId); $where = array('group_id = ?' => (int)$groupId); - $adapter->update($this->getTable('core_store_group'), $bind, $where); + $adapter->update($this->getTable('store_group'), $bind, $where); } return $this; @@ -145,7 +139,7 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb if ($model->getOriginalGroupId() && $model->getGroupId() != $model->getOriginalGroupId()) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from( - $this->getTable('core_store_group'), + $this->getTable('store_group'), 'default_store_id' )->where( $adapter->quoteInto('group_id=?', $model->getOriginalGroupId()) @@ -153,9 +147,9 @@ class Store extends \Magento\Model\Resource\Db\AbstractDb $storeId = $adapter->fetchOne($select, 'default_store_id'); if ($storeId == $model->getId()) { - $bind = array('default_store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $bind = array('default_store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID); $where = array('group_id = ?' => $model->getOriginalGroupId()); - $this->_getWriteAdapter()->update($this->getTable('core_store_group'), $bind, $where); + $this->_getWriteAdapter()->update($this->getTable('store_group'), $bind, $where); } } return $this; diff --git a/app/code/Magento/Core/Model/Resource/Store/Collection.php b/app/code/Magento/Store/Model/Resource/Store/Collection.php similarity index 91% rename from app/code/Magento/Core/Model/Resource/Store/Collection.php rename to app/code/Magento/Store/Model/Resource/Store/Collection.php index 121e9d16b4e8b87637e99dedeb0d219d2f4e7631..1c6e402cafb09913f5b2bbefffa2c38598e16fcc 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Collection.php +++ b/app/code/Magento/Store/Model/Resource/Store/Collection.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Store; +namespace Magento\Store\Model\Resource\Store; /** * Stores collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { @@ -56,7 +50,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected function _construct() { $this->setFlag('load_default_store', false); - $this->_init('Magento\Core\Model\Store', 'Magento\Core\Model\Resource\Store'); + $this->_init('Magento\Store\Model\Store', 'Magento\Store\Model\Resource\Store'); } /** @@ -209,13 +203,13 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ public function addRootCategoryIdAttribute() { - if (!$this->getFlag('core_store_group_table_joined')) { + if (!$this->getFlag('store_group_table_joined')) { $this->getSelect()->join( - array('group_table' => $this->getTable('core_store_group')), + array('group_table' => $this->getTable('store_group')), 'main_table.group_id = group_table.group_id', array('root_category_id') ); - $this->setFlag('core_store_group_table_joined', true); + $this->setFlag('store_group_table_joined', true); } return $this; diff --git a/app/code/Magento/Core/Model/Resource/Website.php b/app/code/Magento/Store/Model/Resource/Website.php similarity index 88% rename from app/code/Magento/Core/Model/Resource/Website.php rename to app/code/Magento/Store/Model/Resource/Website.php index 1a7565e0355d723b7f27f58d350e96c78bde05b0..75adb13939ff5f31160c3f4cf7aa599abcf1cf52 100644 --- a/app/code/Magento/Core/Model/Resource/Website.php +++ b/app/code/Magento/Store/Model/Resource/Website.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Store\Model\Resource; /** - * Core Website Resource Model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Website Resource Model */ class Website extends \Magento\Model\Resource\Db\AbstractDb { @@ -41,7 +35,7 @@ class Website extends \Magento\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_website', 'website_id'); + $this->_init('store_website', 'website_id'); } /** @@ -92,7 +86,7 @@ class Website extends \Magento\Model\Resource\Db\AbstractDb } /** - * Remove core configuration data after delete website + * Remove configuration data after delete website * * @param \Magento\Model\AbstractModel $model * @return $this @@ -100,7 +94,7 @@ class Website extends \Magento\Model\Resource\Db\AbstractDb protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( - 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_WEBSITES, + 'scope = ?' => \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES, 'scope_id = ?' => $model->getWebsiteId() ); @@ -124,10 +118,10 @@ class Website extends \Magento\Model\Resource\Db\AbstractDb 'store_group_table.default_store_id' ); $select = $this->_getReadAdapter()->select()->from( - array('website_table' => $this->getTable('core_website')), + array('website_table' => $this->getTable('store_website')), array('website_id') )->joinLeft( - array('store_group_table' => $this->getTable('core_store_group')), + array('store_group_table' => $this->getTable('store_group')), 'website_table.website_id=store_group_table.website_id' . ' AND website_table.default_group_id = store_group_table.group_id', array('store_id' => $ifNull) diff --git a/app/code/Magento/Core/Model/Resource/Website/Collection.php b/app/code/Magento/Store/Model/Resource/Website/Collection.php similarity index 92% rename from app/code/Magento/Core/Model/Resource/Website/Collection.php rename to app/code/Magento/Store/Model/Resource/Website/Collection.php index 708a67d690d386886606bb85f9123f1d38647fa5..525c2f17e926f9bd7f6dae889e2a4c2ea859ee8f 100644 --- a/app/code/Magento/Core/Model/Resource/Website/Collection.php +++ b/app/code/Magento/Store/Model/Resource/Website/Collection.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Website; +namespace Magento\Store\Model\Resource\Website; /** * Websites collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { @@ -49,7 +43,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected function _construct() { $this->setFlag('load_default_website', false); - $this->_init('Magento\Core\Model\Website', 'Magento\Core\Model\Resource\Website'); + $this->_init('Magento\Store\Model\Website', 'Magento\Store\Model\Resource\Website'); } /** @@ -156,11 +150,11 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio if (!$this->getFlag('groups_and_stores_joined')) { $this->_idFieldName = 'website_group_store'; $this->getSelect()->joinLeft( - array('group_table' => $this->getTable('core_store_group')), + array('group_table' => $this->getTable('store_group')), 'main_table.website_id = group_table.website_id', array('group_id' => 'group_id', 'group_title' => 'name') )->joinLeft( - array('store_table' => $this->getTable('core_store')), + array('store_table' => $this->getTable('store')), 'group_table.group_id = store_table.group_id', array('store_id' => 'store_id', 'store_title' => 'name') ); diff --git a/app/code/Magento/Core/Model/Resource/Website/Grid/Collection.php b/app/code/Magento/Store/Model/Resource/Website/Grid/Collection.php similarity index 79% rename from app/code/Magento/Core/Model/Resource/Website/Grid/Collection.php rename to app/code/Magento/Store/Model/Resource/Website/Grid/Collection.php index 3fd12deb2263ef1a052ac48562491a1f5501cabc..17d2130dc815e983b46debf70187d5e0ad6e424a 100644 --- a/app/code/Magento/Core/Model/Resource/Website/Grid/Collection.php +++ b/app/code/Magento/Store/Model/Resource/Website/Grid/Collection.php @@ -18,21 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Website\Grid; +namespace Magento\Store\Model\Resource\Website\Grid; /** * Grid collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Website\Collection +class Collection extends \Magento\Store\Model\Resource\Website\Collection { /** * Join website and store names diff --git a/app/code/Magento/Core/Model/ScopeInterface.php b/app/code/Magento/Store/Model/ScopeInterface.php similarity index 88% rename from app/code/Magento/Core/Model/ScopeInterface.php rename to app/code/Magento/Store/Model/ScopeInterface.php index c2a58ed82eedc2ddd4172eef2fd797375d4c6288..0c72a9d5c147dd4bfa3754cf585470a0431b8b1e 100644 --- a/app/code/Magento/Core/Model/ScopeInterface.php +++ b/app/code/Magento/Store/Model/ScopeInterface.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; interface ScopeInterface { @@ -31,5 +31,9 @@ interface ScopeInterface const SCOPE_STORES = 'stores'; const SCOPE_WEBSITES = 'websites'; + + const SCOPE_STORE = 'store'; + const SCOPE_GROUP = 'group'; + const SCOPE_WEBSITE = 'website'; /**#@-*/ } diff --git a/app/code/Magento/Core/Model/Store/Storage/Db.php b/app/code/Magento/Store/Model/Storage/Db.php similarity index 82% rename from app/code/Magento/Core/Model/Store/Storage/Db.php rename to app/code/Magento/Store/Model/Storage/Db.php index fbca3a5bad7d5772a786258f7ae3bf1b29d56180..09fb61f664ea8606c09fc3c048718ee35ab78d1d 100644 --- a/app/code/Magento/Core/Model/Store/Storage/Db.php +++ b/app/code/Magento/Store/Model/Storage/Db.php @@ -23,37 +23,18 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store\Storage; +namespace Magento\Store\Model\Storage; -use Magento\Model\Exception; use Magento\App\State; -use Magento\Core\Model\Store; -use Magento\Core\Model\Store\StorageInterface; -use Magento\Core\Model\Store\Group; -use Magento\Core\Model\Store\Group\Factory; -use Magento\Core\Model\Store\Exception as StoreException; -use Magento\Core\Model\StoreFactory; -use Magento\Core\Model\StoreManagerInterface; -use Magento\Core\Model\Website; -use Magento\Core\Model\Website\Factory as WebsiteFactory; -use Magento\Profiler; - -class Db implements StorageInterface +use Magento\Store\Model\Store; +use Magento\Store\Model\Group; +use Magento\Store\Model\Group\Factory; +use Magento\Store\Model\StoreFactory; +use Magento\Store\Model\Website; +use Magento\Store\Model\Website\Factory as WebsiteFactory; + +class Db implements \Magento\Store\Model\StoreManagerInterface { - /** - * Requested scope code - * - * @var string - */ - protected $_scopeCode; - - /** - * Requested scope type - * - * @var string - */ - protected $_scopeType; - /** * Flag that shows that system has only one store view * @@ -99,14 +80,14 @@ class Db implements StorageInterface /** * Groups cache * - * @var Group + * @var Group[] */ protected $_groups = array(); /** * Config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -153,54 +134,40 @@ class Db implements StorageInterface protected $_appState; /** - * @var \Magento\Backend\Model\UrlInterface + * @var \Magento\Core\Helper\Data */ - protected $_url; - - /** - * @var \Magento\App\Http\Context - */ - protected $_httpContext; + protected $_helper; /** * @param StoreFactory $storeFactory * @param WebsiteFactory $websiteFactory * @param Factory $groupFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Stdlib\Cookie $cookie * @param State $appState - * @param \Magento\Backend\Model\UrlInterface $url - * @param \Magento\App\Http\Context $httpContext + * @param \Magento\Core\Helper\Data $helper * @param bool $isSingleStoreAllowed - * @param string $scopeCode - * @param string $scopeType * @param null $currentStore */ public function __construct( StoreFactory $storeFactory, WebsiteFactory $websiteFactory, Factory $groupFactory, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Stdlib\Cookie $cookie, State $appState, - \Magento\Backend\Model\UrlInterface $url, - \Magento\App\Http\Context $httpContext, + \Magento\Core\Helper\Data $helper, $isSingleStoreAllowed, - $scopeCode, - $scopeType, $currentStore = null ) { $this->_storeFactory = $storeFactory; $this->_websiteFactory = $websiteFactory; $this->_groupFactory = $groupFactory; - $this->_scopeCode = $scopeCode; - $this->_scopeType = $scopeType ?: StoreManagerInterface::SCOPE_TYPE_STORE; $this->_config = $config; $this->_isSingleStoreAllowed = $isSingleStoreAllowed; $this->_appState = $appState; $this->_cookie = $cookie; - $this->_url = $url; - $this->_httpContext = $httpContext; + $this->_helper = $helper; if ($currentStore) { $this->_currentStore = $currentStore; } @@ -215,50 +182,14 @@ class Db implements StorageInterface { if (empty($this->_store)) { $this->_store = $this->_storeFactory->create()->setId( - \Magento\Core\Model\Store::DISTRO_STORE_ID + \Magento\Store\Model\Store::DISTRO_STORE_ID )->setCode( - \Magento\Core\Model\Store::DEFAULT_CODE + \Magento\Store\Model\Store::DEFAULT_CODE ); } return $this->_store; } - /** - * Initialize currently ran store - * - * @return void - * @throws StoreException - */ - public function initCurrentStore() - { - Profiler::start('init_stores'); - $this->_initStores(); - Profiler::stop('init_stores'); - - if (empty($this->_scopeCode) && false == is_null($this->_website)) { - $this->_scopeCode = $this->_website->getCode(); - $this->_scopeType = StoreManagerInterface::SCOPE_TYPE_WEBSITE; - } - switch ($this->_scopeType) { - case StoreManagerInterface::SCOPE_TYPE_STORE: - $this->_currentStore = $this->_scopeCode; - break; - case StoreManagerInterface::SCOPE_TYPE_GROUP: - $this->_currentStore = $this->_getStoreByGroup($this->_scopeCode); - break; - case StoreManagerInterface::SCOPE_TYPE_WEBSITE: - $this->_currentStore = $this->_getStoreByWebsite($this->_scopeCode); - break; - default: - $this->throwStoreException(); - } - - if (!empty($this->_currentStore)) { - $this->_checkCookieStore($this->_scopeType); - $this->_checkGetStore($this->_scopeType); - } - } - /** * Check get store * @@ -391,15 +322,15 @@ class Db implements StorageInterface $this->_website = null; - /** @var $websiteCollection \Magento\Core\Model\Resource\Website\Collection */ + /** @var $websiteCollection \Magento\Store\Model\Resource\Website\Collection */ $websiteCollection = $this->_websiteFactory->create()->getCollection(); $websiteCollection->setLoadDefault(true); - /** @var $groupCollection \Magento\Core\Model\Resource\Store\Group\Collection */ + /** @var $groupCollection \Magento\Store\Model\Resource\Group\Collection */ $groupCollection = $this->_groupFactory->create()->getCollection(); $groupCollection->setLoadDefault(true); - /** @var $storeCollection \Magento\Core\Model\Resource\Store\Collection */ + /** @var $storeCollection \Magento\Store\Model\Resource\Collection */ $storeCollection = $this->_storeFactory->create()->getCollection(); $storeCollection->setLoadDefault(true); @@ -411,7 +342,6 @@ class Db implements StorageInterface $websiteStores = array(); $websiteGroups = array(); $groupStores = array(); - foreach ($storeCollection as $store) { /** @var $store Store */ $store->setWebsite($websiteCollection->getItemById($store->getWebsiteId())); @@ -423,13 +353,9 @@ class Db implements StorageInterface $websiteStores[$store->getWebsiteId()][$store->getId()] = $store; $groupStores[$store->getGroupId()][$store->getId()] = $store; - if (is_null($this->_store) && $store->getId()) { + if (is_null($this->_store) && $store->getCode() === \Magento\Store\Model\Store::DEFAULT_CODE) { $this->_store = $store; } - - if (0 == $store->getId()) { - $store->setUrlModel($this->_url); - } } foreach ($groupCollection as $group) { @@ -485,12 +411,22 @@ class Db implements StorageInterface return $this->_hasSingleStore; } + /** + * Check if system is run in the single store mode + * + * @return bool + */ + public function isSingleStoreMode() + { + return $this->hasSingleStore() && $this->_helper->isSingleStoreModeEnabled(); + } + /** * Retrieve application store object * * @param null|string|bool|int|Store $storeId * @return Store - * @throws StoreException + * @throws \Magento\Store\Model\Exception */ public function getStore($storeId = null) { @@ -508,9 +444,6 @@ class Db implements StorageInterface if ($storeId instanceof Store) { return $storeId; } - if (!isset($storeId)) { - $this->throwStoreException(); - } if (empty($this->_stores[$storeId])) { $store = $this->_storeFactory->create(); @@ -558,7 +491,7 @@ class Db implements StorageInterface * * @param null|bool|int|string|Website $websiteId * @return Website - * @throws Exception + * @throws \Magento\Store\Model\Exception */ public function getWebsite($websiteId = null) { @@ -575,7 +508,7 @@ class Db implements StorageInterface // load method will load website by code if given ID is not a numeric value $website->load($websiteId); if (!$website->hasWebsiteId()) { - throw new Exception('Invalid website id/code requested.'); + throw new \Magento\Store\Model\Exception('Invalid website id/code requested.'); } $this->_websites[$website->getWebsiteId()] = $website; $this->_websites[$website->getCode()] = $website; @@ -613,7 +546,7 @@ class Db implements StorageInterface * * @param null|Group|string $groupId * @return Group - * @throws Exception + * @throws \Magento\Store\Model\Exception */ public function getGroup($groupId = null) { @@ -627,7 +560,7 @@ class Db implements StorageInterface if (is_numeric($groupId)) { $group->load($groupId); if (!$group->hasGroupId()) { - throw new Exception('Invalid store group id requested.'); + throw new \Magento\Store\Model\Exception('Invalid store group id requested.'); } } $this->_groups[$group->getGroupId()] = $group; @@ -642,7 +575,7 @@ class Db implements StorageInterface * * @param bool $withDefault * @param bool $codeKey - * @return Group + * @return Group[] */ public function getGroups($withDefault = false, $codeKey = false) { @@ -747,11 +680,11 @@ class Db implements StorageInterface /** * @return void - * @throws StoreException + * @throws \Magento\Store\Model\Exception */ public function throwStoreException() { - throw new StoreException(''); + throw new \Magento\Store\Model\Exception('Store Manager has been initialized not properly'); } /** diff --git a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php b/app/code/Magento/Store/Model/Storage/DefaultStorage.php similarity index 70% rename from app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php rename to app/code/Magento/Store/Model/Storage/DefaultStorage.php index 0f42a1801305144ca933b974c6be562abb19449a..da49711c00678a609c23eadeaa28a454a715f3c8 100644 --- a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php +++ b/app/code/Magento/Store/Model/Storage/DefaultStorage.php @@ -23,76 +23,75 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store\Storage; +namespace Magento\Store\Model\Storage; -class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface +class DefaultStorage implements \Magento\Store\Model\StoreManagerInterface { /** * Application store object * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; /** * Application website object * - * @var \Magento\Core\Model\Website + * @var \Magento\Store\Model\Website */ protected $_website; /** * Application website object * - * @var \Magento\Core\Model\Store\Group + * @var \Magento\Store\Model\Group */ protected $_group; /** - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\Core\Model\Website\Factory $websiteFactory - * @param \Magento\Core\Model\Store\Group\Factory $groupFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\Website\Factory $websiteFactory + * @param \Magento\Store\Model\Group\Factory $groupFactory */ public function __construct( - \Magento\Core\Model\StoreFactory $storeFactory, - \Magento\Core\Model\Website\Factory $websiteFactory, - \Magento\Core\Model\Store\Group\Factory $groupFactory + \Magento\Store\Model\StoreFactory $storeFactory, + \Magento\Store\Model\Website\Factory $websiteFactory, + \Magento\Store\Model\Group\Factory $groupFactory ) { $this->_store = $storeFactory->create(); - $this->_store->setId(\Magento\Core\Model\Store::DISTRO_STORE_ID); - $this->_store->setCode(\Magento\Core\Model\Store::DEFAULT_CODE); + $this->_store->setId(\Magento\Store\Model\Store::DISTRO_STORE_ID); + $this->_store->setCode(\Magento\Store\Model\Store::DEFAULT_CODE); $this->_website = $websiteFactory->create(); $this->_group = $groupFactory->create(); } /** - * Initialize current application store + * Allow or disallow single store mode * + * @param bool $value * @return void */ - public function initCurrentStore() + public function setIsSingleStoreModeAllowed($value) { - //not applicable for default storage } /** - * Allow or disallow single store mode + * Check if store has only one store view * - * @param bool $value - * @return void + * @return bool */ - public function setIsSingleStoreModeAllowed($value) + public function hasSingleStore() { - //not applicable for default storage + return false; } /** - * Check if store has only one store view + * Check if system is run in the single store mode * * @return bool */ - public function hasSingleStore() + public function isSingleStoreMode() { return false; } @@ -100,8 +99,8 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application store object * - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId - * @return \Magento\Core\Model\Store + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId + * @return \Magento\Store\Model\Store */ public function getStore($storeId = null) { @@ -113,7 +112,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store[] + * @return \Magento\Store\Model\Store[] */ public function getStores($withDefault = false, $codeKey = false) { @@ -123,13 +122,13 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application website object * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId - * @return \Magento\Core\Model\Website + * @param null|bool|int|string|\Magento\Store\Model\Website $websiteId + * @return \Magento\Store\Model\Website * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null) { - if ($websiteId instanceof \Magento\Core\Model\Website) { + if ($websiteId instanceof \Magento\Store\Model\Website) { return $websiteId; } @@ -141,7 +140,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool|string $codeKey - * @return \Magento\Core\Model\Website[] + * @return \Magento\Store\Model\Website[] */ public function getWebsites($withDefault = false, $codeKey = false) { @@ -158,13 +157,13 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface /** * Retrieve application store group object * - * @param null|\Magento\Core\Model\Store\Group|string $groupId - * @return \Magento\Core\Model\Store\Group + * @param null|\Magento\Store\Model\Group|string $groupId + * @return \Magento\Store\Model\Group * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) { - if ($groupId instanceof \Magento\Core\Model\Store\Group) { + if ($groupId instanceof \Magento\Store\Model\Group) { return $groupId; } @@ -178,7 +177,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store\Group[] + * @return \Magento\Store\Model\Group[] */ public function getGroups($withDefault = false, $codeKey = false) { @@ -198,13 +197,12 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface */ public function reinitStores() { - //not applicable for default storage } /** * Retrieve default store for default group and website * - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getDefaultStoreView() { @@ -214,18 +212,17 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface /** * Unset website by id from app cache * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId + * @param null|bool|int|string|\Magento\Store\Model\Website $websiteId * @return void */ public function clearWebsiteCache($websiteId = null) { - //not applicable for default storage } /** * Get either default or any store view * - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getAnyStoreView() { @@ -244,11 +241,10 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface /** * @return void - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ public function throwStoreException() { - //not applicable for default storage } /** diff --git a/app/code/Magento/Store/Model/StorageFactory.php b/app/code/Magento/Store/Model/StorageFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..146f9a759db1973dcfbcfdb80595b80fba0e8254 --- /dev/null +++ b/app/code/Magento/Store/Model/StorageFactory.php @@ -0,0 +1,359 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Store\Model; + +use Magento\Profiler; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Store\Model\Store; + +class StorageFactory +{ + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * Default storage class name + * + * @var string + */ + protected $_defaultStorageClassName; + + /** + * Installed storage class name + * + * @var string + */ + protected $_installedStoreClassName; + + /** + * @var \Magento\Store\Model\StoreManagerInterface[] + */ + protected $_cache = array(); + + /** + * @var \Magento\Event\ManagerInterface + */ + protected $_eventManager; + + /** + * @var \Magento\Logger + */ + protected $_log; + + /** + * @var \Magento\Session\SidResolverInterface + */ + protected $_sidResolver; + + /** + * @var \Magento\App\State + */ + protected $_appState; + + /** + * @var string + */ + protected $_writerModel; + + /** + * @var \Magento\Stdlib\Cookie + */ + protected $_cookie; + + /** + * @var \Magento\App\Http\Context + */ + protected $_httpContext; + + /** + * @param \Magento\ObjectManager $objectManager + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Logger $logger + * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\App\State $appState + * @param \Magento\Stdlib\Cookie $cookie + * @param \Magento\App\Http\Context $httpContext + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param string $defaultStorageClassName + * @param string $installedStoreClassName + * @param string $writerModel + */ + public function __construct( + \Magento\ObjectManager $objectManager, + \Magento\Event\ManagerInterface $eventManager, + \Magento\Logger $logger, + \Magento\Session\SidResolverInterface $sidResolver, + \Magento\App\State $appState, + \Magento\Stdlib\Cookie $cookie, + \Magento\App\Http\Context $httpContext, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + $defaultStorageClassName = 'Magento\Store\Model\Storage\DefaultStorage', + $installedStoreClassName = 'Magento\Store\Model\Storage\Db', + $writerModel = '' + ) { + $this->_objectManager = $objectManager; + $this->_defaultStorageClassName = $defaultStorageClassName; + $this->_installedStoreClassName = $installedStoreClassName; + $this->_eventManager = $eventManager; + $this->_log = $logger; + $this->_appState = $appState; + $this->_sidResolver = $sidResolver; + $this->_writerModel = $writerModel; + $this->_cookie = $cookie; + $this->_httpContext = $httpContext; + $this->_scopeConfig = $scopeConfig; + } + + /** + * Get storage instance + * + * @param array $arguments + * @return \Magento\Store\Model\StoreManagerInterface + * @throws \InvalidArgumentException + */ + public function get(array $arguments = array()) + { + $className = + $this->_appState->isInstalled() ? $this->_installedStoreClassName : $this->_defaultStorageClassName; + + if (false == isset($this->_cache[$className])) { + /** @var $storage \Magento\Store\Model\StoreManagerInterface */ + $storage = $this->_objectManager->create($className, $arguments); + + if (false === ($storage instanceof \Magento\Store\Model\StoreManagerInterface)) { + throw new \InvalidArgumentException( + $className . ' doesn\'t implement \Magento\Store\Model\StoreManagerInterface' + ); + } + $this->_cache[$className] = $storage; + if ($className === $this->_installedStoreClassName) { + $this->_reinitStores($storage, $arguments); + $useSid = $this->_scopeConfig->isSetFlag( + \Magento\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storage->getStore() + ); + $this->_sidResolver->setUseSessionInUrl($useSid); + + $this->_eventManager->dispatch('core_app_init_current_store_after'); + + $store = $storage->getStore(true); + $logActive = $this->_scopeConfig->isSetFlag( + 'dev/log/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); + if ($logActive || $this->_appState->getMode() === \Magento\App\State::MODE_DEVELOPER) { + $logFile = $this->_scopeConfig->getValue( + 'dev/log/file', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); + $logExceptionFile = $this->_scopeConfig->getValue( + 'dev/log/exception_file', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); + $this->_log->unsetLoggers(); + $this->_log->addStreamLog( + \Magento\Logger::LOGGER_SYSTEM, + $logFile, + $this->_writerModel + ); + $this->_log->addStreamLog( + \Magento\Logger::LOGGER_EXCEPTION, + $logExceptionFile, + $this->_writerModel + ); + } + } + } + return $this->_cache[$className]; + } + + /** + * Initialize currently ran store + * + * @param \Magento\Store\Model\StoreManagerInterface $storage + * @param array $arguments + * @return void + */ + protected function _reinitStores(\Magento\Store\Model\StoreManagerInterface $storage, $arguments) + { + Profiler::start('init_stores'); + $storage->reinitStores(); + Profiler::stop('init_stores'); + + $scopeCode = $arguments['scopeCode']; + $scopeType = $arguments['scopeType'] ? : ScopeInterface::SCOPE_STORE; + if (empty($scopeCode) && false == is_null($storage->getWebsite(true))) { + $scopeCode = $storage->getWebsite(true)->getCode(); + $scopeType = ScopeInterface::SCOPE_WEBSITE; + } + switch ($scopeType) { + case ScopeInterface::SCOPE_STORE: + $storage->setCurrentStore($scopeCode); + break; + case ScopeInterface::SCOPE_GROUP: + $storage->setCurrentStore($this->_getStoreByGroup($storage, $scopeCode)); + break; + case ScopeInterface::SCOPE_WEBSITE: + $storage->setCurrentStore($this->_getStoreByWebsite($storage, $scopeCode)); + break; + default: + $storage->throwStoreException(); + } + + $currentStore = $storage->getCurrentStore(); + if (!empty($currentStore)) { + $this->_checkCookieStore($storage, $scopeType); + $this->_checkGetStore($storage, $scopeType); + } + } + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storage + * @param string $scopeCode + * @return null|string + */ + protected function _getStoreByGroup(\Magento\Store\Model\StoreManagerInterface $storage, $scopeCode) + { + $groups = $storage->getGroups(true); + $stores = $storage->getStores(true); + if (!isset($groups[$scopeCode])) { + return null; + } + if (!$groups[$scopeCode]->getDefaultStoreId()) { + return null; + } + return $stores[$groups[$scopeCode]->getDefaultStoreId()]->getCode(); + } + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storage + * @param string $scopeCode + * @return null|string + */ + protected function _getStoreByWebsite(\Magento\Store\Model\StoreManagerInterface $storage, $scopeCode) + { + $websites = $storage->getWebsites(true, true); + if (!isset($websites[$scopeCode])) { + return null; + } + if (!$websites[$scopeCode]->getDefaultGroupId()) { + return null; + } + return $this->_getStoreByGroup($storage, $websites[$scopeCode]->getDefaultGroupId()); + } + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storage + * @param string $scopeType + * @return void + */ + protected function _checkCookieStore(\Magento\Store\Model\StoreManagerInterface $storage, $scopeType) + { + if (!$this->_cookie->get()) { + return; + } + + $store = $this->_cookie->get(Store::COOKIE_NAME); + $stores = $storage->getStores(true, true); + if ($store && isset($stores[$store]) + && $stores[$store]->getId() + && $stores[$store]->getIsActive() + ) { + if ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE + && $stores[$store]->getWebsiteId() == $stores[$storage->getCurrentStore()]->getWebsiteId() + ) { + $storage->setCurrentStore($store); + } + if ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_GROUP + && $stores[$store]->getGroupId() == $stores[$storage->getCurrentStore()]->getGroupId() + ) { + $storage->setCurrentStore($store); + } + if ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { + $storage->setCurrentStore($store); + } + } + } + + /** + * @param \Magento\Store\Model\StoreManagerInterface $storage + * @param string $scopeType + * @return void + */ + protected function _checkGetStore(\Magento\Store\Model\StoreManagerInterface $storage, $scopeType) + { + if (empty($_POST['___store']) && empty($_GET['___store'])) { + return; + } + $store = empty($_POST['___store']) ? $_GET['___store'] : $_POST['___store']; + + $stores = $storage->getStores(true, true); + if (!isset($stores[$store])) { + return; + } + + $storeObj = $stores[$store]; + if (!$storeObj->getId() || !$storeObj->getIsActive()) { + return; + } + + /** + * prevent running a store from another website or store group, + * if website or store group was specified explicitly + */ + $curStoreObj = $stores[$storage->getCurrentStore()]; + if ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE + && $storeObj->getWebsiteId() == $curStoreObj->getWebsiteId() + ) { + $storage->setCurrentStore($store); + } elseif ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_GROUP + && $storeObj->getGroupId() == $curStoreObj->getGroupId() + ) { + $storage->setCurrentStore($store); + } elseif ($scopeType == \Magento\Store\Model\ScopeInterface::SCOPE_STORE) { + $storage->setCurrentStore($store); + } + + if ($storage->getCurrentStore() == $store) { + $store = $storage->getStore($store); + if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) { + $this->_cookie->set(Store::COOKIE_NAME, null); + } else { + $this->_cookie->set(Store::COOKIE_NAME, $storage->getCurrentStore(), true); + $this->_httpContext->setValue( + Store::ENTITY, + $storage->getCurrentStore(), + \Magento\Store\Model\Store::DEFAULT_CODE + ); + } + } + return; + } +} diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Store/Model/Store.php similarity index 87% rename from app/code/Magento/Core/Model/Store.php rename to app/code/Magento/Store/Model/Store.php index 628de84ddcdccdd749b1568df9e013a305688047..0036236a8bcf7bdc9be71717ec7e17d81fa59552 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Store/Model/Store.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; use Magento\Directory\Model\Currency\Filter; use Magento\Model\AbstractModel; @@ -31,24 +29,24 @@ use Magento\Model\AbstractModel; /** * Store model * - * @method \Magento\Core\Model\Store setCode(string $value) - * @method \Magento\Core\Model\Store setWebsiteId(int $value) - * @method \Magento\Core\Model\Store setGroupId(int $value) - * @method \Magento\Core\Model\Store setName(string $value) + * @method \Magento\Store\Model\Store setCode(string $value) + * @method \Magento\Store\Model\Store setWebsiteId(int $value) + * @method \Magento\Store\Model\Store setGroupId(int $value) + * @method \Magento\Store\Model\Store setName(string $value) * @method int getSortOrder() * @method int getStoreId() - * @method \Magento\Core\Model\Store setSortOrder(int $value) - * @method \Magento\Core\Model\Store setIsActive(int $value) + * @method \Magento\Store\Model\Store setSortOrder(int $value) + * @method \Magento\Store\Model\Store setIsActive(int $value) */ class Store extends AbstractModel implements - \Magento\BaseScopeInterface, + \Magento\App\ScopeInterface, \Magento\Url\ScopeInterface, \Magento\Object\IdentityInterface { /** * Entity name */ - const ENTITY = 'core_store'; + const ENTITY = 'store'; /** * Custom entry point param @@ -187,13 +185,6 @@ class Store extends AbstractModel implements */ protected $_priceFilter; - /** - * Group model - * - * @var \Magento\Core\Model\Store\Group - */ - protected $_group; - /** * Store configuration cache * @@ -301,14 +292,9 @@ class Store extends AbstractModel implements protected $filesystem; /** - * Core store config + * Store Config * - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - - /** - * @var \Magento\App\ReinitableConfigInterface + * @var \Magento\App\Config\ReinitableConfigInterface */ protected $_config; @@ -329,28 +315,21 @@ class Store extends AbstractModel implements */ protected $_httpContext; - /** - * @var \Magento\App\ConfigInterface - */ - protected $_appConfig; - /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry + * @param \Magento\Store\Model\Resource\Store $resource * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\UrlInterface $url * @param \Magento\App\RequestInterface $request - * @param Resource\Config\Data $configDataResource + * @param \Magento\Core\Model\Resource\Config\Data $configDataResource * @param \Magento\App\Filesystem $filesystem - * @param Store\Config $coreStoreConfig - * @param \Magento\App\ReinitableConfigInterface $coreConfig - * @param Resource\Store $resource + * @param \Magento\App\Config\ReinitableConfigInterface $config * @param StoreManagerInterface $storeManager * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\App\Http\Context $httpContext - * @param \Magento\App\ConfigInterface $appConfig * @param \Magento\Data\Collection\Db $resourceCollection * @param bool $isCustomEntryPoint * @param array $data @@ -358,38 +337,34 @@ class Store extends AbstractModel implements public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, + \Magento\Store\Model\Resource\Store $resource, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, \Magento\App\Cache\Type\Config $configCacheType, \Magento\UrlInterface $url, \Magento\App\RequestInterface $request, \Magento\Core\Model\Resource\Config\Data $configDataResource, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\App\ReinitableConfigInterface $coreConfig, - \Magento\Core\Model\Resource\Store $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ReinitableConfigInterface $config, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Stdlib\Cookie $cookie, \Magento\App\Http\Context $httpContext, - \Magento\App\ConfigInterface $appConfig, \Magento\Data\Collection\Db $resourceCollection = null, $isCustomEntryPoint = false, array $data = array() ) { $this->_coreFileStorageDatabase = $coreFileStorageDatabase; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_config = $config; $this->_url = $url; $this->_configCacheType = $configCacheType; $this->_request = $request; $this->_configDataResource = $configDataResource; $this->_isCustomEntryPoint = $isCustomEntryPoint; $this->filesystem = $filesystem; - $this->_config = $coreConfig; $this->_storeManager = $storeManager; $this->_sidResolver = $sidResolver; $this->_cookie = $cookie; $this->_httpContext = $httpContext; - $this->_appConfig = $appConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -399,7 +374,7 @@ class Store extends AbstractModel implements public function __sleep() { $properties = parent::__sleep(); - $properties = array_diff($properties, array('_coreFileStorageDatabase', '_coreStoreConfig', '_config')); + $properties = array_diff($properties, array('_coreFileStorageDatabase', '_config')); return $properties; } @@ -414,8 +389,9 @@ class Store extends AbstractModel implements $this->_coreFileStorageDatabase = \Magento\App\ObjectManager::getInstance()->get( 'Magento\Core\Helper\File\Storage\Database' ); - $this->_coreStoreConfig = \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\Store\Config'); - $this->_config = \Magento\App\ObjectManager::getInstance()->get('Magento\App\ReinitableConfigInterface'); + $this->_config = \Magento\App\ObjectManager::getInstance()->get( + 'Magento\App\Config\ReinitableConfigInterface' + ); $this->_cookie = \Magento\App\ObjectManager::getInstance()->get('Magento\Stdlib\Cookie'); } @@ -426,7 +402,7 @@ class Store extends AbstractModel implements */ protected function _construct() { - $this->_init('Magento\Core\Model\Resource\Store'); + $this->_init('Magento\Store\Model\Resource\Store'); } /** @@ -462,7 +438,8 @@ class Store extends AbstractModel implements $storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/'); $storeCodeRule->setMessage( __( - 'The store code may contain only letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter' + 'The store code may contain only letters (a-z), numbers (0-9) or underscore(_),' + . ' the first character must be a letter' ), \Zend_Validate_Regex::NOT_MATCH ); @@ -503,30 +480,15 @@ class Store extends AbstractModel implements * @param string $path * @return string|null */ - public function getConfig($path) + protected function _getConfig($path) { - $data = $this->_config->getValue($path, 'store', $this->getCode()); + $data = $this->_config->getValue($path, ScopeInterface::SCOPE_STORE, $this->getCode()); if (!$data && !$this->_appState->isInstalled()) { - $data = $this->_config->getValue($path, 'default'); + $data = $this->_config->getValue($path, \Magento\App\ScopeInterface::SCOPE_DEFAULT); } return $data === false ? null : $data; } - /** - * Set config value for CURRENT model - * - * This value don't save in config - * - * @param string $path - * @param mixed $value - * @return $this - */ - public function setConfig($path, $value) - { - $this->_config->setValue($path, $value, 'store', $this->getCode()); - return $this; - } - /** * Set relation to the website * @@ -561,7 +523,7 @@ class Store extends AbstractModel implements public function getUrl($route = '', $params = array()) { /** @var $url \Magento\UrlInterface */ - $url = $this->getUrlModel()->setScope($this); + $url = $this->_url->setScope($this); if ($this->_storeManager->getStore()->getId() != $this->getId()) { $params['_scope_to_url'] = true; } @@ -585,25 +547,25 @@ class Store extends AbstractModel implements switch ($type) { case \Magento\UrlInterface::URL_TYPE_WEB: $path = $secure ? self::XML_PATH_SECURE_BASE_URL : self::XML_PATH_UNSECURE_BASE_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); break; case \Magento\UrlInterface::URL_TYPE_LINK: $path = $secure ? self::XML_PATH_SECURE_BASE_LINK_URL : self::XML_PATH_UNSECURE_BASE_LINK_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); $url = $this->_updatePathUseRewrites($url); $url = $this->_updatePathUseStoreView($url); break; case \Magento\UrlInterface::URL_TYPE_DIRECT_LINK: $path = $secure ? self::XML_PATH_SECURE_BASE_LINK_URL : self::XML_PATH_UNSECURE_BASE_LINK_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); $url = $this->_updatePathUseRewrites($url); break; case \Magento\UrlInterface::URL_TYPE_LIB: $path = $secure ? self::XML_PATH_SECURE_BASE_LIB_URL : self::XML_PATH_UNSECURE_BASE_LIB_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\UrlInterface::URL_TYPE_WEB, @@ -616,7 +578,7 @@ class Store extends AbstractModel implements case \Magento\UrlInterface::URL_TYPE_STATIC: $path = $secure ? self::XML_PATH_SECURE_BASE_STATIC_URL : self::XML_PATH_UNSECURE_BASE_STATIC_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\UrlInterface::URL_TYPE_WEB, @@ -629,7 +591,7 @@ class Store extends AbstractModel implements case \Magento\UrlInterface::URL_TYPE_CACHE: $path = $secure ? self::XML_PATH_SECURE_BASE_CACHE_URL : self::XML_PATH_UNSECURE_BASE_CACHE_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\UrlInterface::URL_TYPE_WEB, @@ -644,7 +606,7 @@ class Store extends AbstractModel implements $url = $this->_getMediaScriptUrl($this->filesystem, $secure); if (!$url) { $path = $secure ? self::XML_PATH_SECURE_BASE_MEDIA_URL : self::XML_PATH_UNSECURE_BASE_MEDIA_URL; - $url = $this->getConfig($path); + $url = $this->_getConfig($path); if (!$url) { $url = $this->getBaseUrl( \Magento\UrlInterface::URL_TYPE_WEB, @@ -679,7 +641,7 @@ class Store extends AbstractModel implements */ protected function _updatePathUseRewrites($url) { - if ($this->getForceDisableRewrites() || !$this->getConfig( + if ($this->getForceDisableRewrites() || !$this->_getConfig( self::XML_PATH_USE_REWRITES ) || !$this->_appState->isInstalled() ) { @@ -715,7 +677,7 @@ class Store extends AbstractModel implements */ protected function _getMediaScriptUrl(\Magento\App\Filesystem $filesystem, $secure) { - if (!$this->getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage()) { + if (!$this->_getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage()) { return $this->getBaseUrl( \Magento\UrlInterface::URL_TYPE_WEB, $secure @@ -750,9 +712,7 @@ class Store extends AbstractModel implements return !($this->hasDisableStoreInUrl() && $this->getDisableStoreInUrl()) && $this->_appState->isInstalled() && - $this->getConfig( - self::XML_PATH_STORE_IN_URL - ); + $this->_getConfig(self::XML_PATH_STORE_IN_URL); } /** @@ -773,8 +733,9 @@ class Store extends AbstractModel implements public function isFrontUrlSecure() { if ($this->_isFrontSecure === null) { - $this->_isFrontSecure = $this->_coreStoreConfig->getConfigFlag( + $this->_isFrontSecure = $this->_config->isSetFlag( self::XML_PATH_SECURE_IN_FRONTEND, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getId() ); } @@ -797,14 +758,22 @@ class Store extends AbstractModel implements public function isCurrentlySecure() { $standardRule = !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS']; - $offloaderHeader = trim((string)$this->_config->getValue(self::XML_PATH_OFFLOADER_HEADER, 'default')); + $offloaderHeader = trim( + (string)$this->_config->getValue( + self::XML_PATH_OFFLOADER_HEADER, + \Magento\App\ScopeInterface::SCOPE_DEFAULT + ) + ); if (!empty($offloaderHeader) && !empty($_SERVER[$offloaderHeader]) || $standardRule) { return true; } if ($this->_appState->isInstalled()) { - $secureBaseUrl = $this->_coreStoreConfig->getConfig(self::XML_PATH_SECURE_BASE_URL); + $secureBaseUrl = $this->_config->getValue( + self::XML_PATH_SECURE_BASE_URL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!$secureBaseUrl) { return false; @@ -833,14 +802,14 @@ class Store extends AbstractModel implements */ public function getBaseCurrencyCode() { - $configValue = $this->getConfig(self::XML_PATH_PRICE_SCOPE); + $configValue = $this->_getConfig(self::XML_PATH_PRICE_SCOPE); if ($configValue == self::PRICE_SCOPE_GLOBAL) { - return $this->_appConfig->getValue( + return $this->_config->getValue( \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, - 'default' + \Magento\App\ScopeInterface::SCOPE_DEFAULT ); } else { - return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + return $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } } @@ -870,7 +839,7 @@ class Store extends AbstractModel implements */ public function getDefaultCurrencyCode() { - $result = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT); + $result = $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT); return $result; } @@ -957,7 +926,7 @@ class Store extends AbstractModel implements { $codes = $this->getData('available_currency_codes'); if (null === $codes) { - $codes = explode(',', $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW)); + $codes = explode(',', $this->_getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW)); // add base currency, if it is not in allowed currencies $baseCurrencyCode = $this->getBaseCurrencyCode(); if (!in_array($baseCurrencyCode, $codes)) { @@ -1021,8 +990,8 @@ class Store extends AbstractModel implements * Convert price from default currency to current currency * * @param float $price - * @param bool $format Format price to currency format - * @param bool $includeContainer Enclose into <span class="price"><span> + * @param bool $format Format price to currency format + * @param bool $includeContainer Enclose into <span class="price"><span> * @return float */ public function convertPrice($price, $format = false, $includeContainer = true) @@ -1101,10 +1070,10 @@ class Store extends AbstractModel implements /** * Set group model for store * - * @param \Magento\Core\Model\Store\Group $group + * @param \Magento\Store\Model\Group $group * @return void */ - public function setGroup($group) + public function setGroup(\Magento\Store\Model\Group $group) { $this->setGroupId($group->getId()); } @@ -1112,7 +1081,7 @@ class Store extends AbstractModel implements /** * Retrieve group model * - * @return \Magento\Core\Model\Store\Group|bool + * @return \Magento\Store\Model\Group|bool */ public function getGroup() { @@ -1175,7 +1144,7 @@ class Store extends AbstractModel implements public function getCurrentUrl($fromStore = true) { $sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession()); - $requestString = $this->getUrlModel()->escape(ltrim($this->_request->getRequestString(), '/')); + $requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/')); $storeUrl = $this->_storeManager->getStore()->isCurrentlySecure() ? $this->getUrl( '', @@ -1224,11 +1193,8 @@ class Store extends AbstractModel implements $storeParsedUrl['path'] . $requestString . ($storeParsedQuery ? '?' . - http_build_query( - $storeParsedQuery, - '', - '&' - ) : ''); + http_build_query($storeParsedQuery, '', '&') : '' + ); } /** @@ -1267,7 +1233,8 @@ class Store extends AbstractModel implements self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE ); - $this->_configDataResource->clearStoreData(array($this->getId())); + $this->_configDataResource->clearScopeData(\Magento\Store\Model\ScopeInterface::SCOPE_STORES, $this->getId()); + return parent::_beforeDelete(); } @@ -1337,34 +1304,16 @@ class Store extends AbstractModel implements public function getFrontendName() { if (null === $this->_frontendName) { - $storeGroupName = (string)$this->_coreStoreConfig->getConfig('general/store_information/name', $this); + $storeGroupName = (string)$this->_config->getValue( + 'general/store_information/name', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this + ); $this->_frontendName = !empty($storeGroupName) ? $storeGroupName : $this->getGroup()->getName(); } return $this->_frontendName; } - /** - * Set url model for current store - * - * @param \Magento\UrlInterface $urlModel - * @return $this - */ - public function setUrlModel($urlModel) - { - $this->_url = $urlModel; - return $this; - } - - /** - * Get url model by class name for current store - * - * @return \Magento\UrlInterface - */ - public function getUrlModel() - { - return $this->_url; - } - /** * Get identities * diff --git a/app/code/Magento/Core/Model/StoreManager.php b/app/code/Magento/Store/Model/StoreManager.php similarity index 83% rename from app/code/Magento/Core/Model/StoreManager.php rename to app/code/Magento/Store/Model/StoreManager.php index 28a898e562fca613a91703fa2e85dbca82c54c59..8a1dac6bf87dd382560055aad77b5efb486339d3 100644 --- a/app/code/Magento/Core/Model/StoreManager.php +++ b/app/code/Magento/Store/Model/StoreManager.php @@ -21,22 +21,24 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; -class StoreManager implements \Magento\Core\Model\StoreManagerInterface +class StoreManager implements \Magento\Store\Model\StoreManagerInterface { /** * Application run code */ const PARAM_RUN_CODE = 'MAGE_RUN_CODE'; + /** * Application run type (store|website) */ const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE'; + /** * Store storage factory model * - * @var \Magento\Core\Model\Store\StorageFactory + * @var \Magento\Store\Model\StorageFactory */ protected $_factory; @@ -88,30 +90,30 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface protected $_helper; /** - * @param \Magento\Core\Model\Store\StorageFactory $factory + * @param \Magento\Store\Model\StorageFactory $factory * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Helper\Data $helper * @param string $scopeCode * @param string $scopeType */ public function __construct( - \Magento\Core\Model\Store\StorageFactory $factory, + \Magento\Store\Model\StorageFactory $factory, \Magento\App\RequestInterface $request, \Magento\Core\Helper\Data $helper, $scopeCode = '', - $scopeType = 'store' + $scopeType = ScopeInterface::SCOPE_STORE ) { $this->_factory = $factory; $this->_request = $request; $this->_scopeCode = $scopeCode; - $this->_scopeType = $scopeType ?: self::SCOPE_TYPE_STORE; + $this->_scopeType = $scopeType; $this->_helper = $helper; } /** * Get storage instance * - * @return \Magento\Core\Model\Store\StorageInterface + * @return \Magento\Store\Model\StoreManagerInterface */ protected function _getStorage() { @@ -124,27 +126,6 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface return $this->_factory->get($arguments); } - /** - * Retrieve application store object without Store_Exception - * - * @param string|int|Store $storeId - * @throws \Magento\Model\Exception - * @return Store - */ - public function getSafeStore($storeId = null) - { - try { - return $this->getStore($storeId); - } catch (\Exception $e) { - if ($this->_getStorage()->getCurrentStore()) { - $this->_request->setActionName('noroute'); - return new \Magento\Object(); - } - - throw new \Magento\Model\Exception(__('Requested invalid store "%1"', $storeId)); - } - } - /** * Set current default store * @@ -159,7 +140,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface /** * @return void - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ public function throwStoreException() { @@ -203,7 +184,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param null|string|bool|int|Store $storeId * @return Store - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ public function getStore($storeId = null) { @@ -269,8 +250,8 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface /** * Retrieve application store group object * - * @param null|\Magento\Core\Model\Store\Group|string $groupId - * @return \Magento\Core\Model\Store\Group + * @param null|\Magento\Store\Model\Group|string $groupId + * @return \Magento\Store\Model\Group * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) @@ -285,7 +266,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store\Group[] + * @return \Magento\Store\Model\Group[] */ public function getGroups($withDefault = false, $codeKey = false) { diff --git a/app/code/Magento/Core/Model/Store/ListInterface.php b/app/code/Magento/Store/Model/StoreManagerInterface.php similarity index 76% rename from app/code/Magento/Core/Model/Store/ListInterface.php rename to app/code/Magento/Store/Model/StoreManagerInterface.php index aa21e58c39dfc536642bf85ae4d3e40ecf67debf..cee03589caff1dc6ab5ac3cb03079cc684f93e5b 100644 --- a/app/code/Magento/Core/Model/Store/ListInterface.php +++ b/app/code/Magento/Store/Model/StoreManagerInterface.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store; +namespace Magento\Store\Model; -interface ListInterface +interface StoreManagerInterface { /** * Allow or disallow single store mode @@ -40,12 +40,19 @@ interface ListInterface */ public function hasSingleStore(); + /** + * Check if system is run in the single store mode + * + * @return bool + */ + public function isSingleStoreMode(); + /** * Retrieve application store object * - * @param null|string|bool|int|\Magento\Core\Model\Store $storeId - * @return \Magento\Core\Model\Store - * @throws \Magento\Core\Model\Store\Exception + * @param null|string|bool|int|\Magento\Store\Model\Store $storeId + * @return \Magento\Store\Model\Store + * @throws \Magento\Store\Model\Exception */ public function getStore($storeId = null); @@ -54,15 +61,15 @@ interface ListInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store[] + * @return \Magento\Store\Model\Store[] */ public function getStores($withDefault = false, $codeKey = false); /** * Retrieve application website object * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId - * @return \Magento\Core\Model\Website + * @param null|bool|int|string|\Magento\Store\Model\Website $websiteId + * @return \Magento\Store\Model\Website * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null); @@ -72,7 +79,7 @@ interface ListInterface * * @param bool $withDefault * @param bool|string $codeKey - * @return \Magento\Core\Model\Website[] + * @return \Magento\Store\Model\Website[] */ public function getWebsites($withDefault = false, $codeKey = false); @@ -86,15 +93,16 @@ interface ListInterface /** * Retrieve default store for default group and website * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getDefaultStoreView(); /** * Retrieve application store group object * - * @param null|\Magento\Core\Model\Store\Group|string $groupId - * @return \Magento\Core\Model\Store\Group + * @param null|\Magento\Store\Model\Group|string $groupId + * @return \Magento\Store\Model\Group + * @throws \Magento\Store\Model\Exception * @throws \Magento\Model\Exception */ public function getGroup($groupId = null); @@ -106,14 +114,14 @@ interface ListInterface * * @param bool $withDefault * @param bool $codeKey - * @return \Magento\Core\Model\Store\Group[] + * @return \Magento\Store\Model\Group[] */ public function getGroups($withDefault = false, $codeKey = false); /** * Unset website by id from app cache * - * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId + * @param null|bool|int|string|\Magento\Store\Model\Website $websiteId * @return void */ public function clearWebsiteCache($websiteId = null); @@ -121,7 +129,7 @@ interface ListInterface /** * Get either default or any store view * - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getAnyStoreView(); @@ -142,7 +150,7 @@ interface ListInterface /** * @return void - * @throws \Magento\Core\Model\Store\Exception + * @throws \Magento\Store\Model\Exception */ public function throwStoreException(); } diff --git a/app/code/Magento/Store/Model/StoresConfig.php b/app/code/Magento/Store/Model/StoresConfig.php new file mode 100644 index 0000000000000000000000000000000000000000..ceb106c4add430ecd39755619b90677227a47824 --- /dev/null +++ b/app/code/Magento/Store/Model/StoresConfig.php @@ -0,0 +1,72 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Model; + +use Magento\Store\Model\StoreManagerInterface; + +class StoresConfig +{ + /** + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $_storeManager; + + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_config; + + /** + * @param StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $config + */ + public function __construct( + StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $config + ) { + $this->_storeManager = $storeManager; + $this->_config = $config; + } + + /** + * Retrieve store Ids for $path with checking + * + * return array($storeId => $pathValue) + * + * @param string $path + * @return array + */ + public function getStoresConfigByPath($path) + { + $stores = $this->_storeManager->getStores(true); + $storeValues = array(); + /** @var $store \Magento\Store\Model\Store */ + foreach ($stores as $store) { + $value = $this->_config->getValue($path, ScopeInterface::SCOPE_STORE, $store->getCode()); + $storeValues[$store->getId()] = $value; + } + return $storeValues; + } +} diff --git a/app/code/Magento/Core/Model/System/Store.php b/app/code/Magento/Store/Model/System/Store.php similarity index 94% rename from app/code/Magento/Core/Model/System/Store.php rename to app/code/Magento/Store/Model/System/Store.php index a2de0c46b698583d5929cd973d9cd16fddd3f514..d32b594b07406e175245e4ceaa03d80e85ba98a7 100644 --- a/app/code/Magento/Core/Model/System/Store.php +++ b/app/code/Magento/Store/Model/System/Store.php @@ -18,25 +18,19 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\System; +namespace Magento\Store\Model\System; /** * Core System Store Model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Store extends \Magento\Object { /** * Website collection - * websiteId => \Magento\Core\Model\Website + * websiteId => \Magento\Store\Model\Website * * @var array */ @@ -44,7 +38,7 @@ class Store extends \Magento\Object /** * Group collection - * groupId => \Magento\Core\Model\Store\Group + * groupId => \Magento\Store\Model\Group * * @var array */ @@ -52,7 +46,7 @@ class Store extends \Magento\Object /** * Store collection - * storeId => \Magento\Core\Model\Store + * storeId => \Magento\Store\Model\Store * * @var array */ @@ -64,7 +58,7 @@ class Store extends \Magento\Object private $_isAdminScopeAllowed = true; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -72,9 +66,9 @@ class Store extends \Magento\Object * Init model * Load Website, Group and Store collections * - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + public function __construct(\Magento\Store\Model\StoreManagerInterface $storeManager) { $this->_storeManager = $storeManager; return $this->reload(); @@ -348,7 +342,7 @@ class Store extends \Magento\Object * Retrieve store name with website and website store * * @param int $storeId - * @return \Magento\Core\Model\Store|null + * @return \Magento\Store\Model\Store|null */ public function getStoreData($storeId) { @@ -429,13 +423,13 @@ class Store extends \Magento\Object $this->_loadStoreCollection(); } else { switch ($type) { - case 'website': + case \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE: $this->_loadWebsiteCollection(); break; - case 'group': + case \Magento\Store\Model\ScopeInterface::SCOPE_GROUP: $this->_loadGroupCollection(); break; - case 'store': + case \Magento\Store\Model\ScopeInterface::SCOPE_STORE: $this->_loadStoreCollection(); break; default: diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Store/Model/Website.php similarity index 83% rename from app/code/Magento/Core/Model/Website.php rename to app/code/Magento/Store/Model/Website.php index 051e7b9947d150fe9f734128aa771012a182da24..e32f66c3d2b21b23604ad7b01822829787c41d9d 100644 --- a/app/code/Magento/Core/Model/Website.php +++ b/app/code/Magento/Store/Model/Website.php @@ -18,19 +18,17 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; /** * Core Website model * - * @method \Magento\Core\Model\Resource\Website _getResource() - * @method \Magento\Core\Model\Resource\Website getResource() - * @method \Magento\Core\Model\Website setCode(string $value) + * @method \Magento\Store\Model\Resource\Website _getResource() + * @method \Magento\Store\Model\Resource\Website getResource() + * @method \Magento\Store\Model\Website setCode(string $value) * @method string getName() * @method string getGroupTitle() * @method string getStoreTitle() @@ -38,16 +36,18 @@ namespace Magento\Core\Model; * @method int getGroupId() * @method int getWebsiteId() * @method bool hasWebsiteId() - * @method \Magento\Core\Model\Website setName(string $value) + * @method \Magento\Store\Model\Website setName(string $value) * @method int getSortOrder() - * @method \Magento\Core\Model\Website setSortOrder(int $value) - * @method \Magento\Core\Model\Website setDefaultGroupId(int $value) + * @method \Magento\Store\Model\Website setSortOrder(int $value) + * @method \Magento\Store\Model\Website setDefaultGroupId(int $value) * @method int getIsDefault() - * @method \Magento\Core\Model\Website setIsDefault(int $value) + * @method \Magento\Store\Model\Website setIsDefault(int $value) */ -class Website extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Website extends \Magento\Model\AbstractModel implements + \Magento\Object\IdentityInterface, + \Magento\App\ScopeInterface { - const ENTITY = 'core_website'; + const ENTITY = 'store_website'; const CACHE_TAG = 'website'; @@ -76,7 +76,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Website Group Collection array * - * @var \Magento\Core\Model\Store\Group[] + * @var \Magento\Store\Model\Store[] */ protected $_groups; @@ -125,7 +125,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Website default group * - * @var \Magento\Core\Model\Store\Group + * @var \Magento\Store\Model\Store */ protected $_defaultGroup; @@ -159,7 +159,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id protected $_storeFactory; /** - * @var \Magento\Core\Model\Store\GroupFactory + * @var \Magento\Store\Model\GroupFactory */ protected $_storeGroupFactory; @@ -181,12 +181,12 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param Resource\Config\Data $configDataResource - * @param \Magento\App\ConfigInterface $coreConfig - * @param StoreFactory $storeFactory - * @param Store\GroupFactory $storeGroupFactory - * @param WebsiteFactory $websiteFactory - * @param StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Resource\Config\Data $configDataResource + * @param \Magento\App\Config\ScopeConfigInterface $coreConfig + * @param \Magento\Store\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\GroupFactory $storeGroupFactory + * @param \Magento\Store\Model\WebsiteFactory $websiteFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -196,11 +196,11 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Resource\Config\Data $configDataResource, - \Magento\App\ConfigInterface $coreConfig, - \Magento\Core\Model\StoreFactory $storeFactory, - \Magento\Core\Model\Store\GroupFactory $storeGroupFactory, - \Magento\Core\Model\WebsiteFactory $websiteFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $coreConfig, + \Magento\Store\Model\StoreFactory $storeFactory, + \Magento\Store\Model\GroupFactory $storeGroupFactory, + \Magento\Store\Model\WebsiteFactory $websiteFactory, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -223,7 +223,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id */ protected function _construct() { - $this->_init('Magento\Core\Model\Resource\Website'); + $this->_init('Magento\Store\Model\Resource\Website'); } /** @@ -252,7 +252,11 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id { if (!isset($this->_configCache[$path])) { - $config = $this->_coreConfig->getValue($path, 'website', $this->getCode()); + $config = $this->_coreConfig->getValue( + $path, + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, + $this->getCode() + ); if (!$config) { return false; } @@ -304,7 +308,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Retrieve new (not loaded) Group collection object with website filter * - * @return \Magento\Core\Model\Resource\Store\Group\Collection + * @return \Magento\Store\Model\Resource\Group\Collection */ public function getGroupCollection() { @@ -314,7 +318,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Retrieve website groups * - * @return \Magento\Core\Model\Store\Group[] + * @return \Magento\Store\Model\Store[] */ public function getGroups() { @@ -353,7 +357,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Retrieve default group model * - * @return \Magento\Core\Model\Store\Group + * @return \Magento\Store\Model\Store */ public function getDefaultGroup() { @@ -410,7 +414,7 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id /** * Retrieve new (not loaded) Store collection object with website filter * - * @return \Magento\Core\Model\Resource\Store\Collection + * @return \Magento\Store\Model\Resource\Store\Collection */ public function getStoreCollection() { @@ -517,7 +521,14 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id */ protected function _beforeDelete() { - $this->_configDataResource->clearWebsiteData($this); + $this->_configDataResource->clearScopeData( + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES, + $this->getId() + ); + $this->_configDataResource->clearScopeData( + \Magento\Store\Model\ScopeInterface::SCOPE_STORES, + $this->getStoreIds() + ); return parent::_beforeDelete(); } @@ -541,14 +552,15 @@ class Website extends \Magento\Model\AbstractModel implements \Magento\Object\Id public function getBaseCurrencyCode() { if ($this->getConfig( - \Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE - ) == \Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL + \Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE + ) == \Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL ) { - $currencyCode = $this->_coreConfig - ->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); - + $currencyCode = $this->_coreConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } else { - $currencyCode = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + $currencyCode = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } return $currencyCode; diff --git a/app/code/Magento/Core/Model/Website/Factory.php b/app/code/Magento/Store/Model/Website/Factory.php similarity index 86% rename from app/code/Magento/Core/Model/Website/Factory.php rename to app/code/Magento/Store/Model/Website/Factory.php index 2459a6f5f60c2e4eec6e947277795b16aaa0cf95..51211f78ce18c4c4363c6adf2f1c46fec2d00cf9 100644 --- a/app/code/Magento/Core/Model/Website/Factory.php +++ b/app/code/Magento/Store/Model/Website/Factory.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +25,7 @@ /** * Website factory */ -namespace Magento\Core\Model\Website; +namespace Magento\Store\Model\Website; class Factory { @@ -48,10 +46,10 @@ class Factory /** * @param array $data - * @return \Magento\Core\Model\Website + * @return \Magento\Store\Model\Website */ public function create(array $data = array()) { - return $this->_objectManager->create('Magento\Core\Model\Website', $data); + return $this->_objectManager->create('Magento\Store\Model\Website', $data); } } diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..f46953f868aea5502763e1cd32813c6cfeb1c5cd --- /dev/null +++ b/app/code/Magento/Store/etc/di.xml @@ -0,0 +1,166 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <type name="Magento\Module\Updater\SetupFactory"> + <arguments> + <argument name="resourceTypes" xsi:type="array"> + <item name="store_setup" xsi:type="string">Magento\Core\Model\Resource\Setup</item> + </argument> + </arguments> + </type> + <type name="Magento\Store\Model\Config\Reader\Website"> + <arguments> + <argument name="scopePool" xsi:type="object">Magento\App\Config\ScopePool\Proxy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Config\Reader\Store"> + <arguments> + <argument name="scopePool" xsi:type="object">Magento\App\Config\ScopePool\Proxy</argument> + <argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManagerInterface\Proxy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Resolver\Store"> + <arguments> + <argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManagerInterface\Proxy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Resolver\Website"> + <arguments> + <argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManagerInterface\Proxy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Config\Reader\ReaderPool"> + <arguments> + <argument name="readers" xsi:type="array"> + <item name="default" xsi:type="object">Magento\Store\Model\Config\Reader\DefaultReader</item> + <item name="website" xsi:type="object">Magento\Store\Model\Config\Reader\Website</item> + <item name="websites" xsi:type="object">Magento\Store\Model\Config\Reader\Website</item> + <item name="store" xsi:type="object">Magento\Store\Model\Config\Reader\Store</item> + <item name="stores" xsi:type="object">Magento\Store\Model\Config\Reader\Store</item> + </argument> + </arguments> + </type> + <preference for="Magento\App\Config\Scope\ReaderPoolInterface" type="Magento\Store\Model\Config\Reader\ReaderPool"/> + <preference for="Magento\App\ScopeResolverInterface" type="Magento\Store\Model\Resolver\Store" /> + <type name="Magento\App\Action\Action"> + <plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck" sortOrder="10"/> + </type> + <type name="Magento\App\FrontController"> + <plugin name="dispatchExceptionHandler" type="Magento\Store\App\FrontController\Plugin\DispatchExceptionHandler" sortOrder="30"/> + </type> + <type name="Magento\Store\Model\Resource\Website\Collection"> + <arguments> + <argument name="fetchStrategy" xsi:type="object">Magento\Store\Model\Resource\Website\Collection\FetchStrategy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Resource\Group\Collection"> + <arguments> + <argument name="fetchStrategy" xsi:type="object">Magento\Store\Model\Resource\Group\Collection\FetchStrategy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Resource\Store\Collection"> + <arguments> + <argument name="fetchStrategy" xsi:type="object">Magento\Store\Model\Resource\Store\Collection\FetchStrategy</argument> + </arguments> + </type> + <type name="Magento\Store\Model\Store"> + <arguments> + <argument name="isCustomEntryPoint" xsi:type="init_parameter">Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM</argument> + <argument name="url" xsi:type="object" shared="false">Magento\UrlInterface</argument> + </arguments> + </type> + <type name="Magento\Store\Model\StoreManager"> + <arguments> + <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> + <argument name="helper" xsi:type="object">Magento\Core\Helper\Data\Proxy</argument> + </arguments> + </type> + <virtualType name="Magento\Store\Model\Resource\Group\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> + <arguments> + <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> + <argument name="cacheIdPrefix" xsi:type="string">app_</argument> + <argument name="cacheTags" xsi:type="array"> + <item name="storeTag" xsi:type="const">Magento\Store\Model\Store::CACHE_TAG</item> + </argument> + <argument name="cacheLifetime" xsi:type="boolean">false</argument> + </arguments> + </virtualType> + <virtualType name="Magento\Store\Model\Resource\Store\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> + <arguments> + <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> + <argument name="cacheIdPrefix" xsi:type="string">app_</argument> + <argument name="cacheTags" xsi:type="array"> + <item name="storeTag" xsi:type="const">Magento\Store\Model\Store::CACHE_TAG</item> + </argument> + <argument name="cacheLifetime" xsi:type="boolean">false</argument> + </arguments> + </virtualType> + <virtualType name="Magento\Store\Model\Resource\Website\Collection\FetchStrategy" type="Magento\Data\Collection\Db\FetchStrategy\Cache"> + <arguments> + <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Collection</argument> + <argument name="cacheIdPrefix" xsi:type="string">app_</argument> + <argument name="cacheTags" xsi:type="array"> + <item name="storeTag" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</item> + </argument> + <argument name="cacheLifetime" xsi:type="boolean">false</argument> + </arguments> + </virtualType> + <type name="Magento\Store\Model\Config\Processor\Placeholder"> + <arguments> + <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> + <argument name="urlPaths" xsi:type="array"> + <item name="unsecureBaseUrl" xsi:type="string">web/unsecure/base_url</item> + <item name="secureBaseUrl" xsi:type="string">web/secure/base_url</item> + </argument> + <argument name="urlPlaceholder" xsi:type="string">{{base_url}}</argument> + </arguments> + </type> + <type name="Magento\Module\Output\Config"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Session\Config"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Session\SidResolver"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Session\Validator"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\View\Layout\Element\Layout"> + <arguments> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Rating/etc/adminhtml/di.xml b/app/code/Magento/Store/etc/frontend/di.xml similarity index 84% rename from app/code/Magento/Rating/etc/adminhtml/di.xml rename to app/code/Magento/Store/etc/frontend/di.xml index 294bc914fd7a293c28ba9e6be408ebd74c82e853..d0e389d443ffa1c1c4c8ba664116bae3a79f1c47 100644 --- a/app/code/Magento/Rating/etc/adminhtml/di.xml +++ b/app/code/Magento/Store/etc/frontend/di.xml @@ -24,9 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <type name="Magento\Rating\Block\Adminhtml\Edit\Tab\Form"> - <arguments> - <argument name="session" xsi:type="object">Magento\Backend\Model\Session</argument> - </arguments> + <type name="Magento\App\FrontController"> + <plugin name="requestPreprocessor" type="Magento\Store\App\FrontController\Plugin\RequestPreprocessor" sortOrder="50"/> </type> </config> diff --git a/app/code/Magento/Rating/etc/module.xml b/app/code/Magento/Store/etc/module.xml similarity index 83% rename from app/code/Magento/Rating/etc/module.xml rename to app/code/Magento/Store/etc/module.xml index 409b584826b960976a9b8d34cc50cb7b57bd4a6a..5724adfe8f09e774a821ada77751890af34219b1 100644 --- a/app/code/Magento/Rating/etc/module.xml +++ b/app/code/Magento/Store/etc/module.xml @@ -24,16 +24,14 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> - <module name="Magento_Rating" version="1.6.0.1" active="true"> + <module name="Magento_Store" version="2.0.0.0" active="true"> <sequence> <module name="Magento_Core"/> - <module name="Magento_Review"/> </sequence> <depends> <module name="Magento_Core"/> - <module name="Magento_Review"/> - <module name="Magento_Customer"/> - <module name="Magento_Backend"/> + <module name="Magento_Directory"/> + <module name="Magento_Index"/> </depends> </module> </config> diff --git a/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php b/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php new file mode 100644 index 0000000000000000000000000000000000000000..ca3eb52f92cba18c006a72784a15725184ff31ae --- /dev/null +++ b/app/code/Magento/Store/sql/store_setup/install-2.0.0.0.php @@ -0,0 +1,292 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +use Magento\DB\Ddl\Table; + +/* @var $installer \Magento\Core\Model\Resource\Setup */ +$installer = $this; + +$installer->startSetup(); +$connection = $installer->getConnection(); + +/** + * Create table 'store_website' + */ +$table = $connection->newTable( + $installer->getTable('store_website') +)->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Website Id' +)->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + array(), + 'Code' +)->addColumn( + 'name', + Table::TYPE_TEXT, + 64, + array(), + 'Website Name' +)->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Sort Order' +)->addColumn( + 'default_group_id', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Default Group Id' +)->addColumn( + 'is_default', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'default' => '0'), + 'Defines Is Website Default' +)->addIndex( + $installer->getIdxName('store_website', array('code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + array('code'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('store_website', array('sort_order')), + array('sort_order') +)->addIndex( + $installer->getIdxName('store_website', array('default_group_id')), + array('default_group_id') +)->setComment( + 'Websites' +); +$connection->createTable($table); + +/** + * Create table 'store_group' + */ +$table = $connection->newTable( + $installer->getTable('store_group') +)->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Group Id' +)->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Website Id' +)->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + array('nullable' => false), + 'Store Group Name' +)->addColumn( + 'root_category_id', + Table::TYPE_INTEGER, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Root Category Id' +)->addColumn( + 'default_store_id', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Default Store Id' +)->addIndex( + $installer->getIdxName('store_group', array('website_id')), + array('website_id') +)->addIndex( + $installer->getIdxName('store_group', array('default_store_id')), + array('default_store_id') +)->addForeignKey( + $installer->getFkName('store_group', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE +)->setComment( + 'Store Groups' +); +$connection->createTable($table); + +/** + * Create table 'store' + */ +$table = $connection->newTable( + $installer->getTable('store') +)->addColumn( + 'store_id', + Table::TYPE_SMALLINT, + null, + array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), + 'Store Id' +)->addColumn( + 'code', + Table::TYPE_TEXT, + 32, + array(), + 'Code' +)->addColumn( + 'website_id', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Website Id' +)->addColumn( + 'group_id', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Group Id' +)->addColumn( + 'name', + Table::TYPE_TEXT, + 255, + array('nullable' => false), + 'Store Name' +)->addColumn( + 'sort_order', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store Sort Order' +)->addColumn( + 'is_active', + Table::TYPE_SMALLINT, + null, + array('unsigned' => true, 'nullable' => false, 'default' => '0'), + 'Store Activity' +)->addIndex( + $installer->getIdxName('store', array('code'), \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), + array('code'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) +)->addIndex( + $installer->getIdxName('store', array('website_id')), + array('website_id') +)->addIndex( + $installer->getIdxName('store', array('is_active', 'sort_order')), + array('is_active', 'sort_order') +)->addIndex( + $installer->getIdxName('store', array('group_id')), + array('group_id') +)->addForeignKey( + $installer->getFkName('store', 'group_id', 'store_group', 'group_id'), + 'group_id', + $installer->getTable('store_group'), + 'group_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE +)->addForeignKey( + $installer->getFkName('store', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + Table::ACTION_CASCADE, + Table::ACTION_CASCADE +)->setComment( + 'Stores' +); +$connection->createTable($table); + +/** + * Insert websites + */ +$connection->insertForce( + $installer->getTable('store_website'), + array( + 'website_id' => 0, + 'code' => 'admin', + 'name' => 'Admin', + 'sort_order' => 0, + 'default_group_id' => 0, + 'is_default' => 0 + ) +); +$connection->insertForce( + $installer->getTable('store_website'), + array( + 'website_id' => 1, + 'code' => 'base', + 'name' => 'Main Website', + 'sort_order' => 0, + 'default_group_id' => 1, + 'is_default' => 1 + ) +); + +/** + * Insert store groups + */ +$connection->insertForce( + $installer->getTable('store_group'), + array('group_id' => 0, 'website_id' => 0, 'name' => 'Default', 'root_category_id' => 0, 'default_store_id' => 0) +); +$connection->insertForce( + $installer->getTable('store_group'), + array( + 'group_id' => 1, + 'website_id' => 1, + 'name' => 'Main Website Store', + 'root_category_id' => 2, + 'default_store_id' => 1 + ) +); + +/** + * Insert stores + */ +$connection->insertForce( + $installer->getTable('store'), + array( + 'store_id' => 0, + 'code' => 'admin', + 'website_id' => 0, + 'group_id' => 0, + 'name' => 'Admin', + 'sort_order' => 0, + 'is_active' => 1 + ) +); +$connection->insertForce( + $installer->getTable('store'), + array( + 'store_id' => 1, + 'code' => 'default', + 'website_id' => 1, + 'group_id' => 1, + 'name' => 'Default Store View', + 'sort_order' => 0, + 'is_active' => 1 + ) +); + +$installer->endSetup(); diff --git a/app/code/Magento/Core/view/frontend/switch/flags.phtml b/app/code/Magento/Store/view/frontend/switch/flags.phtml similarity index 97% rename from app/code/Magento/Core/view/frontend/switch/flags.phtml rename to app/code/Magento/Store/view/frontend/switch/flags.phtml index 36bdb5dadad4ec52cd08ad1bda3c33835d94d0a2..fc1be6c851c024741d179b959e51ce02094c4ee9 100644 --- a/app/code/Magento/Core/view/frontend/switch/flags.phtml +++ b/app/code/Magento/Store/view/frontend/switch/flags.phtml @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category design - * @package base_default * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Core/view/frontend/switch/languages.phtml b/app/code/Magento/Store/view/frontend/switch/languages.phtml similarity index 98% rename from app/code/Magento/Core/view/frontend/switch/languages.phtml rename to app/code/Magento/Store/view/frontend/switch/languages.phtml index bbb39b88eaf16674a56bdc89bde62ce085c68c70..11fcea25546ec6f0f74e04f5556786232425f4dc 100644 --- a/app/code/Magento/Core/view/frontend/switch/languages.phtml +++ b/app/code/Magento/Store/view/frontend/switch/languages.phtml @@ -18,7 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category design * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ diff --git a/app/code/Magento/Core/view/frontend/switch/stores.phtml b/app/code/Magento/Store/view/frontend/switch/stores.phtml similarity index 96% rename from app/code/Magento/Core/view/frontend/switch/stores.phtml rename to app/code/Magento/Store/view/frontend/switch/stores.phtml index 0f9821d5499455c1116b13cef4a5c3ac78931fa4..44131d6f85f61559348dbe89f8aef2645023cea6 100644 --- a/app/code/Magento/Core/view/frontend/switch/stores.phtml +++ b/app/code/Magento/Store/view/frontend/switch/stores.phtml @@ -18,7 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category design * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -27,7 +26,7 @@ /** * Store switcher template * - * @see \Magento\Core\Block\Store\Switcher + * @see \Magento\Store\Block\Store\Switcher */ ?> <?php if(count($this->getGroups())>1): ?> diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php index 032ed742b6e10be5940a1ee197c19ee97352afae..187ece280bd52e476fcfbf40545d167aca5ccf64 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php @@ -135,13 +135,19 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic if (!$rateObject->hasTaxCountryId()) { $rateObject->setTaxCountryId( - $this->_storeConfig->getConfig(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY) + $this->_scopeConfig->getValue( + \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); } if (!$rateObject->hasTaxRegionId()) { $rateObject->setTaxRegionId( - $this->_storeConfig->getConfig(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION) + $this->_scopeConfig->getValue( + \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); } @@ -187,7 +193,10 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic if (!$rateObject->hasTaxPostcode()) { $rateObject->setTaxPostcode( - $this->_storeConfig->getConfig(\Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_POSTCODE) + $this->_scopeConfig->getValue( + \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); } diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title.php index a727335f1c1c8d7ae57ef048232e63ecec5ef16d..feda6064f0580ae9e6b5e88173a5c8e17526904a 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title.php @@ -50,19 +50,19 @@ class Title extends \Magento\View\Element\Template protected $_rate; /** - * @var \Magento\Core\Model\StoreFactory + * @var \Magento\Store\Model\StoreFactory */ protected $_storeFactory; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Core\Model\StoreFactory $storeFactory + * @param \Magento\Store\Model\StoreFactory $storeFactory * @param \Magento\Tax\Model\Calculation\Rate $rate * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Core\Model\StoreFactory $storeFactory, + \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Tax\Model\Calculation\Rate $rate, array $data = array() ) { diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php index b3f4235804ef4547df0949f02bbae3ce49356e8e..e1efb9cc9d783096ece8adfcaa0874c0a88c2f9c 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Add.php @@ -45,13 +45,13 @@ class Add extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'addButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Add New Tax Rate'), 'onclick' => 'window.location.href=\'' . $this->getUrl('tax/rate/add') . '\'', - 'class' => 'add' + 'class' => 'add primary add-tax-rate' ) ); return parent::_prepareLayout(); diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php index 44743e81f2dc02f8e456441884215ae9df745484..0a4d6a09764deb1ff947a629c9ea8a9f2cccb7f6 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Toolbar/Save.php @@ -54,7 +54,7 @@ class Save extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'backButton', 'Magento\Backend\Block\Widget\Button', array( @@ -64,72 +64,42 @@ class Save extends \Magento\Backend\Block\Template ) ); - $this->addChild( + $this->getToolbar()->addChild( 'resetButton', 'Magento\Backend\Block\Widget\Button', - array('label' => __('Reset'), 'onclick' => 'window.location.reload()') + array('label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset') ); - $this->addChild( - 'saveButton', - 'Magento\Backend\Block\Widget\Button', - array('label' => __('Save Rate'), 'class' => 'save') - ); + $rate = intval($this->getRequest()->getParam('rate')); + if ($rate) { + $this->getToolbar()->addChild( + 'deleteButton', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Delete Rate'), + 'onclick' => 'deleteConfirm(\'' . __( + 'Are you sure you want to do this?' + ) . '\', \'' . $this->getUrl( + 'tax/*/delete', + array('rate' => $rate) + ) . '\')', + 'class' => 'delete' + ) + ); + } - $this->addChild( - 'deleteButton', + $this->getToolbar()->addChild( + 'saveButton', 'Magento\Backend\Block\Widget\Button', array( - 'label' => __('Delete Rate'), - 'onclick' => 'deleteConfirm(\'' . __( - 'Are you sure you want to do this?' - ) . '\', \'' . $this->getUrl( - 'tax/*/delete', - array('rate' => $this->getRequest()->getParam('rate')) - ) . '\')', - 'class' => 'delete' + 'label' => __('Save Rate'), + 'class' => 'save primary save-rate', + 'data_attribute' => array( + 'mage-init' => array('button' => array('event' => 'save', 'target' => '#rate-form')) + ) ) ); - return parent::_prepareLayout(); - } - - /** - * @return string - */ - public function getBackButtonHtml() - { - return $this->getChildHtml('backButton'); - } - - /** - * @return string - */ - public function getResetButtonHtml() - { - return $this->getChildHtml('resetButton'); - } - - /** - * @return string - */ - public function getSaveButtonHtml() - { - $formId = $this->getLayout()->getBlock('tax_rate_form')->getDestElementId(); - $button = $this->getChildBlock('saveButton'); - $button->setDataAttribute( - array('mage-init' => array('button' => array('event' => 'save', 'target' => '#' . $formId))) - ); - return $this->getChildHtml('saveButton'); - } - /** - * @return string|void - */ - public function getDeleteButtonHtml() - { - if (intval($this->getRequest()->getParam('rate')) == 0) { - return; - } - return $this->getChildHtml('deleteButton'); + return parent::_prepareLayout(); } } diff --git a/app/code/Magento/Tax/Block/Sales/Order/Tax.php b/app/code/Magento/Tax/Block/Sales/Order/Tax.php index adda8a5429d22208506b3fb87ad59d6f39a0f0c9..6ff9799b179398c752d2c817d9a0174809892eac 100644 --- a/app/code/Magento/Tax/Block/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Block/Sales/Order/Tax.php @@ -126,7 +126,7 @@ class Tax extends \Magento\View\Element\Template /** * Get order store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php index c44192a20cbd10f5fda4254fe6bcf6c926fd8047..bddcf561cfb7f462513bceb45bc0733fa6ab06a4 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php @@ -447,7 +447,7 @@ class Rate extends \Magento\Backend\App\Action $taxCalculationRateTitleDict = array(); foreach ($this->_objectManager->create( - 'Magento\Core\Model\Store' + 'Magento\Store\Model\Store' )->getCollection()->setLoadDefault( false ) as $store) { diff --git a/app/code/Magento/Tax/Helper/Data.php b/app/code/Magento/Tax/Helper/Data.php index 58fa7fe485f5b1384cb583bd6ef864617b742c2b..b62851c985bcf1bb583cab813ae3acb506fec0d7 100644 --- a/app/code/Magento/Tax/Helper/Data.php +++ b/app/code/Magento/Tax/Helper/Data.php @@ -25,7 +25,7 @@ */ namespace Magento\Tax\Helper; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Customer\Model\Address; /** @@ -112,12 +112,12 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -145,10 +145,10 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Model\Calculation $calculation - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory $taxItemFactory @@ -158,17 +158,17 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\App\Helper\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Registry $coreRegistry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Model\Calculation $calculation, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Locale\FormatInterface $localeFormat, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, \Magento\Tax\Model\Resource\Sales\Order\Tax\ItemFactory $taxItemFactory, \Magento\Locale\ResolverInterface $localeResolver ) { parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_config = $taxConfig; $this->_coreData = $coreData; $this->_coreRegistry = $coreRegistry; @@ -871,7 +871,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getTaxBasedOn($store = null) { - return $this->_coreStoreConfig->getConfig(\Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON, $store); + return $this->_scopeConfig->getValue( + \Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -882,8 +886,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function applyTaxOnCustomPrice($store = null) { - return (int)$this->_coreStoreConfig->getConfig( + return (int)$this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_APPLY_ON, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == 0; } @@ -896,8 +901,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function applyTaxOnOriginalPrice($store = null) { - return (int)$this->_coreStoreConfig->getConfig( + return (int)$this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_APPLY_ON, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == 1; } @@ -1047,7 +1053,10 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getDefaultCustomerTaxClass() { - return $this->_coreStoreConfig->getConfig(self::CONFIG_DEFAULT_CUSTOMER_TAX_CLASS); + return $this->_scopeConfig->getValue( + self::CONFIG_DEFAULT_CUSTOMER_TAX_CLASS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -1057,6 +1066,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getDefaultProductTaxClass() { - return $this->_coreStoreConfig->getConfig(self::CONFIG_DEFAULT_PRODUCT_TAX_CLASS); + return $this->_scopeConfig->getValue( + self::CONFIG_DEFAULT_PRODUCT_TAX_CLASS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index 81df6986bf783109d07c1f39384c100c2afa8783..3471e4c8a2420e298d82f8a957dfc1873e05be88 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -23,7 +23,7 @@ */ namespace Magento\Tax\Model; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Customer\Service\V1\Data\Customer as CustomerDataObject; use Magento\Customer\Service\V1\Data\CustomerBuilder; use Magento\Customer\Service\V1\Data\Region as RegionDataObject; @@ -88,12 +88,12 @@ class Calculation extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -135,8 +135,8 @@ class Calculation extends \Magento\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\GroupFactory $groupFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\CustomerFactory $customerFactory @@ -152,8 +152,8 @@ class Calculation extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\GroupFactory $groupFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\CustomerFactory $customerFactory, @@ -166,7 +166,7 @@ class Calculation extends \Magento\Model\AbstractModel \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_groupFactory = $groupFactory; $this->_customerSession = $customerSession; @@ -424,11 +424,23 @@ class Calculation extends \Magento\Model\AbstractModel { $request = new \Magento\Object(); $request->setCountryId( - $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Config::XML_PATH_ORIGIN_COUNTRY_ID, $store) + $this->_scopeConfig->getValue( + \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) )->setRegionId( - $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Config::XML_PATH_ORIGIN_REGION_ID, $store) + $this->_scopeConfig->getValue( + \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_REGION_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) )->setPostcode( - $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Config::XML_PATH_ORIGIN_POSTCODE, $store) + $this->_scopeConfig->getValue( + \Magento\Shipping\Model\Config::XML_PATH_ORIGIN_POSTCODE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) )->setCustomerClassId( $this->getDefaultCustomerTaxClass($store) )->setStore( @@ -464,7 +476,11 @@ class Calculation extends \Magento\Model\AbstractModel } $address = new \Magento\Object(); $customerData = $this->getCustomerData(); - $basedOn = $this->_coreStoreConfig->getConfig(\Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON, $store); + $basedOn = $this->_scopeConfig->getValue( + \Magento\Tax\Model\Config::CONFIG_XML_PATH_BASED_ON, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); if ($shippingAddress === false && $basedOn == 'shipping' || $billingAddress === false && $basedOn == 'billing' ) { @@ -480,13 +496,11 @@ class Calculation extends \Magento\Model\AbstractModel try { $defaultBilling = $this->_addressService->getDefaultBillingAddress($customerData->getId()); } catch (NoSuchEntityException $e) { - /** Address does not exist */ } try { $defaultShipping = $this->_addressService->getDefaultShippingAddress($customerData->getId()); } catch (NoSuchEntityException $e) { - /** Address does not exist */ } if ($basedOn == 'billing' && $defaultBilling && $defaultBilling->getCountryId()) { @@ -514,18 +528,21 @@ class Calculation extends \Magento\Model\AbstractModel break; case 'default': $address->setCountryId( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) )->setRegionId( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) )->setPostcode( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) ); diff --git a/app/code/Magento/Tax/Model/Config.php b/app/code/Magento/Tax/Model/Config.php index fc1e72d3b4c4858104c99ec6358dafad957e2fd0..08ee1e830505cc972ce2dbb734ca16a00856c562 100644 --- a/app/code/Magento/Tax/Model/Config.php +++ b/app/code/Magento/Tax/Model/Config.php @@ -33,7 +33,7 @@ */ namespace Magento\Tax\Model; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; class Config { @@ -131,16 +131,16 @@ class Config /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig) + public function __construct(\Magento\App\Config\ScopeConfigInterface $scopeConfig) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; } /** @@ -154,7 +154,11 @@ class Config if (null !== $this->_priceIncludesTax) { return $this->_priceIncludesTax; } - return (bool)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $store); + return (bool)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -181,7 +185,11 @@ class Config */ public function applyTaxAfterDiscount($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $store); + return (bool)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -195,7 +203,11 @@ class Config */ public function getPriceDisplayType($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, $store); + return (int)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -206,7 +218,11 @@ class Config */ public function discountTax($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_DISCOUNT_TAX, $store) == 1; + return (int)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_DISCOUNT_TAX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ) == 1; } /** @@ -264,7 +280,11 @@ class Config */ public function getAlgorithm($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_ALGORITHM, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_ALGORITHM, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -275,7 +295,11 @@ class Config */ public function getShippingTaxClass($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $store); + return (int)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -286,7 +310,11 @@ class Config */ public function getShippingPriceDisplayType($store = null) { - return (int)$this->_coreStoreConfig->getConfig(self::CONFIG_XML_PATH_DISPLAY_SHIPPING, $store); + return (int)$this->_scopeConfig->getValue( + self::CONFIG_XML_PATH_DISPLAY_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -298,8 +326,9 @@ class Config public function shippingPriceIncludesTax($store = null) { if ($this->_shippingPriceIncludeTax === null) { - $this->_shippingPriceIncludeTax = (bool)$this->_coreStoreConfig->getConfig( + $this->_shippingPriceIncludeTax = (bool)$this->_scopeConfig->getValue( self::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ); } @@ -324,8 +353,9 @@ class Config */ public function displayCartPricesInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -336,8 +366,9 @@ class Config */ public function displayCartPricesExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -348,8 +379,9 @@ class Config */ public function displayCartPricesBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -360,8 +392,9 @@ class Config */ public function displayCartSubtotalInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -372,8 +405,9 @@ class Config */ public function displayCartSubtotalExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -384,8 +418,9 @@ class Config */ public function displayCartSubtotalBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -396,8 +431,9 @@ class Config */ public function displayCartShippingInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -408,8 +444,9 @@ class Config */ public function displayCartShippingExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -420,8 +457,9 @@ class Config */ public function displayCartShippingBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -432,8 +470,9 @@ class Config */ public function displayCartDiscountInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -444,8 +483,9 @@ class Config */ public function displayCartDiscountExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -456,8 +496,9 @@ class Config */ public function displayCartDiscountBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_CART_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -468,7 +509,11 @@ class Config */ public function displayCartTaxWithGrandTotal($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_CART_GRANDTOTAL, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_CART_GRANDTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -477,7 +522,11 @@ class Config */ public function displayCartFullSummary($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_CART_FULL_SUMMARY, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_CART_FULL_SUMMARY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -486,7 +535,11 @@ class Config */ public function displayCartZeroTax($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_CART_ZERO_TAX, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_CART_ZERO_TAX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -495,8 +548,9 @@ class Config */ public function displaySalesPricesInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -507,8 +561,9 @@ class Config */ public function displaySalesPricesExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -519,8 +574,9 @@ class Config */ public function displaySalesPricesBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_PRICE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -531,8 +587,9 @@ class Config */ public function displaySalesSubtotalInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -543,8 +600,9 @@ class Config */ public function displaySalesSubtotalExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -555,8 +613,9 @@ class Config */ public function displaySalesSubtotalBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SUBTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -567,8 +626,9 @@ class Config */ public function displaySalesShippingInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -579,8 +639,9 @@ class Config */ public function displaySalesShippingExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -591,8 +652,9 @@ class Config */ public function displaySalesShippingBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_SHIPPING, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -603,8 +665,9 @@ class Config */ public function displaySalesDiscountInclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_INCLUDING_TAX; } @@ -615,8 +678,9 @@ class Config */ public function displaySalestDiscountExclTax($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_EXCLUDING_TAX; } @@ -627,8 +691,9 @@ class Config */ public function displaySalesDiscountBoth($store = null) { - return $this->_coreStoreConfig->getConfig( + return $this->_scopeConfig->getValue( self::XML_PATH_DISPLAY_SALES_DISCOUNT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store ) == self::DISPLAY_TYPE_BOTH; } @@ -639,7 +704,11 @@ class Config */ public function displaySalesTaxWithGrandTotal($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_SALES_GRANDTOTAL, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_SALES_GRANDTOTAL, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -648,7 +717,11 @@ class Config */ public function displaySalesFullSummary($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_SALES_FULL_SUMMARY, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_SALES_FULL_SUMMARY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -657,6 +730,10 @@ class Config */ public function displaySalesZeroTax($store = null) { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_DISPLAY_SALES_ZERO_TAX, $store); + return (bool)$this->_scopeConfig->getValue( + self::XML_PATH_DISPLAY_SALES_ZERO_TAX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } } diff --git a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php index ccc51315ddfe36ace32649951a02c73b64cf7504..9e7443dacf2419958aa8d81815099a1f0862ef83 100644 --- a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php +++ b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php @@ -25,7 +25,7 @@ */ namespace Magento\Tax\Model\Config\Price; -class IncludePrice extends \Magento\Core\Model\Config\Value +class IncludePrice extends \Magento\App\Config\Value { /** * @return void diff --git a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php index 95b4df47ab0597052a5fe571c57f9d76bad8fd07..57d2916219ee8536895a9a29f9e9aa28b369765e 100644 --- a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php +++ b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php @@ -34,7 +34,7 @@ class CsvImportHandler /** * Collection of publicly available stores * - * @var \Magento\Core\Model\Resource\Store\Collection + * @var \Magento\Store\Model\Resource\Store\Collection */ protected $_publicStores; @@ -62,13 +62,13 @@ class CsvImportHandler protected $_taxRateFactory; /** - * @param \Magento\Core\Model\Resource\Store\Collection $storeCollection + * @param \Magento\Store\Model\Resource\Store\Collection $storeCollection * @param \Magento\Directory\Model\Resource\Region\Collection $regionCollection * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Tax\Model\Calculation\RateFactory $taxRateFactory */ public function __construct( - \Magento\Core\Model\Resource\Store\Collection $storeCollection, + \Magento\Store\Model\Resource\Store\Collection $storeCollection, \Magento\Directory\Model\Resource\Region\Collection $regionCollection, \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Tax\Model\Calculation\RateFactory $taxRateFactory diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index f8bc44628f8b7e5261c7420112aa94d9dff1edcc..b3f6df0759f574ec00dd2a2c9dee50f6161a8f7a 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -54,19 +54,19 @@ class Calculation extends \Magento\Model\Resource\Db\AbstractDb protected $_taxData; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, \Magento\Tax\Helper\Data $taxData, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_taxData = $taxData; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php index a0f99155e937cc1819c6914e9c54fade9ad637c4..08a7f5ef6e0b4fbe76c5fa47fa4edda9a39f48da 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php @@ -33,7 +33,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rate; class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -42,7 +42,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -51,7 +51,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { @@ -103,7 +103,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Join rate title for specified store * - * @param \Magento\Core\Model\Store|string|int $store + * @param \Magento\Store\Model\Store|string|int $store * @return $this */ public function joinTitle($store = null) diff --git a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php index 2d2e4bc3345ca3583493faa9093fa471194b92dd..7a4a01ab7a06d70a7716804089485144fcbe74a2 100644 --- a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php +++ b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php @@ -139,7 +139,7 @@ class Createdat extends \Magento\Reports\Model\Resource\Report\AbstractReport $columns = array( 'period' => 'period', - 'store_id' => new \Zend_Db_Expr(\Magento\Core\Model\Store::DEFAULT_STORE_ID), + 'store_id' => new \Zend_Db_Expr(\Magento\Store\Model\Store::DEFAULT_STORE_ID), 'code' => 'code', 'order_status' => 'order_status', 'percent' => 'MAX(' . $writeAdapter->quoteIdentifier('percent') . ')', diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php index d10e88166ce45c81bf965338f0f8c5f197788460..76c86c34f0b95c3588bc1365c473ef46821e856d 100644 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ b/app/code/Magento/Tax/Model/Resource/Setup.php @@ -45,7 +45,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup * @param string $resourceName * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Resource\SetupFactory $setupFactory * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param string $moduleName @@ -56,11 +56,11 @@ class Setup extends \Magento\Sales\Model\Resource\Setup $resourceName, \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Resource\SetupFactory $setupFactory, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, $moduleName = 'Magento_Tax', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_setupFactory = $setupFactory; $this->productTypeConfig = $productTypeConfig; diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Nominal/Tax.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Nominal/Tax.php index b4812a1e8e4773cdc210291c1e2f982b985f5304..8e86e19be0a29166e16b8ddb4f5098c5532fcfe4 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Nominal/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Nominal/Tax.php @@ -73,7 +73,7 @@ class Tax extends \Magento\Tax\Model\Sales\Total\Quote\Tax * This method can be used for changing totals collect sort order * * @param array $config - * @param int|string|\Magento\Core\Model\Store $store + * @param int|string|\Magento\Store\Model\Store $store * @return array */ public function processConfigArray($config, $store) diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php index 00f37e3c042080c4130134c31402a6a32b7e6c49..ffdac16ad26517bef06fb21c5bbdae2200629273 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal.php @@ -91,7 +91,7 @@ class Subtotal extends \Magento\Sales\Model\Quote\Address\Total\AbstractTotal /** * Quote store * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; diff --git a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php index 06b8dda306e5ae48d49fc18f7b9a87c541cac862..92ecaae693e1eaf0cca27ff6df544b6b54017f5c 100644 --- a/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Total/Quote/Tax.php @@ -25,7 +25,7 @@ */ namespace Magento\Tax\Model\Sales\Total\Quote; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; use Magento\Sales\Model\Quote\Address; use Magento\Sales\Model\Quote\Address\Total\AbstractTotal; use Magento\Sales\Model\Quote\Item\AbstractItem; diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php index da60eae3646d9f262db3819f4f73163a88717302..72dc25b1b79ca91dbd5e163c90c86bc5698ad451 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php @@ -41,7 +41,7 @@ class Customer extends \Magento\Tax\Model\TaxClass\AbstractType protected $groupService; /** - * @var \Magento\Customer\Service\V1\Data\FilterBuilder + * @var \Magento\Service\V1\Data\FilterBuilder */ protected $filterBuilder; @@ -61,7 +61,7 @@ class Customer extends \Magento\Tax\Model\TaxClass\AbstractType * @param \Magento\Tax\Model\Calculation\Rule $calculationRule * @param \Magento\Customer\Model\Group $modelCustomerGroup * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService - * @param \Magento\Customer\Service\V1\Data\FilterBuilder $filterBuilder + * @param \Magento\Service\V1\Data\FilterBuilder $filterBuilder * @param \Magento\Customer\Service\V1\Data\SearchCriteriaBuilder $searchCriteriaBuilder * @param array $data */ @@ -69,7 +69,7 @@ class Customer extends \Magento\Tax\Model\TaxClass\AbstractType \Magento\Tax\Model\Calculation\Rule $calculationRule, \Magento\Customer\Model\Group $modelCustomerGroup, \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService, - \Magento\Customer\Service\V1\Data\FilterBuilder $filterBuilder, + \Magento\Service\V1\Data\FilterBuilder $filterBuilder, \Magento\Customer\Service\V1\Data\SearchCriteriaBuilder $searchCriteriaBuilder, array $data = array() ) { diff --git a/app/code/Magento/Tax/etc/module.xml b/app/code/Magento/Tax/etc/module.xml index 598bda7498236e997c296e42b9af8a391d5c67a4..39164ff433b6e33aa8a59d4fb5da12db2a241cfb 100644 --- a/app/code/Magento/Tax/etc/module.xml +++ b/app/code/Magento/Tax/etc/module.xml @@ -31,6 +31,7 @@ <module name="Magento_User"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Customer"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php b/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php index a70ad75a6292bea4a8aa711a8db34793c8e2e3a7..8707151bbfe3c640dad61e8fd0692df0893cdbe8 100644 --- a/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php +++ b/app/code/Magento/Tax/sql/tax_setup/install-1.6.0.0.php @@ -305,9 +305,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('tax_calculation_rate_title', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('tax_calculation_rate_title', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('tax_calculation_rate_title', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -393,9 +393,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('tax_order_aggregated_created', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('tax_order_aggregated_created', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('tax_order_aggregated_created', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Tax/view/adminhtml/toolbar/rate/add.phtml b/app/code/Magento/Tax/view/adminhtml/toolbar/rate/add.phtml index e7d66bcb04b3fdc499c9c895bc71a0f865b0fc8b..03ab11d552c1f6e55aa0fb7efb73bd57b179549b 100644 --- a/app/code/Magento/Tax/view/adminhtml/toolbar/rate/add.phtml +++ b/app/code/Magento/Tax/view/adminhtml/toolbar/rate/add.phtml @@ -24,5 +24,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"><?php echo $this->getChildHtml('addButton') ?></div> <?php echo $this->getChildhtml('grid') ?> \ No newline at end of file diff --git a/app/code/Magento/Tax/view/adminhtml/toolbar/rate/save.phtml b/app/code/Magento/Tax/view/adminhtml/toolbar/rate/save.phtml index 465897f7ce5e49ea123234be4a7e8a68d63d122a..fa039a15a05eb17528ffad3e620428bfc57e4c6a 100644 --- a/app/code/Magento/Tax/view/adminhtml/toolbar/rate/save.phtml +++ b/app/code/Magento/Tax/view/adminhtml/toolbar/rate/save.phtml @@ -24,12 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml(); ?> - <?php echo $this->getResetButtonHtml(); ?> - <?php echo $this->getDeleteButtonHtml(); ?> - <?php echo $this->getSaveButtonHtml(); ?> -</div> <?php if( $form ): ?> <?php echo $form->toHtml();?> diff --git a/app/code/Magento/Theme/Block/Html.php b/app/code/Magento/Theme/Block/Html.php index 62b777c1b21dcbb9b24ecaf3e10998c7194410ed..6ba63e402a8654d65585d22be0c331d88b36cfb6 100644 --- a/app/code/Magento/Theme/Block/Html.php +++ b/app/code/Magento/Theme/Block/Html.php @@ -120,14 +120,20 @@ class Html extends \Magento\View\Element\Template public function getPrintLogoUrl() { // load html logo - $logo = $this->_storeConfig->getConfig('sales/identity/logo_html'); + $logo = $this->_scopeConfig->getValue( + 'sales/identity/logo_html', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!empty($logo)) { $logo = 'sales/store/logo_html/' . $logo; } // load default logo if (empty($logo)) { - $logo = $this->_storeConfig->getConfig('sales/identity/logo'); + $logo = $this->_scopeConfig->getValue( + 'sales/identity/logo', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if (!empty($logo)) { // prevent tiff format displaying in html if (strtolower(substr($logo, -5)) === '.tiff' || strtolower(substr($logo, -4)) === '.tif') { @@ -155,7 +161,10 @@ class Html extends \Magento\View\Element\Template */ public function getPrintLogoText() { - return $this->_storeConfig->getConfig('sales/identity/address'); + return $this->_scopeConfig->getValue( + 'sales/identity/address', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -223,7 +232,10 @@ class Html extends \Magento\View\Element\Template */ public function getAbsoluteFooter() { - return $this->_storeConfig->getConfig('design/footer/absolute_footer'); + return $this->_scopeConfig->getValue( + 'design/footer/absolute_footer', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Theme/Block/Html/Footer.php b/app/code/Magento/Theme/Block/Html/Footer.php index 50da11ef8c8b199340d3d3c13292ed778c317971..2802dc5b08cc81bf2bb5eb6ab07b03861cacff77 100644 --- a/app/code/Magento/Theme/Block/Html/Footer.php +++ b/app/code/Magento/Theme/Block/Html/Footer.php @@ -64,7 +64,7 @@ class Footer extends \Magento\View\Element\Template implements \Magento\View\Blo $this->addData( array( 'cache_lifetime' => false, - 'cache_tags' => array(\Magento\Core\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG) + 'cache_tags' => array(\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG) ) ); } @@ -93,7 +93,10 @@ class Footer extends \Magento\View\Element\Template implements \Magento\View\Blo public function getCopyright() { if (!$this->_copyright) { - $this->_copyright = $this->_storeConfig->getConfig('design/footer/copyright'); + $this->_copyright = $this->_scopeConfig->getValue( + 'design/footer/copyright', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_copyright; } @@ -105,6 +108,6 @@ class Footer extends \Magento\View\Element\Template implements \Magento\View\Blo */ public function getIdentities() { - return array(\Magento\Core\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); + return array(\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG); } } diff --git a/app/code/Magento/Theme/Block/Html/Head.php b/app/code/Magento/Theme/Block/Html/Head.php index 7c7ba551b9126c4ce98b01fe6441e27b6193150d..7b1a360b6e2e4fa72eaa463fda4ffa41ba707a9e 100644 --- a/app/code/Magento/Theme/Block/Html/Head.php +++ b/app/code/Magento/Theme/Block/Html/Head.php @@ -25,7 +25,6 @@ namespace Magento\Theme\Block\Html; /** * Html page head block - * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Head extends \Magento\View\Element\Template @@ -253,7 +252,10 @@ class Head extends \Magento\View\Element\Template public function getMediaType() { if (empty($this->_data['media_type'])) { - $this->_data['media_type'] = $this->_storeConfig->getConfig('design/head/default_media_type'); + $this->_data['media_type'] = $this->_scopeConfig->getValue( + 'design/head/default_media_type', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['media_type']; } @@ -266,7 +268,10 @@ class Head extends \Magento\View\Element\Template public function getCharset() { if (empty($this->_data['charset'])) { - $this->_data['charset'] = $this->_storeConfig->getConfig('design/head/default_charset'); + $this->_data['charset'] = $this->_scopeConfig->getValue( + 'design/head/default_charset', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['charset']; } @@ -286,10 +291,12 @@ class Head extends \Magento\View\Element\Template $this->_pureTitle = $title; } - $this->_data['title'] = $this->_storeConfig->getConfig( - 'design/head/title_prefix' - ) . ' ' . $title . ' ' . $this->_storeConfig->getConfig( - 'design/head/title_suffix' + $this->_data['title'] = $this->_scopeConfig->getValue( + 'design/head/title_prefix', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) . ' ' . $title . ' ' . $this->_scopeConfig->getValue( + 'design/head/title_suffix', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); return $this; @@ -329,7 +336,10 @@ class Head extends \Magento\View\Element\Template */ public function getDefaultTitle() { - return $this->_storeConfig->getConfig('design/head/default_title'); + return $this->_scopeConfig->getValue( + 'design/head/default_title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -340,7 +350,10 @@ class Head extends \Magento\View\Element\Template public function getDescription() { if (empty($this->_data['description'])) { - $this->_data['description'] = $this->_storeConfig->getConfig('design/head/default_description'); + $this->_data['description'] = $this->_scopeConfig->getValue( + 'design/head/default_description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['description']; } @@ -353,7 +366,10 @@ class Head extends \Magento\View\Element\Template public function getKeywords() { if (empty($this->_data['keywords'])) { - $this->_data['keywords'] = $this->_storeConfig->getConfig('design/head/default_keywords'); + $this->_data['keywords'] = $this->_scopeConfig->getValue( + 'design/head/default_keywords', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['keywords']; } @@ -366,7 +382,10 @@ class Head extends \Magento\View\Element\Template public function getRobots() { if (empty($this->_data['robots'])) { - $this->_data['robots'] = $this->_storeConfig->getConfig('design/search_engine_robots/default_robots'); + $this->_data['robots'] = $this->_scopeConfig->getValue( + 'design/search_engine_robots/default_robots', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['robots']; } @@ -379,7 +398,10 @@ class Head extends \Magento\View\Element\Template public function getIncludes() { if (empty($this->_data['includes'])) { - $this->_data['includes'] = $this->_storeConfig->getConfig('design/head/includes'); + $this->_data['includes'] = $this->_scopeConfig->getValue( + 'design/head/includes', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['includes']; } @@ -405,11 +427,14 @@ class Head extends \Magento\View\Element\Template protected function _getFaviconFile() { $folderName = \Magento\Backend\Model\Config\Backend\Image\Favicon::UPLOAD_DIR; - $storeConfig = $this->_storeConfig->getConfig('design/head/shortcut_icon'); - $path = $folderName . '/' . $storeConfig; + $scopeConfig = $this->_scopeConfig->getValue( + 'design/head/shortcut_icon', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $path = $folderName . '/' . $scopeConfig; $faviconFile = $this->_storeManager->getStore()->getBaseUrl(\Magento\UrlInterface::URL_TYPE_MEDIA) . $path; - if (!is_null($storeConfig) && $this->_isFile($path)) { + if (!is_null($scopeConfig) && $this->_isFile($path)) { $url = $faviconFile; } else { $url = $this->getViewFileUrl('Magento_Theme::favicon.ico'); diff --git a/app/code/Magento/Theme/Block/Html/Header.php b/app/code/Magento/Theme/Block/Html/Header.php index fc97cc92a4d1ce328fafcd304ab709e9567c772d..ccba737c558c55904fc47f87c7b025bc224f1fa6 100644 --- a/app/code/Magento/Theme/Block/Html/Header.php +++ b/app/code/Magento/Theme/Block/Html/Header.php @@ -23,7 +23,7 @@ */ namespace Magento\Theme\Block\Html; -use \Magento\Customer\Helper\Data; +use Magento\Customer\Helper\Data; /** * Html page header block @@ -52,7 +52,6 @@ class Header extends \Magento\View\Element\Template */ protected $httpContext; - /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Customer\Model\Session $customerSession @@ -107,7 +106,10 @@ class Header extends \Magento\View\Element\Template public function getLogoAlt() { if (empty($this->_data['logo_alt'])) { - $this->_data['logo_alt'] = $this->_storeConfig->getConfig('design/header/logo_alt'); + $this->_data['logo_alt'] = $this->_scopeConfig->getValue( + 'design/header/logo_alt', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_data['logo_alt']; } @@ -126,7 +128,10 @@ class Header extends \Magento\View\Element\Template $this->escapeHtml($this->_customerSession->getCustomer()->getName()) ); } else { - $this->_data['welcome'] = $this->_storeConfig->getConfig('design/header/welcome'); + $this->_data['welcome'] = $this->_scopeConfig->getValue( + 'design/header/welcome', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } return $this->_data['welcome']; @@ -140,7 +145,10 @@ class Header extends \Magento\View\Element\Template protected function _getLogoUrl() { $folderName = \Magento\Backend\Model\Config\Backend\Image\Logo::UPLOAD_DIR; - $storeLogoPath = $this->_storeConfig->getConfig('design/header/logo_src'); + $storeLogoPath = $this->_scopeConfig->getValue( + 'design/header/logo_src', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $path = $folderName . '/' . $storeLogoPath; $logoUrl = $this->_urlBuilder->getBaseUrl(array('_type' => \Magento\UrlInterface::URL_TYPE_MEDIA)) . $path; diff --git a/app/code/Magento/Theme/Block/Html/Notices.php b/app/code/Magento/Theme/Block/Html/Notices.php index bc251312c91c8b004bbfebd0ac3dea85cc122a5c..d408ac40262e81fb5f346c1671d18fb464b3aef0 100644 --- a/app/code/Magento/Theme/Block/Html/Notices.php +++ b/app/code/Magento/Theme/Block/Html/Notices.php @@ -44,7 +44,10 @@ class Notices extends \Magento\View\Element\Template */ public function displayNoscriptNotice() { - return $this->_storeConfig->getConfig('web/browser_capabilities/javascript'); + return $this->_scopeConfig->getValue( + 'web/browser_capabilities/javascript', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -54,7 +57,10 @@ class Notices extends \Magento\View\Element\Template */ public function displayNoLocalStorageNotice() { - return $this->_storeConfig->getConfig('web/browser_capabilities/local_storage'); + return $this->_scopeConfig->getValue( + 'web/browser_capabilities/local_storage', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -64,7 +70,10 @@ class Notices extends \Magento\View\Element\Template */ public function displayDemoNotice() { - return $this->_storeConfig->getConfig('design/head/demonotice'); + return $this->_scopeConfig->getValue( + 'design/head/demonotice', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Theme/Block/Html/Pager.php b/app/code/Magento/Theme/Block/Html/Pager.php index 9e66f9b3d5b1781fb1027f21a56c5fb89595792f..cd657a0a55a779c3b7b0de9436aceb924bb3a195 100644 --- a/app/code/Magento/Theme/Block/Html/Pager.php +++ b/app/code/Magento/Theme/Block/Html/Pager.php @@ -715,7 +715,10 @@ class Pager extends \Magento\View\Element\Template */ public function getAnchorTextForPrevious() { - return $this->_storeConfig->getConfig('design/pagination/anchor_text_for_previous'); + return $this->_scopeConfig->getValue( + 'design/pagination/anchor_text_for_previous', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** @@ -725,7 +728,10 @@ class Pager extends \Magento\View\Element\Template */ public function getAnchorTextForNext() { - return $this->_storeConfig->getConfig('design/pagination/anchor_text_for_next'); + return $this->_scopeConfig->getValue( + 'design/pagination/anchor_text_for_next', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } /** diff --git a/app/code/Magento/Theme/Model/Config.php b/app/code/Magento/Theme/Model/Config.php index a70e4e9661c728de6deda2a91d49ba0d23d81a49..3838ccb5fbb8f84576930ea7420d0ab5726a5be2 100644 --- a/app/code/Magento/Theme/Model/Config.php +++ b/app/code/Magento/Theme/Model/Config.php @@ -42,7 +42,7 @@ class Config protected $_configData; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -66,7 +66,7 @@ class Config /** * @param \Magento\App\Config\ValueInterface $configData * @param \Magento\App\Config\Storage\WriterInterface $configWriter - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Cache\FrontendInterface $configCache * @param \Magento\Cache\FrontendInterface $layoutCache @@ -74,7 +74,7 @@ class Config public function __construct( \Magento\App\Config\ValueInterface $configData, \Magento\App\Config\Storage\WriterInterface $configWriter, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Event\ManagerInterface $eventManager, \Magento\Cache\FrontendInterface $configCache, \Magento\Cache\FrontendInterface $layoutCache @@ -98,7 +98,7 @@ class Config public function assignToStore( $theme, array $stores = array(), - $scope = \Magento\Core\Model\ScopeInterface::SCOPE_STORES + $scope = \Magento\Store\Model\ScopeInterface::SCOPE_STORES ) { $isReassigned = false; @@ -193,7 +193,7 @@ class Config protected function _assignThemeToDefaultScope($themeId, &$isReassigned) { $configPath = \Magento\View\DesignInterface::XML_PATH_THEME_ID; - $this->_configWriter->save($configPath, $themeId, \Magento\BaseScopeInterface::SCOPE_DEFAULT); + $this->_configWriter->save($configPath, $themeId, \Magento\App\ScopeInterface::SCOPE_DEFAULT); $isReassigned = true; return $this; } diff --git a/app/code/Magento/Theme/Model/Config/Customization.php b/app/code/Magento/Theme/Model/Config/Customization.php index ed4c019ad4e949a1ce979594488d130201c9844c..f5632b1c9fa042f45556ba6e2ff085340d2aae3a 100644 --- a/app/code/Magento/Theme/Model/Config/Customization.php +++ b/app/code/Magento/Theme/Model/Config/Customization.php @@ -31,7 +31,7 @@ namespace Magento\Theme\Model\Config; class Customization { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -62,12 +62,12 @@ class Customization protected $_unassignedTheme; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\DesignInterface $design * @param \Magento\View\Design\Theme\ThemeProviderInterface $themeProvider */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\DesignInterface $design, \Magento\View\Design\Theme\ThemeProviderInterface $themeProvider ) { @@ -113,7 +113,7 @@ class Customization { $storesByThemes = array(); $stores = $this->_storeManager->getStores(); - /** @var $store \Magento\Core\Model\Store */ + /** @var $store \Magento\Store\Model\Store */ foreach ($stores as $store) { $themeId = $this->_getConfigurationThemeId($store); if (!isset($storesByThemes[$themeId])) { @@ -128,7 +128,7 @@ class Customization * Check if current theme has assigned to any store * * @param \Magento\View\Design\ThemeInterface $theme - * @param null|\Magento\Core\Model\Store $store + * @param null|\Magento\Store\Model\Store $store * @return bool */ public function isThemeAssignedToStore($theme, $store = null) @@ -154,7 +154,7 @@ class Customization * Is theme assigned to specific store * * @param \Magento\View\Design\ThemeInterface $theme - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return bool */ protected function _isThemeAssignedToSpecificStore($theme, $store) @@ -165,7 +165,7 @@ class Customization /** * Get configuration theme id * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return int */ protected function _getConfigurationThemeId($store) diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index cf9c8838efc64c0d7b381aab39d93fca72b9dda8..04e0190daa9b8d8958bc877f72c5c609828229b6 100644 --- a/app/code/Magento/Theme/etc/module.xml +++ b/app/code/Magento/Theme/etc/module.xml @@ -27,8 +27,10 @@ <module name="Magento_Theme" version="1.6.0.0" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Theme/view/frontend/html/notices.phtml b/app/code/Magento/Theme/view/frontend/html/notices.phtml index 83ecfb3030b770852d662e7fc8efa7d63549f448..885edbd7fad8cb663d74ac63c5384b14916c876f 100644 --- a/app/code/Magento/Theme/view/frontend/html/notices.phtml +++ b/app/code/Magento/Theme/view/frontend/html/notices.phtml @@ -70,7 +70,7 @@ </div> </div> <?php endif; ?> -<?php if ($this->helper('Magento\Core\Helper\Cookie')->isUserNotAllowSaveCookie()): ?> +<?php if ($this->helper('Magento\Store\Helper\Cookie')->isUserNotAllowSaveCookie()): ?> <div class="message global cookie" id="notice-cookie-block" style="display: none"> <div class="content"> <p> @@ -91,9 +91,9 @@ "<?php echo $this->getViewFileUrl('Magento_Theme::js/notices.js')?>", function() { $('#notice-cookie-block').cookieBlock({ cookieAllowButtonSelector: '#btn-cookie-allow', - cookieName: '<?php echo \Magento\Core\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>', - cookieValue: '<?php echo $this->helper('Magento\Core\Helper\Cookie')->getAcceptedSaveCookiesWebsiteIds() ?>', - cookieLifetime: <?php echo $this->helper('Magento\Core\Helper\Cookie')->getCookieRestrictionLifetime()?>, + cookieName: '<?php echo \Magento\Store\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>', + cookieValue: '<?php echo $this->helper('Magento\Store\Helper\Cookie')->getAcceptedSaveCookiesWebsiteIds() ?>', + cookieLifetime: <?php echo $this->helper('Magento\Store\Helper\Cookie')->getCookieRestrictionLifetime()?>, noCookiesUrl: '<?php echo $this->getUrl('cms/index/noCookies') ?>' }); }); diff --git a/app/code/Magento/Core/view/frontend/js/msg-box.js b/app/code/Magento/Theme/view/frontend/js/msg-box.js similarity index 98% rename from app/code/Magento/Core/view/frontend/js/msg-box.js rename to app/code/Magento/Theme/view/frontend/js/msg-box.js index b8eca544ca8bafb7d5c1f410d40cddf5fe46fa06..7cccf4ec3569f01d8e33cfd50a9d49e78e7c85f6 100644 --- a/app/code/Magento/Core/view/frontend/js/msg-box.js +++ b/app/code/Magento/Theme/view/frontend/js/msg-box.js @@ -1,4 +1,4 @@ -/** +/** * Magento * * NOTICE OF LICENSE @@ -15,35 +15,35 @@ * * 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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -/*jshint browser:true jquery:true expr:true*/ -(function ($) { - "use strict"; - /** - * MsgBox Widget checks if message box is displayed and sets cookie - */ - $.widget('mage.msgBox', { - options: { - msgBoxCookieName: 'message_box_display', - msgBoxSelector: '.main div.messages' - }, - _create: function() { - if ($.mage.cookies.get(this.options.msgBoxCookieName)) { - var expires = new Date(); - expires.setFullYear(1970); - $.mage.cookies.set(this.options.msgBoxCookieName, null, {expires: expires, path: "/"}); - } else { - $(this.options.msgBoxSelector).hide(); - } - } - }); -})(jQuery); - -jQuery(document).ready(function($){ - $('body').msgBox(); -}); + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/*jshint browser:true jquery:true expr:true*/ +(function ($) { + "use strict"; + /** + * MsgBox Widget checks if message box is displayed and sets cookie + */ + $.widget('mage.msgBox', { + options: { + msgBoxCookieName: 'message_box_display', + msgBoxSelector: '.main div.messages' + }, + _create: function() { + if ($.mage.cookies.get(this.options.msgBoxCookieName)) { + var expires = new Date(); + expires.setFullYear(1970); + $.mage.cookies.set(this.options.msgBoxCookieName, null, {expires: expires, path: "/"}); + } else { + $(this.options.msgBoxSelector).hide(); + } + } + }); +})(jQuery); + +jQuery(document).ready(function($){ + $('body').msgBox(); +}); diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml index 802bb1e8b49124b9ed9bddec460048520a00fcfa..9679bb1d15c2e4f3b2ef8af75b85f249db2ffa21 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default.xml @@ -39,7 +39,7 @@ <argument name="label" translate="true" xsi:type="string">Skip to content</argument> </arguments> </block> - <block class="Magento\Core\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/> + <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/> </container> <container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header content"> <block class="Magento\Theme\Block\Html\Header" name="logo"> @@ -96,7 +96,7 @@ </container> <container name="footer-container" as="footer" label="Page Footer Container" htmlTag="footer" htmlClass="page footer"> <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer content"> - <block class="Magento\Core\Block\Switcher" name="store_switcher" as="store_switcher" template="switch/stores.phtml"/> + <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" template="switch/stores.phtml"/> <block class="Magento\View\Element\Html\Links" name="footer_links"> <arguments> <argument name="css_class" xsi:type="string">footer links</argument> @@ -109,4 +109,14 @@ <container name="before_body_end" as="before_body_end" label="Page Bottom"/> </block> <update handle="default_head_blocks"/> + <referenceBlock name="head"> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-msg-box-js" after="jquery-jquery-ui-js"> + <arguments> + <argument name="file" xsi:type="string">Magento_Theme::js/msg-box.js</argument> + </arguments> + </block> + </referenceBlock> + <referenceContainer name="content"> + <block class="Magento\View\Element\FormKey" name="formkey"/> + </referenceContainer> </layout> diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 3a707d94e69b42e9af55529a55d0b64d790889a5..02a1a5dd2350517080804aec529612635b8c0e9a 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -38,6 +38,11 @@ <argument name="file" xsi:type="string">jquery/jquery.js</argument> </arguments> </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-migrate-js"> + <arguments> + <argument name="file" xsi:type="string">jquery/jquery-migrate.js</argument> + </arguments> + </block> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-jquery-no-conflict-js"> <arguments> <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument> @@ -105,7 +110,7 @@ </block> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-loader-js"> <arguments> - <argument name="file" xsi:type="string">mage/loader.js</argument> + <argument name="file" xsi:type="string">mage/loader_old.js</argument> </arguments> </block> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-dataPost-js"> diff --git a/app/code/Magento/Translation/Model/Inline/Config.php b/app/code/Magento/Translation/Model/Inline/Config.php index f88c6c407290514e62c81baae727c1fb5c10d586..c9ebad0b559121e46f3d0202fdc71634ae7bb98c 100644 --- a/app/code/Magento/Translation/Model/Inline/Config.php +++ b/app/code/Magento/Translation/Model/Inline/Config.php @@ -21,7 +21,6 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Translation\Model\Inline; /** @@ -30,9 +29,11 @@ namespace Magento\Translation\Model\Inline; class Config implements \Magento\Translate\Inline\ConfigInterface { /** - * @var \Magento\Core\Model\Store\ConfigInterface + * Core store config + * + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $config; + protected $_scopeConfig; /** * @var \Magento\Core\Helper\Data @@ -40,12 +41,14 @@ class Config implements \Magento\Translate\Inline\ConfigInterface protected $_helper; /** - * @param \Magento\Core\Model\Store\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Helper\Data $helper */ - public function __construct(\Magento\Core\Model\Store\ConfigInterface $config, \Magento\Core\Helper\Data $helper) - { - $this->config = $config; + public function __construct( + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Core\Helper\Data $helper + ) { + $this->_scopeConfig = $scopeConfig; $this->_helper = $helper; } @@ -54,7 +57,11 @@ class Config implements \Magento\Translate\Inline\ConfigInterface */ public function isActive($scope = null) { - return $this->config->getConfigFlag('dev/translate_inline/active', $scope); + return $this->_scopeConfig->isSetFlag( + 'dev/translate_inline/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $scope + ); } /** diff --git a/app/code/Magento/Translation/Model/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php index 8ca3d2dd0734babe57cf6b630bd96fee1f94c378..74f15cd583b02876ab26a4f11eba3de432dcfce8 100644 --- a/app/code/Magento/Translation/Model/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -113,7 +113,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface protected $_resourceFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -140,8 +140,8 @@ class Parser implements \Magento\Translate\Inline\ParserInterface /** * Initialize base inline translation model * + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Translation\Model\Resource\StringFactory $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Filter_Interface $inputFilter * @param \Magento\App\State $appState * @param \Magento\App\Cache\TypeListInterface $appCache, @@ -149,7 +149,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface */ public function __construct( \Magento\Translation\Model\Resource\StringFactory $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\App\State $appState, \Magento\App\Cache\TypeListInterface $appCache, @@ -187,11 +187,13 @@ class Parser implements \Magento\Translate\Inline\ParserInterface foreach ($translateParams as $param) { if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { $storeId = 0; - } else if (empty($param['perstore'])) { - $resource->deleteTranslate($param['original'], null, false); - $storeId = 0; } else { - $storeId = $validStoreId; + if (empty($param['perstore'])) { + $resource->deleteTranslate($param['original'], null, false); + $storeId = 0; + } else { + $storeId = $validStoreId; + } } $resource->saveTranslate($param['original'], $param['custom'], null, $storeId); } @@ -411,8 +413,8 @@ class Parser implements \Magento\Translate\Inline\ParserInterface private function _prepareTagAttributesForContent(&$content) { $quoteHtml = $this->_getHtmlQuote(); - $tagMatch = array(); - $nextTag = 0; + $tagMatch = array(); + $nextTag = 0; $tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . self::REGEXP_TOKEN . ')[^>]*?)+\\\\?/?>#iS'; while (preg_match($tagRegExp, $content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) { $tagHtml = $tagMatch[0][0]; @@ -600,7 +602,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface 'translated' => $matches[2][0], 'original' => $matches[3][0], 'location' => 'Text', - 'scope' => $matches[4][0], + 'scope' => $matches[4][0] ) ); diff --git a/app/code/Magento/Translation/Model/Resource/String.php b/app/code/Magento/Translation/Model/Resource/String.php index 90148505703225a6083365b63b4c852bc73dd3c9..136a21d6ccd812b28dfa58da13c612ac4a1f5b89 100644 --- a/app/code/Magento/Translation/Model/Resource/String.php +++ b/app/code/Magento/Translation/Model/Resource/String.php @@ -31,7 +31,7 @@ class String extends \Magento\Model\Resource\Db\AbstractDb protected $_localeResolver; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $scopeResolver; @@ -43,13 +43,13 @@ class String extends \Magento\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\BaseScopeResolverInterface $scopeResolver - * @param null $scope + * @param \Magento\App\ScopeResolverInterface $scopeResolver + * @param string|null $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, $scope = null ) { $this->_localeResolver = $localeResolver; @@ -104,7 +104,7 @@ class String extends \Magento\Model\Resource\Db\AbstractDb protected function _getLoadSelect($field, $value, $object) { $select = parent::_getLoadSelect($field, $value, $object); - $select->where('store_id = ?', \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $select->where('store_id = ?', \Magento\Store\Model\Store::DEFAULT_STORE_ID); return $select; } @@ -137,16 +137,12 @@ class String extends \Magento\Model\Resource\Db\AbstractDb protected function _beforeSave(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); - $select = $adapter->select()->from( - $this->getMainTable(), - 'key_id' - )->where( - 'string = :string' - )->where( - 'store_id = :store_id' - ); + $select = $adapter->select() + ->from($this->getMainTable(), 'key_id') + ->where('string = :string') + ->where('store_id = :store_id'); - $bind = array('string' => $object->getString(), 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID); + $bind = array('string' => $object->getString(), 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID); $object->setId($adapter->fetchOne($select, $bind)); return parent::_beforeSave($object); @@ -207,7 +203,7 @@ class String extends \Magento\Model\Resource\Db\AbstractDb $where = array('locale = ?' => $locale, 'string = ?' => $string); if ($storeId === false) { - $where['store_id > ?'] = \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $where['store_id > ?'] = \Magento\Store\Model\Store::DEFAULT_STORE_ID; } elseif ($storeId !== null) { $where['store_id = ?'] = $storeId; } @@ -287,7 +283,7 @@ class String extends \Magento\Model\Resource\Db\AbstractDb /** * Retrieve current store identifier * - * @return \Magento\BaseScopeInterface + * @return int */ protected function getStoreId() { diff --git a/app/code/Magento/Translation/Model/Resource/Translate.php b/app/code/Magento/Translation/Model/Resource/Translate.php index 128af4713e59e55f4651cf281c2ba7a6562e858c..e57c0e8ebc0d98037baa82e5cee69398eac94adc 100644 --- a/app/code/Magento/Translation/Model/Resource/Translate.php +++ b/app/code/Magento/Translation/Model/Resource/Translate.php @@ -31,7 +31,7 @@ class Translate extends \Magento\Model\Resource\Db\AbstractDb implements \Magent protected $_appState; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $scopeResolver; @@ -43,13 +43,13 @@ class Translate extends \Magento\Model\Resource\Db\AbstractDb implements \Magent /** * @param \Magento\App\Resource $resource * @param \Magento\App\State $appState - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param null|string $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\App\State $appState, - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, $scope = null ) { $this->_appState = $appState; @@ -159,7 +159,7 @@ class Translate extends \Magento\Model\Resource\Db\AbstractDb implements \Magent /** * Retrieve current store identifier * - * @return \Magento\BaseScopeInterface + * @return int */ protected function getStoreId() { diff --git a/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php index 6e2120b4e8cff981ee8f1d3f6b8d7f853ad6b68b..b048123ce54df4bbde3d9d46a60b61a9c6360c4e 100644 --- a/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php +++ b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index 05d7fae094c3e1250bf9506a98135bf42d3717b4..62204f30880adb4373f4532afa088018695e711f 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -30,6 +30,7 @@ </sequence> <depends> <module name="Magento_Core"/> + <module name="Magento_Store" /> <module name="Magento_Backend"/> </depends> </module> diff --git a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php index 0629dd3ff0a301e864366ecc12e87aae80e5f28c..23af3e3911d918976720bcd6b9890811073bde56 100644 --- a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php +++ b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -98,9 +98,9 @@ $table = $installer->getConnection() $installer->getIdxName('translation', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('translation', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('translation', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Ups/Block/Backend/System/CarrierConfig.php b/app/code/Magento/Ups/Block/Backend/System/CarrierConfig.php index a88f22b13ae17c8e6026d3a752c84465a72fbbbd..1bdc6e9f9f5a9723944b3eb4d7fe3e8c0b4f022d 100644 --- a/app/code/Magento/Ups/Block/Backend/System/CarrierConfig.php +++ b/app/code/Magento/Ups/Block/Backend/System/CarrierConfig.php @@ -26,7 +26,7 @@ namespace Magento\Ups\Block\Backend\System; use Magento\Backend\Block\Template; use Magento\Backend\Block\Template\Context as TemplateContext; use Magento\Ups\Helper\Config as ConfigHelper; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; /** * Backend shipping UPS content block @@ -41,14 +41,14 @@ class CarrierConfig extends Template protected $carrierConfig; /** - * @var \Magento\Core\Model\Website + * @var \Magento\Store\Model\Website */ protected $_websiteModel; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Ups\Helper\Config $carrierConfig - * @param \Magento\Core\Model\Website $websiteModel + * @param \Magento\Store\Model\Website $websiteModel * @param array $data */ public function __construct( @@ -75,7 +75,7 @@ class CarrierConfig extends Template /** * Get website model * - * @return \Magento\Core\Model\Website + * @return \Magento\Store\Model\Website */ public function getWebsiteModel() { @@ -91,6 +91,6 @@ class CarrierConfig extends Template */ public function getConfig($path, $store = null) { - return $this->_storeConfig->getConfig($path, $store); + return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store); } } diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index 7abc2f96780b20b912e5ee432d9a3b138e248f44..0fd355a8b209bb81b5285c8b12ad48218d5f0248 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -141,7 +141,7 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface protected $configHelper; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory @@ -162,7 +162,7 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, @@ -184,7 +184,7 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface $this->_localeFormat = $localeFormat; $this->configHelper = $configHelper; parent::__construct( - $coreStoreConfig, + $scopeConfig, $rateErrorFactory, $logAdapterFactory, $xmlElFactory, @@ -265,8 +265,9 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface if ($request->getOrigCountry()) { $origCountry = $request->getOrigCountry(); } else { - $origCountry = $this->_coreStoreConfig->getConfig( + $origCountry = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ); } @@ -276,8 +277,9 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface if ($request->getOrigRegionCode()) { $origRegionCode = $request->getOrigRegionCode(); } else { - $origRegionCode = $this->_coreStoreConfig->getConfig( + $origRegionCode = $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ); } @@ -290,8 +292,9 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface $rowRequest->setOrigPostal($request->getOrigPostcode()); } else { $rowRequest->setOrigPostal( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -301,8 +304,9 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface $rowRequest->setOrigCity($request->getOrigCity()); } else { $rowRequest->setOrigCity( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -616,7 +620,7 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface if ($params['10_action'] == '4') { $params['10_action'] = 'Shop'; - $serviceCode = null; // Service code is not relevant when we're asking ALL possible services' rates + $serviceCode = null; } else { $params['10_action'] = 'Rate'; $serviceCode = $rowRequest->getProduct() ? $rowRequest->getProduct() : ''; @@ -1357,8 +1361,8 @@ XMLAuth; 'ULE' ) && $request->getShipperAddressCountryCode() == self::USA_COUNTRY_ID && - ($request->getRecipientAddressCountryCode() == 'CA' || //Canada - $request->getRecipientAddressCountryCode() == 'PR') //Puerto Rico + ($request->getRecipientAddressCountryCode() == 'CA' || + $request->getRecipientAddressCountryCode() == 'PR') ) { $invoiceLineTotalPart = $shipmentPart->addChild('InvoiceLineTotal'); $invoiceLineTotalPart->addChild('CurrencyCode', $request->getBaseCurrencyCode()); @@ -1541,14 +1545,10 @@ XMLAuth; if ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::CANADA_COUNTRY_ID || $countryShipper == self::CANADA_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID || - $countryShipper == self::MEXICO_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID && - $method == '11' // UPS Standard + $countryShipper == self::MEXICO_COUNTRY_ID && $countryRecipient == self::USA_COUNTRY_ID && $method == '11' ) { $containerTypes = array(); - if ($method == '07' // Worldwide Express - || $method == '08' // Worldwide Expedited - || $method == '65' // Worldwide Saver - ) { + if ($method == '07' || $method == '08' || $method == '65') { // Worldwide Expedited if ($method != '08') { $containerTypes = array( @@ -1568,9 +1568,9 @@ XMLAuth; return array('00' => __('Customer Packaging')) + $containerTypes; } elseif ($countryShipper == self::USA_COUNTRY_ID && $countryRecipient == self::PUERTORICO_COUNTRY_ID && - ($method == '03' || // UPS Ground - $method == '02' || // UPS Second Day Air - $method == '01') // UPS Next Day Air + ($method == '03' || + $method == '02' || + $method == '01') ) { // Container types should be the same as for domestic $params->setCountryRecipient(self::USA_COUNTRY_ID); diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml index 4322d5eee4e85ca49ad79d0a8dec4420a9501b71..3aa8d05e5f267a1b5a1700e5b300b03a7aa1a5b5 100644 --- a/app/code/Magento/Ups/etc/module.xml +++ b/app/code/Magento/Ups/etc/module.xml @@ -26,6 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Ups" version="2.0.0.0" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/Ups/view/adminhtml/system/shipping/carrier_config.phtml b/app/code/Magento/Ups/view/adminhtml/system/shipping/carrier_config.phtml index a77b7fa9a9eea45ff91812e5b5e0361d77161e86..b9e5991b9159825b7610b607370c047de7b43a3c 100644 --- a/app/code/Magento/Ups/view/adminhtml/system/shipping/carrier_config.phtml +++ b/app/code/Magento/Ups/view/adminhtml/system/shipping/carrier_config.phtml @@ -33,7 +33,7 @@ $websiteCode = $this->getRequest()->getParam('website'); $storeCode = $this->getRequest()->getParam('store'); if (!$storeCode && $websiteCode) { - /** @var $web \Magento\Core\Model\Website */ + /** @var $web \Magento\Store\Model\Website */ $web = $this->getWebsiteModel()->load($websiteCode); $storedAllowedMethods = explode(',', $web->getConfig('carriers/ups/allowed_methods')); $storedOriginShipment = $web->getConfig('carriers/ups/origin_shipment'); diff --git a/app/code/Magento/UrlRewrite/App/Request/RewriteService.php b/app/code/Magento/UrlRewrite/App/Request/RewriteService.php index cadd7055f758d1da25f9969bd08134cfe136154c..a13b7ec2cd47c69d974f3b63ff9f109c46e88345 100644 --- a/app/code/Magento/UrlRewrite/App/Request/RewriteService.php +++ b/app/code/Magento/UrlRewrite/App/Request/RewriteService.php @@ -31,7 +31,7 @@ class RewriteService protected $_rewriteFactory; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -43,12 +43,12 @@ class RewriteService /** * @param \Magento\App\RouterList $routerList * @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ public function __construct( \Magento\App\RouterList $routerList, \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory, - \Magento\App\ConfigInterface $config + \Magento\App\Config\ScopeConfigInterface $config ) { $this->_rewriteFactory = $rewriteFactory; $this->_config = $config; diff --git a/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite.php b/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite.php index ee9ef28e47f69ad1e38512915558452d43dee3c8..47629a57e60ae81ddef3ac2c36ae3bb11ecde1f3 100644 --- a/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite.php +++ b/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite.php @@ -67,7 +67,7 @@ class UrlRewrite extends \Magento\Model\Resource\Db\AbstractDb if (!is_null($object->getStoreId())) { $select->where( 'store_id IN(?)', - array(\Magento\Core\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()) + array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()) ); $select->order('store_id ' . \Magento\DB\Select::SQL_DESC); $select->limit(1); @@ -80,12 +80,12 @@ class UrlRewrite extends \Magento\Model\Resource\Db\AbstractDb * Retrieve request_path using id_path and current store's id. * * @param string $idPath - * @param int|\Magento\Core\Model\Store $store + * @param int|\Magento\Store\Model\Store $store * @return string */ public function getRequestPathByIdPath($idPath, $store) { - if ($store instanceof \Magento\Core\Model\Store) { + if ($store instanceof \Magento\Store\Model\Store) { $storeId = (int)$store->getId(); } else { $storeId = (int)$store; @@ -135,7 +135,7 @@ class UrlRewrite extends \Magento\Model\Resource\Db\AbstractDb 'request_path IN (:' . implode(', :', array_flip($pathBind)) . ')' )->where( 'store_id IN(?)', - array(\Magento\Core\Model\Store::DEFAULT_STORE_ID, (int)$object->getStoreId()) + array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, (int)$object->getStoreId()) ); $items = $adapter->fetchAll($select, $pathBind); diff --git a/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite/Collection.php b/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite/Collection.php index 9b3f12cb545c660b5dbefb085181da2a88fa431d..9833eab125ca7d823f3725c7c9ce91caba97020d 100644 --- a/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite/Collection.php +++ b/app/code/Magento/UrlRewrite/Model/Resource/UrlRewrite/Collection.php @@ -30,7 +30,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio /** * Store Manager Model * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -39,7 +39,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param mixed $connection * @param \Magento\Model\Resource\Db\AbstractDb $resource */ @@ -48,7 +48,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, $connection = null, \Magento\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/UrlRewrite/Model/UrlRewrite.php b/app/code/Magento/UrlRewrite/Model/UrlRewrite.php index 8b547035a494fdc08af995b7fa6c4339aae712a6..ac2694245bb040f3ceae3ffc247b10ac9186c6ab 100644 --- a/app/code/Magento/UrlRewrite/Model/UrlRewrite.php +++ b/app/code/Magento/UrlRewrite/Model/UrlRewrite.php @@ -62,9 +62,9 @@ class UrlRewrite extends \Magento\Model\AbstractModel /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Stdlib\Cookie @@ -72,7 +72,7 @@ class UrlRewrite extends \Magento\Model\AbstractModel protected $_cookie; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -84,9 +84,9 @@ class UrlRewrite extends \Magento\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Stdlib\Cookie $cookie - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\App\Http\Context $httpContext * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -95,16 +95,16 @@ class UrlRewrite extends \Magento\Model\AbstractModel public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Stdlib\Cookie $cookie, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\App\Http\Context $httpContext, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { + $this->_scopeConfig = $scopeConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_coreStoreConfig = $coreStoreConfig; $this->_cookie = $cookie; $this->_storeManager = $storeManager; $this->_httpContext = $httpContext; @@ -130,7 +130,7 @@ class UrlRewrite extends \Magento\Model\AbstractModel if ($this->hasCategoryId()) { $this->_cacheTag = array( \Magento\Catalog\Model\Category::CACHE_TAG, - \Magento\Core\Model\Store\Group::CACHE_TAG + \Magento\Store\Model\Group::CACHE_TAG ); } @@ -316,8 +316,8 @@ class UrlRewrite extends \Magento\Model\AbstractModel $currentStore = $this->_storeManager->getStore(); $this->setStoreId($currentStore->getId())->loadByIdPath($this->getIdPath()); - $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); - $targetUrl = $request->getBaseUrl(). '/' . $this->getRequestPath(); + $this->_cookie->set(\Magento\Store\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); + $targetUrl = $request->getBaseUrl() . '/' . $this->getRequestPath(); $this->_sendRedirectHeaders($targetUrl, true); } @@ -332,15 +332,16 @@ class UrlRewrite extends \Magento\Model\AbstractModel $isPermanentRedirectOption = $this->hasOption('RP'); if ($external === 'http:/' || $external === 'https:') { $destinationStoreCode = $this->_storeManager->getStore($this->getStoreId())->getCode(); - $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $destinationStoreCode, true); + $this->_cookie->set(\Magento\Store\Model\Store::COOKIE_NAME, $destinationStoreCode, true); $this->_sendRedirectHeaders($this->getTargetPath(), $isPermanentRedirectOption); } else { $targetUrl = $request->getBaseUrl() . '/' . $this->getTargetPath(); } $isRedirectOption = $this->hasOption('R'); if ($isRedirectOption || $isPermanentRedirectOption) { - if ($this->_coreStoreConfig->getConfig( - 'web/url/use_store' + if ($this->_scopeConfig->getValue( + 'web/url/use_store', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && ($storeCode = $this->_storeManager->getStore()->getCode()) ) { $targetUrl = $request->getBaseUrl() . '/' . $storeCode . '/' . $this->getTargetPath(); @@ -349,8 +350,9 @@ class UrlRewrite extends \Magento\Model\AbstractModel $this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption); } - if ($this->_coreStoreConfig->getConfig( - 'web/url/use_store' + if ($this->_scopeConfig->getValue( + 'web/url/use_store', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ) && ($storeCode = $this->_storeManager->getStore()->getCode()) ) { $targetUrl = $request->getBaseUrl() . '/' . $storeCode . '/' . $this->getTargetPath(); diff --git a/app/code/Magento/UrlRewrite/etc/module.xml b/app/code/Magento/UrlRewrite/etc/module.xml index ab2f27dd4196c8dc9a140fda0bf114dca641e71d..9146452e3ec02c5633e38eb451814821b19f3ffc 100644 --- a/app/code/Magento/UrlRewrite/etc/module.xml +++ b/app/code/Magento/UrlRewrite/etc/module.xml @@ -28,6 +28,7 @@ <depends> <module name="Magento_Catalog" /> <module name="Magento_Core" /> + <module name="Magento_Store" /> </depends> </module> </config> diff --git a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-1.0.0.0.php b/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-1.0.0.0.php index acc29da8a9e64462599a45011758bd2273408515..eb5e0101a708989ffce146311ac7f6fd284ca295 100644 --- a/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-1.0.0.0.php +++ b/app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-1.0.0.0.php @@ -106,9 +106,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('core_url_rewrite', array('store_id')), array('store_id') )->addForeignKey( - $installer->getFkName('core_url_rewrite', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('core_url_rewrite', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/User/Block/Buttons.php b/app/code/Magento/User/Block/Buttons.php index 8771d84bb06c3af70e60e2d76b8c85c29d3ff393..687311c1a8041322d124c855cbbd4615e093b99c 100644 --- a/app/code/Magento/User/Block/Buttons.php +++ b/app/code/Magento/User/Block/Buttons.php @@ -53,7 +53,7 @@ class Buttons extends \Magento\Backend\Block\Template */ protected function _prepareLayout() { - $this->addChild( + $this->getToolbar()->addChild( 'backButton', 'Magento\Backend\Block\Widget\Button', array( @@ -63,38 +63,40 @@ class Buttons extends \Magento\Backend\Block\Template ) ); - $this->addChild( + $this->getToolbar()->addChild( 'resetButton', 'Magento\Backend\Block\Widget\Button', - array('label' => __('Reset'), 'onclick' => 'window.location.reload()') + array('label' => __('Reset'), 'onclick' => 'window.location.reload()', 'class' => 'reset') ); - $this->addChild( + if (intval($this->getRequest()->getParam('rid'))) { + $this->getToolbar()->addChild( + 'deleteButton', + 'Magento\Backend\Block\Widget\Button', + array( + 'label' => __('Delete Role'), + 'onclick' => 'deleteConfirm(\'' . __( + 'Are you sure you want to do this?' + ) . '\', \'' . $this->getUrl( + '*/*/delete', + array('rid' => $this->getRequest()->getParam('rid')) + ) . '\')', + 'class' => 'delete' + ) + ); + } + + $this->getToolbar()->addChild( 'saveButton', 'Magento\Backend\Block\Widget\Button', array( 'label' => __('Save Role'), - 'class' => 'save', + 'class' => 'save primary save-role', 'data_attribute' => array( 'mage-init' => array('button' => array('event' => 'save', 'target' => '#role-edit-form')) ) ) ); - - $this->addChild( - 'deleteButton', - 'Magento\Backend\Block\Widget\Button', - array( - 'label' => __('Delete Role'), - 'onclick' => 'deleteConfirm(\'' . __( - 'Are you sure you want to do this?' - ) . '\', \'' . $this->getUrl( - '*/*/delete', - array('rid' => $this->getRequest()->getParam('rid')) - ) . '\')', - 'class' => 'delete' - ) - ); return parent::_prepareLayout(); } diff --git a/app/code/Magento/User/Model/Resource/Setup.php b/app/code/Magento/User/Model/Resource/Setup.php index 7da2f039bcdf242966a12cd456fd6d87e17e9136..a352155c51d40df8ca214cf2e46317c0242f7728 100644 --- a/app/code/Magento/User/Model/Resource/Setup.php +++ b/app/code/Magento/User/Model/Resource/Setup.php @@ -29,7 +29,7 @@ namespace Magento\User\Model\Resource; * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Setup extends \Magento\Core\Model\Resource\Setup +class Setup extends \Magento\Module\Setup { /** * Role model factory @@ -60,7 +60,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup protected $_rulesFactory; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context + * @param \Magento\Module\Setup\Context $context * @param string $resourceName * @param \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory @@ -70,14 +70,14 @@ class Setup extends \Magento\Core\Model\Resource\Setup * @param string $connectionName */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, \Magento\User\Model\Resource\Role\CollectionFactory $roleCollectionFactory, \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, \Magento\User\Model\RoleFactory $roleFactory, \Magento\User\Model\RulesFactory $rulesFactory, $moduleName = 'Magento_User', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION ) { $this->_roleCollectionFactory = $roleCollectionFactory; $this->_rulesCollectionFactory = $rulesCollectionFactory; diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index eb476a74e9aee16f46bc69182bd9589e4aa9071d..8b3ce32a5d1a2e1afa1a2197b759411d1b85bb2b 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -135,7 +135,7 @@ class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Mode protected $_transportBuilder; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -151,7 +151,7 @@ class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Mode * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -166,7 +166,7 @@ class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Mode \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -228,7 +228,7 @@ class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Mode $this->_roleFactory = $objectManager->get('Magento\User\Model\RoleFactory'); $this->_encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); $this->_transportBuilder = $objectManager->get('Magento\Mail\Template\TransportBuilder'); - $this->_storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface'); + $this->_storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface'); } /** diff --git a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php index 7286dc3a5c9106d4267aa1453903754b782343c7..6fbbafac803a39a42beb03dd0e8339251400684d 100644 --- a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php +++ b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); @@ -92,7 +92,7 @@ $map = array( 'admin/cms/page' => 'Magento_Cms::page', 'admin/cms/page/delete' => 'Magento_Cms::page_delete', 'admin/cms/page/save' => 'Magento_Cms::save', - 'admin/system/config/contacts' => 'Magento_Contacts::contacts', + 'admin/system/config/contact' => 'Magento_Contact::contact', 'admin/system/currency/rates' => 'Magento_CurrencySymbol::currency_rates', 'admin/system/currency/symbols' => 'Magento_CurrencySymbol::symbols', 'admin/system/currency' => 'Magento_CurrencySymbol::system_currency', @@ -125,7 +125,7 @@ $map = array( 'admin/report/salesroot/paypal_settlement_reports/view' => 'Magento_Paypal::paypal_settlement_reports_view', 'admin/system/config/persistent' => 'Magento_Persistent::persistent', 'admin/cms/poll' => 'Magento_Poll::poll', - 'admin/catalog/reviews_ratings/ratings' => 'Magento_Rating::ratings', + 'admin/catalog/reviews_ratings/ratings' => 'Magento_Review::ratings', 'admin/report/shopcart/abandoned' => 'Magento_Reports::abandoned', 'admin/report/customers/accounts' => 'Magento_Reports::accounts', 'admin/report/products/bestsellers' => 'Magento_Reports::bestsellers', diff --git a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.3-1.6.1.4.php b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.3-1.6.1.4.php index 3659f6c434a355fb4458dc6ff832793f3e13e6b5..c0a46819f73bf8c18ec72a2e87a93d59ded76032 100644 --- a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.3-1.6.1.4.php +++ b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.3-1.6.1.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.4-1.6.1.5.php b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.4-1.6.1.5.php index ab710dfad0a6d2a16c297ed267d306e40f041564..cd61107793271b8133f3ca17a2020c8531e0b733 100644 --- a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.4-1.6.1.5.php +++ b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.4-1.6.1.5.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/etc/di.xml b/app/code/Magento/User/etc/di.xml index afb6261858065b9f094aa08f45997a6a530aeb20..15caac252044de790b7394c7f95a143f8621903a 100644 --- a/app/code/Magento/User/etc/di.xml +++ b/app/code/Magento/User/etc/di.xml @@ -25,7 +25,6 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <type name="Magento\User\Model\Role" shared="false" /> - <preference for="Magento\Backend\App\ConfigInterface" type="Magento\Backend\App\Config" /> <type name="Magento\User\Model\Resource\Rules"> <arguments> <argument name="rootResource" xsi:type="object">Magento\Acl\RootResource\Proxy</argument> diff --git a/app/code/Magento/User/etc/module.xml b/app/code/Magento/User/etc/module.xml index 452a773b3660c5612bc7c9ee6b963c365b6bf5f4..f8365a8a1546efa2db736ad49791410286760cd7 100644 --- a/app/code/Magento/User/etc/module.xml +++ b/app/code/Magento/User/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Backend"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Backend"/> <module name="Magento_Core"/> <module name="Magento_Catalog"/> @@ -41,7 +42,7 @@ <module name="Magento_CatalogRule"/> <module name="Magento_CatalogSearch"/> <module name="Magento_Checkout"/> - <module name="Magento_Contacts"/> + <module name="Magento_Contact"/> <module name="Magento_CurrencySymbol"/> <module name="Magento_Customer"/> <module name="Magento_DesignEditor"/> @@ -53,7 +54,6 @@ <module name="Magento_Payment"/> <module name="Magento_Paypal"/> <module name="Magento_Persistent"/> - <module name="Magento_Rating"/> <module name="Magento_Reports"/> <module name="Magento_Rss"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/User/sql/user_setup/install-1.6.0.0.php b/app/code/Magento/User/sql/user_setup/install-1.6.0.0.php index 2ed154cc1c9312ae071606133a1f2de7746401f0..4ab35c4a92f78357b7027f05ffa09975fa9257e4 100644 --- a/app/code/Magento/User/sql/user_setup/install-1.6.0.0.php +++ b/app/code/Magento/User/sql/user_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.0.0-1.6.1.0.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.0.0-1.6.1.0.php index 3263dc5f95b5688016aa4cf107ceaf2bf7a378e8..a915f9402cc4f171a07dec2d0b37705e005ba738 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.0.0-1.6.1.0.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.0.0-1.6.1.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.0-1.6.1.1.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.0-1.6.1.1.php index 14e2c9f70dcedd3c7ae9b456db08d00be3d45fdc..a78ed2582209564797de823c92b2da1fbaa57f93 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.0-1.6.1.1.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.0-1.6.1.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.2-1.6.1.3.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.2-1.6.1.3.php index 87ecaf7fcc525a2ae396f979917e391bba08d55e..ce169d799c7881fb18fd9d40a11cd5c6fd4caba0 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.2-1.6.1.3.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.2-1.6.1.3.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Module\Setup */ $installer = $this; $tableName = $installer->getTable('admin_rule'); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php index 1b41fcbd1417366e77c70481322d5dc57a95a23c..631577dc3589d86c84f1112b038c886beab62017 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.3-1.6.1.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php index 0f372dc1243c541db26c839e02087c747fea586c..68bbeb53f89352a7391309e6fbfde737717d3038 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.4-1.6.1.5.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.5-1.6.1.6.php b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.5-1.6.1.6.php index e5a67bac8660427e90b0702388b30e483e23a975..e7db2413fe4352b34ac53f6484f1ff8903d6f1d6 100644 --- a/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.5-1.6.1.6.php +++ b/app/code/Magento/User/sql/user_setup/upgrade-1.6.1.5-1.6.1.6.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $connection = $installer->getConnection(); diff --git a/app/code/Magento/User/view/adminhtml/admin/forgotpassword.phtml b/app/code/Magento/User/view/adminhtml/admin/forgotpassword.phtml index 6e9b0663f7b5fdd6e3b1e6c07fde40bcc2de4b01..34f45dddca69c5ce77b420b900b359ac139482b8 100644 --- a/app/code/Magento/User/view/adminhtml/admin/forgotpassword.phtml +++ b/app/code/Magento/User/view/adminhtml/admin/forgotpassword.phtml @@ -38,13 +38,12 @@ <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/elements.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/form.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/admin.css') ?>" media="all" /> - <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/header.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" /> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script> diff --git a/app/code/Magento/User/view/adminhtml/admin/resetforgottenpassword.phtml b/app/code/Magento/User/view/adminhtml/admin/resetforgottenpassword.phtml index 93d2aca989835025c893c1701547b5819328d55f..dd5889e71e6aafb2159cf7186b8d1f99a496144d 100644 --- a/app/code/Magento/User/view/adminhtml/admin/resetforgottenpassword.phtml +++ b/app/code/Magento/User/view/adminhtml/admin/resetforgottenpassword.phtml @@ -37,13 +37,12 @@ <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/elements.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/form.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/admin.css') ?>" media="all" /> - <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/header.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('css/pages.css') ?>" media="all" /> <link rel="stylesheet" href="<?php echo $this->getViewFileUrl('mui/utils.css') ?>" media="all" /> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-1.8.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/jquery-no-conflict.js') ?>"></script> - <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui.js') ?>"></script> + <script src="<?php echo $this->getViewFileUrl('jquery/jquery-ui-1.9.2.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.tmpl.min.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('jquery/jquery.validate.js') ?>"></script> <script src="<?php echo $this->getViewFileUrl('mage/translate.js') ?>"></script> diff --git a/app/code/Magento/User/view/adminhtml/role/info.phtml b/app/code/Magento/User/view/adminhtml/role/info.phtml index 718c4be91deb63d599a3fd6a21806f0e134570df..e515cd75c454b0d50bbc67efba591fd8c0d425d0 100644 --- a/app/code/Magento/User/view/adminhtml/role/info.phtml +++ b/app/code/Magento/User/view/adminhtml/role/info.phtml @@ -24,12 +24,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<div class="page-actions"> - <?php echo $this->getBackButtonHtml() ?> - <?php echo $this->getResetButtonHtml() ?> - <?php echo $this->getDeleteButtonHtml() ?> - <?php echo $this->getSaveButtonHtml() ?> -</div> <form action="<?php echo $this->getUrl('*/*/saverole') ?>" method="post" id="role-edit-form"> <?php echo $this->getBlockHtml('formkey')?> </form> diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index a1d23b576c44a700356130ddcbb179dc1e23f29d..bae1280590e1a25bad029e03fe47353043d0c993 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -139,7 +139,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C protected $_httpClientFactory; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Logger\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory @@ -160,7 +160,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Logger\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory, @@ -182,7 +182,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $this->_productCollectionFactory = $productCollectionFactory; $this->_httpClientFactory = $httpClientFactory; parent::__construct( - $coreStoreConfig, + $scopeConfig, $rateErrorFactory, $logAdapterFactory, $xmlElFactory, @@ -298,8 +298,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $r->setOrigPostal($request->getOrigPostcode()); } else { $r->setOrigPostal( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -309,8 +310,9 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $r->setOrigCountryId($request->getOrigCountryId()); } else { $r->setOrigCountryId( - $this->_coreStoreConfig->getConfig( + $this->_scopeConfig->getValue( \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $request->getStoreId() ) ); @@ -775,7 +777,6 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C 'INT_26' => 'Priority Express', 'INT_27' => 'Priority Express' ), - // Added because USPS has different services but with same CLASSID value, which is "0" 'method_to_code' => array( 'First-Class Mail Large Envelope' => '0_FCLE', 'First-Class Mail Letter' => '0_FCL', @@ -1659,14 +1660,16 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C $method = 'Priority'; $rootNode = 'PriorityMailIntlRequest'; $xml = $xmlWrap->addChild($rootNode); - } else if ($service == 'First Class') { - $method = 'FirstClass'; - $rootNode = 'FirstClassMailIntlRequest'; - $xml = $xmlWrap->addChild($rootNode); } else { - $method = 'Express'; - $rootNode = 'ExpressMailIntlRequest'; - $xml = $xmlWrap->addChild($rootNode); + if ($service == 'First Class') { + $method = 'FirstClass'; + $rootNode = 'FirstClassMailIntlRequest'; + $xml = $xmlWrap->addChild($rootNode); + } else { + $method = 'Express'; + $rootNode = 'ExpressMailIntlRequest'; + $xml = $xmlWrap->addChild($rootNode); + } } $xml->addAttribute('USERID', $this->getConfigData('userid')); @@ -1713,10 +1716,12 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C if ($method == 'FirstClass') { if (stripos($shippingMethod, 'Letter') !== false) { $xml->addChild('FirstClassMailType', 'LETTER'); - } else if (stripos($shippingMethod, 'Flat') !== false) { - $xml->addChild('FirstClassMailType', 'FLAT'); } else { - $xml->addChild('FirstClassMailType', 'PARCEL'); + if (stripos($shippingMethod, 'Flat') !== false) { + $xml->addChild('FirstClassMailType', 'FLAT'); + } else { + $xml->addChild('FirstClassMailType', 'PARCEL'); + } } } if ($method != 'FirstClass') { @@ -1837,22 +1842,28 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C if ($recipientUSCountry && $service == 'Priority Express') { $requestXml = $this->_formUsExpressShipmentRequest($request); $api = 'ExpressMailLabel'; - } else if ($recipientUSCountry) { - $requestXml = $this->_formUsSignatureConfirmationShipmentRequest($request, $service); - if ($this->getConfigData('mode')) { - $api = 'SignatureConfirmationV3'; + } else { + if ($recipientUSCountry) { + $requestXml = $this->_formUsSignatureConfirmationShipmentRequest($request, $service); + if ($this->getConfigData('mode')) { + $api = 'SignatureConfirmationV3'; + } else { + $api = 'SignatureConfirmationCertifyV3'; + } } else { - $api = 'SignatureConfirmationCertifyV3'; + if ($service == 'First Class') { + $requestXml = $this->_formIntlShipmentRequest($request); + $api = 'FirstClassMailIntl'; + } else { + if ($service == 'Priority') { + $requestXml = $this->_formIntlShipmentRequest($request); + $api = 'PriorityMailIntl'; + } else { + $requestXml = $this->_formIntlShipmentRequest($request); + $api = 'ExpressMailIntl'; + } + } } - } else if ($service == 'First Class') { - $requestXml = $this->_formIntlShipmentRequest($request); - $api = 'FirstClassMailIntl'; - } else if ($service == 'Priority') { - $requestXml = $this->_formIntlShipmentRequest($request); - $api = 'PriorityMailIntl'; - } else { - $requestXml = $this->_formIntlShipmentRequest($request); - $api = 'ExpressMailIntl'; } $debugData = array('request' => $requestXml); diff --git a/app/code/Magento/Usps/etc/adminhtml/di.xml b/app/code/Magento/Usps/etc/adminhtml/di.xml index 7ba856fc88354d4104abfe6ba753b79cc6270cbd..414a996b8c9c024f83fc4644ccc8e726068ef0ec 100644 --- a/app/code/Magento/Usps/etc/adminhtml/di.xml +++ b/app/code/Magento/Usps/etc/adminhtml/di.xml @@ -36,11 +36,4 @@ </arguments> <plugin name="usps" type="Magento\Usps\Block\Adminhtml\Order\Packaging\Plugin\DisplayGirth"/> </type> - <type name="Magento\Module\Updater\SetupFactory"> - <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="usps_setup" xsi:type="string">Magento\Core\Model\Resource\Setup</item> - </argument> - </arguments> - </type> </config> diff --git a/app/code/Magento/Usps/etc/module.xml b/app/code/Magento/Usps/etc/module.xml index f93bca9e7e450a48d052dd1382c24e7ccaaa1a29..18cbfcd6c38adc2706dfa1dedf6fa8a10f09a549 100644 --- a/app/code/Magento/Usps/etc/module.xml +++ b/app/code/Magento/Usps/etc/module.xml @@ -26,6 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Usps" version="2.0.0.0" active="true"> <depends> + <module name="Magento_Store"/> <module name="Magento_Shipping"/> <module name="Magento_Directory"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index 5ef6407703497f2f5ae7e25d0e43ed863b4c1809..fed168d13b776b08b7990f359c3491f5c863fcf6 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -103,20 +103,27 @@ class ErrorProcessor { /** Log information about actual exception. */ $reportId = $this->_logException($exception); - if ($exception instanceof \Magento\Service\Exception) { - if ($exception instanceof \Magento\Service\ResourceNotFoundException) { + if ($exception instanceof \Magento\Webapi\ServiceException) { + if ($exception instanceof \Magento\Webapi\ServiceResourceNotFoundException) { $httpCode = \Magento\Webapi\Exception::HTTP_NOT_FOUND; - } elseif ($exception instanceof \Magento\Service\AuthorizationException) { + } elseif ($exception instanceof \Magento\Webapi\ServiceAuthorizationException) { $httpCode = \Magento\Webapi\Exception::HTTP_UNAUTHORIZED; } else { $httpCode = \Magento\Webapi\Exception::HTTP_BAD_REQUEST; } + + $wrappedErrors = array(); + if ($exception instanceof \Magento\Exception\InputException) { + $wrappedErrors = $exception->getErrors(); + } + $maskedException = new \Magento\Webapi\Exception( $exception->getMessage(), $exception->getCode(), $httpCode, $exception->getParameters(), - $exception->getName() + $exception->getName(), + $wrappedErrors ); } else if ($exception instanceof \Magento\Webapi\Exception) { $maskedException = $exception; diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index 0047d63acffedf09bd960080250754631a6d494d..24bc5743c26578e5b84ad54eccb24a1bb1483a80 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -24,6 +24,7 @@ namespace Magento\Webapi\Controller; use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationService; +use Magento\Service\Data\AbstractObject; use Magento\Webapi\Controller\Rest\Request as RestRequest; use Magento\Webapi\Controller\Rest\Response as RestResponse; use Magento\Webapi\Controller\Rest\Router; @@ -71,13 +72,13 @@ class Rest implements \Magento\App\FrontControllerInterface protected $_errorProcessor; /** - * Initialize dependencies - * * @var \Magento\App\AreaList */ protected $areaList; /** + * Initialize dependencies + * * @param RestRequest $request * @param RestResponse $response * @param Router $router @@ -133,7 +134,7 @@ class Rest implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->areaList->getArea($this->_layout->getArea()) + $this->areaList->getArea($this->_appState->getAreaCode()) ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { @@ -150,7 +151,7 @@ class Rest implements \Magento\App\FrontControllerInterface if (!$this->_authorizationService->isAllowed($route->getAclResources())) { // TODO: Consider passing Integration ID instead of Consumer ID - throw new \Magento\Service\AuthorizationException( + throw new \Magento\Webapi\ServiceAuthorizationException( "Not Authorized.", 0, null, @@ -171,7 +172,7 @@ class Rest implements \Magento\App\FrontControllerInterface $inputParams = $this->_serializer->getInputData($serviceClassName, $serviceMethodName, $inputData); $service = $this->_objectManager->get($serviceClassName); /** @var \Magento\Service\Data\AbstractObject $outputData */ - $outputData = call_user_func_array(array($service, $serviceMethodName), $inputParams); + $outputData = call_user_func_array([$service, $serviceMethodName], $inputParams); $outputArray = $this->_processServiceOutput($outputData); $this->_response->prepareResponse($outputArray); } catch (\Exception $e) { @@ -196,37 +197,22 @@ class Rest implements \Magento\App\FrontControllerInterface protected function _processServiceOutput($data) { if (is_array($data)) { - $result = array(); + $result = []; foreach ($data as $datum) { - if (is_object($datum)) { - $result[] = $this->_convertDataObjectToArray($datum); + if ($datum instanceof AbstractObject) { + $result[] = $datum->__toArray(); } else { $result[] = $datum; } } - } else if (is_object($data)) { - $result = $this->_convertDataObjectToArray($data); - } elseif (is_null($data)) { - $result = array(); + } else if ($data instanceof AbstractObject) { + $result = $data->__toArray(); + } else if (is_null($data)) { + $result = []; } else { /** No processing is required for scalar types */ $result = $data; } return $result; } - - /** - * Convert Data Object to array. - * - * @param object $dataObject - * @return array - * @throws \InvalidArgumentException - */ - protected function _convertDataObjectToArray($dataObject) - { - if (!is_object($dataObject) || !method_exists($dataObject, '__toArray')) { - throw new \InvalidArgumentException("All objects returned by service must implement __toArray()."); - } - return $dataObject->__toArray(); - } } diff --git a/app/code/Magento/Webapi/Controller/Rest/Request.php b/app/code/Magento/Webapi/Controller/Rest/Request.php index b760dc60b87840d206e1d15627239a8a6b7fc584..7435f8be363aef26f7b67024958382e7672626d5 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request.php @@ -124,7 +124,7 @@ class Request extends \Magento\Webapi\Controller\Request public function getBodyParams() { if (null == $this->_bodyParams) { - $this->_bodyParams = $this->_getDeserializer()->deserialize((string)$this->getRawBody()); + $this->_bodyParams = (array)$this->_getDeserializer()->deserialize((string)$this->getRawBody()); } return $this->_bodyParams; } diff --git a/app/code/Magento/Webapi/Controller/Rest/Response.php b/app/code/Magento/Webapi/Controller/Rest/Response.php index b2f530660f6b2b75f57059c6a3cc4d67284c8f83..4cdbf332c6843672accebc929f36995ee687cec6 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Response.php +++ b/app/code/Magento/Webapi/Controller/Rest/Response.php @@ -94,17 +94,19 @@ class Response extends \Magento\Webapi\Controller\Response $responseHttpCode = null; /** @var \Exception $exception */ foreach ($this->getException() as $exception) { + /** @var \Magento\Webapi\Exception $maskedException */ $maskedException = $this->_errorProcessor->maskException($exception); $messageData = array( 'message' => $maskedException->getMessage(), 'http_code' => $maskedException->getHttpCode() ); - if ($maskedException->getCode()) { - $messageData['code'] = $maskedException->getCode(); - } if ($maskedException->getDetails()) { $messageData['parameters'] = $maskedException->getDetails(); } + if ($maskedException->getWrappedErrors()) { + $messageData['wrapped_errors'] = $maskedException->getWrappedErrors(); + } + if ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { $messageData['trace'] = $exception->getTraceAsString(); } diff --git a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php index 38ebef808dd1950b3d1a082597f455c78efb424e..92656717006effdc82472d37c81c5c2e27d25ea7 100644 --- a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php +++ b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php @@ -76,23 +76,19 @@ class ServiceArgsSerializer /** @var ParameterReflection[] $params */ $params = $serviceMethod->getParameters(); - $inputData = array(); + $inputData = []; foreach ($params as $param) { $paramName = $param->getName(); if (isset($inputArray[$paramName])) { if ($this->_isArrayParam($param)) { $paramType = "{$param->getType()}[]"; - /** Eliminate 'item' node if present. It is wrapping all data, declared in WSDL as array */ - $paramValue = isset( - $inputArray[$paramName][ComplexTypeStrategy::ARRAY_ITEM_KEY_NAME] - ) ? $inputArray[$paramName][ComplexTypeStrategy::ARRAY_ITEM_KEY_NAME] : $inputArray[$paramName]; } else { $paramType = $param->getType(); - $paramValue = $inputArray[$paramName]; } + $paramValue = $inputArray[$paramName]; $inputData[] = $this->_convertValue($paramValue, $paramType); } else { - $inputData[] = $param->getDefaultValue(); // not set, so use default + $inputData[] = $param->getDefaultValue(); // not set, so use default } } @@ -114,11 +110,7 @@ class ServiceArgsSerializer /** This pattern will help to skip parameters declarations which precede to the current one */ $precedingParamsPattern = str_repeat('.*\@param.*', $param->getPosition()); $paramType = str_replace('\\', '\\\\', $param->getType()); - if (preg_match( - "/.*{$precedingParamsPattern}\\@param\\s+({$paramType}\\[\\]).*/is", - $docBlock->getContents() - ) - ) { + if (preg_match("/.*{$precedingParamsPattern}\@param\s+({$paramType}\[\]).*/is", $docBlock->getContents())) { $isArray = true; } } @@ -141,6 +133,7 @@ class ServiceArgsSerializer $class = new ClassReflection($className); foreach ($data as $propertyName => $value) { // Converts snake_case to uppercase CamelCase to help form getter/setter method names + // This use case is for REST only. SOAP request data is already camel cased $camelCaseProperty = str_replace(' ', '', ucwords(str_replace('_', ' ', $propertyName))); $methodName = $this->_processGetterMethod($class, $camelCaseProperty); $methodReflection = $class->getMethod($methodName); @@ -165,9 +158,12 @@ class ServiceArgsSerializer if ($this->_typeProcessor->isTypeSimple($type)) { $result = $this->_typeProcessor->processSimpleType($value, $type); } elseif ($this->_typeProcessor->isArrayType($type)) { - $itemType = $this->_typeProcessor->getArrayItemType($type); + if (isset($value['item'])) { + $value = $this->_removeSoapItemNode($value['item']); + } // Initializing the result for array type else it will return null for empty array - $result = is_array($value) ? array() : null; + $result = is_array($value) ? [] : null; + $itemType = $this->_typeProcessor->getArrayItemType($type); foreach ($value as $key => $item) { $result[$key] = $this->_createFromArray($itemType, $item); } @@ -204,4 +200,21 @@ class ServiceArgsSerializer } return $methodName; } + + /** + * Remove item node added by the SOAP server for array types + * + * @param array|mixed $value + * @return array + */ + protected function _removeSoapItemNode($value) + { + /** + * In case when only one Data object value is passed, it will not be wrapped into a subarray + * within item node. If several Data object values are passed, they will be wrapped into + * an indexed array within item node. + */ + $isAssociative = array_keys($value) !== range(0, count($value) - 1); + return $isAssociative ? [$value] : $value; + } } diff --git a/app/code/Magento/Webapi/Controller/Soap.php b/app/code/Magento/Webapi/Controller/Soap.php index 7875b4460f75695ed53bebd57ca9bd77c5b6866a..8e64915d7d668076fb87106898a28f6d35ea3884 100644 --- a/app/code/Magento/Webapi/Controller/Soap.php +++ b/app/code/Magento/Webapi/Controller/Soap.php @@ -25,7 +25,7 @@ */ namespace Magento\Webapi\Controller; -use Magento\Service\AuthorizationException; +use Magento\Webapi\ServiceAuthorizationException; use Magento\Webapi\Exception as WebapiException; /** @@ -129,7 +129,7 @@ class Soap implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->areaList->getArea($this->_layout->getArea()) + $this->areaList->getArea($this->_appState->getAreaCode()) ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { @@ -167,7 +167,7 @@ class Soap implements \Magento\App\FrontControllerInterface * Parse the Authorization header and return the access token e.g. Authorization: Bearer <access-token> * * @return string Access token - * @throws AuthorizationException + * @throws ServiceAuthorizationException */ protected function _getAccessToken() { @@ -177,9 +177,9 @@ class Soap implements \Magento\App\FrontControllerInterface if (isset($token[1]) && is_string($token[1])) { return $token[1]; } - throw new AuthorizationException(__('Authentication header format is invalid.')); + throw new ServiceAuthorizationException(__('Authentication header format is invalid.')); } - throw new AuthorizationException(__('Authentication header is absent.')); + throw new ServiceAuthorizationException(__('Authentication header is absent.')); } /** diff --git a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php index 145458b18043d15d7f0a9a5bd27c29bd66810bd3..1e2f0948cfd7b2f96180b5413fb4f6171bb925fd 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php @@ -24,10 +24,12 @@ namespace Magento\Webapi\Controller\Soap\Request; use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationService; +use Magento\Service\Data\AbstractObject; +use Magento\Service\DataObjectConverter; use Magento\Webapi\Model\Soap\Config as SoapConfig; use Magento\Webapi\Controller\Soap\Request as SoapRequest; use Magento\Webapi\Exception as WebapiException; -use Magento\Service\AuthorizationException; +use Magento\Webapi\ServiceAuthorizationException; use Magento\Webapi\Controller\ServiceArgsSerializer; /** @@ -35,7 +37,6 @@ use Magento\Webapi\Controller\ServiceArgsSerializer; * * The main responsibility is to instantiate proper action controller (service) and execute requested method on it. * - * TODO: Fix warnings suppression * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Handler @@ -54,8 +55,8 @@ class Handler /** @var AuthorizationService */ protected $_authorizationService; - /** @var \Magento\Webapi\Helper\Data */ - protected $_helper; + /** @var DataObjectConverter */ + protected $_dataObjectConverter; /** @var ServiceArgsSerializer */ protected $_serializer; @@ -67,7 +68,7 @@ class Handler * @param \Magento\ObjectManager $objectManager * @param SoapConfig $apiConfig * @param AuthorizationService $authorizationService - * @param \Magento\Webapi\Helper\Data $helper + * @param DataObjectConverter $dataObjectConverter * @param ServiceArgsSerializer $serializer */ public function __construct( @@ -75,14 +76,14 @@ class Handler \Magento\ObjectManager $objectManager, SoapConfig $apiConfig, AuthorizationService $authorizationService, - \Magento\Webapi\Helper\Data $helper, + DataObjectConverter $dataObjectConverter, ServiceArgsSerializer $serializer ) { $this->_request = $request; $this->_objectManager = $objectManager; $this->_apiConfig = $apiConfig; $this->_authorizationService = $authorizationService; - $this->_helper = $helper; + $this->_dataObjectConverter = $dataObjectConverter; $this->_serializer = $serializer; } @@ -94,7 +95,7 @@ class Handler * @return \stdClass|null * @throws WebapiException * @throws \LogicException - * @throws AuthorizationException + * @throws ServiceAuthorizationException */ public function __call($operation, $arguments) { @@ -110,7 +111,7 @@ class Handler if (!$this->_authorizationService->isAllowed($serviceMethodInfo[SoapConfig::KEY_ACL_RESOURCES])) { // TODO: Consider passing Integration ID instead of Consumer ID - throw new AuthorizationException( + throw new ServiceAuthorizationException( "Not Authorized.", 0, null, @@ -138,7 +139,7 @@ class Handler { /** SoapServer wraps parameters into array. Thus this wrapping should be removed to get access to parameters. */ $arguments = reset($arguments); - $arguments = $this->_toArray($arguments); + $arguments = $this->_dataObjectConverter->convertStdObjectToArray($arguments); return $this->_serializer->getInputData($serviceClass, $serviceMethod, $arguments); } @@ -151,11 +152,13 @@ class Handler */ protected function _prepareResponseData($data) { - if ($this->_isDataObject($data)) { - $result = $this->_unpackDataObject($data); + if ($data instanceof AbstractObject) { + $result = $this->_dataObjectConverter->convertKeysToCamelCase($data->__toArray()); } elseif (is_array($data)) { foreach ($data as $key => $value) { - $result[$key] = $this->_isDataObject($value) ? $this->_unpackDataObject($value) : $value; + $result[$key] = $value instanceof AbstractObject + ? $this->_dataObjectConverter->convertKeysToCamelCase($value->__toArray()) + : $value; } } elseif (is_scalar($data) || is_null($data)) { $result = $data; @@ -164,75 +167,4 @@ class Handler } return array(self::RESULT_NODE_NAME => $result); } - - /** - * Create new object and initialize its public fields with data retrieved from Data Object. - * - * This method processes all nested Data Objects recursively. - * - * @param object $dataObject - * @return \stdClass - * @throws \InvalidArgumentException - */ - protected function _unpackDataObject($dataObject) - { - if (!$this->_isDataObject($dataObject)) { - throw new \InvalidArgumentException("Object is expected to implement __toArray() method."); - } - return $this->_unpackArray($dataObject->__toArray()); - } - - /** - * @param array $dataArray - * @return \stdClass - */ - protected function _unpackArray($dataArray) - { - $response = new \stdClass(); - foreach ($dataArray as $fieldName => $fieldValue) { - if ($this->_isDataObject($fieldValue)) { - $fieldValue = $this->_unpackDataObject($fieldValue); - } - if (is_array($fieldValue)) { - $fieldValue = $this->_unpackArray($fieldValue); - } - $fieldName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $fieldName)))); - $response->{$fieldName} = $fieldValue; - } - return $response; - } - - /** - * Check if provided variable is service Data Object. - * - * @param mixed $var - * @return bool - */ - protected function _isDataObject($var) - { - return is_object($var) && method_exists($var, '__toArray'); - } - - /** - * Convert multidimensional object/array into multidimensional array of primitives. - * - * @param object|array $input - * @return array - * @throws \InvalidArgumentException - */ - protected function _toArray($input) - { - if (!is_object($input) && !is_array($input)) { - throw new \InvalidArgumentException("Input argument must be an array or object"); - } - $result = array(); - foreach ((array)$input as $key => $value) { - if (is_object($value) || is_array($value)) { - $result[$key] = $this->_toArray($value); - } else { - $result[$key] = $value; - } - } - return $result; - } } diff --git a/app/code/Magento/Webapi/Exception.php b/app/code/Magento/Webapi/Exception.php index 1dec84b10bf332043b1f912ce01821f2f81346fc..d3d7d7f2e6bb46a902cbb4ce84b7ca6d34ddb102 100644 --- a/app/code/Magento/Webapi/Exception.php +++ b/app/code/Magento/Webapi/Exception.php @@ -67,6 +67,13 @@ class Exception extends \RuntimeException */ protected $_name; + /** + * Wrapped error details. + * + * @var array + */ + protected $_wrappedErrors; + /** * Initialize exception with HTTP code. * @@ -75,6 +82,7 @@ class Exception extends \RuntimeException * @param int $httpCode * @param array $details Additional exception details * @param string $name Exception name + * @param array $wrappedErrors Wrapped error details * @throws \InvalidArgumentException */ public function __construct( @@ -82,7 +90,8 @@ class Exception extends \RuntimeException $code = 0, $httpCode = self::HTTP_BAD_REQUEST, array $details = array(), - $name = '' + $name = '', + array $wrappedErrors = array() ) { /** Only HTTP error codes are allowed. No success or redirect codes must be used. */ if ($httpCode < 400 || $httpCode > 599) { @@ -92,6 +101,7 @@ class Exception extends \RuntimeException $this->_httpCode = $httpCode; $this->_details = $details; $this->_name = $name; + $this->_wrappedErrors = $wrappedErrors; } /** @@ -136,4 +146,14 @@ class Exception extends \RuntimeException { return $this->_name; } + + /** + * Retrieve wrapped errors. + * + * @return array + */ + public function getWrappedErrors() + { + return $this->_wrappedErrors; + } } diff --git a/app/code/Magento/Webapi/Helper/Data.php b/app/code/Magento/Webapi/Helper/Data.php index 53257da48068663d4afedb4d79f8da1c0de38716..dc784fdd06dfff9bcf6b450758aea35295f973de 100644 --- a/app/code/Magento/Webapi/Helper/Data.php +++ b/app/code/Magento/Webapi/Helper/Data.php @@ -24,6 +24,7 @@ namespace Magento\Webapi\Helper; use Magento\Integration\Controller\Adminhtml\Integration as IntegrationController; +use Magento\Service\Data\AbstractObject; class Data extends \Magento\App\Helper\AbstractHelper { @@ -92,7 +93,7 @@ class Data extends \Magento\App\Helper\AbstractHelper if (preg_match(\Magento\Webapi\Model\Config::SERVICE_CLASS_PATTERN, $className, $matches)) { $moduleNamespace = $matches[1]; $moduleName = $matches[2]; - $moduleNamespace = $moduleNamespace == 'Magento' ? '' : $moduleNamespace; + $moduleNamespace = ($moduleNamespace == 'Magento') ? '' : $moduleNamespace; $serviceNameParts = explode('\\', trim($matches[4], '\\')); if ($moduleName == $serviceNameParts[0]) { /** Avoid duplication of words in service name */ @@ -108,33 +109,4 @@ class Data extends \Magento\App\Helper\AbstractHelper } throw new \InvalidArgumentException(sprintf('The service interface name "%s" is invalid.', $className)); } - - /** - * Convert Data Object getter name into field name. - * - * @param string $getterName - * @return string - */ - public function dataObjectGetterNameToFieldName($getterName) - { - if (strpos($getterName, 'get') === 0) { - /** Remove 'get' prefix and make the first letter lower case */ - $fieldName = substr($getterName, strlen('get')); - } else { - /** If methods are with 'is' or 'has' prefix */ - $fieldName = $getterName; - } - return lcfirst($fieldName); - } - - /** - * Convert Data Object field name into setter name. - * - * @param string $fieldName - * @return string - */ - public function dataObjectFieldNameToSetterName($fieldName) - { - return 'set' . ucfirst($fieldName); - } } diff --git a/app/code/Magento/Webapi/Model/Config/ClassReflector/TypeProcessor.php b/app/code/Magento/Webapi/Model/Config/ClassReflector/TypeProcessor.php index 0e0bcf73577e2a19f6c292aa35f0fc375d58d65a..dda43cdc43623eb3159f92758c60352d12ca198a 100644 --- a/app/code/Magento/Webapi/Model/Config/ClassReflector/TypeProcessor.php +++ b/app/code/Magento/Webapi/Model/Config/ClassReflector/TypeProcessor.php @@ -30,9 +30,6 @@ use Zend\Code\Reflection\ClassReflection; */ class TypeProcessor { - /** @var \Magento\Webapi\Helper\Data */ - protected $_helper; - /** * Array of types data. * <pre>array( @@ -66,16 +63,6 @@ class TypeProcessor */ protected $_typeToClassMap = array(); - /** - * Construct type processor. - * - * @param \Magento\Webapi\Helper\Data $helper - */ - public function __construct(\Magento\Webapi\Helper\Data $helper) - { - $this->_helper = $helper; - } - /** * Retrieve processed types data. * @@ -187,19 +174,13 @@ class TypeProcessor */ protected function _processMethod(\Zend\Code\Reflection\MethodReflection $methodReflection, $typeName) { - $isGetter = strpos( - $methodReflection->getName(), - 'get' - ) === 0 || strpos( - $methodReflection->getName(), - 'is' - ) === 0 || strpos( - $methodReflection->getName(), - 'has' - ) === 0; - if ($isGetter) { + $isGetter = (strpos($methodReflection->getName(), 'get') === 0) + || (strpos($methodReflection->getName(), 'is') === 0) + || (strpos($methodReflection->getName(), 'has') === 0); + /** Field will not be added to WSDL if getter has params */ + if ($isGetter && !$methodReflection->getNumberOfParameters()) { $returnMetadata = $this->getGetterReturnType($methodReflection); - $fieldName = $this->_helper->dataObjectGetterNameToFieldName($methodReflection->getName()); + $fieldName = $this->dataObjectGetterNameToFieldName($methodReflection->getName()); $this->_types[$typeName]['parameters'][$fieldName] = array( 'type' => $this->process($returnMetadata['type']), 'required' => $returnMetadata['isRequired'], @@ -229,6 +210,29 @@ class TypeProcessor return $description; } + /** + * Convert Data Object getter name into field name. + * + * @param string $getterName + * @return string + */ + public function dataObjectGetterNameToFieldName($getterName) + { + if ((strpos($getterName, 'get') === 0)) { + /** Remove 'get' prefix and make the first letter lower case */ + $fieldName = substr($getterName, strlen('get')); + } elseif ((strpos($getterName, 'is') === 0)) { + /** Remove 'is' prefix and make the first letter lower case */ + $fieldName = substr($getterName, strlen('is')); + } elseif ((strpos($getterName, 'has') === 0)) { + /** Remove 'has' prefix and make the first letter lower case */ + $fieldName = substr($getterName, strlen('has')); + } else { + $fieldName = $getterName; + } + return lcfirst($fieldName); + } + /** * Identify getter return type by its reflection. * @@ -263,16 +267,14 @@ class TypeProcessor if (preg_match("/.*\\@return\\s+({$escapedReturnType}\\[\\]).*/i", $methodDocBlock->getContents(), $matches)) { $returnType = $matches[1]; } - $isRequired = preg_match( - "/.*\@return\s+\S+\|null.*/i", - $methodDocBlock->getContents(), - $matches - ) ? false : true; - return array( + $isRequired = preg_match("/.*\@return\s+\S+\|null.*/i", $methodDocBlock->getContents(), $matches) + ? false + : true; + return [ 'type' => $returnType, 'isRequired' => $isRequired, 'description' => $returnAnnotation->getDescription() - ); + ]; } /** @@ -283,7 +285,11 @@ class TypeProcessor */ public function normalizeType($type) { - $normalizationMap = array('str' => 'string', 'integer' => 'int', 'bool' => 'boolean'); + $normalizationMap = array( + 'str' => 'string', + 'integer' => 'int', + 'bool' => 'boolean', + ); return is_string($type) && isset($normalizationMap[$type]) ? $normalizationMap[$type] : $type; } diff --git a/app/code/Magento/Webapi/Model/Plugin/Setup.php b/app/code/Magento/Webapi/Model/Plugin/Setup.php index 3c5e06840d5669df1ac171e076ef2d51dc8548d4..28e5b2dd018291ec21b39701337d68990b75ae2f 100644 --- a/app/code/Magento/Webapi/Model/Plugin/Setup.php +++ b/app/code/Magento/Webapi/Model/Plugin/Setup.php @@ -28,7 +28,7 @@ use Magento\Integration\Model\Integration; use Magento\Webapi\Model\IntegrationConfig; /** - * Plugin for Magento\Core\Model\Resource\Setup model to manage resource permissions of + * Plugin for Magento\Module\Setup model to manage resource permissions of * integration installed from config file */ class Setup diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index cb1f639ce384042d5bcec73b2d02a96ff3beca34..4388133affa6bad7cd16d150b1c5df3d4141dfef 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -35,35 +35,28 @@ class Fault extends \RuntimeException * Fault codes that are used in SOAP faults. */ const FAULT_CODE_SENDER = 'Sender'; - const FAULT_CODE_RECEIVER = 'Receiver'; /**#@+ * Nodes that can appear in Detail node of SOAP fault. */ - const NODE_DETAIL_CODE = 'Code'; - const NODE_DETAIL_PARAMETERS = 'Parameters'; - + const NODE_DETAIL_WRAPPED_ERRORS = 'WrappedErrors'; /** Note that parameter node must be unique in scope of all complex types declared in WSDL */ const NODE_DETAIL_PARAMETER = 'GenericFaultParameter'; - const NODE_DETAIL_PARAMETER_KEY = 'key'; - const NODE_DETAIL_PARAMETER_VALUE = 'value'; - + const NODE_DETAIL_WRAPPED_ERROR = 'WrappedError'; + const NODE_DETAIL_WRAPPED_ERROR_FIELD_NAME = 'fieldName'; + const NODE_DETAIL_WRAPPED_ERROR_CODE = 'code'; + const NODE_DETAIL_WRAPPED_ERROR_VALUE = 'value'; const NODE_DETAIL_TRACE = 'Trace'; - const NODE_DETAIL_WRAPPER = 'GenericFault'; - /**#@-*/ /** @var string */ protected $_soapFaultCode; - /** @var string */ - protected $_errorCode; - /** * Parameters are extracted from exception and can be inserted into 'Detail' node as 'Parameters'. * @@ -71,6 +64,13 @@ class Fault extends \RuntimeException */ protected $_parameters = array(); + /** + * Wrapped errors are extracted from exception and can be inserted into 'Detail' node as 'WrappedErrors'. + * + * @var array + */ + protected $_wrappedErrors = array(); + /** * Fault name is used for details wrapper node name generation. * @@ -122,7 +122,7 @@ class Fault extends \RuntimeException parent::__construct($previousException->getMessage(), $previousException->getCode(), $previousException); $this->_soapCode = $previousException->getOriginator(); $this->_parameters = $previousException->getDetails(); - $this->_errorCode = $previousException->getCode(); + $this->_wrappedErrors = $previousException->getWrappedErrors(); $this->_request = $request; $this->_soapServer = $soapServer; $this->_localeResolver = $localeResolver; @@ -143,8 +143,8 @@ class Fault extends \RuntimeException if ($this->getParameters()) { $this->addDetails(array(self::NODE_DETAIL_PARAMETERS => $this->getParameters())); } - if ($this->getErrorCode()) { - $this->addDetails(array(self::NODE_DETAIL_CODE => $this->getErrorCode())); + if ($this->getWrappedErrors()) { + $this->addDetails(array(self::NODE_DETAIL_WRAPPED_ERRORS => $this->getWrappedErrors())); } return $this->getSoapFaultMessage($this->getMessage(), $this->getSoapCode(), $this->getDetails()); @@ -160,6 +160,16 @@ class Fault extends \RuntimeException return $this->_parameters; } + /** + * Retrieve wrapped errors about current fault. + * + * @return array + */ + public function getWrappedErrors() + { + return $this->_wrappedErrors; + } + /** * Receive SOAP fault name. * @@ -188,16 +198,6 @@ class Fault extends \RuntimeException } } - /** - * Retrieve error code. - * - * @return string|null - */ - public function getErrorCode() - { - return $this->_errorCode; - } - /** * Add details about current fault. * @@ -252,9 +252,9 @@ class Fault extends \RuntimeException { $detailXml = $this->_generateDetailXml($details); $language = $this->getLanguage(); - $detailsNamespace = !empty($detailXml) ? 'xmlns:m="' . urlencode( - $this->_soapServer->generateUri(true) - ) . '"' : ''; + $detailsNamespace = !empty($detailXml) + ? 'xmlns:m="' . urlencode($this->_soapServer->generateUri(true)) . '"' + : ''; $reason = htmlentities($reason); $message = <<<FAULT_MESSAGE <?xml version="1.0" encoding="utf-8" ?> @@ -289,10 +289,9 @@ FAULT_MESSAGE; if (is_array($details) && !empty($details)) { $detailsXml = $this->_convertDetailsToXml($details); if ($detailsXml) { - $errorDetailsNode = $this->getFaultName() ? $this->getFaultName() : self::NODE_DETAIL_WRAPPER; - $detailsXml = "<env:Detail><m:{$errorDetailsNode}>" . - $detailsXml . - "</m:{$errorDetailsNode}></env:Detail>"; + $errorDetailsNode = $this->getFaultName() ? $this->getFaultName() :self::NODE_DETAIL_WRAPPER; + $detailsXml = "<env:Detail><m:{$errorDetailsNode}>" + . $detailsXml . "</m:{$errorDetailsNode}></env:Detail>"; } else { $detailsXml = ''; } @@ -315,15 +314,16 @@ FAULT_MESSAGE; continue; } switch ($detailNode) { - case self::NODE_DETAIL_CODE: - // break is intentionally omitted case self::NODE_DETAIL_TRACE: if (is_string($detailValue) || is_numeric($detailValue)) { $detailsXml .= "<m:{$detailNode}>" . htmlspecialchars($detailValue) . "</m:{$detailNode}>"; } break; case self::NODE_DETAIL_PARAMETERS: - $detailsXml .= $this->_getParametersXml($detailValue, $detailNode, $detailsXml); + $detailsXml .= $this->_getParametersXml($detailValue); + break; + case self::NODE_DETAIL_WRAPPED_ERRORS: + $detailsXml .= $this->_getWrappedErrorsXml($detailValue); break; } } @@ -339,24 +339,72 @@ FAULT_MESSAGE; protected function _getParametersXml($parameters) { $result = ''; - if (is_array($parameters)) { - $paramsXml = ''; - foreach ($parameters as $parameterName => $parameterValue) { - if (is_string($parameterName) && (is_string($parameterValue) || is_numeric($parameterValue))) { - $keyNode = self::NODE_DETAIL_PARAMETER_KEY; - $valueNode = self::NODE_DETAIL_PARAMETER_VALUE; - $parameterNode = self::NODE_DETAIL_PARAMETER; - $paramsXml .= "<m:{$parameterNode}><m:{$keyNode}>{$parameterName}</m:{$keyNode}><m:{$valueNode}>" . - htmlspecialchars( - $parameterValue - ) . "</m:{$valueNode}></m:{$parameterNode}>"; - } - } - if (!empty($paramsXml)) { - $parametersNode = self::NODE_DETAIL_PARAMETERS; - $result = "<m:{$parametersNode}>" . $paramsXml . "</m:{$parametersNode}>"; + if (!is_array($parameters)) { + return $result; + } + + $paramsXml = ''; + foreach ($parameters as $parameterName => $parameterValue) { + if (is_string($parameterName) && (is_string($parameterValue) || is_numeric($parameterValue))) { + $keyNode = self::NODE_DETAIL_PARAMETER_KEY; + $valueNode = self::NODE_DETAIL_PARAMETER_VALUE; + $parameterNode = self::NODE_DETAIL_PARAMETER; + $paramsXml .= "<m:$parameterNode><m:$keyNode>$parameterName</m:$keyNode><m:$valueNode>" + . htmlspecialchars($parameterValue) . "</m:$valueNode></m:$parameterNode>"; } } + if (!empty($paramsXml)) { + $parametersNode = self::NODE_DETAIL_PARAMETERS; + $result = "<m:$parametersNode>" . $paramsXml . "</m:$parametersNode>"; + } + return $result; } + + /** + * Generate XML for wrapped errors. + * + * @param array $wrappedErrors + * @return string + */ + protected function _getWrappedErrorsXml($wrappedErrors) + { + $result = ''; + if (!is_array($wrappedErrors)) { + return $result; + } + + $errorsXml = ''; + foreach ($wrappedErrors as $error) { + $errorsXml .= $this->_generateErrorNodeXml($error); + } + if (!empty($errorsXml)) { + $wrappedErrorsNode = self::NODE_DETAIL_WRAPPED_ERRORS; + $result = "<m:$wrappedErrorsNode>" . $errorsXml . "</m:$wrappedErrorsNode>"; + } + + return $result; + } + + /** + * Generate XML for a particular error node. + * + * @param array $error + * @return string + */ + protected function _generateErrorNodeXML($error) + { + $fieldNameNode = self::NODE_DETAIL_WRAPPED_ERROR_FIELD_NAME; + $codeNode = self::NODE_DETAIL_WRAPPED_ERROR_CODE; + $valueNode = self::NODE_DETAIL_WRAPPED_ERROR_VALUE; + $wrappedErrorNode = self::NODE_DETAIL_WRAPPED_ERROR; + + $fieldName = isset($error['fieldName']) ? $error['fieldName'] : ""; + $code = isset($error['code']) ? $error['code'] : ""; + $value = isset($error['value']) ? $error['value'] : ""; + + return "<m:$wrappedErrorNode><m:$fieldNameNode>$fieldName</m:$fieldNameNode><m:$codeNode>" + . "$code</m:$codeNode><m:$valueNode>" . htmlspecialchars($value) + . "</m:$valueNode></m:$wrappedErrorNode>"; + } } diff --git a/app/code/Magento/Webapi/Model/Soap/Server.php b/app/code/Magento/Webapi/Model/Soap/Server.php index 969d305a4b80badccb59db1b3ddb91b1baee20cc..c2e194f7aa23315343f74cc943eea559a6b57740 100644 --- a/app/code/Magento/Webapi/Model/Soap/Server.php +++ b/app/code/Magento/Webapi/Model/Soap/Server.php @@ -57,7 +57,7 @@ class Server /** @var \Magento\Webapi\Controller\Soap\Request */ protected $_request; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** @var \Magento\Webapi\Model\Soap\Server\Factory */ @@ -66,6 +66,11 @@ class Server /** @var \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor */ protected $_typeProcessor; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * Initialize dependencies, initialize WSDL cache. * @@ -73,9 +78,10 @@ class Server * @param \Magento\Config\ScopeInterface $configScope * @param \Magento\Webapi\Controller\Soap\Request $request * @param \Magento\DomDocument\Factory $domDocumentFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Webapi\Model\Soap\Server\Factory $soapServerFactory * @param \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor $typeProcessor + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @throws \Magento\Webapi\Exception */ public function __construct( @@ -83,9 +89,10 @@ class Server \Magento\Config\ScopeInterface $configScope, \Magento\Webapi\Controller\Soap\Request $request, \Magento\DomDocument\Factory $domDocumentFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Webapi\Model\Soap\Server\Factory $soapServerFactory, - \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor $typeProcessor + \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor $typeProcessor, + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { if (!extension_loaded('soap')) { throw new \Magento\Webapi\Exception( @@ -101,8 +108,12 @@ class Server $this->_storeManager = $storeManager; $this->_soapServerFactory = $soapServerFactory; $this->_typeProcessor = $typeProcessor; + $this->_scopeConfig = $scopeConfig; /** Enable or disable SOAP extension WSDL cache depending on Magento configuration. */ - $wsdlCacheEnabled = (bool)$storeManager->getStore()->getConfig(self::CONFIG_PATH_WSDL_CACHE_ENABLED); + $wsdlCacheEnabled = $this->_scopeConfig->isSetFlag( + self::CONFIG_PATH_WSDL_CACHE_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); if ($wsdlCacheEnabled) { ini_set('soap.wsdl_cache_enabled', '1'); } else { @@ -131,7 +142,10 @@ class Server */ public function getApiCharset() { - $charset = $this->_storeManager->getStore()->getConfig(self::CONFIG_PATH_SOAP_CHARSET); + $charset = $this->_scopeConfig->getValue( + self::CONFIG_PATH_SOAP_CHARSET, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); return $charset ? $charset : self::SOAP_DEFAULT_ENCODING; } diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl/ComplexTypeStrategy.php b/app/code/Magento/Webapi/Model/Soap/Wsdl/ComplexTypeStrategy.php index 14bf46740a53be4d79853d9c798ab2eb126a7d2a..79bf1da83769064a6004964486acb2ece8deeda1 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl/ComplexTypeStrategy.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl/ComplexTypeStrategy.php @@ -128,6 +128,9 @@ class ComplexTypeStrategy extends AbstractComplexTypeStrategy 'type', Wsdl::TYPES_NS . ':' . $this->_typeProcessor->translateArrayTypeName($parameterType) ); + if (!$isRequired) { + $element->setAttribute('minOccurs', 0); + } } else { $this->_processParameter($element, $isRequired, $parameterData, $parameterType, $callInfo); } diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php index 84f7141dbe70c21db1f53b96a83b866c1fbb254b..805e6c5a0875f111188400c41125f34329625510 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php @@ -33,9 +33,7 @@ use Magento\Webapi\Model\Soap\Fault; class Generator { const WSDL_NAME = 'MagentoWSDL'; - const WSDL_CACHE_ID = 'WSDL'; - /** * WSDL factory instance. * @@ -183,7 +181,10 @@ class Generator $inputMessageName = $this->getInputMessageName($operationName); $complexTypeName = $this->getElementComplexTypeName($inputMessageName); $inputParameters = array(); - $elementData = array('name' => $inputMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName); + $elementData = array( + 'name' => $inputMessageName, + 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName + ); if (isset($methodData['interface']['in']['parameters'])) { $inputParameters = $methodData['interface']['in']['parameters']; } else { @@ -195,13 +196,17 @@ class Generator $typeData = array( 'documentation' => $methodData['documentation'], 'parameters' => $inputParameters, - 'callInfo' => $callInfo + 'callInfo' => $callInfo, ); $this->_typeProcessor->setTypeData($complexTypeName, $typeData); $wsdl->addComplexType($complexTypeName); $wsdl->addMessage( $inputMessageName, - array('messageParameters' => array('element' => Wsdl::TYPES_NS . ':' . $inputMessageName)) + array( + 'messageParameters' => array( + 'element' => Wsdl::TYPES_NS . ':' . $inputMessageName + ) + ) ); return Wsdl::TYPES_NS . ':' . $inputMessageName; } @@ -218,19 +223,28 @@ class Generator { $outputMessageName = $this->getOutputMessageName($operationName); $complexTypeName = $this->getElementComplexTypeName($outputMessageName); - $wsdl->addElement(array('name' => $outputMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName)); + $wsdl->addElement( + array( + 'name' => $outputMessageName, + 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName + ) + ); $callInfo = array(); $callInfo['returned']['always']['calls'] = array($operationName); $typeData = array( 'documentation' => sprintf('Response container for the %s call.', $operationName), 'parameters' => $methodData['interface']['out']['parameters'], - 'callInfo' => $callInfo + 'callInfo' => $callInfo, ); $this->_typeProcessor->setTypeData($complexTypeName, $typeData); $wsdl->addComplexType($complexTypeName); $wsdl->addMessage( $outputMessageName, - array('messageParameters' => array('element' => Wsdl::TYPES_NS . ':' . $outputMessageName)) + array( + 'messageParameters' => array( + 'element' => Wsdl::TYPES_NS . ':' . $outputMessageName + ) + ) ); return Wsdl::TYPES_NS . ':' . $outputMessageName; } @@ -352,15 +366,15 @@ class Generator protected function _processInterfaceCallInfo($interface, $serviceName, $methodName) { foreach ($interface as $direction => $interfaceData) { - $direction = $direction == 'in' ? 'requiredInput' : 'returned'; + $direction = ($direction == 'in') ? 'requiredInput' : 'returned'; foreach ($interfaceData['parameters'] as $parameterData) { $parameterType = $parameterData['type']; if (!$this->_typeProcessor->isTypeSimple($parameterType)) { $operation = $this->getOperationName($serviceName, $methodName); if ($parameterData['required']) { - $condition = $direction == 'requiredInput' ? 'yes' : 'always'; + $condition = ($direction == 'requiredInput') ? 'yes' : 'always'; } else { - $condition = $direction == 'requiredInput' ? 'no' : 'conditionally'; + $condition = ($direction == 'requiredInput') ? 'no' : 'conditionally'; } $callInfo = array(); $callInfo[$direction][$condition]['calls'][] = $operation; @@ -380,47 +394,77 @@ class Generator { $faultMessageName = Fault::NODE_DETAIL_WRAPPER; $complexTypeName = $this->getElementComplexTypeName($faultMessageName); - $wsdl->addElement(array('name' => $faultMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName)); + $wsdl->addElement( + array( + 'name' => $faultMessageName, + 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName + ) + ); $faultParamsComplexType = Fault::NODE_DETAIL_PARAMETER; $faultParamsData = array( 'parameters' => array( Fault::NODE_DETAIL_PARAMETER_KEY => array( 'type' => 'string', 'required' => true, - 'documentation' => '' + 'documentation' => '', ), Fault::NODE_DETAIL_PARAMETER_VALUE => array( 'type' => 'string', 'required' => true, - 'documentation' => '' + 'documentation' => '', ) ) ); - $genericFaultTypeData = array( + $wrappedErrorComplexType = Fault::NODE_DETAIL_WRAPPED_ERROR; + $wrappedErrorData = array( 'parameters' => array( - Fault::NODE_DETAIL_CODE => array( - 'type' => 'int', + Fault::NODE_DETAIL_WRAPPED_ERROR_FIELD_NAME => array( + 'type' => 'string', 'required' => true, - 'documentation' => 'SOAP fault code, unique for each type of exceptions.' + 'documentation' => '', ), + Fault::NODE_DETAIL_WRAPPED_ERROR_CODE => array( + 'type' => 'string', + 'required' => true, + 'documentation' => '', + ), + Fault::NODE_DETAIL_WRAPPED_ERROR_VALUE => array( + 'type' => 'string', + 'required' => true, + 'documentation' => '', + ), + ) + ); + $genericFaultTypeData = array( + 'parameters' => array( Fault::NODE_DETAIL_TRACE => array( 'type' => 'string', 'required' => false, - 'documentation' => 'Exception calls stack trace.' + 'documentation' => 'Exception calls stack trace.', ), Fault::NODE_DETAIL_PARAMETERS => array( 'type' => "{$faultParamsComplexType}[]", 'required' => false, - 'documentation' => 'Additional exception parameters.' + 'documentation' => 'Additional exception parameters.', + ), + Fault::NODE_DETAIL_WRAPPED_ERRORS => array( + 'type' => "{$wrappedErrorComplexType}[]", + 'required' => false, + 'documentation' => 'Additional wrapped errors.', ) ) ); $this->_typeProcessor->setTypeData($faultParamsComplexType, $faultParamsData); + $this->_typeProcessor->setTypeData($wrappedErrorComplexType, $wrappedErrorData); $this->_typeProcessor->setTypeData($complexTypeName, $genericFaultTypeData); $wsdl->addComplexType($complexTypeName); $wsdl->addMessage( $faultMessageName, - array('messageParameters' => array('element' => Wsdl::TYPES_NS . ':' . $faultMessageName)) + array( + 'messageParameters' => array( + 'element' => Wsdl::TYPES_NS . ':' . $faultMessageName + ) + ) ); return Wsdl::TYPES_NS . ':' . $faultMessageName; diff --git a/app/code/Magento/Service/AuthorizationException.php b/app/code/Magento/Webapi/ServiceAuthorizationException.php similarity index 95% rename from app/code/Magento/Service/AuthorizationException.php rename to app/code/Magento/Webapi/ServiceAuthorizationException.php index afea5deb65f4556935acbac0460e6afc92428c00..123b65ef5a5cfc2fb5571b5d546e99ae397bdae7 100644 --- a/app/code/Magento/Service/AuthorizationException.php +++ b/app/code/Magento/Webapi/ServiceAuthorizationException.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Service; +namespace Magento\Webapi; -class AuthorizationException extends \Magento\Service\Exception +class ServiceAuthorizationException extends \Magento\Webapi\ServiceException { /** * Create custom message for authorization exception. diff --git a/app/code/Magento/Service/Exception.php b/app/code/Magento/Webapi/ServiceException.php similarity index 95% rename from app/code/Magento/Service/Exception.php rename to app/code/Magento/Webapi/ServiceException.php index 9173ba42eac47c7a81f88b9781e087b11152906a..eb61ea42f3efc37ccc62fbe7956c2c675e15f1b6 100644 --- a/app/code/Magento/Service/Exception.php +++ b/app/code/Magento/Webapi/ServiceException.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Service; +namespace Magento\Webapi; -class Exception extends \Magento\Model\Exception +class ServiceException extends \Magento\Model\Exception { /** @var array */ protected $_parameters; diff --git a/app/code/Magento/Service/ResourceNotFoundException.php b/app/code/Magento/Webapi/ServiceResourceNotFoundException.php similarity index 94% rename from app/code/Magento/Service/ResourceNotFoundException.php rename to app/code/Magento/Webapi/ServiceResourceNotFoundException.php index 273354e0de1c7d178a22a5e86aede667956038c1..7b037d2886f5980788420057f47cef42a7ef077d 100644 --- a/app/code/Magento/Service/ResourceNotFoundException.php +++ b/app/code/Magento/Webapi/ServiceResourceNotFoundException.php @@ -23,9 +23,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Service; +namespace Magento\Webapi; -class ResourceNotFoundException extends \Magento\Service\Exception +class ServiceResourceNotFoundException extends \Magento\Webapi\ServiceException { /** * Create custom message for resource not found exception. diff --git a/app/code/Magento/Webapi/etc/module.xml b/app/code/Magento/Webapi/etc/module.xml index 98541fee1c0c1815c27bcaedd073ee107f92ead2..46e7bd67be22c8c8be27d20e6dc18b490496790a 100644 --- a/app/code/Magento/Webapi/etc/module.xml +++ b/app/code/Magento/Webapi/etc/module.xml @@ -27,14 +27,14 @@ <module name="Magento_Webapi" version="1.0.0.4" active="true"> <sequence> <module name="Magento_Core"/> + <module name="Magento_Store"/> <module name="Magento_Integration"/> - <module name="Magento_Service"/> <module name="Magento_Backend"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Core"/> <module name="Magento_Integration"/> - <module name="Magento_Service"/> <module name="Magento_Backend"/> <module name="Magento_User"/> <module name="Magento_Authz"/> diff --git a/app/code/Magento/Webapi/sql/webapi_setup/install-1.0.0.0.php b/app/code/Magento/Webapi/sql/webapi_setup/install-1.0.0.0.php index aa21ed5b984ec1ebad01d7af4bc136ce36e0338f..cac4a22282d9c8048c5d48af96c2cc0eb0d0eebe 100644 --- a/app/code/Magento/Webapi/sql/webapi_setup/install-1.0.0.0.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/install-1.0.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.0-1.0.0.1.php b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.0-1.0.0.1.php index 4b7746d0894d718f25018b434e0ab21af8f19b35..df0913d3f868de5b48fa82f69b64bb4a5641cf11 100644 --- a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.0-1.0.0.1.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.0-1.0.0.1.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var \Magento\Core\Model\Resource\Setup $installer */ +/* @var \Magento\Module\Setup $installer */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.1-1.0.0.2.php b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.1-1.0.0.2.php index 1a3ef0d2d56feb66bf86ad78119171b943ac6ba6..53b3f2263c9f08bb168f80b77d09ca8b17201869 100644 --- a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.1-1.0.0.2.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.1-1.0.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var \Magento\Core\Model\Resource\Setup $installer */ +/* @var \Magento\Module\Setup $installer */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.2-1.0.0.3.php b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.2-1.0.0.3.php index 192823ac82326c86445b4d6b145c8a134b1dbd1a..20807a821fcc4926392971a5b43ff3bed4b796fb 100644 --- a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.2-1.0.0.3.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.2-1.0.0.3.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var \Magento\Core\Model\Resource\Setup $installer */ +/* @var \Magento\Module\Setup $installer */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php index 72d63510ce1b37c9f9a29e7225c2f3d8e013ec1d..d77670c51d229b306a70cf659874426fadb8e9f5 100644 --- a/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var \Magento\Core\Model\Resource\Setup $installer */ +/* @var \Magento\Module\Setup $installer */ $installer = $this; $installer->startSetup(); $connection = $installer->getConnection(); diff --git a/app/code/Magento/Weee/Block/Element/Weee/Tax.php b/app/code/Magento/Weee/Block/Element/Weee/Tax.php index 5a4089feb1810761ab46dd83f05a1a676d801ead..e55898ad6a637d5ea22fc55c65385ce503c4c781 100644 --- a/app/code/Magento/Weee/Block/Element/Weee/Tax.php +++ b/app/code/Magento/Weee/Block/Element/Weee/Tax.php @@ -18,11 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Weee * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Weee\Block\Element\Weee; class Tax extends \Magento\Data\Form\Element\AbstractElement diff --git a/app/code/Magento/Weee/Helper/Data.php b/app/code/Magento/Weee/Helper/Data.php index 0d52f7351bdf71faf2091527a75ba9a6a8eda4ea..4e821142f3f88fc125d38c755fdfb8607ab76f1e 100644 --- a/app/code/Magento/Weee/Helper/Data.php +++ b/app/code/Magento/Weee/Helper/Data.php @@ -25,8 +25,8 @@ */ namespace Magento\Weee\Helper; -use Magento\Core\Model\Store; -use Magento\Core\Model\Website; +use Magento\Store\Model\Store; +use Magento\Store\Model\Website; /** * WEEE data helper @@ -61,9 +61,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Weee\Model\Tax @@ -71,31 +71,31 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_weeeTax; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Weee\Model\Tax $weeeTax * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Weee\Model\Tax $weeeTax, \Magento\Tax\Helper\Data $taxData, \Magento\Registry $coreRegistry, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + \Magento\App\Config\ScopeConfigInterface $scopeConfig ) { $this->_storeManager = $storeManager; $this->_weeeTax = $weeeTax; $this->_coreRegistry = $coreRegistry; $this->_taxData = $taxData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; parent::__construct($context); } @@ -107,7 +107,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getPriceDisplayType($store = null) { - return $this->_coreStoreConfig->getConfig('tax/weee/display', $store); + return $this->_scopeConfig->getValue( + 'tax/weee/display', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -118,7 +122,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getListPriceDisplayType($store = null) { - return $this->_coreStoreConfig->getConfig('tax/weee/display_list', $store); + return $this->_scopeConfig->getValue( + 'tax/weee/display_list', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -129,7 +137,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getSalesPriceDisplayType($store = null) { - return $this->_coreStoreConfig->getConfig('tax/weee/display_sales', $store); + return $this->_scopeConfig->getValue( + 'tax/weee/display_sales', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -140,7 +152,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getEmailPriceDisplayType($store = null) { - return $this->_coreStoreConfig->getConfig('tax/weee/display_email', $store); + return $this->_scopeConfig->getValue( + 'tax/weee/display_email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -151,7 +167,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isDiscounted($store = null) { - return $this->_coreStoreConfig->getConfigFlag('tax/weee/discount', $store); + return $this->_scopeConfig->isSetFlag( + 'tax/weee/discount', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -162,7 +182,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isTaxable($store = null) { - return $this->_coreStoreConfig->getConfigFlag('tax/weee/apply_vat', $store); + return $this->_scopeConfig->isSetFlag( + 'tax/weee/apply_vat', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** @@ -173,23 +197,24 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function includeInSubtotal($store = null) { - return $this->_coreStoreConfig->getConfigFlag('tax/weee/include_in_subtotal', $store); + return $this->_scopeConfig->isSetFlag( + 'tax/weee/include_in_subtotal', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** - * Get weee tax amount for product based on shipping and billing addresses, website and tax settings + * Get weee tax amount for product based on website * * @param \Magento\Catalog\Model\Product $product - * @param null|\Magento\Customer\Model\Address\AbstractAddress $shipping - * @param null|\Magento\Customer\Model\Address\AbstractAddress $billing - * @param null|bool|int|string|Website $website - * @param bool $calculateTaxes + * @param mixed $website * @return float */ - public function getAmount($product, $shipping = null, $billing = null, $website = null, $calculateTaxes = false) + public function getAmount($product, $website = null) { if ($this->isEnabled()) { - return $this->_weeeTax->getWeeeAmount($product, $shipping, $billing, $website, $calculateTaxes); + return $this->_weeeTax->getWeeeAmount($product, null, null, $website, false); } return 0; } @@ -416,7 +441,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isEnabled($store = null) { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_FPT_ENABLED, $store); + return $this->_scopeConfig->getValue( + self::XML_PATH_FPT_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $store + ); } /** diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index 39eb5de39f1e8dbf2cc0964d5df993cdfcad2c16..d187fa69a4f7e9ca733d3cdd20c447b5d4916de9 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -35,7 +35,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price protected $_attributeTax; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -47,18 +47,18 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price /** * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax ) { diff --git a/app/code/Magento/Weee/Model/Observer.php b/app/code/Magento/Weee/Model/Observer.php index 7ec5addd9afb179234a02bca4d17647fddd7fcd7..2a570d11b0f35547a667f3b091aa916d491e97f0 100644 --- a/app/code/Magento/Weee/Model/Observer.php +++ b/app/code/Magento/Weee/Model/Observer.php @@ -94,13 +94,13 @@ class Observer extends \Magento\Model\AbstractModel */ public function setWeeeRendererInForm(\Magento\Event\Observer $observer) { - //adminhtml_catalog_product_edit_prepare_form - + /** @var \Magento\Data\Form $form */ $form = $observer->getEvent()->getForm(); $attributes = $this->_weeeTax->getWeeeAttributeCodes(true); foreach ($attributes as $code) { - if ($weeeTax = $form->getElement($code)) { + $weeeTax = $form->getElement($code); + if ($weeeTax) { $weeeTax->setRenderer($this->_layout->createBlock('Magento\Weee\Block\Renderer\Weee\Tax')); } } @@ -242,9 +242,7 @@ class Observer extends \Magento\Model\AbstractModel */ public function updateProductOptions(\Magento\Event\Observer $observer) { - /* @var $helper \Magento\Weee\Helper\Data */ - $helper = $this->_weeeData; - if (!$helper->isEnabled()) { + if (!$this->_weeeData->isEnabled()) { return $this; } @@ -256,11 +254,11 @@ class Observer extends \Magento\Model\AbstractModel return $this; } - $options['oldPlusDisposition'] = $helper->getOriginalAmount($_product); - $options['plusDisposition'] = $helper->getAmount($_product); + $options['oldPlusDisposition'] = $this->_weeeData->getOriginalAmount($_product); + $options['plusDisposition'] = $this->_weeeData->getAmount($_product); // Exclude Weee amount from excluding tax amount - if (!$helper->typeOfDisplay($_product, array(Tax::DISPLAY_INCL, Tax::DISPLAY_INCL_DESCR))) { + if (!$this->_weeeData->typeOfDisplay($_product, array(Tax::DISPLAY_INCL, Tax::DISPLAY_INCL_DESCR))) { $options['exclDisposition'] = true; } @@ -277,9 +275,7 @@ class Observer extends \Magento\Model\AbstractModel */ public function updateBundleProductOptions(\Magento\Event\Observer $observer) { - /* @var $weeeHelper \Magento\Weee\Helper\Data */ - $weeeHelper = $this->_weeeData; - if (!$weeeHelper->isEnabled()) { + if (!$this->_weeeData->isEnabled()) { return $this; } @@ -294,14 +290,14 @@ class Observer extends \Magento\Model\AbstractModel return $this; } - $amount = $weeeHelper->getAmount($selection); - $attributes = $weeeHelper->getProductWeeeAttributes($_product, null, null, null, $weeeHelper->isTaxable()); - $amountInclTaxes = $weeeHelper->getAmountInclTaxes($attributes); + $amount = $this->_weeeData->getAmount($selection); + $attributes = $this->_weeeData->getProductWeeeAttributes($_product, null, null, null, $this->_weeeData->isTaxable()); + $amountInclTaxes = $this->_weeeData->getAmountInclTaxes($attributes); $taxes = $amountInclTaxes - $amount; $options['plusDisposition'] = $amount; $options['plusDispositionTax'] = $taxes < 0 ? 0 : $taxes; // Exclude Weee amount from excluding tax amount - if (!$weeeHelper->typeOfDisplay($_product, array(0, 1, 4))) { + if (!$this->_weeeData->typeOfDisplay($_product, array(0, 1, 4))) { $options['exclDisposition'] = true; } diff --git a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php index d622c1f004fe5adba33c06125868cc0c19d48e18..af8bd26067c5f29a16450151d637dd341e7d6c4c 100644 --- a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php @@ -35,17 +35,17 @@ namespace Magento\Weee\Model\Resource\Attribute\Backend\Weee; class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; parent::__construct($resource); diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php index e15d9623ad90a313c40b806da9437cb068c074d9..ab2636d575fb10c5818ca41f89465a8977153883 100644 --- a/app/code/Magento/Weee/Model/Tax.php +++ b/app/code/Magento/Weee/Model/Tax.php @@ -26,7 +26,7 @@ namespace Magento\Weee\Model; use Magento\Catalog\Model\Product; -use Magento\Core\Model\Website; +use Magento\Store\Model\Website; class Tax extends \Magento\Model\AbstractModel { @@ -80,7 +80,7 @@ class Tax extends \Magento\Model\AbstractModel protected $_attributeFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -98,7 +98,7 @@ class Tax extends \Magento\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Tax\Model\CalculationFactory $calculationFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Tax\Helper\Data $taxData @@ -111,7 +111,7 @@ class Tax extends \Magento\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Tax\Model\CalculationFactory $calculationFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Tax\Helper\Data $taxData, @@ -224,19 +224,15 @@ class Tax extends \Magento\Model\AbstractModel $websiteId = $this->_storeManager->getWebsite($website)->getId(); $store = $this->_storeManager->getWebsite($website)->getDefaultGroup()->getDefaultStore(); - $customer = null; + /** @var \Magento\Tax\Model\Calculation $calculator */ + $calculator = $this->_calculationFactory->create(); if ($shipping) { $customerTaxClass = $shipping->getQuote()->getCustomerTaxClassId(); - $customer = $shipping->getQuote()->getCustomer(); + $calculator->setCustomerData($shipping->getQuote()->getCustomerData()); } else { $customerTaxClass = null; } - /** @var \Magento\Tax\Model\Calculation $calculator */ - $calculator = $this->_calculationFactory->create(); - if ($customer) { - $calculator->setCustomer($customer); - } $rateRequest = $calculator->getRateRequest($shipping, $billing, $customerTaxClass, $store); $defaultRateRequest = $calculator->getRateRequest(false, false, false, $store); diff --git a/app/code/Magento/Weee/Model/Total/Quote/Weee.php b/app/code/Magento/Weee/Model/Total/Quote/Weee.php index d5b7efb1c589aa5c081713495c4a20a46d0cffef..5132431f3b6ee2fd29e3c48110c2fd22e9ff8e0a 100644 --- a/app/code/Magento/Weee/Model/Total/Quote/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Quote/Weee.php @@ -25,7 +25,7 @@ */ namespace Magento\Weee\Model\Total\Quote; -use Magento\Core\Model\Store; +use Magento\Store\Model\Store; class Weee extends \Magento\Tax\Model\Sales\Total\Quote\Tax { @@ -37,7 +37,7 @@ class Weee extends \Magento\Tax\Model\Sales\Total\Quote\Tax protected $_weeeData; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; diff --git a/app/code/Magento/Weee/etc/di.xml b/app/code/Magento/Weee/etc/di.xml index 15b065b279c6ba92955342a189f18a83a8bdd000..8fd85ef93d2a05f8af20b005285bd02283cee350 100644 --- a/app/code/Magento/Weee/etc/di.xml +++ b/app/code/Magento/Weee/etc/di.xml @@ -31,7 +31,7 @@ </type> <type name="Magento\Weee\Model\Observer"> <arguments> - <argument name="layout" xsi:type="object">Magento\Core\Model\Layout\Proxy</argument> + <argument name="layout" xsi:type="object">Magento\View\Layout\Proxy</argument> <argument name="weeeTax" xsi:type="object">Magento\Weee\Model\Tax\Proxy</argument> <argument name="weeeData" xsi:type="object">Magento\Weee\Helper\Data\Proxy</argument> </arguments> diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml index 3b0f77d7dcb2899f3734af85de9c7907bcd9de97..ea9a8505c51720ddc748f5c696dbf392a67304a8 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -31,6 +31,7 @@ <module name="Magento_Sales"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Catalog"/> <module name="Magento_Tax"/> <module name="Magento_Sales"/> diff --git a/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php b/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php index 2437da6d27654f0031ecc4c36ad674e9d20fbb0e..c66b41db5756bead428362cc8b76d07b27939867 100644 --- a/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php +++ b/app/code/Magento/Weee/sql/weee_setup/install-1.6.0.0.php @@ -106,9 +106,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('weee_tax', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('weee_tax', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE @@ -177,9 +177,9 @@ $table = $installer->getConnection()->newTable( \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('weee_discount', 'website_id', 'core_website', 'website_id'), + $installer->getFkName('weee_discount', 'website_id', 'store_website', 'website_id'), 'website_id', - $installer->getTable('core_website'), + $installer->getTable('store_website'), 'website_id', \Magento\DB\Ddl\Table::ACTION_CASCADE, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php index de5107f42670cb4e9bf31c566719ab3bc1cacef5..83edc8ca29fa704ed033215fd465eae6d3cdee46 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php @@ -36,7 +36,7 @@ namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab; class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** - * @var \Magento\Core\Model\System\Store + * @var \Magento\Store\Model\System\Store */ protected $_store; @@ -49,7 +49,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\System\Store $store + * @param \Magento\Store\Model\System\Store $store * @param \Magento\View\Design\Theme\LabelFactory $themeLabelFactory * @param array $data */ @@ -57,7 +57,7 @@ class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magent \Magento\Backend\Block\Template\Context $context, \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\System\Store $store, + \Magento\Store\Model\System\Store $store, \Magento\View\Design\Theme\LabelFactory $themeLabelFactory, array $data = array() ) { diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index 694cc7ca19d0dfc86e9693f578a2e0f39c57fb0f..7e94ad5f1f320b43790ed2dbcc93072232806c4d 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -45,9 +45,9 @@ class Filter extends \Magento\Cms\Model\Template\Filter * @param \Magento\Logger $logger * @param \Magento\Escaper $escaper * @param \Magento\View\Url $viewUrl - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Core\Model\VariableFactory $coreVariableFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\LayoutFactory $layoutFactory * @param \Magento\App\State $appState @@ -59,9 +59,9 @@ class Filter extends \Magento\Cms\Model\Template\Filter \Magento\Logger $logger, \Magento\Escaper $escaper, \Magento\View\Url $viewUrl, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Core\Model\VariableFactory $coreVariableFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\View\LayoutFactory $layoutFactory, \Magento\App\State $appState, @@ -75,7 +75,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter $logger, $escaper, $viewUrl, - $coreStoreConfig, + $scopeConfig, $coreVariableFactory, $storeManager, $layout, diff --git a/app/code/Magento/Widget/data/widget_setup/data-upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Widget/data/widget_setup/data-upgrade-1.6.0.0-1.6.0.1.php index 85e8926695d03d28c5c7a70f18cb2bf1c0812c03..320eb1c48fc3659abf7476560d4464264dab7483 100644 --- a/app/code/Magento/Widget/data/widget_setup/data-upgrade-1.6.0.0-1.6.0.1.php +++ b/app/code/Magento/Widget/data/widget_setup/data-upgrade-1.6.0.0-1.6.0.1.php @@ -24,15 +24,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup\Migration */ -$installer = $this->_migrationFactory->create(array('resourceName' => 'core_setup')); +/** @var $installer \Magento\Module\Setup\Migration */ +$installer = $this->createMigrationSetup(); $installer->startSetup(); $installer->appendClassAliasReplace( 'widget_instance', 'instance_type', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('instance_id') ); $installer->doUpdateClassAliases(); diff --git a/app/code/Magento/Widget/etc/di.xml b/app/code/Magento/Widget/etc/di.xml index fe924c19f23087762b18efa7d41a3cb141b18c6e..e86df2653c54da903c03b9787feac504770d005e 100644 --- a/app/code/Magento/Widget/etc/di.xml +++ b/app/code/Magento/Widget/etc/di.xml @@ -43,11 +43,4 @@ <argument name="blockFilter" xsi:type="string">Magento\Widget\Model\Template\Filter</argument> </arguments> </type> - <type name="Magento\Module\Updater\SetupFactory"> - <arguments> - <argument name="resourceTypes" xsi:type="array"> - <item name="widget_setup" xsi:type="string">Magento\Core\Model\Resource\Setup\Generic</item> - </argument> - </arguments> - </type> </config> diff --git a/app/code/Magento/Widget/etc/module.xml b/app/code/Magento/Widget/etc/module.xml index d5f2f63fd87a07dedab269fd50cd3b5bb2cffdd1..f71f6c932ecb3a91fc06f14e12ec82d3f381883d 100644 --- a/app/code/Magento/Widget/etc/module.xml +++ b/app/code/Magento/Widget/etc/module.xml @@ -29,6 +29,7 @@ <module name="Magento_Cms"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Cms"/> <module name="Magento_Core"/> <module name="Magento_Backend"/> diff --git a/app/code/Magento/Widget/sql/widget_setup/install-1.6.0.0.php b/app/code/Magento/Widget/sql/widget_setup/install-1.6.0.0.php index 0fa3fba6f85e2e0391198874328936c6e1143713..78c6ecf2a10092d748c5434c934c4b2644d24d3c 100644 --- a/app/code/Magento/Widget/sql/widget_setup/install-1.6.0.0.php +++ b/app/code/Magento/Widget/sql/widget_setup/install-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Widget/sql/widget_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Widget/sql/widget_setup/upgrade-1.6.0.1-1.6.0.2.php index 4c495add3a716a1432e8a205c7678d05d98350b1..31c274b8d7aaae8d515ddcd8a70ba4de70c9d2b5 100644 --- a/app/code/Magento/Widget/sql/widget_setup/upgrade-1.6.0.1-1.6.0.2.php +++ b/app/code/Magento/Widget/sql/widget_setup/upgrade-1.6.0.1-1.6.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer = $this; $installer->startSetup(); diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 7d6bd305531099b73acdcb66aab3a190fe012d15..7f4329ddd501663cbbfb05b1b66aa631a2f0a2dd 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -39,20 +39,20 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock /** * Customer instance * - * @var \Magento\Customer\Model\Customer + * @var \Magento\Customer\Service\V1\Data\Customer */ protected $_customer = null; /** - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ - protected $_customerFactory; + protected $_customerAccountService; /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService * @param array $data * @param array $priceBlockTypes */ @@ -60,11 +60,11 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService, array $data = array(), array $priceBlockTypes = array() ) { - $this->_customerFactory = $customerFactory; + $this->_customerAccountService = $customerAccountService; parent::__construct( $context, $httpContext, @@ -94,12 +94,12 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock /** * Retrieve Shared Wishlist Customer instance * - * @return \Magento\Customer\Model\Customer + * @return \Magento\Customer\Service\V1\Data\Customer */ public function getWishlistCustomer() { if (is_null($this->_customer)) { - $this->_customer = $this->_customerFactory->create()->load($this->_getWishlist()->getCustomerId()); + $this->_customer = $this->_customerAccountService->getCustomer($this->_getWishlist()->getCustomerId()); } return $this->_customer; diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index 9e0455e83ba887a62abd0187492b32732d84c526..d4ef7c3545cce552ddcc10f5b2f49733fdde0167 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -44,13 +44,23 @@ abstract class AbstractController extends \Magento\App\Action\Action */ protected $_formKeyValidator; + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + /** * @param Context $context * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + * @param \Magento\Customer\Model\Session $customerSession */ - public function __construct(Context $context, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator) - { + public function __construct( + Context $context, + \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, + \Magento\Customer\Model\Session $customerSession + ) { $this->_formKeyValidator = $formKeyValidator; + $this->_customerSession = $customerSession; parent::__construct($context); } @@ -98,7 +108,7 @@ abstract class AbstractController extends \Magento\App\Action\Action $this->_forward('noroute'); return; } - $isOwner = $wishlist->isOwner($this->_objectManager->get('Magento\Customer\Model\Session')->getCustomerId()); + $isOwner = $wishlist->isOwner($this->_customerSession->getCustomerId()); $messages = array(); $addedItems = array(); diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index 9fd3d969fc0f8aec3b7479c3dfe256828871a67c..8ccb4be6a816b8c4c095673790a294735c4f1c1c 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -75,30 +75,40 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements */ protected $inlineTranslation; + /** + * @var \Magento\Customer\Helper\View + */ + protected $_customerHelperView; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Registry $coreRegistry * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Customer\Helper\View $customerHelperView */ public function __construct( \Magento\App\Action\Context $context, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, + \Magento\Customer\Model\Session $customerSession, \Magento\Registry $coreRegistry, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\App\Response\Http\FileFactory $fileResponseFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Translate\Inline\StateInterface $inlineTranslation + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Customer\Helper\View $customerHelperView ) { $this->_coreRegistry = $coreRegistry; $this->_wishlistConfig = $wishlistConfig; $this->_fileResponseFactory = $fileResponseFactory; $this->_transportBuilder = $transportBuilder; $this->inlineTranslation = $inlineTranslation; - parent::__construct($context, $formKeyValidator); + $this->_customerHelperView = $customerHelperView; + parent::__construct($context, $formKeyValidator, $customerSession); } /** @@ -115,13 +125,18 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements ) ) { $this->_actionFlag->set('', 'no-dispatch', true); - $customerSession = $this->_objectManager->get('Magento\Customer\Model\Session'); + $customerSession = $this->_customerSession; if (!$customerSession->getBeforeWishlistUrl()) { $customerSession->setBeforeWishlistUrl($this->_redirect->getRefererUrl()); } $customerSession->setBeforeWishlistRequest($request->getParams()); } - if (!$this->_objectManager->get('Magento\Core\Model\Store\Config')->getConfigFlag('wishlist/general/active')) { + if (!$this->_objectManager->get( + 'Magento\App\Config\ScopeConfigInterface' + )->isSetFlag( + 'wishlist/general/active' + ) + ) { throw new NotFoundException(); } return parent::dispatch($request); @@ -155,7 +170,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements if (!$wishlistId) { $wishlistId = $this->getRequest()->getParam('wishlist_id'); } - $customerId = $this->_objectManager->get('Magento\Customer\Model\Session')->getCustomerId(); + $customerId = $this->_customerSession->getCustomerId(); /* @var \Magento\Wishlist\Model\Wishlist $wishlist */ $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist'); if ($wishlistId) { @@ -194,7 +209,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements } $this->_view->loadLayout(); - $session = $this->_objectManager->get('Magento\Customer\Model\Session'); + $session = $this->_customerSession; $block = $this->_view->getLayout()->getBlock('customer.wishlist'); $referer = $session->getAddActionReferer(true); if ($block) { @@ -222,7 +237,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements throw new NotFoundException(); } - $session = $this->_objectManager->get('Magento\Customer\Model\Session'); + $session = $this->_customerSession; $requestParams = $this->getRequest()->getParams(); @@ -352,7 +367,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements */ public function updateItemOptionsAction() { - $session = $this->_objectManager->get('Magento\Customer\Model\Session'); + $session = $this->_customerSession; $productId = (int)$this->getRequest()->getParam('product'); if (!$productId) { $this->_redirect('*/'); @@ -710,16 +725,18 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $message = nl2br(htmlspecialchars($message)); if (empty($emails)) { $error = __('Email address can\'t be empty.'); - } else if (count($emails) > $emailsLeft) { - $error = __('This wishlist can be shared %1 more times.', $emailsLeft); } else { - foreach ($emails as $index => $email) { - $email = trim($email); - if (!\Zend_Validate::is($email, 'EmailAddress')) { - $error = __('Please input a valid email address.'); - break; + if (count($emails) > $emailsLeft) { + $error = __('This wishlist can be shared %1 more times.', $emailsLeft); + } else { + foreach ($emails as $index => $email) { + $email = trim($email); + if (!\Zend_Validate::is($email, 'EmailAddress')) { + $error = __('Please input a valid email address.'); + break; + } + $emails[$index] = $email; } - $emails[$index] = $email; } } } @@ -740,8 +757,8 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $sent = 0; try { - $customer = $this->_objectManager->get('Magento\Customer\Model\Session')->getCustomer(); - + $customer = $this->_customerSession->getCustomerDataObject(); + $customerName = $this->_customerHelperView->getCustomerName($customer); /*if share rss added rss feed to email template*/ if ($this->getRequest()->getParam('rss_url')) { $rss_url = $this->_view->getLayout()->createBlock( @@ -759,11 +776,14 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $sharingCode = $wishlist->getSharingCode(); try { - $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config'); - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + $scopeConfig = $this->_objectManager->get('Magento\App\Config\ScopeConfigInterface'); + $storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface'); foreach ($emails as $email) { $transport = $this->_transportBuilder->setTemplateIdentifier( - $storeConfig->getConfig('wishlist/email/email_template') + $scopeConfig->getValue( + 'wishlist/email/email_template', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->setTemplateOptions( array( 'area' => \Magento\Core\Model\App\Area::AREA_FRONTEND, @@ -772,6 +792,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements )->setTemplateVars( array( 'customer' => $customer, + 'customerName' => $customerName, 'salable' => $wishlist->isSalable() ? 'yes' : '', 'items' => $wishlistBlock, 'addAllLink' => $this->_url->getUrl('*/shared/allcart', array('code' => $sharingCode)), @@ -780,7 +801,10 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements 'store' => $storeManager->getStore() ) )->setFrom( - $storeConfig->getConfig('wishlist/email/email_identity') + $scopeConfig->getValue( + 'wishlist/email/email_identity', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) )->addTo( $email )->getTransport(); diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php index b3dc3fcb2dfa810113375604d6136bef43cbd338..ca38865099698cbc2687337b94af87f3be398d3e 100644 --- a/app/code/Magento/Wishlist/Controller/Shared.php +++ b/app/code/Magento/Wishlist/Controller/Shared.php @@ -46,15 +46,17 @@ class Shared extends AbstractController /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator + * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Registry $coreRegistry */ public function __construct( \Magento\App\Action\Context $context, \Magento\Core\App\Action\FormKeyValidator $formKeyValidator, + \Magento\Customer\Model\Session $customerSession, \Magento\Registry $coreRegistry ) { $this->_coreRegistry = $coreRegistry; - parent::__construct($context, $formKeyValidator); + parent::__construct($context, $formKeyValidator, $customerSession); } /** @@ -87,7 +89,7 @@ class Shared extends AbstractController public function indexAction() { $wishlist = $this->_getWishlist(); - $customerId = $this->_objectManager->get('Magento\Customer\Model\Session')->getCustomerId(); + $customerId = $this->_customerSession->getCustomerId(); if ($wishlist && $wishlist->getCustomerId() && $wishlist->getCustomerId() == $customerId) { $this->getResponse()->setRedirect( diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 648f786e8f08fa76980ce0c28ab3dcf8946936b0..1fed400207a877ca927a8f3190e2a00527617d0c 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -49,7 +49,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Currently logged in customer * - * @var \Magento\Customer\Model\Customer + * @var \Magento\Customer\Service\V1\Data\Customer */ protected $_currentCustomer; @@ -91,9 +91,9 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Core store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Customer\Model\Session @@ -106,7 +106,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_wishlistFactory; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -115,33 +115,41 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_postDataHelper; + /** + * @var \Magento\Customer\Helper\View + */ + protected $_customerViewHelper; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Registry $coreRegistry - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\PostData $postDataHelper + * @param \Magento\Customer\Helper\View $customerViewHelper */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Registry $coreRegistry, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Helper\PostData $postDataHelper + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Core\Helper\PostData $postDataHelper, + \Magento\Customer\Helper\View $customerViewHelper ) { $this->_coreRegistry = $coreRegistry; $this->_coreData = $coreData; - $this->_coreStoreConfig = $coreStoreConfig; + $this->_scopeConfig = $scopeConfig; $this->_customerSession = $customerSession; $this->_wishlistFactory = $wishlistFactory; $this->_storeManager = $storeManager; $this->_postDataHelper = $postDataHelper; + $this->_customerViewHelper = $customerViewHelper; parent::__construct($context); } @@ -158,7 +166,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Retrieve logged in customer * - * @return \Magento\Customer\Model\Customer + * @return \Magento\Customer\Service\V1\Data\Customer */ protected function _getCurrentCustomer() { @@ -168,10 +176,10 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Set current customer * - * @param \Magento\Customer\Model\Customer $customer + * @param \Magento\Customer\Service\V1\Data\Customer $customer * @return void */ - public function setCustomer(\Magento\Customer\Model\Customer $customer) + public function setCustomer(\Magento\Customer\Service\V1\Data\Customer $customer) { $this->_currentCustomer = $customer; } @@ -179,12 +187,12 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Retrieve current customer * - * @return \Magento\Customer\Model\Customer|null + * @return \Magento\Customer\Service\V1\Data\Customer|null */ public function getCustomer() { if (!$this->_currentCustomer && $this->_customerSession->isLoggedIn()) { - $this->_currentCustomer = $this->_customerSession->getCustomer(); + $this->_currentCustomer = $this->_customerSession->getCustomerDataObject(); } return $this->_currentCustomer; } @@ -220,11 +228,15 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getItemCount() { $storedDisplayType = $this->_customerSession->getWishlistDisplayType(); - $currentDisplayType = $this->_coreStoreConfig->getConfig(self::XML_PATH_WISHLIST_LINK_USE_QTY); + $currentDisplayType = $this->_scopeConfig->getValue( + self::XML_PATH_WISHLIST_LINK_USE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $storedDisplayOutOfStockProducts = $this->_customerSession->getDisplayOutOfStockProducts(); - $currentDisplayOutOfStockProducts = $this->_coreStoreConfig->getConfig( - self::XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK + $currentDisplayOutOfStockProducts = $this->_scopeConfig->getValue( + self::XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); if (!$this->_customerSession->hasWishlistItemCount() || $currentDisplayType != $storedDisplayType || @@ -264,7 +276,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * Retrieve Item Store for URL * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getUrlStore($item) { @@ -278,8 +290,10 @@ class Data extends \Magento\App\Helper\AbstractHelper if ($product) { if ($product->isVisibleInSiteVisibility()) { $storeId = $product->getStoreId(); - } else if ($product->hasUrlDataObject()) { - $storeId = $product->getUrlDataObject()->getStoreId(); + } else { + if ($product->hasUrlDataObject()) { + $storeId = $product->getUrlDataObject()->getStoreId(); + } } } return $this->_storeManager->getStore($storeId); @@ -438,7 +452,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isAllow() { - if ($this->isModuleOutputEnabled() && $this->_coreStoreConfig->getConfig('wishlist/general/active')) { + if ($this->isModuleOutputEnabled() && $this->_scopeConfig->getValue( + 'wishlist/general/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { return true; } return false; @@ -461,10 +479,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getCustomerName() { - $customer = $this->_getCurrentCustomer(); - if ($customer) { - return $customer->getName(); - } + return $this->getCustomer() + ? $this->_customerViewHelper->getCustomerName($this->getCustomer()) + : null; } /** @@ -493,7 +510,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isRssAllow() { - return $this->_coreStoreConfig->getConfigFlag('rss/wishlist/active'); + return $this->_scopeConfig->isSetFlag('rss/wishlist/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } /** @@ -528,16 +545,26 @@ class Data extends \Magento\App\Helper\AbstractHelper $count = 0; if ($this->getCustomer()) { $collection = $this->getWishlistItemCollection()->setInStockFilter(true); - if ($this->_coreStoreConfig->getConfig(self::XML_PATH_WISHLIST_LINK_USE_QTY)) { + if ($this->_scopeConfig->getValue( + self::XML_PATH_WISHLIST_LINK_USE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) { $count = $collection->getItemsQty(); } else { $count = $collection->getSize(); } $this->_customerSession->setWishlistDisplayType( - $this->_coreStoreConfig->getConfig(self::XML_PATH_WISHLIST_LINK_USE_QTY) + $this->_scopeConfig->getValue( + self::XML_PATH_WISHLIST_LINK_USE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); $this->_customerSession->setDisplayOutOfStockProducts( - $this->_coreStoreConfig->getConfig(self::XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK) + $this->_scopeConfig->getValue( + self::XML_PATH_CATALOGINVENTORY_SHOW_OUT_OF_STOCK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) ); } $this->_customerSession->setWishlistItemCount($count); @@ -552,6 +579,9 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function isDisplayQty() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_WISHLIST_LINK_USE_QTY); + return $this->_scopeConfig->getValue( + self::XML_PATH_WISHLIST_LINK_USE_QTY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } } diff --git a/app/code/Magento/Wishlist/Model/Config.php b/app/code/Magento/Wishlist/Model/Config.php index 766b3ca4352d49efa85091a21eda9fb7aefc3967..fe617aebbf47b31aa06dd7e20de88d21d165881d 100644 --- a/app/code/Magento/Wishlist/Model/Config.php +++ b/app/code/Magento/Wishlist/Model/Config.php @@ -53,19 +53,25 @@ class Config private $_sharingEmailLimit; /** - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Config $catalogConfig * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig */ public function __construct( - \Magento\Core\Model\Store\ConfigInterface $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Config $catalogConfig, \Magento\Catalog\Model\Attribute\Config $attributeConfig ) { - $emailLimitInConfig = (int)$storeConfig->getConfig(self::XML_PATH_SHARING_EMAIL_LIMIT); - $textLimitInConfig = (int)$storeConfig->getConfig(self::XML_PATH_SHARING_TEXT_LIMIT); - $this->_sharingEmailLimit = $emailLimitInConfig ?: self::SHARING_EMAIL_LIMIT; - $this->_sharignTextLimit = $textLimitInConfig ?: self::SHARING_TEXT_LIMIT; + $emailLimitInConfig = (int)$scopeConfig->getValue( + self::XML_PATH_SHARING_EMAIL_LIMIT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $textLimitInConfig = (int)$scopeConfig->getValue( + self::XML_PATH_SHARING_TEXT_LIMIT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + $this->_sharingEmailLimit = $emailLimitInConfig ? : self::SHARING_EMAIL_LIMIT; + $this->_sharignTextLimit = $textLimitInConfig ? : self::SHARING_TEXT_LIMIT; $this->_catalogConfig = $catalogConfig; $this->_attributeConfig = $attributeConfig; } diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index f147de4aa2d1518680d987807d7298c7564e0f26..563957b7c93d05e5fd1dfc0d15edb040c9ed016a 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -100,7 +100,7 @@ class Item extends \Magento\Model\AbstractModel implements protected $_flagOptionsSaved = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -137,7 +137,7 @@ class Item extends \Magento\Model\AbstractModel implements /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl @@ -151,7 +151,7 @@ class Item extends \Magento\Model\AbstractModel implements public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\DateTime $date, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php index abc5bdd144af5c2b8e82e379917964aabccfc086..19e7ee2c01bd40017eab5f21e7caba24de5a28a3 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php @@ -107,7 +107,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio protected $_inventoryData = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -163,7 +163,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Sales\Helper\Admin $adminhtmlSales - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility @@ -185,7 +185,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio \Magento\Event\ManagerInterface $eventManager, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Sales\Helper\Admin $adminhtmlSales, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\DateTime $date, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, @@ -396,7 +396,7 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio */ public function addStoreData() { - $storeTable = $this->_coreResource->getTableName('core_store'); + $storeTable = $this->_coreResource->getTableName('store'); $this->getSelect()->join( array('store' => $storeTable), 'main_table.store_id=store.store_id', diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php index 15010eb986b68e35ea26dddc06829e06302c79ac..42abee23be3f352f05966288add45bc750bed281 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php @@ -29,6 +29,8 @@ */ namespace Magento\Wishlist\Model\Resource\Item\Collection; +use Magento\Customer\Controller\RegistryConstants as RegistryConstants; + class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection { /** @@ -43,7 +45,7 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Sales\Helper\Admin $adminhtmlSales - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility @@ -66,7 +68,7 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection \Magento\Event\ManagerInterface $eventManager, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Sales\Helper\Admin $adminhtmlSales, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\DateTime $date, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, @@ -112,7 +114,7 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection { parent::_initSelect(); $this->addCustomerIdFilter( - $this->_registryManager->registry('current_customer')->getId() + $this->_registryManager->registry(RegistryConstants::CURRENT_CUSTOMER_ID) )->resetSortOrder()->addDaysInWishlist()->addStoreData(); return $this; } diff --git a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php index b22fe690c95d208bff6d9baa8d615a3cfc2a2121..fb6e02e93e17c5addb6ffa0d36d9b55cd70353df 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php @@ -46,17 +46,6 @@ class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollectio $this->_init('Magento\Wishlist\Model\Wishlist', 'Magento\Wishlist\Model\Resource\Wishlist'); } - /** - * Filter collection by customer - * - * @param \Magento\Customer\Model\Customer $customer - * @return $this - */ - public function filterByCustomer(\Magento\Customer\Model\Customer $customer) - { - return $this->filterByCustomerId($customer->getId()); - } - /** * Filter collection by customer id * diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index 1bb6fa98b8866a7bf655e377fe4f3a06ffcb18ab..ff3bbc414613702a068dc256c092cb3800aafd19 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -67,7 +67,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I /** * Store filter for wishlist * - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -93,7 +93,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I protected $_catalogProduct; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -139,7 +139,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I * @param \Magento\Wishlist\Helper\Data $wishlistData * @param ResourceWishlist $resource * @param Collection $resourceCollection - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param ItemFactory $wishlistItemFactory * @param CollectionFactory $wishlistCollectionFactory @@ -156,7 +156,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I \Magento\Wishlist\Helper\Data $wishlistData, ResourceWishlist $resource, Collection $resourceCollection, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\DateTime $date, ItemFactory $wishlistItemFactory, CollectionFactory $wishlistCollectionFactory, @@ -531,7 +531,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I /** * Retrieve wishlist store object * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ public function getStore() { @@ -544,7 +544,7 @@ class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\I /** * Set wishlist store * - * @param \Magento\Core\Model\Store $store + * @param \Magento\Store\Model\Store $store * @return $this */ public function setStore($store) diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml index 5bcf991e96111e3ec9082f708529fdd3c20a2ea5..05eeedea6b20f2846ccd1107a76663a70ee5687f 100644 --- a/app/code/Magento/Wishlist/etc/module.xml +++ b/app/code/Magento/Wishlist/etc/module.xml @@ -30,6 +30,7 @@ <module name="Magento_Catalog"/> </sequence> <depends> + <module name="Magento_Store"/> <module name="Magento_Customer"/> <module name="Magento_Catalog"/> <module name="Magento_Core"/> diff --git a/app/code/Magento/Wishlist/sql/wishlist_setup/install-1.6.0.0.php b/app/code/Magento/Wishlist/sql/wishlist_setup/install-1.6.0.0.php index 9adee7434dc38ee4a2fb27a51e00a3b00f76d38b..af2f09833324547a80cce1b89f38d2ee7006a0f7 100644 --- a/app/code/Magento/Wishlist/sql/wishlist_setup/install-1.6.0.0.php +++ b/app/code/Magento/Wishlist/sql/wishlist_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer \Magento\Core\Model\Resource\Setup */ +/* @var $installer \Magento\Module\Setup */ $installer->startSetup(); @@ -154,9 +154,9 @@ $table = $installer->getConnection()->newTable( $installer->getIdxName('wishlist_item', 'store_id'), 'store_id' )->addForeignKey( - $installer->getFkName('wishlist_item', 'store_id', 'core_store', 'store_id'), + $installer->getFkName('wishlist_item', 'store_id', 'store', 'store_id'), 'store_id', - $installer->getTable('core_store'), + $installer->getTable('store'), 'store_id', \Magento\DB\Ddl\Table::ACTION_SET_NULL, \Magento\DB\Ddl\Table::ACTION_CASCADE diff --git a/app/code/Magento/Wishlist/view/email/share_notification.html b/app/code/Magento/Wishlist/view/email/share_notification.html index 386e494b723c7eba71bf19eade069a7921f24b8f..8001d252113054c5996efcdce96a96a431e24c28 100644 --- a/app/code/Magento/Wishlist/view/email/share_notification.html +++ b/app/code/Magento/Wishlist/view/email/share_notification.html @@ -1,4 +1,4 @@ -<!--@subject Take a look at {{var customer.name}}'s wishlist @--> +<!--@subject Take a look at {{var customerName}}'s wishlist @--> <!--@vars {"store url=\"\"":"Store Url", "var logo_url":"Email Logo Image Url", @@ -33,8 +33,8 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; </td> </tr> <tr> - <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{escapehtml var=$customer.name}}</p></center></td> - </td> + <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{escapehtml var=$customerName}}</strong></p></center></td> + </tr> </table> </td> </tr> diff --git a/app/design/adminhtml/Magento/backend/Magento_AdminNotification/css/source/module.less b/app/design/adminhtml/Magento/backend/Magento_AdminNotification/css/source/module.less new file mode 100644 index 0000000000000000000000000000000000000000..e3237fe969def56a8c555f123af500ed7cf295b4 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_AdminNotification/css/source/module.less @@ -0,0 +1,121 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +/* + System Messages +-------------------------------------- */ +.message-system { + &:extend(._layout-width all); +} + +.message-system-inner { + background: #f7f3eb; + border: 1px solid #c0bbaf; + border-top: 0; + border-radius: 0 0 5px 5px; + float: right; + overflow: hidden; +} + +.message-system-unread .message-system-inner { + float: none; +} + +.message-system-list { + margin: 0; + padding: 0; + list-style: none; + float: left; +} + +.message-system .message-system-list { + width: 75%; +} + +.message-system-list li { + padding: 5px 13px 7px 36px; + position: relative; +} + +.message-system-short { + padding: 5px 13px 7px; + float: right; +} + +.message-system-short span { + display: inline-block; + margin-left: 7px; + border-left: 1px #d1ccc3 solid; +} + +.message-system-short span:first-child { + border: 0; + margin-left: 0; +} + +.message-system-short a { + padding-left: 27px; + position: relative; + height: 16px; +} + +.message-system .message-system-short a:before, +.message-system-list li:before { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + height: 16px; + width: 16px; + font-size: 16px; + line-height: 16px; + text-align: center; + position: absolute; + left: 7px; + top: 2px; +} + +.message-system-list li:before { + top: 5px; + left: 13px; +} + +.message-system .message-system-short .warning a:before, +.message-system-list li.warning:before { + content: "\e006"; + color: #f2a825; +} + +.message-system .message-system-short .error a:before, +.message-system-list li.error:before { + content: "\e086"; + font-family: 'MUI-Icons'; + color: #c00815; +} + +.ui-dialog .message-system-list { + margin-bottom: 25px; +} + diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/css/source/module.less b/app/design/adminhtml/Magento/backend/Magento_Backend/css/source/module.less new file mode 100644 index 0000000000000000000000000000000000000000..df219953fb79bc7e5d3ef90c480d70989906c537 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/css/source/module.less @@ -0,0 +1,503 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +.search-global { + &.miniform { + position: relative; + z-index: 2; + display: inline-block; + vertical-align: top; + margin:6px 10px 0; + .mage-suggest { + border: 0; + border-radius: 0; + } + } + &-actions { + display: none; + } + &-field { + margin: 0; + .label { + position: absolute; + right: 4px; + z-index: 2; + cursor: pointer; + .icon-font( + "\e01f", + @_icon-font: 'MUI-Icons', + @_icon-font-size: 18px, + @_icon-font-line-height: 29px, + @_icon-font-color: #cac3b4, + @_icon-font-text-hide: true + ); + } + .control { + width:48px; + overflow: hidden; + opacity: 0; + transition: all 0.3s ease; + input[type="text"] { + background: transparent; + border: none; + width: 100%; + } + } + } + &-field.active { + z-index: 2; + .label:before { + display: none; + } + .control { + overflow: visible; + opacity: 1; + transition: all 0.3s ease; + width:300px; + } + } + &-menu { + .box-sizing(); + display: block; + width: 100%; + } +} + +.notifications { + &-summary { + display: inline-block; + text-align: left; + position: relative; + z-index: 1; + } + &-action { + color: @primary7; + display: inline-block; + padding: 12px 5px 11px; + text-transform: capitalize; + .icon-font( + "\e06e", + @_icon-font: "MUI-Icons", + @_icon-font-size: 18px, + @_icon-font-line-height: 18px, + ); + &:visited, + &:focus, + &:active, + &:hover { + color: @primary7; + text-decoration: none; + } + &.active { + background-color: #FFF; // @todo: color; + color: #676056; // @todo: color; + } + .text { + .visually-hidden(); + } + .qty.counter { + display: inline-block; + background: #ed4f2e; + font-size: 12px; + line-height: 12px; + font-weight: bold; + padding: 1px 3px; + position: absolute; + top: 6px; + left: 50%; + border-radius: 4px; + } + } + &-list { + width: 300px; + padding: 0; + margin: 0; + .last { + padding:10px; + text-align: center; + font-size: 12px; + } + } + &-summary &-entry { + padding: 15px; + .style14(); + + } + &-entry { + &:hover .action { + display: block; + } + position: relative; + z-index: 1; + &-title { + padding-right:15px; + .style33(); + display: block; + margin-bottom: 10px; + } + &-description { + line-height:1.3; + display: block; + max-height: 1.3*3em; + overflow: hidden; + margin-bottom: 10px; + text-oveflow: ellipsis; + } + } + &-close.action { + position: absolute; + z-index: 1; + right: 0; + top: 12px; + right: 12px; + .icon-font( + "\e07f", + @_icon-font: 'MUI-Icons', + @_icon-font-text-hide: true, + @_icon-font-size: 16px + ); + .button-reset(); + display: none; + } + &-dialog-content { + display:none; + } + &-critical &-entry-title { + padding-left: 25px; + .icon-font( + "\e086", + @_icon-font: 'MUI-Icons', + @_icon-font-size: 18px, + @_icon-font-line-height: 18px, + @_icon-font-color: #c00815 + ) + } + &-critical &-entry-title:before { + position: absolute; + margin-left: -25px; + } + &-dialog-content &-entry-time { + color: #8c867e; + font-size: 13px; + font-family: Helvetica, Arial, sans-serif; + position: absolute; + right: 17px; + bottom: 27px; + text-align: right; + } + &-url { + .icon-font( + "\e084", + @_icon-font: 'MUI-Icons', + @_icon-font-text-hide: true, + @_icon-font-size: 16px, + @_icon-font-position: after, + @_icon-font-margin: -2px 0 0 10px + ); + } + &-dialog-content &-entry-title { + font-size: 15px; + } +} + +.locale-switcher { + &-field { + white-space: nowrap; + float: left; + .control, + .label { + vertical-align: middle; + margin: 0 10px 0 0; + display: inline-block; + } + } + &-select { + .css(appearance, none, 1); + appearance: none; + border: 1px solid #ada89e; + max-width: 200px; + height: 31px; + background-image: url("@{baseDir}images/select-bg.svg"); + background-repeat: no-repeat; + background-position: 100% 50%; + background-size:30px 60px; + padding-right:29px; + text-indent: 0.01px; + text-overflow: ''; + &::-ms-expand{ + display:none; + } + .lt-ie10 & { + background-image: none; + padding-right: 4px; + } + } +} + +.autocomplete-results { +} + +.mage-suggest { + text-align: left; + .box-sizing(); + position: relative; + display: inline-block; + vertical-align: top; + width: 100%; + background-color: #fff; + border: 1px solid #ccc; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} + +.mage-suggest:after { + position: absolute; + top: 3px; + right: 3px; + bottom: 0; + width: 22px; + text-align: center; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e01f'; // search icon + font-size: 18px; + color: #b2b2b2; +} + +.mage-suggest input[type="search"], +.mage-suggest input.search { + width: 100%; + border: none; + background: none; + padding-right: 30px; +} + +.mage-suggest-dropdown { + position: absolute; + left: 0; + right: 0; + top: 100%; + margin: 1px -1px 0 -1px; + border: 1px solid #cac2b5; + background: #fff; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + z-index: 990; +} + +.mage-suggest-dropdown ul { + margin: 0; + padding: 0; + list-style: none; +} + +.mage-suggest-dropdown li { + border-bottom: 1px solid #e5e5e5; + padding: 0; +} + +.field-category_ids .mage-suggest-dropdown, +.field-new_category_parent .mage-suggest-dropdown { + max-height: 200px; + overflow: auto; +} + +.mage-suggest-dropdown li a { + display: block; +} + +.mage-suggest-dropdown li a, +.mage-suggest-dropdown .jstree li a:hover, +.mage-suggest-dropdown .jstree .jstree-hovered, +.mage-suggest-dropdown .jstree .jstree-clicked { + padding: 6px 12px 5px; + text-decoration: none; + color: #333; +} + +.mage-suggest-dropdown .jstree li a:hover, +.mage-suggest-dropdown .jstree .jstree-hovered, +.mage-suggest-dropdown .jstree .jstree-clicked { + border: none; +} + +.mage-suggest-dropdown li a.ui-state-focus { + background: #f5f5f5; +} + +.mage-suggest-dropdown .jstree li { + border-bottom: 0; +} + +.mage-suggest-dropdown .jstree li a { + display: inline-block; +} + +.mage-suggest-dropdown .jstree .mage-suggest-selected > a { + color: #000000; + background: #F1FFEB; +} + +.mage-suggest-dropdown .jstree .mage-suggest-selected > a:hover, +.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-hovered, +.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-clicked, +.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-hovered, +.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-clicked { + background: #E5FFD9; +} + +.mage-suggest-dropdown .jstree .mage-suggest-not-active > a { + color: #D4D4D4; +} + +.mage-suggest-dropdown .jstree .mage-suggest-not-active > a:hover, +.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-hovered, +.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-clicked { + background: #F5F5F5; +} + +.mage-suggest-dropdown .category-path { + font-size: 11px; + margin-left: 10px; + color: #9ba8b5; +} + +.suggest-expandable .action-dropdown .action-toggle { + display: inline-block; + max-width: 500px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + background: none; + border: none; + box-shadow: none; + color: #676056; + font-size: 12px; + padding: 5px 4px; + filter: none; +} + +.suggest-expandable .action-dropdown .action-toggle span { + display: inline; +} + +.suggest-expandable .action-dropdown .action-toggle:before { + display: inline-block; + float: right; + margin-left: 4px; + font-size: 13px; + color: #b2b0ad; +} + +.suggest-expandable .action-dropdown .action-toggle:hover:before { + color: #7e7e7e; +} + +.suggest-expandable .dropdown-menu { + margin: 1px 0 0; + left: 0; + right: auto; + width: 221px; +} + +.suggest-expandable .mage-suggest { + border: none; +} + +.suggest-expandable .mage-suggest:after { + top: 6px; + right: 6px; +} + +.suggest-expandable .mage-suggest-inner .title { + margin: 0; + padding: 0 10px 4px; + text-transform: uppercase; + color: #a6a098; + font-size: 12px; + border-bottom: 1px solid #e5e5e5; +} + +.suggest-expandable .mage-suggest-inner > input[type="search"], +.suggest-expandable .mage-suggest-inner > input.search { + position: relative; + margin: 6px 5px 5px; + padding-right: 20px; + border: 1px solid #ccc; + width: 211px; + z-index: 1; +} + +.suggest-expandable .mage-suggest-inner > input.ui-autocomplete-loading, +.suggest-expandable .mage-suggest-inner > input.mage-suggest-state-loading { + background: #fff url(../mui/images/ajax-loader-small.gif) no-repeat 190px 50%; +} + +.suggest-expandable .mage-suggest { + border-radius: 3px 3px 0 0; +} + +.suggest-expandable .mage-suggest-dropdown { + margin-top: 0; + border-top: 0; + border-radius: 0 0 3px 3px; + max-height: 300px; + overflow: auto; + width: 100%; + float: left; +} + +.suggest-expandable .mage-suggest-dropdown ul { + margin: 0; + padding: 0; + list-style: none; +} + +.suggest-expandable .action-show-all, +.suggest-expandable .action-show-all:hover, +.suggest-expandable .action-show-all:active, +.suggest-expandable .action-show-all:focus, +.suggest-expandable .action-show-all[disabled] { + border-top: 1px solid #e5e5e5; + display: block; + width: 100%; + padding: 8px 10px 10px; + text-align: left; + font: 12px/1.333 Arial, Verdana, sans-serif; + color: #676056; +} + +.product-actions .suggest-expandable { + max-width: 500px; + float: left; + margin-top: 1px; +} + +.page-actions.fixed #product-template-suggest-container { + display: none; +} diff --git a/app/design/adminhtml/magento_backend/Magento_Backend/images/logo-magento-small.png b/app/design/adminhtml/Magento/backend/Magento_Backend/images/logo-magento-small.png similarity index 100% rename from app/design/adminhtml/magento_backend/Magento_Backend/images/logo-magento-small.png rename to app/design/adminhtml/Magento/backend/Magento_Backend/images/logo-magento-small.png diff --git a/app/design/adminhtml/magento_backend/Magento_Backend/images/logo-magento.png b/app/design/adminhtml/Magento/backend/Magento_Backend/images/logo-magento.png similarity index 100% rename from app/design/adminhtml/magento_backend/Magento_Backend/images/logo-magento.png rename to app/design/adminhtml/Magento/backend/Magento_Backend/images/logo-magento.png diff --git a/app/design/adminhtml/magento_backend/Magento_Backend/layout/default.xml b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml similarity index 91% rename from app/design/adminhtml/magento_backend/Magento_Backend/layout/default.xml rename to app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml index 461bbc59ec3bb7f75d878986dbd676ab0e75ab2e..f3b0ca8ac80d3a8ff9d0e34ec310a8ee240d9e37 100644 --- a/app/design/adminhtml/magento_backend/Magento_Backend/layout/default.xml +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="head"> <block class="Magento\Theme\Block\Html\Head\Css" name="mui-reset-css"> <arguments> @@ -55,22 +55,14 @@ <argument name="file" xsi:type="string">css/admin.css</argument> </arguments> </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-header"> - <arguments> - <argument name="file" xsi:type="string">css/header.css</argument> - </arguments> - </block> <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-pages"> <arguments> <argument name="file" xsi:type="string">css/pages.css</argument> </arguments> </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-ie8"> + <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-css"> <arguments> - <argument name="file" xsi:type="string">css/styles-ie8.css</argument> - <argument name="properties" xsi:type="array"> - <item name="ie_condition" xsi:type="string">lt IE 9</item> - </argument> + <argument name="file" xsi:type="string">css/styles.css</argument> </arguments> </block> <block class="Magento\Theme\Block\Html\Head\Css" name="jquery-farbtastic-css-farbtastic-css"> diff --git a/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/css/source/module.less b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/css/source/module.less new file mode 100644 index 0000000000000000000000000000000000000000..fa7c75866c99b80168216cfd02ffd1a3ed12bf82 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_ConfigurableProduct/css/source/module.less @@ -0,0 +1,98 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +.product-actions { + .clearfix(); + .switcher { + float: right; + } +} + +#configurable-attributes-container .actions-select { + .dropdown( + @_dropdown-list-pointer: false + ); + + .action.toggle { + padding: 0 8px; + border: 1px solid #ccc; + background: #fff; + border-radius: 0 4px 4px 0; + + &:after { + width: 14px; + text-indent: -2px; + } + } + + ul.dropdown { + li:hover { + background: #eef8fc; + } + + a { + color: #333; + text-decoration: none; + } + } +} + +#product-variations-matrix .actions-image-uploader { + .dropdown-split( + @_dropdown-split-list-pointer: false + ); + + .action.toggle { + padding: 0 2px; + border: 1px solid #b7b2a7; + background: #fff; + border-radius: 0 4px 4px 0; + border-left: none; + height: 33px; + + &.no-display { + display: none; + } + + &:after { + width: 12px; + text-indent: -5px; + } + } + + ul.dropdown { + left: 0; + margin-left: 0; + width: 100px; + + li:hover { + background: #eef8fc; + } + + a { + color: #333; + text-decoration: none; + } + } +} diff --git a/app/design/adminhtml/Magento/backend/Magento_Theme/css/source/module.less b/app/design/adminhtml/Magento/backend/Magento_Theme/css/source/module.less new file mode 100644 index 0000000000000000000000000000000000000000..d61868bc56c39c96f3f6e974d72dffa41d131ea4 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/Magento_Theme/css/source/module.less @@ -0,0 +1,227 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// @group Header + +@layout-min-width: 960px; +@layout-max-width: 1300px; +@layout-indent: 15px; + +// Base + +body, +html { + height: 100%; + min-height: 100%; +} + +body { + color: @baseColor; + font: @baseFontWeight @baseFontSize/@baseLineHeight @baseFont; + background: @primary7; +} + +.page-wrapper { + display: flex; + flex-direction: column; + min-height: 100%; + width: 100%; + max-width: 100%; + min-width: @layout-min-width + 2 * @layout-indent; +} +.page-header { + &-wrapper { + background-color: @color-dark; + } + &:extend(._layout-width all); + text-align: right; + .clearer(); + .logo { + margin-top: 5px; + float: left; + text-decoration: none; + display: inline-block; + &:before { + content:""; + display: inline-block; + vertical-align: middle; + width: 109px; + height: 35px; + background-image: url("@{baseDir}images/logo.svg"); + background-size: 109px 70px; + background-repeat: no-repeat; + } + &:after { + display: inline-block; + vertical-align: middle; + margin-left: 10px; + content: attr(data-edition); + font-weight: 600; + font-size: 16px; + color: #ef672f; + margin-top:-2px; + } + span { + .visually-hidden(); + } + } + .dropdown-menu { + border: 0; + } +} +.admin-user { + display: inline-block; + vertical-align: top; + position: relative; + text-align: left; + + &-account { + .icon-font( + "\e02c", + @_icon-font: "MUI-Icons", + @_icon-font-size: 13px, + @_icon-font-line-height: 13px, + @_icon-font-margin: -3px 0 0, + @_icon-font-position: after, + ); + display: inline-block; + padding: 12px 14px; + color: @primary7; + &:link, + &:visited { + color: @primary7; + } + &:focus, + &:active, + &:hover { + color: @primary7; + text-decoration: none; + } + .active & { + background-color: #FFF; + color: #676056; + } + } + &-menu { + padding: 15px; + white-space: nowrap; + margin-top: 0; + li { + border: 0; + padding: 0; + &:hover { + background: transparent; + } + } + a { + display: block; + .style6(); + line-height: 1.385; + padding: 3px 12px 3px; + text-decoration: none; + &:hover { + color: @primary4; + background: @defaultButton5; // @todo: color var + text-decoration: none; + } + span:before { + content: "("; + } + span:after { + content: ")"; + } + } + } +} + +.page-actions { + &.fixed &-inner { + &:extend(._layout-width all); + } + &.fixed &-buttons { + padding-right: 15px; + } +} + +.page-content { + &:extend(._layout-width all); + margin-bottom:20px; + .clearer(); +} + +.page-footer { + &-wrapper { + background-color: @color-light; + margin-top: auto; + } + padding: 15px 0; + &:extend(._layout-width all); +} +.footer-legal { + float:right; + width: 550px; + .link-report, + .magento-version, + .copyright { + font-size:13px; + } + &:before { + content:""; + display: inline-block; + vertical-align: middle; + position:absolute; + z-index: 1; + margin-top: 2px; + margin-left: -35px; + width: 30px; + height: 35px; + background-image: url("@{baseDir}images/logo.svg"); + background-position: 0 -35px; + background-size: 109px 70px; + background-repeat: no-repeat; + } +} + +.no-flexboxlegacy { + .page-wrapper { + position: relative; + z-index: 1; + &:after { + content:""; + display:block; + height: 1px; + overflow: hidden; + } + } + .page-content { + margin-bottom: 90px; + + } + .page-footer-wrapper { + position: absolute; + bottom: 0; + width: 100%; + } +} + diff --git a/app/design/adminhtml/Magento/backend/css/admin.css b/app/design/adminhtml/Magento/backend/css/admin.css new file mode 100644 index 0000000000000000000000000000000000000000..197a1281b2280c406708eea34d61d5b68897ecda --- /dev/null +++ b/app/design/adminhtml/Magento/backend/css/admin.css @@ -0,0 +1,4119 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +@font-face { + font-family: 'admin-icons'; + src: url('../fonts/icons/admin-icons.eot'); + src: url('../fonts/icons/admin-icons.eot?#iefix') format('embedded-opentype'), url('../fonts/icons/admin-icons.svg#admin-icons') format('svg'), url('../fonts/icons/admin-icons.woff') format('woff'), url('../fonts/icons/admin-icons.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'MUI-Icons'; + src: url('../mui/fonts/MUI-Icons.eot'); + src: url('../mui/fonts/MUI-Icons.eot?#iefix') format('embedded-opentype'), url('../mui/fonts/MUI-Icons.svg#MUI-Icons') format('svg'), url('../mui/fonts/MUI-Icons.woff') format('woff'), url('../mui/fonts/MUI-Icons.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} +/* @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700 <http://fonts.googleapis.com/css?family=Open+Sans:400italic%2c400%2c600%2c700>); */ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 600; + src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 700; + src: local('Open Sans Bold'), local('OpenSans-Bold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 400; + src: local('Open Sans Italic'), local('OpenSans-Italic'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); +} +h1 { + color: #676056; + font: 400 28px/1.2 'Open Sans', sans-serif; +} +h2 { + color: #676056; + font: 400 20px/1.2 'Open Sans', sans-serif; +} +h3 { + color: #676056; + font: 600 16px/1.2 'Open Sans', sans-serif; +} +h4 { + color: #676056; + font: 600 14px/1.2 'Open Sans', sans-serif; +} +h5 { + color: #676056; + font: 600 13px/1.2 'Open Sans', sans-serif; +} +h6 { + color: #676056; + font: 600 12px/1.2 'Open Sans', sans-serif; +} +a { + display: inline; + color: #026294; + text-decoration: none; +} +a:visited, +a:active { + color: #026294; +} +a:focus, +a:hover { + color: #026294; + text-decoration: underline; +} +body, +html { + height: 100%; + min-height: 100%; +} +body { + background: #f2ebde; +} +.DefaultButton, +.PrimaryButton, +.PrimarySplitButton > .action-toggle.primary { + font: 14px/19px 'Open Sans', sans-serif; + font-weight: 500; + background: #f2ebde; + border: 1px solid #ada89e; + color: #676056; + display: inline-block; + padding: 5px 14px; + text-align: center; + text-decoration: none; + vertical-align: top; + cursor: pointer; + border-radius: 2px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.DefaultButton:hover, +.DefaultButton:focus, +.DefaultButton:active, +.PrimaryButton:hover, +.PrimaryButton:focus, +.PrimaryButton:active, +.PrimarySplitButton > .action-toggle.primary:hover, +.PrimarySplitButton > .action-toggle.primary:focus, +.PrimarySplitButton > .action-toggle.primary:active { + text-decoration: none; + background: #cac3b4; + color: #676056; +} +.DefaultButton:active, +.PrimaryButton:active, +.PrimarySplitButton > .action-toggle.primary:active { + border: 1px solid #989287; +} +.DefaultButton:visited, +.PrimaryButton:visited, +.PrimarySplitButton > .action-toggle.primary:visited { + color: #676056; +} +.DefaultButton[disabled], +.DefaultButton.disabled, +.PrimaryButton[disabled], +.PrimaryButton.disabled, +.PrimarySplitButton > .action-toggle.primary[disabled], +.PrimarySplitButton > .action-toggle.primary.disabled { + cursor: not-allowed; + opacity: 0.5; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); +} +.DefaultButton[disabled]:hover, +.DefaultButton.disabled:hover, +.DefaultButton[disabled]:active, +.DefaultButton.disabled:active, +.PrimaryButton[disabled]:hover, +.PrimaryButton.disabled:hover, +.PrimaryButton[disabled]:active, +.PrimaryButton.disabled:active, +.PrimarySplitButton > .action-toggle.primary[disabled]:hover, +.PrimarySplitButton > .action-toggle.primary.disabled:hover, +.PrimarySplitButton > .action-toggle.primary[disabled]:active, +.PrimarySplitButton > .action-toggle.primary.disabled:active { + color: #676056; + background: #f2ebde; + border: 1px solid #ada89e; +} +.PrimaryButton, +.PrimarySplitButton > .action-toggle.primary { + color: #fff; + background: #007dbd; + border: 1px solid #0574ad; +} +.PrimaryButton:focus, +.PrimaryButton:hover, +.PrimarySplitButton > .action-toggle.primary:focus, +.PrimarySplitButton > .action-toggle.primary:hover { + color: #fff; + background: #026294; + border: 1px solid #026294; +} +.PrimaryButton:active, +.PrimarySplitButton > .action-toggle.primary:active { + color: #fff; + background: #026294; + border: 1px solid #004c74; +} +.PrimaryButton:visited, +.PrimarySplitButton > .action-toggle.primary:visited { + color: #fff; +} +.PrimaryButton[disabled]:hover, +.PrimaryButton.disabled:hover, +.PrimaryButton[disabled]:active, +.PrimaryButton.disabled:active, +.PrimarySplitButton > .action-toggle.primary[disabled]:hover, +.PrimarySplitButton > .action-toggle.primary.disabled:hover, +.PrimarySplitButton > .action-toggle.primary[disabled]:active, +.PrimarySplitButton > .action-toggle.primary.disabled:active { + color: #fff; + background: #007dbd; + border: 1px solid #0574ad; +} +.PrimarySplitButton.btn-round .action-default.primary { + border-radius: 2px 0 0 2px; +} +.PrimarySplitButton.btn-round .action-default.primary:focus { + outline: none; +} +.PrimarySplitButton > .action-default.primary { + border-radius: 2px 0 0 2px; +} +.PrimarySplitButton > .action-default.primary:focus { + outline: none; +} +.PrimarySplitButton > .action-toggle.primary { + overflow: hidden; + z-index: 1; + padding: 0; + border-radius: 0 2px 2px 0; + font-size: 15px; + width: 30px; + height: 31px; + line-height: 30px; + margin-left: -1px; + position: relative; + z-index: 2; + filter: none; +} +.PrimarySplitButton > .action-toggle.primary:focus { + outline: none; +} +.PrimarySplitButton > .action-toggle.primary:before { + text-align: center; +} +.PrimarySplitButton .dropdown-menu { + left: 0; + right: auto; + z-index: 1; +} +.PrimarySplitButton .dropdown-menu > li > .item { + padding: 9px 10px 10px; +} +.PrimarySplitButton.active > .action-toggle.primary, +.PrimarySplitButton.active > .action-toggle.primary:hover { + background: #026294; + border: 1px solid #004c74; +} +.dont-use-this-class-big-size { + font-size: 18px; + line-height: 24px; + padding: 8px 19px; +} +/* + Reset 'button view' for actions +-------------------------------------- */ +.customer-current-activity .action-refresh, +.pager .action-next, +.pager .action-previous, +.pager .action-next:hover, +.pager .action-previous:hover, +.pager .action-next.disabled:focus, +.pager .action-previous.disabled:focus, +.pager .action-next.disabled:active, +.pager .action-previous.disabled:active, +.data-table .action-.delete, +.data-table .action-.delete:hover, +.data-table .action-.delete:active, +.data-table .action-.delete.active, +.data-table .action-delete, +.data-table .action-delete:hover, +.data-table .action-delete:active, +.data-table .action-delete.active, +.data-table .action-locked, +.data-table .action-locked:hover, +.data-table .action-locked:active, +.data-table .action-locked.active, +.data-table .action-locked[disabled], +#product-variations-matrix .action-choose, +#product-variations-matrix .action-choose:hover, +#product-variations-matrix .action-choose:active, +#product-variations-matrix .action-choose.active, +#product-variations-matrix .action-choose[disabled], +.action-manage-images, +.action-manage-images:hover, +.action-manage-images:active, +.action-manage-images.active, +.action-manage-images[disabled], +.image-panel .action-close, +.image-panel .action-close:hover, +.image-panel .action-close:active, +.image-panel .action-close.active, +.image-panel .action-close[disabled], +.image-panel-controls .action-remove, +.image-panel-controls .action-remove:hover, +.image-panel-controls .action-remove:active, +.image-panel-controls .action-remove.active, +.image-panel-controls .action-remove[disabled], +.vde-image-sizing .action-connect, +.vde-image-sizing .action-connect:hover, +.vde-image-sizing .action-connect:active, +.vde-image-sizing .action-connect.active, +.vde-image-sizing .action-connect[disabled], +.suggest-expandable .action-show-all, +.suggest-expandable .action-show-all:hover, +.suggest-expandable .action-show-all:active, +.suggest-expandable .action-show-all.active, +.suggest-expandable .action-show-all[disabled], +.custom-file > .action-add, +.custom-file > .action-add:hover, +.custom-file > .action-add:active, +.custom-file > .action-add.active, +.custom-file > .action-add[disabled], +.vde-tools-header .action-close, +.vde-tools-header .action-close:hover, +.vde-tools-header .action-close:active, +.vde-tools-header .action-close.active, +.image .action-delete, +.image .action-delete:hover, +.image .action-delete:active, +.image .action-delete.active, +.fieldset-wrapper-title .actions .action-delete, +.fieldset-wrapper-title .actions .action-delete:hover, +.fieldset-wrapper-title .actions .action-delete:active, +.fieldset-wrapper-title .actions .action-delete.active, +.address-list-item-actions .action-delete, +.address-list-item-actions .action-delete:hover, +.address-list-item-actions .action-delete:active, +.address-list-item-actions .action-delete.active, +.notification .action-close, +.notification .action-close:hover, +.notification .action-close:active, +.notification .action-close.active, +.page-login .action-forgotpassword, +.page-login .action-forgotpassword:hover, +.page-login .action-forgotpassword:active, +.page-login .action-forgotpassword.active, +.page-login .action-back, +.page-login .action-back:hover, +.page-login .action-back:active, +.page-login .action-back.active, +.attribute-popup .page-actions #reset, +.attribute-popup .page-actions #reset:hover, +.attribute-popup .page-actions #reset:active, +.attribute-popup .page-actions #reset.active, +.attribute-popup .page-actions #reset[disabled] { + border: none; + border-radius: 0; + background: none; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; + filter: none; +} +.attribute-popup .messages { + margin: 0 15px; +} +.data-table .action-.delete[disabled], +.data-table .action-delete[disabled], +.data-table .action-locked[disabled], +#product-variations-matrix .action-choose[disabled], +.image-panel .action-close[disabled], +.image-panel-controls .action-remove[disabled], +.suggest-expandable .action-show-all[disabled], +#store-view-window [class^='action-close'], +#store-view-window [class^='action-close']:hover, +#store-view-window [class^='action-close']:active, +#store-view-window [class^='action-close'].active, +#store-view-window [class^='action-close'][disabled], +.custom-file > .action-add[disabled], +.image .action-delete, +.image .action-delete:hover, +.image .action-delete:active, +.image .action-delete.active, +.fieldset-wrapper-title .actions .action-delete, +.fieldset-wrapper-title .actions .action-delete:hover, +.fieldset-wrapper-title .actions .action-delete:active, +.fieldset-wrapper-title .actions .action-delete.active, +.address-list-item-actions .action-delete, +.address-list-item-actions .action-delete:hover, +.address-list-item-actions .action-delete:active, +.address-list-item-actions .action-delete.active, +.notification .action-close, +.notification .action-close:hover, +.notification .action-close:active, +.notification .action-close.active { + border: none; + border-radius: 0; + background: none; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; + filter: none; +} +.fade.critical-notification { + display: block; +} +.fade.critical-notification .popup { + top: 200px; +} +.data-table .action-.delete[disabled], +.data-table .action-delete[disabled], +.data-table .action-locked[disabled], +#product-variations-matrix .action-choose[disabled], +.image-panel .action-close[disabled], +.image-panel-controls .action-remove[disabled], +.suggest-expandable .action-show-all[disabled], +#store-view-window [class^='action-close'], +#store-view-window [class^='action-close']:hover, +#store-view-window [class^='action-close']:active, +#store-view-window [class^='action-close'].active, +#store-view-window [class^='action-close'][disabled], +.custom-file > .action-add[disabled], +.vde-tools-header .action-close[disabled], +.vde-image-sizing .action-reset, +.vde-image-sizing .action-reset:hover, +.vde-image-sizing .action-reset:active, +.vde-image-sizing .action-reset.active, +.vde-image-sizing .action-reset[disabled], +.image .action-delete[disabled], +.fieldset-wrapper-title .actions .action-delete[disabled], +.address-list-item-actions .action-delete[disabled], +.notifications [class^="action-"], +.notifications [class^="action-"]:hover, +.notifications [class^="action-"]:active, +.notifications [class^="action-"].active, +.notifications [class^="action-"][disabled], +.notification .action-close, +.notification .action-close:hover, +.notification .action-close:active, +.notification .action-close.active, +.notification .action-close[disabled] { + border: 0; + border-radius: 0; + background: none; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; + filter: none; +} +.vde-image-sizing .action-connect, +.vde-image-sizing .action-connect:hover, +.vde-image-sizing .action-connect:active, +.vde-image-sizing .action-connect.active, +.vde-image-sizing .action-connect[disabled], +.vde-tab-data .action-download, +.vde-tab-data .action-download:hover, +.vde-tab-data .action-download:active, +.vde-tab-data .action-download.active, +.vde-tab-data .action-download[disabled], +.vde-tab-data .action-delete, +.vde-tab-data .action-delete:hover, +.vde-tab-data .action-delete:active, +.vde-tab-data .action-delete.active, +.vde-tab-data .action-delete[disabled], +.vde-tab-data .action-edit, +.vde-tab-data .action-edit:hover, +.vde-tab-data .action-edit:active, +.vde-tab-data .action-edit.active, +.vde-tab-data .action-edit[disabled] { + border: none; + border-radius: 0; + background: none; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; +} +/* + Actions as links +-------------------------------------- */ +.notification-entry-dialog .action-cancel, +.attribute-popup .page-actions #reset { + background: none; + border: none; + color: #6d665e; + font-weight: normal; + font-size: 12px; + cursor: pointer; + text-decoration: underline; +} +.notification-entry-dialog .action-cancel:hover, +.attribute-popup .page-actions #reset:hover { + color: #000; + border-bottom-color: #000; + filter: none; +} +/* + Fileupload button +-------------------------------------- */ +.action-upload { + position: relative; +} +.action-upload > input[type="file"] { + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + opacity: 0; + font-size: 10em; +} +/* + Dropdown menu +-------------------------------------- */ +.dropdown-menu, +.ui-autocomplete { + position: absolute; + display: none; + list-style: none; + min-width: 100px; + margin: 1px 0 0 0; + padding: 0; + right: 0; + top: 100%; + border: 1px solid #cac2b5; + background: #fff; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); + z-index: 990; +} +.dropdown-menu > li, +.ui-autocomplete > li { + padding: 5px; + border-bottom: 1px solid #e5e5e5; +} +.dropdown-menu > li.selected, +.ui-autocomplete > li.selected { + background: #eef8fc; +} +.dropdown-menu > li:hover, +.ui-autocomplete > li:hover { + background: #eef8fc; +} +.dropdown-menu > li:last-child, +.ui-autocomplete > li:last-child { + border-bottom: none; +} +.dropdown-menu > li > .item, +.ui-autocomplete > li > .item { + cursor: pointer; +} +.dropdown-menu-top { + margin: 0 0 3px 0; + top: auto; + bottom: 100%; +} +.ui-autocomplete { + right: auto; +} +.ui-autocomplete > li { + padding: 0; +} +.ui-autocomplete > li > a { + display: block; + padding: 5px; +} +.ui-autocomplete > li > a.level-0 { + padding-left: 5px !important; +} +.ui-autocomplete .ui-state-focus { + background: #f5f5f5; +} +.active .dropdown-menu { + display: block; +} +/* + Actions Dropdown +-------------------------------------- */ +.action-dropdown { + text-align: left; + position: relative; + display: inline-block; +} +.action-dropdown > [class^='action-'] { + float: left; + border-radius: 0; +} +.action-dropdown > .action-default { + border-radius: 5px 0 0 5px; +} +.action-dropdown > .action-toggle { + border-left: 1px solid #c5c0b9; + border-radius: 0 5px 5px 0; + margin-left: -1px; + padding: 4px 7px; +} +.action-dropdown > .action-toggle > span { + display: none; +} +.action-dropdown > .action-toggle:before { + display: block; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02c'; + /* arrow down */ + font-size: 11px; +} +.action-dropdown > .action-toggle.active:before { + content: '\e029'; + /* arrow up */ +} +.action-dropdown > .action-toggle.primary { + border-left: 1px solid #e1721d; +} +.action-dropdown > .action-toggle.primary:hover { + background: #e2701a; + margin-left: -1px; +} +.action-dropdown.active .dropdown-menu { + display: block; + white-space: nowrap; +} +.action-dropdown.active .dropdown-menu > li { + padding: 0; +} +.action-dropdown .dropdown-menu > li > .item { + display: block; + padding: 6px 10px 5px; + color: #333; + text-decoration: none; +} +/* + Action delete icon +-------------------------------------- */ +/* TODO: replase ".action-.delete" to ".action-delete" after buttons refactoring */ +.data-table .action-.delete span, +.data-table .action-delete span, +.data-table .action-locked span, +.image .action-delete span, +.fieldset-wrapper-title .actions .action-delete span, +.address-list-item-actions .action-delete span { + display: none; +} +.data-table .action-.delete:before, +.data-table .action-delete:before, +.image .action-delete:before, +.fieldset-wrapper-title .actions .action-delete:before, +.address-list-item-actions .action-delete:before { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + font-size: 18px; + -webkit-font-smoothing: antialiased; + content: '\e07f'; + /* delete icon */ + color: #b7b3ad; +} +/* + Locked action icon +-------------------------------------- */ +.data-table .action-locked:before { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + font-size: 20px; + -webkit-font-smoothing: antialiased; + content: '\e03e'; + /* lock icon */ + color: #b7b3ad; +} +.data-table .action-.delete:hover:before, +.data-table .action-delete:hover:before, +.data-table .action-locked:hover:before, +.image .action-delete:hover:before, +.fieldset-wrapper-title .actions .action-delete:hover:before, +.address-list-item-actions .action-delete:hover:before { + color: #7e7e7e; +} +.data-table input.action-.delete[type="button"], +.data-table input.action-.delete[type="submit"], +.data-table input.action-.delete[type="reset"], +.data-table button.action-.delete, +.data-table input.action-.delete[type="button"]:visited, +.data-table input.action-.delete[type="submit"]:visited, +.data-table input.action-.delete[type="reset"]:visited, +.data-table button.action-.delete:visited, +.data-table input.action-.delete[type="button"]:hover, +.data-table input.action-.delete[type="submit"]:hover, +.data-table input.action-.delete[type="reset"]:hover, +.data-table button.action-.delete:hover, +.data-table input.action-.delete[type="button"]:active, +.data-table input.action-.delete[type="submit"]:active, +.data-table input.action-.delete[type="reset"]:active, +.data-table button.action-.delete:active { + background: transparent; + padding: 3px 7px 0; +} +.data-table input.action-.delete[type=button]:hover:before, +.data-table input.action-.delete[type=submit]:hover:before, +.data-table input.action-.delete[type=reset]:hover:before, +.data-table button.action-.delete:hover:before, +.data-table input.action-.delete[type=button]:focus:before, +.data-table input.action-.delete[type=submit]:focus:before, +.data-table input.action-.delete[type=reset]:focus:before, +.data-table button.action-.delete:focus:before { + background: transparent; + color: #a5a29d; +} +/* + Forms +-------------------------------------- */ +fieldset { + border: 1px solid #ccc; + padding: 20px; +} +legend { + padding: 0 10px; + margin: 0 -10px; +} +fieldset legend + br { + display: none; +} +label { + display: inline-block; +} +label > input[type="radio"], +label > input[type="checkbox"] { + margin: -3px 3px 0 0; + vertical-align: middle; +} +input[type=text], +input[type=password], +input[type=datetime], +input[type=datetime-local], +input[type=date], +input[type=month], +input[type=time], +input[type=week], +input[type=number], +input[type=range], +input[type=email], +input[type=url], +input[type=search], +input.search, +input[type=tel], +input[type=color], +textarea, +.input-text { + display: inline-block; + padding: 4px; + margin: 0; + background-color: #fff; + height: 28px; + color: #676056; + font-size: 14px; + font-weight: 400; + border: 1px solid #ccc; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border-radius: 4px; + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); +} +textarea, +.input-text { + height: auto; +} +textarea { + resize: vertical; +} +select { + height: 28px; + padding: 4px 4px 5px; + margin: 0 0 8px; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +select[multiple], +select[size] { + height: auto; +} +input[type=text]:focus, +input[type=password]:focus, +input[type=datetime]:focus, +input[type=datetime-local]:focus, +input[type=date]:focus, +input[type=month]:focus, +input[type=time]:focus, +input[type=week]:focus, +input[type=number]:focus, +input[type=range]:focus, +input[type=email]:focus, +input[type=url]:focus, +input[type=search]:focus, +input.search:focus, +input[type=tel]:focus, +input[type=color]:focus, +textarea:focus, +select:focus { + outline: 0; + border-color: #75b9f0; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); +} +input[type="radio"], +input[type="checkbox"] { + margin: 3px 0; + line-height: normal; +} +input[disabled], +select[disabled], +textarea[disabled], +input[readonly], +select[readonly], +textarea[readonly] { + cursor: not-allowed; + background-color: #fff; + border-color: #eee; + box-shadow: none; + color: #999; +} +select[disabled].multiselect > option[selected] { + color: #fff; + background: #6d6d6d; +} +textarea:-moz-placeholder, +input:-moz-placeholder { + color: #999 !important; + font-style: italic; +} +option.placeholder { + color: #999 !important; + font-style: italic !important; +} +:-ms-input-placeholder { + color: #999 !important; + font-style: italic; +} +::-webkit-input-placeholder { + color: #999 !important; +} +:-moz-placeholder { + color: #999 !important; +} +.form-inline .control { + width: 100%; +} +.form-inline .label { + width: 20%; + padding-top: 6px; +} +.form-inline .label ~ .control { + width: 60%; +} +.form-inline .no-label .control { + margin-left: 20%; + width: 60%; +} +fieldset.field [class^='fields-group-'] .field .control { + width: auto; + margin: 0 0 0 20px; +} +.form-inline .field-service { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + float: left; + width: 20%; + padding: 7px 0 0 15px; + color: #999; + font-size: 12px; + letter-spacing: 0.05em; +} +.form-inline .field-service[value-scope]:before { + content: attr(value-scope) !important; + white-space: nowrap; + display: block; + margin-bottom: 5px; +} +.form-inline .field-service .checkbox { + margin: 0; + vertical-align: middle; +} +.control > input { + width: 100%; +} +.control > input[type="button"] { + width: auto; +} +.control > input.hasDatepicker { + width: 160px; +} +.control > input[type="radio"], +.control > input[type="checkbox"], +.control > input[type="file"] { + width: auto; +} +.control > table { + width: 100%; +} +.multi-input { + margin: 0 0 20px; +} +.multi-input > input { + width: 100%; +} +.control .input-file { + margin-top: 4px; +} +/* TODO: remove styles for images when images will be replaced by font icons */ +.control .hasDatepicker + img { + margin: -3px 0 0 5px; + vertical-align: middle; +} +.nobr { + white-space: nowrap; +} +/* + Form Validation +-------------------------------------- */ +label.mage-error { + display: block; + color: red; + text-align: left; + clear: both; + margin: 3px 0 0 0; +} +textarea.mage-error, +select.mage-error, +input.mage-error { + border-color: #fa7973 !important; + box-shadow: 0 0 8px rgba(250, 121, 115, 0.6) !important; +} +input.mage-error ~ .addafter { + border-color: #fa7973 !important; + box-shadow: 0 0 8px rgba(250, 121, 115, 0.6) !important; +} +/* + Forms for Store Scope +-------------------------------------- */ +.form-inline .field-store_id .label + .control, +.form-inline .field-store_ids .label + .control, +.form-inline .field-website_ids .label + .control, +.form-inline .field-website_id .label + .control, +.form-inline .field-select_stores .label + .control, +.form-inline .field-stores .label + .control { + width: auto; +} +/* + Forms styles +-------------------------------------- */ +.page-content-inner { + position: relative; + background: #f5f2ed; + border: 1px solid #b7b2a6; + border-radius: 5px; + padding: 20px; +} +.fieldset-wrapper, +.fieldset { + background: #fff; + border: 1px solid #eae6e0; + border-radius: 5px; + margin: 0 0 8px; + padding: 5px 18px 18px; + position: relative; +} +.fieldset-wrapper > .fieldset-wrapper-title, +.fieldset > .legend { + position: static; + float: left; + width: 100%; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + padding: 0; + border-bottom: 1px solid #ededed; + margin: 0 0 18px; +} +.fieldset-wrapper > .fieldset-wrapper-title { + float: none; +} +.fieldset-wrapper > .fieldset-wrapper-title .title, +.fieldset > .legend span { + color: #676056; + font-size: 20px; + font-weight: 400; + padding: 7px 0 10px; + display: inline-block; +} +/* Collapsable fieldset-wrapper */ +.collapsable-wrapper { + padding-bottom: 2px; +} +.collapsable-wrapper.opened { + padding-bottom: 18px; +} +.collapsable-wrapper > .fieldset-wrapper-title { + border-bottom: none; + margin-bottom: 0; +} +.collapsable-wrapper.opened > .fieldset-wrapper-title { + border-bottom: 1px solid #ededed; + margin-bottom: 18px; +} +.collapsable-wrapper .fieldset-wrapper-title > .title { + position: relative; + padding-left: 22px; + cursor: pointer; + float: left; +} +.collapsable-wrapper .fieldset-wrapper-title > .title:before { + position: absolute; + left: 0; + top: 7px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02a'; + /* arrow right icon */ + color: #b2b0ad; +} +.collapsable-wrapper.opened > .fieldset-wrapper-title > .title:before { + content: '\e02c'; + /* arrow down icon */ +} +.collapsable-wrapper .fieldset-wrapper-title > .title:hover:before { + color: #7e7e7e; +} +/* Fieldset styles in another fieldset */ +.fieldset .fieldset-wrapper, +.fieldset-wrapper .fieldset-wrapper { + border-color: #cccbca; + padding: 0; +} +.fieldset .fieldset-wrapper .fieldset-wrapper-title, +.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title { + background: #f4f2ef; + background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y0ZjJlZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWViZTYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); + background: -moz-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f2ef), color-stop(100%, #eeebe6)); + background: -webkit-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); + background: -o-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); + background: -ms-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); + background: linear-gradient(to bottom, #f4f2ef 0%, #eeebe6 100%); + padding: 0 18px; + border-radius: 5px; +} +.fieldset .fieldset-wrapper.opened .fieldset-wrapper-title, +.fieldset-wrapper .fieldset-wrapper.opened .fieldset-wrapper-title { + border-radius: 5px 5px 0 0; + border-bottom: 1px solid #cccbca; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + min-height: 39px; +} +.fieldset .fieldset-wrapper .fieldset-wrapper-title .actions, +.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .actions { + padding: 10px 2px 0 0; +} +.fieldset .fieldset-wrapper .fieldset-wrapper-title .title, +.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .title { + padding-top: 9px; + padding-bottom: 8px; + color: #555; + font: normal 16px/1.333 Arial, Verdana, sans-serif; +} +.fieldset .fieldset-wrapper .fieldset-wrapper-title .title:before, +.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .title:before { + top: 9px; +} +.fieldset-wrapper-content .fieldset > .title { + margin-top: 0; + padding-left: 22px; +} +.fieldset-wrapper .draggable-handle, +.fieldset .draggable-handle { + width: 8px; + height: 14px; + line-height: 14px; + background: url(Magento_Backend::images/draggable-handle-vertical.gif) no-repeat 0 0; + cursor: ns-resize; + color: #b2b0ad; +} +.fieldset-wrapper-title > .draggable-handle { + position: absolute; + left: 10px; + top: 12px; +} +.fieldset .fieldset-wrapper .fieldset-wrapper-content, +.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-content { + padding: 0 10px; +} +/* Sortable fieldsets */ +.ui-sortable .entry-edit .fieldset-wrapper-title, +#product_options_container_top .fieldset-wrapper-title { + padding-left: 30px; +} +.fieldset-wrapper-title > .actions, +.fieldset .legend > .actions { + float: right; + padding-top: 8px; +} +.fieldset > .legend + br { + display: block; + height: 0; + overflow: hidden; + clear: left; +} +.fieldset-wrapper .fieldset, +.fieldset .fieldset { + background: transparent; + padding: 9px 0; + border: none; + border-radius: 0; + margin: 0 0 29px; +} +.fieldset .comment { + margin: 0 0 29px 10px; +} +.fieldset .field { + margin: 0 0 29px; +} +.with-note .note, +.field .note { + color: #676056; + font-size: 12px; + font-weight: 400; +} +.fieldset .field .options-list { + list-style: none; + margin: 0; + padding: 0; +} +.fieldset .field .options-list input[type="checkbox"], +.fieldset .field .options-list input[type="radio"] { + margin-right: 5px; +} +[class^="fields-group-"] .field { + margin-bottom: 0; +} +.fieldset-wrapper .fieldset:last-child, +.fieldset .fieldset:last-child, +.fieldset .field:last-child { + margin-bottom: 0; +} +.fieldset .label { + color: #676056; + font-size: 13px; + font-weight: 600; +} +.fieldset .control .label { + color: #676056; + font-size: 14px; + font-weight: 400; +} +.field.required > .label:after { + color: #e22626; + font-size: 13px; + font-weight: 400; +} +.with-addon .textarea { + margin: 0 0 6px; +} +.fieldset .control .textarea, +.fieldset .control .addon .textarea { + border-radius: 4px; + width: 100%; +} +.fieldset > .field > input[type="checkbox"] { + margin-top: 12px; +} +.fieldset-alt { + position: relative; + display: table-row; + border: 0; + padding: 0; + margin-bottom: 20px; + width: 100%; +} +.fieldset-alt > .field { + display: table-cell; + vertical-align: top; + padding-right: 4%; +} +.fieldset-alt > .field.no-display { + display: none; +} +.fieldset-alt .field > .label { + display: block; + width: 100%; + clear: both; + text-align: left; + margin: 0 0 10px; +} +.fieldset-alt .label + .control { + width: 100%; +} +.fieldset-alt .field-option-title { + width: 50%; +} +.fieldset .tooltip .help { + margin: 7px 0 0 15px; +} +.fieldset-alt .field-option-store-view { + width: 20%; +} +.fieldset-alt .field-option-input-type { + width: 20%; +} +.fieldset-alt .field-option-input-type select { + width: 100%; +} +.fieldset-alt .field-option-req { + width: 105px; + white-space: nowrap; +} +.fieldset-alt .field-option-req .control { + position: relative; + top: 32px; +} +.fieldset-alt .field-option-position, +.fieldset-alt .field-option-position .control { + width: 60px; +} +/* "Use default" checkbox */ +.use-default-control { + display: none; +} +.use-default-label { + cursor: pointer; + text-decoration: underline; + font-size: 11px; + color: #a29c94; +} +.use-default-label:hover { + color: #7e7e7e; +} +/* + Custom Multiselect +-------------------------------------- */ +.multiselect-alt { + margin: 0; + padding: 0; + list-style: none; + border: 1px solid #ccc; + border-radius: 5px; + color: #333; +} +.multiselect-alt .item { + position: relative; + border-top: 1px solid #fff; + cursor: pointer; +} +.multiselect-alt .item:first-child { + border-top: 0; +} +.multiselect-alt .item.selected { + background: #d7ebf5; +} +.multiselect-alt .item.selected:hover { + background: #afdef2; +} +.multiselect-alt label { + display: block; + cursor: pointer; + padding: 6px 25px 5px; +} +.multiselect-alt .item.selected label:before { + position: absolute; + left: 8px; + top: 1px; + bottom: 0; + width: 10px; + line-height: 28px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e01e'; + /* checked icon */ + text-align: center; + color: #7ba4b1; + font-size: 9px; + text-shadow: 0 -1px 1px #60727b; +} +.multiselect-alt input[type="checkbox"] { + width: 0; + height: 0; + opacity: 0; + margin: 0; + padding: 0; +} +/* + Form item with table +-------------------------------------- */ +.with-table .label { + float: none; + text-align: left; + width: 100%; +} +.with-table .control { + clear: left; + float: none; + width: 100%; +} +/* + Form currency label +-------------------------------------- */ +.addon input { + border-width: 1px 0 1px 1px; +} +.addon input:focus ~ .addafter { + border-color: #75b9f0; + box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); +} +.addon input ~ .addafter strong { + display: inline-block; + background: #fff; + line-height: 24px; + margin: 0 3px 0 -2px; + padding-left: 4px; + padding-right: 4px; + position: relative; + font-size: 12px; + top: 0; +} +.addon input:focus ~ .addafter strong { + margin-top: 0; +} +.addon .addafter { + background: none; + color: #a6a6a6; + border-width: 1px 1px 1px 0; + border-radius: 4px 4px 0 0; + padding: 0; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.075) inset; +} +.field .control input[type='text'][disabled], +.field .control input[type='text'][disabled] ~ .addafter, +.field .control select[disabled], +.field .control select[disabled] ~ .addafter { + background-color: #fff; + border-color: #eee; + box-shadow: none; + color: #999; +} +.field .control input[type='text'][disabled] ~ .addafter strong, +.field .control select[disabled] ~ .addafter strong { + background-color: #fff; +} +.field.type-price .addon, +.field-price .addon, +.field-special_price .addon, +.field-msrp .addon { + direction: rtl; +} +.field.type-price .addon > *, +.field-price .addon > *, +.field-special_price .addon > *, +.field-msrp .addon > * { + direction: ltr; +} +.field.type-price .addon .addafter, +.field-price .addon .addafter, +.field-special_price .addon .addafter, +.field-msrp .addon .addafter { + border-width: 1px 0 1px 1px; + border-radius: 4px 0 0 4px; +} +.field.type-price .addon input:first-child, +.field-price .addon input:first-child, +.field-special_price .addon input:first-child, +.field-msrp .addon input:first-child { + border-radius: 0 4px 4px 0; +} +.field.type-price input, +.field-price input, +.field-special_price input, +.field-msrp input { + border-width: 1px 1px 1px 0; + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.075) inset; +} +.field.type-price input:focus, +.field-price input:focus, +.field-special_price input:focus, +.field-msrp input:focus { + box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); +} +.field.type-price input:focus ~ label.addafter, +.field-price input:focus ~ label.addafter, +.field-special_price input:focus ~ label.addafter, +.field-msrp input:focus ~ label.addafter { + box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); +} +.field.type-price input ~ label.addafter strong, +.field-price input ~ label.addafter strong, +.field-special_price input ~ label.addafter strong, +.field-msrp input ~ label.addafter strong { + margin-left: 2px; + margin-right: -2px; +} +/* + Calendar +-------------------------------------- */ +.ui-datepicker { + z-index: 998 !important; +} +.ui-datepicker .ui-datepicker-calendar td { + padding: 0; +} +.ui-datepicker .ui-datepicker-calendar th { + background: #efefef; + border: 1px solid #cfcfcf; + padding: 4px; + color: #676056; + font-weight: bold; +} +.ui-datepicker-calendar tbody tr td, +.ui-datepicker-calendar tbody tr:nth-child(2n+1) td { + background: #fff; +} +.ui-datepicker .ui-datepicker-prev span, +.ui-datepicker .ui-datepicker-next span { + margin-top: -1px; +} +/* + Details element +-------------------------------------- */ +summary { + cursor: pointer; + display: inline-block; +} +.no-details details > * { + display: none; +} +.no-details details > summary:before { + float: left; + width: 20px; + content: 'â–º '; +} +.no-details details.open > summary:before { + content: 'â–¼ '; +} +.no-details details summary { + display: block; +} +/* + Blockquotes +-------------------------------------- */ +blockquote { + border-left: 2px solid #ccc; + padding-left: 5px; +} +blockquote small:before { + content: '\2014 \00A0'; +} +/* + Addresses +-------------------------------------- */ +address { + font-style: normal; +} +/* + Tables +-------------------------------------- */ +table > caption { + margin-bottom: 5px; +} +table tfoot, +table th { + background: #e6e6e6; +} +table tfoot, +table thead { + background: #666158; + color: #cac3b4; +} +table thead.active { + /*background:#F37B21;*/ +} +table th { + text-align: left; + background: transparent; + font-weight: normal; +} +table th, +table td { + border: 1px solid #C0BBAF; + padding: 6px 10px 7px; +} +table tbody tr td { + background: #F5F2ED; + color: #676056; + padding-top: 12px; +} +table tbody tr:not(:last-child) td { + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; +} +table .dropdown-menu li { + padding: 7px 15px; + line-height: 14px; + cursor: pointer; +} +table tbody tr td:first-child input[type="checkbox"] { + margin: 0; +} +table tbody tr:nth-child(odd) td, +table tbody tr:nth-child(odd) th { + background-color: #E6E3DE; +} +table tbody tr.selected td, +table tbody tr.selected th { + border: 1px solid #C0BBAF; +} +table tbody tr.selected td, +table tbody tr.selected th, +table tbody tr:hover td, +table tbody tr:hover th, +table tbody tr:nth-child(odd):hover td, +table tbody tr:nth-child(odd):hover th { + background-color: #fff; +} +/* + X-tree styles +-------------------------------------- */ +.x-tree-node .leaf .x-tree-node-icon { + background-image: url(../images/fam_leaf.png); +} +.x-tree-node .system-leaf .x-tree-node-icon { + background-image: url(../images/fam_application_form_delete.png); +} +.x-tree-node-ct { + overflow: hidden; +} +/* + Styles for "js" tooltip with positionings +-------------------------------------- */ +.tipsy { + padding: 11px; +} +.tipsy-inner { + padding: 12px 15px; + max-width: 185px; + background: #faf8f6; + border: 1px solid #dcd8ce; + box-shadow: 0 2px 5px rgba(49, 48, 43, 0.4); +} +.tipsy-inner .error { + width: 158px; +} +.tipsy-inner .error h5 { + color: #be0a0a; + font-size: 16px; + font-weight: 500; + margin: 0 0 6px 0; +} +.tipsy-inner .error p { + color: #676056; + line-height: 1.5; + margin: 0; +} +.tipsy-e .tipsy-arrow { + top: 50%; + left: 1px; + margin-top: -10px; + border-top: 10px solid transparent; + border-right: 10px solid #dcd8ce; + border-bottom: 10px solid transparent; + border-left: none; +} +.tipsy-w .tipsy-arrow { + top: 50%; + right: 0; + margin-top: -10px; + border-top: 10px solid transparent; + border-right: none; + border-bottom: 10px solid transparent; + border-left: 10px solid #dcd8ce; +} +.tipsy-n .tipsy-arrow, +.tipsy-ne .tipsy-arrow, +.tipsy-nw .tipsy-arrow { + bottom: 1px; + border-top: 10px solid #dcd8ce; + border-right: 10px solid transparent; + border-bottom: none; + border-left: 10px solid transparent; +} +.tipsy-ne .tipsy-arrow { + left: 16px; +} +.tipsy-nw .tipsy-arrow { + right: 16px; +} +.tipsy-s .tipsy-arrow, +.tipsy-se .tipsy-arrow, +.tipsy-sw .tipsy-arrow { + top: 1px; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-bottom: 10px solid #dcd8ce; + border-top: none; +} +.tipsy-se .tipsy-arrow { + left: 16px; +} +.tipsy-sw .tipsy-arrow { + right: 16px; +} +.tipsy-arrow:after, +.tipsy-arrow:before { + position: absolute; + width: 0; + height: 0; + content: ''; +} +.tipsy-e .tipsy-arrow:after { + top: -5px; + left: 2px; + margin-top: -4px; + border-top: 9px solid transparent; + border-right: 9px solid #faf8f6; + border-bottom: 9px solid transparent; +} +.tipsy-e .tipsy-arrow:before { + top: -8px; + margin-top: 0; + border-top: 10px solid transparent; + border-right: 10px solid rgba(49, 48, 43, 0.1); + border-bottom: 10px solid transparent; +} +.tipsy-w .tipsy-arrow:after { + top: -5px; + left: -12px; + margin-top: -4px; + border-top: 9px solid transparent; + border-right: none; + border-bottom: 9px solid transparent; + border-left: 9px solid #faf8f6; +} +.tipsy-w .tipsy-arrow:before { + top: -8px; + left: -10px; + margin-top: 0; + border-top: 10px solid transparent; + border-right: none; + border-bottom: 10px solid transparent; + border-left: 10px solid rgba(49, 48, 43, 0.1); +} +.tipsy-n .tipsy-arrow:after, +.tipsy-ne .tipsy-arrow:after, +.tipsy-nw .tipsy-arrow:after { + margin-top: -4px; + left: -9px; + top: -7px; + border-top: 9px solid #faf8f6; + border-right: 9px solid transparent; + border-left: 9px solid transparent; +} +.tipsy-n .tipsy-arrow:before, +.tipsy-ne .tipsy-arrow:before, +.tipsy-nw .tipsy-arrow:before { + left: -10px; + top: -8px; + margin-top: 0; + border-top: 10px solid rgba(49, 48, 43, 0.1); + border-right: 10px solid transparent; + border-left: 10px solid transparent; +} +.tipsy-s .tipsy-arrow:after, +.tipsy-sw .tipsy-arrow:after, +.tipsy-se .tipsy-arrow:after { + left: -9px; + top: 6px; + margin-top: -4px; + border-top: none; + border-right: 9px solid transparent; + border-bottom: 9px solid #faf8f6; + border-left: 9px solid transparent; +} +.tipsy-inner dl { + margin: 0; +} +.tipsy-inner dt { + margin: 0 0 4px; + font-size: 16px; + font-weight: 400; + color: #f47b20; +} +.tipsy-inner dd { + margin: 0; + color: #676056; + font-size: 12px; + line-height: 18px; + font-family: Arial, Helvetica, sans-serif; +} +/* + Popups +-------------------------------------- */ +.fade .popup { + padding: 0; + border: 5px solid #969288; + border-radius: 8px; +} +.wrapper-popup { + padding: 0 10px; +} +.fade .popup .popup-inner { + padding: 20px; + border-radius: 3px; +} +.fade .popup .popup-title { + margin: 0 0 10px; +} +.popup-loading { + position: fixed; + z-index: 1003; + width: 200px; + background: rgba(255, 255, 255, 0.8); + left: 50%; + top: 40%; + margin-left: -100px; + color: #d85909; + border-color: #d85909; + font-size: 14px; + font-weight: bold; + text-align: center; + padding: 100px 0 10px; +} +.popup-loading:after { + position: absolute; + left: 50%; + top: 40%; + background-image: url(../mui/images/ajax-loader-big.gif); + width: 64px; + height: 64px; + margin: -32px 0 0 -32px; + content: ''; + z-index: 2; +} +/* Loading mask */ +.loading-old, +.loading-mask { + background: rgba(255, 255, 255, 0.4); + z-index: 999; +} +.loading-old, +.loading-mask { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; +} +.loading-old .loader, +.loading-mask .loader { + position: absolute; + margin: auto; + left: 0; + top: 0; + right: 0; + bottom: 0; + width: 160px; + height: 160px; + color: #5e5b56; + font-size: 14px; + font-weight: bold; + text-align: center; + background: #e5e2dd url(../mui/images/ajax-loader-big.gif) no-repeat 50% 30%; + border-radius: 5px; + opacity: .95; +} +.loading-mask img { + display: none; +} +.loading-old p, +.loading-mask p { + margin-top: 118px; +} +/* Backup popup */ +/* TODO: remove after backups page js refactoring */ +.backup-dialog { + margin-top: inherit !important; +} +/* + Login page +-------------------------------------- */ +.page-login { + height: 100%; +} +.page-login .wrapper { + min-height: 100%; + padding: 0; +} +.page-login .wrapper-inner { + overflow: auto; + padding-bottom: 140px; +} +.page-login .footer { + clear: both; + height: 100px; + margin-top: -100px; + position: relative; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.page-login .footer-content { + max-width: none; + min-width: 0; +} +.page-login .footer-copyright { + text-align: left; +} +.page-login .form-login { + width: 280px; + margin: 160px auto 60px; + padding: 30px 25px; + border: 1px solid #e3ded5; + border-radius: 5px; + background: #f7f2ec; +} +.page-login .fieldset { + background: transparent; + border: 0; + border-radius: 0; + margin: 0; + padding: 0; +} +.page-login .fieldset > .legend { + border-bottom: 0; + margin-bottom: 15px; +} +.page-login .fieldset > .legend span { + font-size: 32px; + line-height: 32px; + padding: 0; + color: #8a847c; + display: inline; +} +.page-login .fieldset .field { + margin: 0 0 13px; +} +.page-login .form-inline .label { + width: auto; + padding: 0; + margin-bottom: 13px; +} +.page-login .field-username label, +.page-login .field-password label, +.page-login .field-confirmation label { + display: none; +} +.page-login .form-inline .label + .control { + width: auto; + float: none; +} +.page-login .header { + margin-bottom: 30px; + background: transparent; + padding: 0; + z-index: auto; + position: static; +} +.page-login .header .logo { + display: block; + width: 262px; + height: 64px; + text-indent: -999em; + background: url(Magento_Backend::images/logo-magento.png) no-repeat; +} +.page-login button { + border-radius: 2px; +} +.page-login button:not(.primary) { + background-image: none; + background-color: #f7f3eb; + padding: 0 13px; + color: #676056; + border: 1px solid #ada89e; + cursor: pointer; + display: inline-block; + font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: 500; + line-height: 26px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + vertical-align: middle; +} +.page-login button:not(.primary):focus, +.page-login button:not(.primary):active { + background-color: #cac3b4; + border: 1px solid #989287; + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.page-login button:not(.primary):hover { + background-color: #cac3b4; +} +.page-login button:not(.primary).disabled, +.page-login button:not(.primary)[disabled] { + cursor: default; + pointer-events: none; + opacity: 0.5; +} +.page-login button.primary { + background-image: none; + background-color: #007dbd; + padding: 0 13px; + color: #ffffff; + border: 1px solid #0a6c9f; + cursor: pointer; + display: inline-block; + font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: 500; + line-height: 26px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + vertical-align: middle; +} +.page-login button.primary:focus, +.page-login button.primary:active { + background-color: #026294; + border: 1px solid #004c74; + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + color: #ffffff; +} +.page-login button.primary:hover { + background-color: #026294; + border: 1px solid #026294; +} +.page-login button.primary.disabled, +.page-login button.primary[disabled] { + cursor: default; + pointer-events: none; + opacity: 0.5; +} +.page-login .form-actions { + padding: 0; + margin: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.page-login .actions, +.page-login .links { + display: inline-block; + vertical-align: middle; +} +.page-login input[type=text], +.page-login input[type=password] { + border-color: #cac3b4; + font-size: 18px; + padding: 12px 12px 14px; + height: auto; +} +.page-login :-ms-input-placeholder { + color: #bebab1 !important; +} +.page-login ::-webkit-input-placeholder { + color: #bebab1 !important; +} +.page-login :-moz-placeholder { + color: #bebab1 !important; +} +.page-login button.action-login, +.page-login button.action-retrieve { + font-size: 22px; + padding: 14px 22px 16px; +} +.page-login button.action-retrieve, +.page-login button.action-reset { + font-size: 18px; + padding: 10px 17px 10px; +} +.page-login .action-forgotpassword, +.page-login .action-back { + font-size: 12px; + color: #1c8bb8; + text-decoration: underline; + position: absolute; + left: 0; + bottom: -70px; +} +.page-login .action-forgotpassword:hover, +.page-login .action-back:hover { + text-decoration: none; +} +/* + Page title +-------------------------------------- */ +.page-title { + position: relative; + margin: 20px 0; +} +.page-title-inner > .title { + color: #676056; + font-size: 28px; + font-weight: 400; + display: inline-block; + margin: 0; + width: 100%; + word-wrap: break-word; +} +.page-title-inner .title > h3 { + margin: 0; +} +.page-title-inner .actions { + float: right; +} +.page-title-inner .actions form { + display: inline-block; +} +/* + Messages (Global) +-------------------------------------- */ +.wrapper > .message { + padding: 0 20px; +} +.page-content > #messages { + max-width: 1300px; + min-width: 960px; + margin: 0 auto; +} +.messages { + margin: 20px 0; +} +.messages > .message:last-child { + margin-bottom: 0; +} +.messages.license { + font-size: 20px; + line-height: 1.2; + margin: 20px auto; + max-width: 1300px; + min-width: 960px; + padding: 0 20px; +} +.message { + background: #f9f5ec; + border-bottom: 1px solid #c7c2b6; + border-radius: 5px; + color: #676056; + margin: 20px 0; + padding: 10px 26px 10px 35px; + position: relative; + text-shadow: none; +} +.message:before { + position: absolute; + left: 11px; + top: 50%; + margin-top: -11px; + background: none; + text-shadow: none; + width: auto; + height: auto; + border: 0; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + font-size: 16px; + line-height: inherit; + content: '\e046'; + /* icon-info */ + color: #d87e34; +} +.message.error { + color: #963535; + border-color: #963535; + background: #f3dcd8; +} +.message.error:before { + content: '\e069'; + color: #963535; +} +.message.success { + border-color: #ceceb6; + background: #e4eecb; + color: #185b00; +} +.message.success:before { + content: '\e067'; + color: #185b00; +} +.messages-inbox { + float: right; +} +.messages-inbox .critical { + color: red; +} +/* System Messages */ +.message-system { + padding: 0; +} +.message-system:before { + display: none; +} +.message-system .message-inner { + position: relative; + min-width: 960px; + max-width: 1300px; + margin: 0 auto; +} +.message-system .message-inner:before { + background: none; + border: 0; + content: '\e006'; + /* notification icon */ + color: #6e685e; + font-family: 'MUI-Icons'; + font-style: normal; + font-weight: normal; + speak: none; + -webkit-font-smoothing: antialiased; + height: auto; + left: 8px; + margin-top: -10px; + position: absolute; + text-shadow: none; + top: 50%; + width: auto; + font-size: 16px; +} +.message-system .message-content { + padding: 10px 26px 10px 32px; +} +/* + No-javaScript-Enabled message +-------------------------------------- */ +.message-noscript { + background: #ff9; + padding: 0; + border: 0; + box-shadow: 0 1px 2px #46433d; + z-index: 994; +} +.message-noscript:before { + content: ''; +} +.message-noscript .message-content { + margin: 0 auto; + max-width: 1300px; + min-width: 960px; + padding: 3px 0; + position: relative; + text-align: center; +} +.message-noscript .message-content:before { + position: relative; + background: none; + text-shadow: none; + width: auto; + height: auto; + vertical-align: middle; + border: 0; + font-family: 'MUI-Icons'; + font-style: normal; + font-weight: normal; + font-size: 32px; + speak: none; + -webkit-font-smoothing: antialiased; + content: '\e006'; + /* notification icon */ + color: #6e685e; +} +.message-demo-mode { + background: #d75f07; + border: 0; + color: #fff; + text-align: center; + padding: 5px 0; + box-shadow: 0 1px 2px #46433d; + z-index: 993; +} +.message-demo-mode:before { + content: ''; +} +.message-demo-mode .message-content { + margin: 0 auto; + max-width: 1300px; + min-width: 960px; + position: relative; + text-align: center; +} +.message-demo-mode .message-content:before { + position: relative; + background: none; + text-shadow: none; + width: auto; + height: auto; + vertical-align: middle; + border: 0; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + font-size: 16px; + content: '\e006'; + /* notification icon */ +} +/* + Information message +-------------------------------------- */ +.message-info, +.message.info { + background: #fffbf0; + border: 1px solid #d87e34; + margin-bottom: 20px; +} +.message-info:before, +.message.info:before { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e046'; + /* icon-info */ + color: #d87e34; +} +/* + Error message +-------------------------------------- */ +.message-error, +.message.error { + color: #963535; + background: #f3dcd8; + border: 1px solid #963535; + margin-bottom: 20px; +} +.message-error:before, +.message.error:before { + content: '\e069'; + color: #963535; +} +/* + Store Switcher +-------------------------------------- */ +.store-switcher-alt { + position: relative; + display: inline-block; +} +.store-switcher-alt .dropdown-menu { + white-space: nowrap; + margin-top: 2px; +} +.store-switcher-alt.active .dropdown-menu { + display: block; +} +.store-switcher-alt .dropdown-menu ul { + margin: 0; + padding: 0; + list-style: none; +} +.store-switcher-alt strong { + display: block; + font-size: 14px; + font-weight: 500; + line-height: 1.333; + color: #a6a098; + padding: 5px 10px; +} +.store-switcher-alt .store-selected { + font-size: 12px; + font-weight: 400; + line-height: 1.333; + color: #676056; + cursor: pointer; +} +.store-switcher-alt .store-selected:after { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02c'; + /* arrow down icon */ + color: #b3b0ad; + margin: 0 0 0 3px; + vertical-align: text-top; +} +.store-switcher-alt .store-switcher-website, +.store-switcher-alt .store-switcher-store { + padding: 0; +} +.store-switcher-alt .store-switcher-website:hover, +.store-switcher-alt .store-switcher-store:hover { + background: none; +} +.store-switcher-website { + margin: 5px 0 0; +} +.store-switcher-website > strong { + padding-left: 13px; +} +.store-switcher-store { + margin: 1px 0 0; +} +.store-switcher-store > strong { + padding-left: 20px; +} +.store-switcher-alt .store-switcher-store > ul { + margin-top: 1px; +} +.store-switcher-alt .store-switcher-store-view { + padding: 0; +} +.store-switcher-store-view:first-child { + border-top: 1px solid #e5e5e5; +} +.store-switcher-store-view > a { + display: block; + padding: 5px 15px 5px 24px; + color: #333; + font-size: 13px; + text-decoration: none; +} +.store-switcher-alt .store-switcher-all, +.store-switcher-alt .manage-stores { + padding: 0; +} +.store-switcher-alt .store-switcher-all > a, +.store-switcher-alt .manage-stores > a { + display: block; + padding: 8px 15px; + color: #676056; + text-decoration: none; + font-size: 12px; +} +/* + Page Structure +-------------------------------------- */ +.page-title.complex .title { + float: left; + width: 70%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.page-title.complex .store-switcher-alt { + float: right; + margin: 12px 0 0; +} +.side-col { + position: relative; + width: 20%; +} +.main-col { + position: relative; + width: 80%; + padding: 0 20px 20px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; +} +.col-left { + float: left; +} +.col-right { + float: right; +} +.col-1-layout .main-col { + width: auto; +} +.col-2-left-layout .main-col, +.col-2-right-layout .side-col { + float: right; +} +.col-2-right-layout .main-col, +.col-2-left-layout .side-col { + float: left; +} +.col-2-left-layout, +.col-1-layout { + position: relative; + background: #f5f2ed; + border: 1px solid #d5d0ca; + margin: 0 auto; +} +.col-1-layout { + padding: 20px; +} +.col-2-left-layout:before { + position: absolute; + display: block; + left: 20%; + top: 0; + bottom: 0; + width: 6px; + margin-left: -7px; + content: ''; + background: -moz-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); + /* FF3.6+ */ + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0.06))); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); + /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); + /* Opera 11.10+ */ + background: -ms-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); + /* IE10+ */ + background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); + /* W3C */ + z-index: 2; +} +/* Sidebar and main column vertical separator */ +.main-col:after, +.side-col:after { + position: absolute; + top: 0; + bottom: 0; + width: 1px; + background: #ded9d3; + content: ''; +} +.col-2-left-layout .side-col:after { + right: 0; +} +.col-2-right-layout .side-col:after { + left: 0; +} +.col-2-right-layout .main-col:after { + right: -1px; +} +.col-2-left-layout .main-col:after { + left: -1px; +} +.col-2-left-layout .main-col, +.col-2-right-layout .main-col { + min-width: 730px; +} +/* Sidebar title */ +/* TODO: temporary styles */ +.side-col h3 { + padding: 0 17px; + margin-top: 16px; +} +.side-col .ui-tabs h3 { + margin-bottom: 5px; + color: #524c44; + text-shadow: 0 1px 0 #fff; +} +/* + Universal Sidebar Tabs +-------------------------------------- */ +.side-col .ui-tabs .ui-accordion-header { + position: relative; + margin: 10px 0 0; + padding: 5px 20px; + cursor: pointer; + color: #524c44; + text-shadow: 0 1px 0 #fff; +} +.side-col .ui-tabs .ui-accordion-header:focus { + outline: none; +} +.side-col .ui-accordion-header:before { + position: absolute; + left: 4px; + top: 7px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02a'; + /* arrow right icon */ + font-size: 14px; + color: #ada79e; +} +.side-col .ui-accordion-header:hover:before { + color: #777; +} +.side-col .ui-accordion-header-active:before { + content: '\e02c'; + /* arrow down icon */ +} +.side-col .tabs { + margin: 0 0 30px; + padding: 0; + list-style: none; + font-weight: 500; +} +.side-col > .ui-tabs > .tabs:first-child > li:first-child > a { + border-top-left-radius: 5px; +} +.side-col .tabs > li { + border-bottom: 1px solid #e5e1db; +} +.side-col .tabs > li:first-child { + border-top: 1px solid #e5e1db; +} +.side-col .tabs > li a { + position: relative; + display: block; + padding: 8px 18px; + text-decoration: none; + color: #676056; + -webkit-transition: background 0.3s ease-in-out; + -moz-transition: background 0.3s ease-in-out; + transition: background 0.3s ease-in-out; +} +.side-col .tabs > li a:active, +.side-col .tabs > li a:focus { + outline: none; +} +.side-col .tabs > li a:hover { + background: #fff; +} +.side-col .tabs > .ui-state-active a { + border-left: 3px solid #d87e34; + padding-left: 15px; + background: #dedcd8; + box-shadow: 0 1px 2px #ccc inset; +} +.side-col .tabs > .ui-state-active a:after, +.side-col .tabs > .ui-state-active a:before { + position: absolute; + top: 50%; + right: 0; + width: 14px; + margin-top: -14px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02b'; + /* left turned triangle icon */ + font-size: 22px; + color: #f5f2ed; + overflow: hidden; + z-index: 4; +} +.side-col .tabs > .ui-state-active a:before { + color: #bdbbb7; + margin-top: -13px; + z-index: 3; +} +.side-col .tabs span.error, +.side-col .tabs span.loader { + display: none; + position: absolute; + right: 12px; + top: 7px; + width: 16px; + height: 16px; + font-size: 16px; +} +.side-col .tab-item-link.changed { + font-style: italic; +} +.side-col .tab-item-link.error span.error, +.side-col .ui-tabs-loading span.loader { + display: block; +} +.side-col .tab-item-link.error span.error:after { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e006'; + /* warning icon */ + color: #d87e34; +} +.side-col .ui-tabs-loading span.loader:after { + background: url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; + display: block; + content: ''; + width: 16px; + height: 16px; +} +/* TODO: styles for navigation on System > Configuration page */ +/* + Horizontal Tabs +-------------------------------------- */ +.tabs-horiz { + list-style: none; + margin: 0; + padding: 3px 0 0; +} +.tabs-horiz > li { + float: left; + border: 1px solid #e9e4db; + border-bottom-width: 0; + margin: 0 -1px 0 0; +} +.tabs-horiz > li a { + position: relative; + display: block; + padding: 7px 18px 9px; + text-decoration: none; + font-size: 12px; + line-height: 1.666; + color: #676056; +} +.tabs-horiz > .ui-state-active a { + background: #fff; + border-top: 3px solid #f3771e; + margin-top: -3px; + box-shadow: 1px 0 3px #e9e4db; +} +/* + System -> Configuration page navigation in sidebar +-------------------------------------- */ +.config-nav, +.config-nav .items { + margin: 0; + padding: 0; + list-style: none; +} +.config-nav-block:last-child { + margin-bottom: 30px; +} +.config-nav .item { + border-top: 1px solid #E5E1DB; +} +.config-nav .item:first-child { + border-top: 0; +} +.config-nav .title { + margin-bottom: 0; + text-transform: uppercase; + color: #444; + border: solid #CCC; + border-width: 1px 0; + opacity: .8; + padding: 7px 17px; + background: #E6E3DE; +} +.config-nav .item-nav { + display: block; + padding: 8px 18px; + text-decoration: none; + color: #676056; + -webkit-transition: background 0.3s ease-in-out; + -moz-transition: background 0.3s ease-in-out; + transition: background 0.3s ease-in-out; +} +.config-nav .item-nav:hover { + background: #fff; +} +.config-nav .item-nav.active { + position: relative; + border-left: 3px solid #d87e34; + padding-left: 15px; + background: #dedcd8; + box-shadow: 0 1px 2px #ccc inset; +} +.config-nav .item-nav.active:after { + position: absolute; + top: 50%; + right: 0; + width: 14px; + margin-top: -14px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e02b'; + /* left turned triangle icon */ + font-size: 22px; + text-shadow: -1px 1px 0 #bdbbb7; + color: #f5f2ed; + overflow: hidden; + z-index: 3; +} +/* + Footer +-------------------------------------- */ +.footer { + position: absolute; + left: 0; + right: 0; + bottom: 0; + color: #989288; + font-size: 11px; +} +.footer-content { + margin: 0 auto; + max-width: 1300px; + min-width: 960px; + padding: 20px; +} +/* + Switcher +-------------------------------------- */ +.switcher { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + display: inline-block; + overflow: hidden; +} +.switcher input[type="checkbox"] { + position: absolute; + left: -999em; +} +.switcher-label { + color: #676056; + font-size: 13px; + font-weight: 600; + text-transform: uppercase; +} +.switcher-label:before { + content: attr(data-text-off); +} +.switcher-label:after { + display: inline-block; + margin-left: 10px; + vertical-align: bottom; + width: 34px; + height: 17px; + background: url(../images/switcher.png) no-repeat; + content: ''; +} +.switcher input[type="checkbox"]:focus + .switcher-label:after { + border-color: #75b9f0; +} +.switcher input[type="checkbox"]:checked + .switcher-label:after { + background-position: -34px 0; +} +.switcher input[type="checkbox"]:checked + .switcher-label:before { + content: attr(data-text-on); +} +/* + Content actions panel (with buttons, switchers...) +-------------------------------------- */ +.page-actions .buttons-group { + vertical-align: top; + text-align: left; +} +.page-actions > .switcher { + display: inline-block; + vertical-align: top; + margin: 6px 10px 0 0; +} +.page-actions .store-switcher { + float: left; +} +.catalog-product-index .page-actions { + padding-top: 0; +} +/* TODO: refactor trees */ +.x-tree ul { + margin: 0; + padding: 0; +} +/* + Table Grid +-------------------------------------- */ +/* Grid - General */ +.grid-container { + margin-bottom: 10px; +} +.grid { + border-bottom: 0; + color: #676056; + font-size: 13px; + font-weight: 400; + padding-bottom: .5em; +} +.grid table { + border-collapse: collapse; + border: none; + width: 100%; +} +.grid table.border { + border: 1px solid #c0bbaf; +} +.grid tbody { + background: #e6e3de; +} +.grid tr.even, +.grid tr.even tr { + background: #f5f2ed; +} +.grid tr.on-mouse { + cursor: pointer; +} +.grid tr.on-mouse td, +.grid table tbody tr.on-mouse:hover td, +.grid table tbody tr.on-mouse:hover th, +.grid table tbody tr.on-mouse:nth-child(odd):hover td, +.grid table tbody tr.on-mouse:nth-child(odd):hover th { + background-color: #fff; +} +/* Rows mouse-over */ +.grid tr.invalid { + background-color: #f5d6c7; +} +.grid th, +.grid td { + padding: 2px 4px 2px 4px; + vertical-align: top; +} +.grid th { + border: none; +} +.grid td.editable input.input-text { + width: 50px; + margin-left: 4px; +} +.grid td input.input-text { + width: 86%; +} +.grid td input.input-inactive { + background: #eee; +} +.grid table td { + border: solid #c0bbaf; + border-width: 0 1px 1px; + padding: 5px; +} +.grid table.border td { + background: #fff; +} +.grid table td.product { + text-align: right; +} +.grid table td.empty-text { + border: solid #c0bbaf; + border-width: 0 1px; + color: #676056; + font-size: 16px; + font-weight: 400; + text-align: center; + padding: 15px; +} +.grid table tr:last-child td.empty-text { + border-width: 0 1px 1px; +} +.grid table td.empty-text:hover { + background: #e6e3de; +} +.grid table td .action-select { + width: 100%; +} +.grid tbody.odd tr { + background: #fff; +} +.grid tbody.even tr { + background: #f6f6f6; +} +.grid tbody.odd tr td, +.grid tbody.even tr td { + border-bottom: 0; +} +.grid tbody.odd tr.border td, +.grid tbody.even tr.border td { + border-bottom: 1px solid #dadfe0; +} +/* + Grid - Pager and Buttons row +-------------------------------------- */ +.grid-actions { + border: 1px solid #c0bbaf; + border-bottom: 0; + background: #f6f3ec; + background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y2ZjNlYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVhZTEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); + background: -moz-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f6f3ec), color-stop(100%, #edeae1)); + background: -webkit-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -o-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -ms-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: linear-gradient(to bottom, #f6f3ec 0%, #edeae1 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f6f3ec', endColorstr='#edeae1', GradientType=0); + padding: 7px 8px 8px; + position: relative; +} +[id$='Grid'] .separator { + padding: 0 4px; + color: #b9b9b9; +} +.grid-actions select { + margin: 0 5px; +} +.grid-actions .export, +.grid-actions .filter-actions { + float: right; + margin-left: 30px; +} +.grid-actions .filter-actions button { + float: left; + margin-left: 4px; +} +.grid-actions .pager { + color: #676056; + font-size: 13px; + font-weight: 400; +} +.grid-actions .pager select { + width: 5em; + margin: 0 4px; +} +.grid-actions .pager input.page { + width: 2em; +} +.pager .action-next, +.pager .action-previous { + display: inline-block; + position: relative; + text-indent: 100%; + overflow: hidden; + height: 16px; + width: 16px; + vertical-align: middle; + text-decoration: none; +} +.pager .action-next:after, +.pager .action-previous:after { + font-family: 'MUI-Icons'; + content: "\e02a"; + font-size: 16px; + color: #333; + position: absolute; + top: 0; + left: 0; + line-height: 1; + text-indent: 0; +} +.pager .action-previous:after { + content: "\e02b"; +} +.pager span.action-next:after, +.pager span.action-previous:after { + color: #7f7f7f; +} +.grid-actions .date { + float: left; + margin: 0 15px 0 0; + position: relative; +} +.grid-actions .date input { + margin: 0 5px; + width: 80px; +} +.grid-actions .required:after { + content: '*'; + color: #f00; +} +[class^=" reports-report-"] .grid-actions .required:after { + content: ''; +} +[class^=" reports-report-"] .grid-actions .required .label span:after { + content: '*'; + color: #f00; +} +.grid-actions img { + vertical-align: middle; + height: 22px; + width: 22px; +} +.grid-actions .pager img { + width: auto; + height: auto; +} +.grid-actions .validation-advice { + background: #f3dcd8; + border: 1px solid #963535; + border-radius: 3px; + color: #963535; + margin: 5px 0 0; + padding: 3px 7px; + position: absolute; + white-space: nowrap; + z-index: 5; +} +.grid-actions .validation-advice:before { + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + content: '\e029'; + /* user icon */ + position: absolute; + top: -12px; + left: 50%; + margin-left: -3px; +} +.grid-actions .link-feed { + white-space: nowrap; +} +.grid-actions input[type="text"].validation-failed { + border-color: #fa7973; + box-shadow: 0 0 8px rgba(250, 121, 115, 0.6); +} +/* + Grid - Headings +-------------------------------------- */ +.grid tr.headings th { + color: #ffffff; + font-size: 13px; + font-weight: 700; + border-right: 1px solid #837f79; + padding: 0; + vertical-align: bottom; +} +.grid tr th:first-child { + border-left: 1px solid #837f79; +} +.grid tr.headings th > span { + display: block; + border-bottom: 2px solid transparent; + padding: 5px 5px 2px; + white-space: nowrap; +} +.grid tr.headings th:hover > span { + border-color: #504841; +} +.grid tr.headings th.no-link:hover > span, +.grid tr.headings th.col-select:hover > span { + border-color: transparent; +} +.grid tr.headings th a label { + display: block; + padding-right: 20px; +} +.grid tr.headings th a { + display: block; + color: #ffffff; + font-size: 13px; + font-weight: 700; + position: relative; + text-decoration: none; +} +.grid tr.headings th a:after { + display: none; + height: 8px; + width: 15px; + position: absolute; + bottom: 4px; + right: 0; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + font-size: 20px; + line-height: 8px; + -webkit-font-smoothing: antialiased; + content: '\e038'; + /* arrow down icon */ + color: #8c8172; +} +.grid tr.headings th a:hover:after { + display: block; +} +.grid tr.headings th a.sort-arrow-desc:after { + color: #c7b299; + display: block; +} +.grid tr.headings th a.sort-arrow-asc:after { + color: #c7b299; + content: '\e035'; + /* arrow up icon */ + display: block; +} +.grid tr.headings th a.sort-arrow-desc:hover:after, +.grid tr.headings th a.sort-arrow-asc:hover:after { + color: #fff; +} +/* Grid - Filter */ +.grid .filter { + cursor: default; +} +.grid .filter th { + padding: 5px; + border-right: 1px solid #837F79; + vertical-align: top; + white-space: normal; +} +.grid .filter input.input-text { + background: #5e5a52; + border-radius: 2px; + border: none; + color: #bcb795; + padding: 0 5px; + height: 20px; + width: 99%; +} +.grid .filter input.input-text::-webkit-input-placeholder { + color: #858376 !important; + text-transform: lowercase; +} +.grid .filter input.input-text:-moz-placeholder { + color: #858376 !important; + text-transform: lowercase; +} +.grid .filter input.input-text::-moz-placeholder { + color: #858376 !important; + text-transform: lowercase; +} +:-ms-input-placeholder { + color: #858376 !important; + text-transform: lowercase; +} +.grid .filter select { + background: #5e5a52; + border-radius: 2px; + border: none; + color: #bcb795; + margin: 0; + padding: 0; + height: 20px; + width: 99%; +} +.grid td select { + font-family: Arial, Helvetica, sans-serif; + font-size: 13px; + padding: 4px 4px 5px; + text-align: left; +} +.grid .action-select { + background: #fff; + border: 1px solid #ccc; + margin: 0; +} +.grid .filter .range .range-line { + margin-bottom: 3px; +} +.grid .filter .range div.date { + min-width: 121px; +} +.grid .filter .range .date input { + margin-top: 0; + vertical-align: middle; + width: 80%; +} +.grid .filter .range select { + margin: 0; + color: #676056; + font-size: 11px; + font-weight: 400; + color: #bcb795; +} +.grid .filter .date { + position: relative; +} +.grid .filter .date img { + width: 15px; + height: 15px; + cursor: pointer; + vertical-align: middle; + margin-left: 5px; + position: relative; + z-index: 2; + opacity: 0; +} +.grid .filter .date:before { + position: absolute; + left: 80%; + top: 1px; + margin-left: 5px; + text-shadow: none; + width: 16px; + height: 16px; + line-height: 16px; + font-family: 'MUI-Icons'; + font-style: normal; + speak: none; + font-weight: normal; + -webkit-font-smoothing: antialiased; + font-size: 16px; + content: '\e06a'; + /* icon calendar */ + color: #cac3b4; + z-index: 1; +} +.grid .head-massaction select { + width: 50px; +} +/* Grid - Mass Action */ +.massaction { + color: #cac3b4; + padding: 7px 8px; + background: #666158; + box-shadow: 0 1px 2px 0 #504d46 inset, 0 -1px 2px 0 #504d46 inset; + overflow: hidden; +} +.massaction ul { + list-style: none; + margin: 0; + padding: 6px 0 0; +} +.massaction li { + display: inline-block; +} +.massaction li:before { + color: #837F79; + content: '|'; + display: inline-block; + margin: 0 5px; +} +.massaction li:first-child:before { + display: none; +} +.massaction .entry-edit { + float: right; + display: inline-block; +} +.massaction .entry-edit fieldset { + margin: 0; + padding: 0; + background: none; + border: none; +} +.massaction .entry-edit fieldset select { + border-radius: 2px; + margin: 0; +} +.massaction .entry-edit fieldset select.validation-failed { + border: 1px dashed #eb340a; + background: #faebe7; +} +.massaction .entry-edit .field-row { + display: inline-block; + vertical-align: middle; +} +.massaction .entry-edit .outer-span .entry-edit { + float: none; +} +.massaction .entry-edit .field-row label { + color: #cac3b4; + line-height: 26px; + margin: 0 5px 0 20px; + padding: 0; + vertical-align: middle; + width: auto; + float: none; +} +.massaction .entry-edit .validation-advice { + display: none !important; +} +.massaction a { + color: #e7e2d7; + text-decoration: none; +} +.massaction a:hover { + color: #fff; +} +/* Grid Footer */ +.grid table tfoot tr { + background: #656156; +} +.grid table tfoot tr th, +.grid table tfoot tr td { + border-right: 1px solid #837f79; + line-height: 1.7em; + padding: 3px 10px; +} +.grid table tfoot tr th:first-child, +.grid table tfoot tr td:first-child { + border-left: 1px solid #837f79; +} +.grid table.border tfoot tr td { + background: #656156; +} +.grid .col-price, +.grid .col-number { + text-align: right; +} +/* Dynamic Grid */ +/* Used in pages like Catalog -> Attributes */ +.dynamic-grid th { + padding: 2px; + width: 100px; +} +.dynamic-grid td { + padding: 2px; +} +.dynamic-grid td input { + width: 94px; +} +tr.dynamic-grid td, +tr.dynamic-grid th { + padding: 2px 10px 2px 0; + width: auto; +} +tr.dynamic-grid input.input-text { + width: 154px; +} +.available { + color: #080; + font-weight: bold; +} +.not-available { + color: #800; +} +.categories-side-col { + padding: 0 3%; +} +/* + TODO: change ids to 'table.data' after refactoring of all templates for grids + Manage Products Grid +-------------------------------------- */ +#cross_sell_product_grid table.data, +#up_sell_product_grid table.data, +#related_product_grid table.data, +#productGrid_table, +#setGrid_table, +#attributeGrid_table, +.ui-dialog .data { + word-wrap: break-word; + table-layout: fixed; +} +#cross_sell_product_grid table.data th, +#up_sell_product_grid table.data th, +#related_product_grid table.data th, +#productGrid_table th, +#setGrid_table th, +#attributeGrid_table th, +.ui-dialog .data th { + word-wrap: normal; + overflow: hidden; + vertical-align: top; +} +#cross_sell_product_grid table.data th > span, +#up_sell_product_grid table.data th > span, +#related_product_grid table.data th > span, +#productGrid_table th > span, +#customerGrid_table th > span, +#setGrid_table th > span, +#attributeGrid_table th > span, +.ui-dialog .data th > span { + white-space: normal; +} +table .col-draggable .draggable-handle { + position: relative; + top: 0; + float: left; +} +.grid table .col-id { + text-align: left; +} +/* + Data table +-------------------------------------- */ +.data-table { + border-collapse: separate; + /* do not remove this! without this rule in FF when table has only 1 row bottom and side borders disappear*/ + width: 100%; +} +.data-table thead, +.data-table tfoot, +.data-table th, +.accordion .config .data-table thead th, +.accordion .config .data-table tfoot td { + background: #fff; + color: #676056; + font-size: 13px; + font-weight: 600; +} +.data-table th { + border-color: #c9c2b8; + border-width: 0 0 1px; + padding: 7px; +} +.data-table td, +.data-table tbody tr td, +.accordion .config .data-table td { + background: #fff; + padding: 5px 7px; + color: #676056; + font-size: 14px; + font-weight: 400; + vertical-align: middle; + border: solid #eae8e4; + border-width: 0 0 1px; +} +.data-table tbody tr.selected td, +.data-table tbody tr.selected th, +.data-table tbody tr:hover td, +.data-table tbody tr:hover th { + background: #fff; +} +.data-table tbody tr:nth-child(odd) td, +.data-table tbody tr:nth-child(odd):hover td, +.accordion .config .data-table tbody tr:nth-child(odd) td { + background: #fbfaf6; +} +.data-table tbody tr.odd td { + background: #fbfaf6; +} +.data-table tfoot tr:last-child td, +.data-table tfoot tr:last-child th, +.accordion .config .data-table tfoot tr:last-child td { + border: 0; +} +.data-table input[type="text"] { + width: 98%; + padding-left: 1%; + padding-right: 1%; +} +.data-table select { + margin: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border-radius: 4px; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.data-table th.required-entry:after, +.data-table td.required-entry:after { + content: '*'; + color: red; +} +.data-table .col-actions .actions-split { + margin-top: 4px; +} +.data-table .col-actions .actions-split [class^='action-'] { + background: none; + border: 1px solid #c8c3b5; + padding: 3px 5px; + color: #bbb3a6; + font-size: 12px; +} +.data-table .col-actions .actions-split [class^='action-']:first-child { + border-right: 0; +} +.data-table .col-actions .actions-split .dropdown-menu { + margin-top: -1px; +} +.data-table .col-actions .actions-split .dropdown-menu a { + display: block; + color: #333; + text-decoration: none; +} +.data-table .col-actions .actions-split.active .action-toggle { + position: relative; + border-bottom-right-radius: 0; + box-shadow: none; + background: #fff; +} +.data-table .col-actions .actions-split.active .action-toggle:after { + position: absolute; + top: 100%; + left: 0; + right: 0; + height: 2px; + margin-top: -1px; + background: #fff; + content: ''; + z-index: 2; +} +.data-table .col-actions .actions-split.active .dropdown-menu { + border-top-right-radius: 0; +} +/* + Data table - alternative view +-------------------------------------- */ +.customer-information .data-table, +.order-information .data-table, +.order-account-information .data-table, +.adminhtml-rma-new .data-table { + width: 100%; +} +.customer-information .data-table tbody tr th, +.order-information .data-table tbody tr th, +.order-account-information .data-table tbody tr th, +.adminhtml-rma-new .data-table tbody tr th, +.adminhtml-logging-details .log-details .data-table th, +[class^=" sales-transactions-"] .data-table tbody tr th, +[class^=" sales-"] .order-payment-method .data-table tbody tr th, +[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th { + font-weight: bold; +} +.customer-information .data-table tbody tr td, +.customer-information .data-table tbody tr th, +.order-information .data-table tbody tr td, +.order-information .data-table tbody tr th, +.order-account-information .data-table tbody tr td, +.order-account-information .data-table tbody tr th, +.adminhtml-logging-details .log-details .data-table td, +.adminhtml-logging-details .log-details .data-table th, +[class^=" adminhtml-rma-"] .data-table tbody tr td, +[class^=" adminhtml-rma-"] .data-table tbody tr th, +[class^=" sales-transactions-"] .data-table tbody tr th, +[class^=" sales-transactions-"] .data-table tbody tr td, +[class^=" sales-"] .order-payment-method .data-table tbody tr th, +[class^=" sales-"] .order-payment-method .data-table tbody tr td, +[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th, +[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr td { + background-color: #fff; + border: 0; + padding: 9px 10px 10px; + color: #666; + vertical-align: top; +} +.customer-information .data-table tbody tr:nth-child(2n+1) td, +.customer-information .data-table tbody tr:nth-child(2n+1) th, +.order-information .data-table tbody tr:nth-child(2n+1) td, +.order-information .data-table tbody tr:nth-child(2n+1) th, +.order-account-information .data-table tbody tr:nth-child(2n+1) td, +.order-account-information .data-table tbody tr:nth-child(2n+1) th, +.adminhtml-logging-details .log-details .data-table tr:nth-child(odd) td, +.adminhtml-logging-details .log-details .data-table tr:nth-child(odd) th, +[class^=" adminhtml-rma-"] .data-table tbody tr:nth-child(2n+1) td, +[class^=" adminhtml-rma-"] .data-table tbody tr:nth-child(2n+1) th, +[class^=" sales-transactions-"] .data-table tbody tr:nth-child(2n+1) th, +[class^=" sales-transactions-"] .data-table tbody tr:nth-child(2n+1) td, +[class^=" sales-"] .order-payment-method .data-table tbody tr:nth-child(2n+1) th, +[class^=" sales-"] .order-payment-method .data-table tbody tr:nth-child(2n+1) td, +[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr:nth-child(2n+1) th, +[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr:nth-child(2n+1) td { + background-color: #fbfaf6; +} +/* + Content alignments in tables +-------------------------------------- */ +/* left */ +.col-website, +.col-name, +.col-sku, +.col-color, +.col-size, +.col-product, +.col-comment, +.col-actions, +.col-status { + text-align: left; +} +/* center */ +.col-include, +.col-display, +.col-image, +.col-no-records, +.col-select, +.col-default, +.col-uqty { + text-align: center; +} +/* right */ +.col-qty, +.col-weight, +.col-price, +.col-price > input, +.col-id, +.col-total, +.col-average { + text-align: right; +} +/* + Attribute Information +-------------------------------------- */ +.data-table .col-default { + white-space: nowrap; + text-align: center; + vertical-align: middle; +} +.data-table .col-delete { + text-align: center; + width: 32px; +} +.data-table .col-file { + white-space: nowrap; +} +.data-table .col-file input { + margin: 0 5px; + width: 40%; +} +.data-table .col-file input:first-child { + margin-left: 0; +} +/* + Website store views tree +-------------------------------------- */ +.store-tree .website-name { + font-size: 14px; + font-weight: bold; +} +.store-tree .webiste-groups { + margin: 5px 0 20px 18px; +} +.store-tree .webiste-groups dt { + font-weight: bold; +} +.store-tree .webiste-groups dd { + margin: 5px 0 15px 15px; +} +.store-tree .webiste-groups dd > ul { + list-style: none; + margin: 0; + padding: 0; +} +.store-tree .webiste-groups dd > ul > li { + margin: 0 0 5px; +} +/* + Customer Reviews +-------------------------------------- */ +.field-detailed_rating .control-value { + padding: 0; +} +.field-detailed_rating .nested { + padding: 0; +} +.field-detailed_rating .field-rating { + margin: 15px 0 0 0; +} +.field-detailed_rating .field-rating:first-child { + margin-top: 0; +} +.field-detailed_rating .field-rating .label { + width: 75px; +} +.field-detailed_rating .field-rating .control { + unicode-bidi: bidi-override; + direction: rtl; + width: 125px; +} +.field-detailed_rating input[type="radio"] { + display: none; +} +.field-detailed_rating .field-rating .control label { + color: #ccc; + cursor: pointer; + font-size: 18px; + float: right; + overflow: hidden; + white-space: nowrap; + width: 18px; + -webkit-transition: color 150ms linear; + -moz-transition: color 150ms linear; + -o-transition: color 150ms linear; + -ms-transition: color 150ms linear; + transition: color 150ms linear; +} +/* + Tree Store Scope +-------------------------------------- */ +.tree-store-scope .buttons-set { + margin-bottom: 9px; +} +.tree-store-scope .buttons-set button { + margin-right: 4px; +} +.tree-store-scope .field { + margin: 0 0 5px; +} +.tree-store-scope [class^="field field-website_"] .label, +.tree-store-scope [class^="field field-group_"] .label, +.tree-store-scope [class^="field field-w_"] .label, +.tree-store-scope [class^="field field-sg_"] .label { + text-align: left; + font-size: 18px; + padding-right: 0; + width: auto; +} +.tree-store-scope [class^="field field-group_"] .label, +.tree-store-scope [class^="field field-sg_"] .label { + padding-left: 20px; +} +.tree-store-scope .field input[type="checkbox"] { + margin-right: 3px; + position: relative; + top: 2px; +} +.tree-store-scope .field .addafter { + display: inline-block; + padding-top: 6px; +} +.tree-store-scope .tooltip .help { + margin-top: 11px; +} +/* + Product Massaction page + TODO: css code below should be removed after element.html refactoring +-------------------------------------- */ +.attributes-edit-form .attribute-change-checkbox { + white-space: nowrap; + display: block; +} +.attributes-edit-form .attribute-change-checkbox > label > input { + width: auto; +} +.attributes-edit-form .field:last-child, +.attributes-edit-form .field-name, +.attributes-edit-form .field.type-price, +.attributes-edit-form .field-price, +.attributes-edit-form .field-special_price, +.attributes-edit-form .field-meta_title, +.attributes-edit-form .field-visibility, +.attributes-edit-form .field-custom_design, +.attributes-edit-form .field-page_layout, +.attributes-edit-form .field-options_container, +.attributes-edit-form .field-country_of_manufacture, +.attributes-edit-form .field-msrp_display_actual_price_type, +.attributes-edit-form .field-tax_class_id, +.attributes-edit-form .field-is_returnable, +.attributes-edit-form .field-msrp, +.attributes-edit-form .field-gift_wrapping_price { + margin-bottom: 50px; +} +.attributes-edit-form .field .control { + position: relative; +} +.attributes-edit-form .field-name .attribute-change-checkbox, +.attributes-edit-form .field-meta_title .attribute-change-checkbox, +.attributes-edit-form .field-gift_wrapping_price .attribute-change-checkbox, +.attributes-edit-form .field .control select + .addafter { + position: absolute; + left: 0; + top: 35px; +} +.attributes-edit-form .field.type-price .attribute-change-checkbox, +.attributes-edit-form .field-price .attribute-change-checkbox, +.attributes-edit-form .field-special_price .attribute-change-checkbox, +.attributes-edit-form .field-msrp .attribute-change-checkbox { + position: absolute; + top: 35px; +} +.attributes-edit-form .field-special_from_date > .control .input-text, +.attributes-edit-form .field-special_to_date > .control .input-text, +.attributes-edit-form .field-news_from_date > .control .input-text, +.attributes-edit-form .field-news_to_date > .control .input-text, +.attributes-edit-form .field-custom_design_from > .control .input-text, +.attributes-edit-form .field-custom_design_to > .control .input-text { + border-width: 1px; + border-radius: 4px; + width: 130px; +} +.attributes-edit-form .field-special_from_date .attribute-change-checkbox, +.attributes-edit-form .field-special_to_date .attribute-change-checkbox, +.attributes-edit-form .field-news_from_date .attribute-change-checkbox, +.attributes-edit-form .field-news_to_date .attribute-change-checkbox, +.attributes-edit-form .field-custom_design_from .attribute-change-checkbox, +.attributes-edit-form .field-custom_design_to .attribute-change-checkbox { + margin-top: 5px; +} +.attributes-edit-form .field-weight .fields-group-2 .control { + width: 160px; +} +.attributes-edit-form .field-weight .fields-group-2 .control > input { + width: 130px; + float: left; +} +.attributes-edit-form .field-weight .fields-group-2 .control > input + .addafter { + position: absolute; + top: 35px; +} +.attributes-edit-form .field-weight .fields-group-2 .control .addafter strong { + line-height: 26px; +} +.attributes-edit-form .field .control select { + border-radius: 4px; +} +.attributes-edit-form .field-gift_message_available .addon > .select, +.attributes-edit-form .field-gift_wrapping_available .addon > .select { + margin-bottom: 25px; +} +.attributes-edit-form .field-gift_message_available .addon > input[type="checkbox"], +.attributes-edit-form .field-gift_wrapping_available .addon > input[type="checkbox"] { + width: auto; + margin-right: 5px; +} +/* + Widgets +-------------------------------------- */ +.widget-layout-updates .fieldset-wrapper, +.widget-layout-updates .data-table { + margin: 0 0 18px; +} +.widget-layout-updates .fieldset-wrapper-title label { + padding: 10px 0 0; +} +.widget-layout-updates .fieldset-wrapper-title select { + margin: 3px 10px 5px; +} +.widget-layout-updates .fieldset-wrapper-title span, +.widget-layout-updates .fieldset-wrapper-title select { + vertical-align: middle; +} +.widget-layout-updates .data-table { + table-layout: fixed; +} +.widget-layout-updates .data-table, +.widget-layout-updates .data-table tr:nth-child(odd) td, +.widget-layout-updates .data-table tr:nth-child(odd):hover td { + background: none; + border: none; +} +.widget-layout-updates .data-table th, +.widget-layout-updates .data-table tbody td { + border: none; + padding: 5px 10px; +} +.widget-layout-updates .data-table select { + margin: 0; + max-width: 99%; + overflow: hidden; +} +.widget-layout-updates .chooser_container { + padding: 0 10px; + margin-bottom: 18px; +} +.widget-layout-updates .chooser_container p { + margin: 0 0 18px; +} +.widget-layout-updates .chooser_container p img, +.widget-layout-updates .chooser_container p input { + vertical-align: middle; +} +/* + Preview window +-------------------------------------- */ +.preview-window { + background: #fff; +} +.preview-window .toolbar { + background: #f5f2ed; + padding: 20px; +} +.preview-window .toolbar .switcher { + margin: 0; +} +.preview-window .toolbar .switcher span { + background: none; + width: auto; +} +/* + Global 'No Products found' block +-------------------------------------- */ +.no-products-message { + background: #fbfaf6; + padding: 12px; + text-align: center; + font-size: 12px; + color: #666; + margin-bottom: 13px; +} +/* + WYSIWYG +-------------------------------------- */ +.action-wysiwyg { + margin: 10px 0; +} +#catalog-wysiwyg-editor .buttons-set { + margin-bottom: 9px; +} +#catalog-wysiwyg-editor .buttons-set button { + margin-right: 4px; +} +/* + Add Attribute Popup +-------------------------------------- */ +#create_new_attribute { + overflow: hidden; +} +#create_new_attribute > .loading-mask { + left: -25px; + top: -50px; +} +.attribute-popup { + background: none; +} +.attribute-popup #edit_form > .fieldset > .legend { + display: none; +} +.attribute-popup .wrapper-popup { + padding: 0; + height: 511px; + overflow-x: hidden; + overflow-y: auto; +} +.attribute-popup .fieldset, +.attribute-popup .fieldset-wrapper { + border: none; + border-radius: 0; + padding: 4px 0 20px; + margin: 0 23px 20px; +} +.attribute-popup .fieldset-wrapper { + border-top: none; +} +.attribute-popup .fieldset-wrapper .fieldset-wrapper-title { + border-bottom: none; +} +.attribute-popup .fieldset-wrapper .fieldset-wrapper-content > .fieldset { + margin-left: 0; + margin-right: 0; +} +.attribute-popup .fieldset > .field > input[type="checkbox"] { + margin-top: 7px; +} +.attribute-popup .fieldset .label { + width: 35%; +} +.attribute-popup .collapsable-wrapper, +#manage-titles-wrapper .fieldset-wrapper-title { + margin-bottom: 0; + padding-bottom: 0; +} +.attribute-popup .collapsable-wrapper .fieldset-wrapper-title > .title:before { + color: #797269; + font-size: 14px; + top: 9px; +} +.attribute-popup form .entry-edit:first-child .fieldset { + border-bottom: 1px solid #dfdcd7; +} +.attribute-popup .fieldset .legend { + border: none; +} +.attribute-popup .page-actions { + position: fixed; + top: auto !important; + left: 0; + right: 0; + bottom: 0; + background: #fff; + padding: 27px 50px 25px 23px; + border-top: 1px solid #dfdcd7; +} +.attribute-popup .page-actions [class^='action-'] { + margin-left: 18px; +} +.attribute-popup #base_fieldset { + padding-top: 20px; +} +.attribute-popup #base_fieldset > .legend { + display: none; +} +.attribute-popup .page-actions #reset, +.attribute-popup .page-actions #reset:hover, +.attribute-popup .page-actions #reset:active, +.attribute-popup .page-actions #reset:focus { + float: right; + vertical-align: middle; + margin: 5px 0 0 18px; +} +.attribute-popup .page-actions-placeholder { + display: none; +} +.attribute-popup .page-actions.fixed .page-actions-inner { + background: #fff; + padding: 0; + min-width: 100%; + max-width: 100%; + min-height: 100%; + margin: 0; +} +.attribute-popup .footer { + display: none; +} +#manage-options-panel > .data-table { + clear: both; +} +.CustomGridView .col-1-layout { + padding: 0; + background: transparent; + border: 0; + border-radius: 0; + max-width: 1300px; + min-width: 960px; +} +.CustomGridAction .grid-actions { + border-radius: 5px 5px 0 0; + margin-top: 20px; + padding: 9px 16px 9px 65px; +} +.CustomGridAction .page-actions.fixed { + left: 0; + margin: 0; + padding: 0 21px; + position: fixed; +} +.CustomGridAction .page-actions { + position: absolute; + z-index: 2; + margin-top: 10px; + margin-left: 15px; + padding: 0; +} +.adminhtml-googleshopping-items-index .grid-title { + border: 1px solid #c0bbaf; + border-bottom: 0; + background: #f6f3ec; + background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y2ZjNlYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVhZTEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); + background: -moz-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f6f3ec), color-stop(100%, #edeae1)); + background: -webkit-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -o-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: -ms-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); + background: linear-gradient(to bottom, #f6f3ec 0%, #edeae1 100%); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f6f3ec', endColorstr='#edeae1', GradientType=0); + padding: 7px 8px 8px; + position: relative; + float: none; +} +.adminhtml-googleshopping-items-index .grid { + padding-bottom: 25px; +} +.adminhtml-googleshopping-items-index .grid-title .title { + font-size: 18px; +} +.adminhtml-googleshopping-items-index .page-actions { + float: right; +} +.adminhtml-system-backup-index .page-actions.fixed, +.adminhtml-scheduled-operation-index .page-actions.fixed, +.adminhtml-system-currency-index .page-actions.fixed, +.adminhtml-system-currencysymbol-index .page-actions.fixed, +.adminhtml-cache-index .page-actions.fixed, +.adminhtml-system-store-index .page-actions.fixed, +.sales-order-status-index .page-actions.fixed { + background-image: none; + padding: 0 21px; + position: fixed; +} +.catalog-product-index .grid-actions { + padding-left: 90px; +} +.sidebar-actions { + padding: 14px 0; +} +.sidebar-actions button { + margin: 0 0 5px; +} +.sales-order-create-index .grid table .action-configure { + float: right; +} +.adminhtml-system-currency-index .import-service { + float: left; +} +.adminhtml-system-currency-index .page-actions.fixed .import-service { + display: inline-block; + float: none; +} +.fpt-item-container select { + width: 100%; +} +.fpt-item-container select:first-child { + margin-bottom: 8px; +} +.clearfix:before, +.clearfix:after, +[class$="-layout"]:after, +.footer-content:before, +.footer-content:after, +.page-title-inner:before, +.page-title-inner:after, +.tabs-horiz:before, +.tabs-horiz:after, +.actions-split:before, +.actions-split:after, +.page-create-order:before, +.page-create-order:after, +.order-addresses:before, +.order-addresses:after, +.order-methods:before, +.order-methods:after, +.order-summary:before, +.order-summary:after, +.order-methods:before, +.order-methods:after, +.grid-actions:before, +.grid-actions:after, +.fieldset-wrapper-title:before, +.fieldset-wrapper-title:after { + content: ""; + display: table; +} +.clearfix:after, +[class$="-layout"]:after, +.footer-content:after, +.page-title-inner:after, +.tabs-horiz:after, +.actions-split:after, +.page-create-order:after, +.order-addresses:after, +.order-methods:after, +.order-summary:after, +.order-methods:after, +.grid-actions:after, +.fieldset-wrapper-title:after { + clear: both; +} diff --git a/app/design/adminhtml/magento_backend/css/header.css b/app/design/adminhtml/Magento/backend/css/header.css similarity index 100% rename from app/design/adminhtml/magento_backend/css/header.css rename to app/design/adminhtml/Magento/backend/css/header.css diff --git a/app/design/adminhtml/magento_backend/css/pages.css b/app/design/adminhtml/Magento/backend/css/pages.css similarity index 93% rename from app/design/adminhtml/magento_backend/css/pages.css rename to app/design/adminhtml/Magento/backend/css/pages.css index 6bb370560b2f8a7646e6b84304592245d8931837..f8b90918ccb73785f8bc083d18371654376b5cb1 100644 --- a/app/design/adminhtml/magento_backend/css/pages.css +++ b/app/design/adminhtml/Magento/backend/css/pages.css @@ -23,58 +23,10 @@ /* Product Creation -------------------------------------- */ -/* Action "Back" as cross */ -[class^=" catalog-product-"] .page-actions .action-back, -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" catalog-product-"] .page-actions .action-back:active, -[class^=" newsletter-"] .page-actions .action-back, -[class^=" newsletter-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:active { - overflow: hidden; - padding: 5px 6px 3px; - margin-left: 12px; - color: #7a7976; -} -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active { - filter: none; - border: 0; -} -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:hover, -.sales-order-create-index .page-actions-inner .cancel:hover { - color: #000; -} [class^=" catalog-product-"] .page-actions .action-back.mage-error, [class^=" newsletter-"] .page-actions .action-back.mage-error { color: #b57c72; } -[class^=" catalog-product-"] .page-actions .action-back:before, -[class^=" newsletter-"] .page-actions .action-back:before, -.sales-order-create-index .page-actions-inner .cancel:before { - display: inline-block; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e07d'; - /* close icon */ - font-size: 16px; -} -[class^=" catalog-product-"] .page-actions .action-back span, -[class^=" newsletter-"] .page-actions .action-back span, -.sales-order-create-index .page-actions-inner .cancel span { - display: inline-block; - overflow: hidden; - text-indent: -999em; -} -.page-actions .switcher { - display: inline-block; - vertical-align: top; - margin: 6px 17px 6px 6px; -} .field-weight .control .field:first-child { width: 36%; margin-right: 15px; @@ -788,9 +740,6 @@ /* Newsletter -------------------------------------- */ -[class^=" newsletter-"] .page-actions .action-back { - float: right; -} /* Newsletter Templates -------------------------------------- */ @@ -948,128 +897,6 @@ .adminhtml-googleshopping-types-new #gcontent_attributes_container { margin-top: -6px; } -/* - Dashboard --------------------------------------- */ -.adminhtml-dashboard-index .col-2-left-layout, -.adminhtml-dashboard-index .col-1-layout { - min-width: 0; -} -.adminhtml-dashboard-index .side-col { - width: 38%; - padding: 1%; -} -.adminhtml-dashboard-index .side-col .entry-edit { - padding: 10px 15px 10px 10px; - margin-bottom: 5px; -} -.adminhtml-dashboard-index .side-col .entry-edit .entry-edit-head { - margin-bottom: 20px; -} -.adminhtml-dashboard-index .side-col .entry-edit .entry-edit-head h4 { - margin: 0; -} -.adminhtml-dashboard-index .side-col .entry-edit fieldset { - padding: 0; - border: 0; -} -.adminhtml-dashboard-index .side-col .entry-edit fieldset .grid { - padding-bottom: 0; -} -.adminhtml-dashboard-index .col-2-left-layout .main-col { - min-width: 0; - width: 60%; - padding: 16px 30px 30px; -} -.adminhtml-dashboard-index .col-2-left-layout .main-col .store-switcher-alt { - margin-bottom: 15px; -} -.adminhtml-dashboard-index .col-2-left-layout .main-col .store-switcher-alt > strong { - padding-left: 0; -} -.dashboard-container { - border-radius: 0; -} -.dashboard-container.col-2-left-layout:before { - left: 40%; -} -.dashboard-inner .tabs-horiz > li a { - padding-left: 14px; - padding-right: 14px; -} -.dashboard-container #diagram_tab_content { - background: #fff; - border: 1px solid #eae6e0; - border-radius: 5px; - border-top-left-radius: 0; - margin: 0 0 20px; - padding: 18px; - position: relative; -} -.dashboard-container .dashboard-diagram .store-switcher + div { - /* loader under a diagram */ - background: url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; - min-height: 75px; - text-align: center; -} -.dashboard-container .dashboard-diagram .store-switcher + div img { - max-width: 100%; -} -.dashboard-container .dashboard-diagram .store-switcher + div.dashboard-diagram-nodata { - /* when there is no data to display the diagram */ - background-image: none; - min-height: 15px; -} -.dashboard-container #grid_tab_content { - background: #ffffff url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; - border: 1px solid #eae6e0; - border-radius: 5px; - border-top-left-radius: 0; - min-height: 50px; -} -.dashboard-container #grid_tab_content .grid { - padding: 0; -} -.dashboard-container .store-switcher { - margin: 20px 0 10px; -} -.dashboard-container .dashboard-diagram .store-switcher { - margin-top: 0; -} -.dashboard-diagram-nodata { - border: 1px solid #ccc; - padding: 20px 0; - text-align: center; -} -.action-switch-to-analytics:link, -.action-switch-to-analytics:visited, -.action-switch-to-hub:link, -.action-switch-to-hub:visited { - font-weight: 400; - font-size: 16px; - color: #19a3d1; - position: relative; - padding: 0 0 0 20px; - margin: 11px 0 0 20px; - background: none; - box-shadow: none; -} -.action-switch-to-hub:before, -.action-switch-to-analytics:before { - position: absolute; - width: 17px; - height: 12px; - background: url(../images/icons-dashboard-switcher.png) 0 0 no-repeat; - left: 0; - top: 4px; - content: ''; -} -.action-switch-to-hub:before { - top: 2px; -} -.action-switch-to-analytics:before { - background-position: 0 -13px; -} /* Sales -------------------------------------- */ @@ -1129,6 +956,13 @@ float: right; width: 49%; } +[class*="-order-"] .order-card-validation { + width: 49.5%; + box-sizing: border-box; +} +[class*="-order-"] .order-card-validation .actions { + margin-top: 17px; +} #order-data .order-account-information { float: none; width: auto; @@ -1243,13 +1077,6 @@ [class*="-order-"] .order-shipping-address .control + label { margin: 17px 0 0; } -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active { - float: right; - margin: 0 0 0 12px; - padding: 3px 0 3px 6px; -} .sales-order-create-index #order-message .messages .message, .sales-order-edit-index #order-message .messages .message { margin: 0 0 60px; @@ -1404,11 +1231,6 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d #order-data .page-actions { padding-top: 0; } -#order-data .store-switcher { - margin: -46px 0 0; - position: relative; - width: 50%; -} .create-order-sidebar-container > div + div { border-top: 1px solid #ededed; margin-top: 35px; @@ -1836,6 +1658,9 @@ table.items-to-invoice tbody tr:hover td { [class^=" sales-"] .order-payment-currency { margin-top: 15px; } +[class^=" sales-"] .order-payment-additional { + margin-top: 15px; +} [class^=" sales-"] .grid tbody td { vertical-align: top; } @@ -2266,6 +2091,12 @@ table.items-to-invoice tbody tr:hover td { .field-skeleton_set .select { width: 100%; } +#affected-attribute-set-form .fieldset .field { + margin-bottom: 12px; +} +#affected-attribute-set-form .fieldset .field:last-child { + margin-bottom: 0; +} /* Cache Management -------------------------------------- */ diff --git a/app/design/adminhtml/magento_backend/less/styles.less b/app/design/adminhtml/Magento/backend/css/source/abstract.less similarity index 64% rename from app/design/adminhtml/magento_backend/less/styles.less rename to app/design/adminhtml/Magento/backend/css/source/abstract.less index b28ed69d09eb6fc05e4e702514a5e78cd6944592..df0b0f4e72989d5ab5c7381975e6403c8376dcda 100644 --- a/app/design/adminhtml/magento_backend/less/styles.less +++ b/app/design/adminhtml/Magento/backend/css/source/abstract.less @@ -1,5 +1,5 @@ -/** -// * Magento +// /** +// // * Magento // * // * NOTICE OF LICENSE // * @@ -16,16 +16,15 @@ // * 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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ +// * +// * @category design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ -@import "clearless/all.less"; -@import "styles/base.less"; -@import "vars.less"; -@import "lib/buttons.less"; -@import "styles/admin.less"; -//@import "styles/header.less"; -//@import "styles/pages.less"; -@import "styles/debug.less"; +//&:extend(._layout-width all); +._layout-width { + .layout-width(); + .box-sizing(); + width: 100%; +} diff --git a/app/design/adminhtml/Magento/backend/css/source/dashboard.less b/app/design/adminhtml/Magento/backend/css/source/dashboard.less new file mode 100644 index 0000000000000000000000000000000000000000..36abe4d86a2ddb39de0062a07f1a703df49ee792 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/css/source/dashboard.less @@ -0,0 +1,205 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +/* + Dashboard +-------------------------------------- */ +@dashboard-bg: #f7f3eb; +@dashboard-tab-content-bg: #fff; +@dashboard-active-color: #ef672f; + +/* + Dashboard Layout +-------------------------------------- */ +.adminhtml-dashboard-index .col-1-layout { + max-width: 1300px; // resets global styles + border: none; // resets global styles + border-radius: 0; // resets global styles + padding: 0; // resets global styles + background: @dashboard-bg; // resets global styles +} + +.dashboard-inner { + .clearfix(); + padding-top: 35px; +} + +.dashboard-secondary { + float: left; + width: 32%; + margin: 0 1.5%; +} + +.dashboard-main { + float: right; + width: 65%; +} + +/* + Dashboard Diagram +-------------------------------------- */ +.dashboard-diagram { + &-chart { + max-width: 100%; + height: auto; + } + &-nodata, + &-switcher { + padding: 20px 0; + } + &-image { + background: @dashboard-tab-content-bg url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; + } +} + +/* + Dashboard Store Stats +-------------------------------------- */ +.dashboard-container { + .ui-tabs-panel { + background-color: @dashboard-tab-content-bg; + min-height: 40px; + padding: 15px; + } + .tabs-horiz > li { + border: none; + margin: 0 5px 0 0; + } + .ui-tabs-anchor { + .style7(); + background: #e0dacf; + padding: 7px 15px 9px; // resets global tab styles + border-radius: 2px 2px 0 0; + } + .ui-tabs-active .ui-tabs-anchor { + border-top: none; // resets global tab styles + margin-top: 0; // resets global tab styles + box-shadow: none; // resets global tab styles + } +} + +.dashboard-store-stats { + margin-top: 35px; + .ui-tabs-panel { + background: @dashboard-tab-content-bg url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; + } +} + +.dashboard-item { + margin-bottom: 30px; + &-header { + margin-left: 5px; + } + &.dashboard-item-primary { + margin-bottom: 35px; + .title { + font-size: 22px; + margin-bottom: 5px; + } + .dashboard-sales-value { + display: block; + text-align: right; + font-weight: 600; + font-size: 30px; + margin-right: 12px; + padding-bottom: 5px; + } + &:first-child { + color: @dashboard-active-color; + .title { + color: @dashboard-active-color; + } + } + } +} + +.dashboard-totals { + background: @dashboard-tab-content-bg; + padding: 50px 15px 25px; + &-list { + .clearfix(); + .list-reset-styles(); + } + &-item { + float: left; + width: 18%; + margin-left: 7%; + padding-top: 15px; + border-top: 2px solid #cac3b4; + &:first-child { + margin-left: 0; + } + } + &-label { + display: block; + font-size: 16px; + font-weight: 600; + padding-bottom: 2px; + } + &-value { + color: @dashboard-active-color; + font-size: 20px; + } +} + +.dashboard-data { + width: 100%; + thead { + background: transparent; // resets global styles + } + th, + td { + border: none; // resets global styles + padding: 10px 12px; // resets global styles + text-align: right; // resets global styles + &:first-child { + text-align: left; + } + } + th { + color: @primary1; // resets global styles + font-weight: 600; + } + td { + background-color: transparent; // resets global styles + } + tbody { + tr:hover td { + background-color: transparent; // resets global styles + } + tr:nth-child(odd), + tr:nth-child(odd):hover { + td, + th { + background-color: #e1dbcf; // resets global styles + .ui-tabs-panel & { + background-color: #f7f3eb; // resets global styles + } + } + } + } + .ui-tabs-panel & { + background-color: @dashboard-tab-content-bg; + } +} diff --git a/app/design/adminhtml/Magento/backend/css/source/navigation.less b/app/design/adminhtml/Magento/backend/css/source/navigation.less new file mode 100644 index 0000000000000000000000000000000000000000..ab0498e10c32ed37593de59b1c389885a4c08c43 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/css/source/navigation.less @@ -0,0 +1,216 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +/* + Global Navigation +-------------------------------------- */ + +.navigation { + background-color: @color-middle; +} + +.navigation .level-0.reverse > .submenu { + right: 1px; +} + +.navigation > ul { + &:extend(._layout-width all); + position: relative; + text-align: right; + z-index: 900; +} + +.navigation .level-0 > .submenu { + display: none; + position: absolute; + top: 100%; + padding: 19px 13px; +} + +.navigation .level-0 > .submenu a { + display: block; + .style6(); + line-height: 1.385; + padding: 3px 12px 3px; + text-decoration: none; + &:hover { + color: @primary4; + background: @defaultButton5; + text-decoration: none; + } +} + +.navigation .level-0 > .submenu li { + margin-bottom: 1px; +} + +.navigation .level-0 > .submenu a[href="#"] { + cursor: default; + display: block; + .style30(); + line-height: 1; + margin: 7px 0 6px; + padding: 0 12px; + + &:focus, + &:hover { + .style30(); + background: none; + text-decoration: none; + } +} + +.navigation .level-0 { + display: inline-block; + float: left; + text-align: left; + -webkit-transition: display .15s ease-out; + -moz-transition: display .15s ease-out; +} + +.navigation .level-0 > a { + background: none; + //position: relative; + display: block; + padding: 12px 13px 0; + .style15(); + text-transform: uppercase; + text-decoration: none; + -webkit-transition: background .15s ease-out; + -moz-transition: background .15s ease-out; + &:after { + content: ""; + display: block; + margin-top: 10px; + height: 3px; + font-size: 0; + } +} + +.navigation .level-0.active > a { + font-weight: @baseFontWeightBold; + &:after { + background: #ef672f; + } +} + +//.navigation .level-0:hover > a, +.navigation .level-0.hover.recent > a { + background: #fff; + .style15I(); + &:after { + background: none; + } +} +.navigation .level-0.hover.recent.active > a { + font-weight: @baseFontWeightBold; +} + +.navigation .level-0 > a:focus { + outline: none; +} + +.navigation .level-0 > .submenu { + opacity: 0; + visibility: hidden; +} + +.navigation .level-0.recent.hover > .submenu { + opacity: 1; + visibility: visible; +} + +.no-js .navigation .level-0:hover > .submenu, +.no-js .navigation .level-0.hover > .submenu, +.no-js .navigation .level-0 > a:focus + .submenu { + display: block; +} + +.navigation .level-0 > .submenu { + background: #fff; + box-shadow: 0 3px 3px rgba(50, 50, 50, .15); +} + +.navigation .level-0 > .submenu li { + max-width: 200px; +} + +.navigation .level-0 > .submenu > ul { + white-space: nowrap; +} + +.navigation .level-0 > .submenu .column { + display: inline-block; + margin-left: 40px; + vertical-align: top; + &:first-child { + margin-left: 0; + } +} + +.navigation .level-0 .submenu .level-1 { + white-space: normal; +} + +.navigation .level-0.parent .submenu .level-1.parent { + margin: 17px 0 25px; +} + +.navigation .level-0.parent .level-1.parent:first-child { + margin-top: 0; +} + +.navigation .level-2 .submenu { + margin-left: 7px; +} + +.navigation .level-0 > .submenu .level-2 > a[href="#"] { + font-size: 13px; + margin-top: 10px; + margin-left: 7px; +} + +.navigation .level-2 > .submenu a { + font-size: 12px; + line-height: 1.231; +} + +.navigation .level-0 > .submenu .level-3 > a[href="#"], +.navigation .level-3 .submenu { + margin-left: 15px; +} + +/* + Admin and Store Settings +-------------------------------------- */ +.navigation .level-0.item-system, +.navigation .level-0.item-stores { + float: none; +} + +.navigation .level-0.item-system > .submenu, +.navigation .level-0.item-stores > .submenu { + left: auto; + right: 1px; +} diff --git a/app/design/adminhtml/Magento/backend/css/source/theme.less b/app/design/adminhtml/Magento/backend/css/source/theme.less new file mode 100644 index 0000000000000000000000000000000000000000..da3a7a40baf7ef442db278cf009c03bd23a0a10d --- /dev/null +++ b/app/design/adminhtml/Magento/backend/css/source/theme.less @@ -0,0 +1,359 @@ +// /** +// // * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// Override default variables +@font-family-base: 'Open Sans', @font-family-sans-serif; + +// Introduce new theme specific variables + +@color-dark: #31302b; +@color-middle: #676056; +@color-light: #e0dacf; +@color-general: #f3ebde; + +@color-link: #026294; + +@page-main-action-color: #645D53; + +@dropdown-split-actions-padding: ''; +@dropdown-split-toggle-actions-padding: 0 5px; + +// Default = secondary button +@button-padding: 0 13px; +@button-font-weight: 500; +@button-font-size: 13px; +@button-height: 26px; +@button-color: #645D53; +@button-background: #f7f3eb; +@button-border: 1px solid #ada89e; +@button-background-hover: #cac3b4; +@button-color-hover: ''; +@button-border-hover: ''; +@button-background-active: @button-background-hover; +@button-color-active: ''; +@button-border-active: 1px solid #989287; +// Primary button +@button-primary-height: @button-height; +@button-primary-background: #007dbd; +@button-primary-border: 1px solid #0a6c9f; +@button-primary-color: #fff; +@button-primary-background-hover: #026294; +@button-primary-border-hover: 1px solid #026294; +@button-primary-color-hover: ''; +@button-primary-background-active: @button-primary-background-hover; +@button-primary-border-active: 1px solid #004c74; + +// +// Buttons +//-------------------------------------- +button { + border-radius: 2px; + .button(); + &.primary { + .button-primary(); + } +} + +// +// Page main actions +//-------------------------------------- +.page-main-actions { + .clearfix(); + background: #e0dace; + color: @page-main-action-color; + padding: 15px; + margin-left: auto; + margin-right: auto; + .box-sizing(); + .page-actions { + float: right; + .page-actions-buttons { + float: right; + display: flex; + justify-content: flex-end; + } + button { + margin-left: 13px; + //flex-shrink: 0; + &.primary { + // &:not(:last-child) { + // float: right; + // } + float: right; + order: 2; + } + &.save:not(.primary) { + // &:not(:last-child) { + // float: right; + // } + float: right; + order: 1; + } + &.back, + &.action-back, + &.delete { + .button-reset(); + margin: 0 13px; + .ie & { + margin-top: 6px; + } + } + &.delete { + color: #e22626; + float: left; + order: -1; + } + &.back, + &.action-back { + float: left; + order: -1; + .icon-font( + @_icon-font-content: @icon-arrow-left-thin, + @_icon-font-line-height: normal, + @_icon-font-margin: 0 2px 0 0 + ); + } + } + .actions-split { + margin-left: 13px; + // &:not(:last-child) { + // float: right; + // } + float: right; + order: 2; + button { + &.primary { + float: left; + } + } + } + // Fixed page actions + &.fixed { + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 998; + padding: 0; + background: -moz-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(245, 242, 237, 1)), color-stop(56%, rgba(245, 242, 237, 1)), color-stop(100%, rgba(245, 242, 237, 0))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* W3C */ + .page-actions-inner { + position: relative; + padding-top: 15px; + padding-bottom: 15px; + min-height: 36px; + text-align: right; + .clearfix(); + .box-sizing(); + &:before { + text-align: left; + content: attr(data-title); + float: left; + font-size: 20px; + max-width: 50%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .lt-ie10 & { + background: #f5f2ed; + } + } + } + } + .store-switcher { + margin-top: 5px; + } +} + +.store-switcher { + display: inline-block; + font-size: 13px; + .label { + margin-right: 5px; + } + .actions.dropdown { + .dropdown( + @_options-selector : ~".dropdown-menu", + @_dropdown-list-border: 1px #ada89e solid, + @_dropdown-list-pointer: false, + @_icon-font-line-height: 20px, + @_icon-font-color: @page-main-action-color, + @_icon-font-color-hover: @page-main-action-color, + @_icon-font-color-active: @page-main-action-color, + @_dropdown-list-item-hover: transparent, + @_dropdown-list-item-padding: 0 + ); + .action.toggle { + .button-reset(); + color: @color-link; + line-height: normal; + vertical-align: middle; + } + ul.dropdown-menu { + margin-top: 4px; + padding-top: 5px; + left: 0; + min-width: 195px; + li { + border: 0; + cursor: default; + &:hover { + cursor: default; + } + a, + span { + padding: 5px 13px; + display: block; + color: @page-main-action-color; + } + a { + text-decoration: none; + &:hover { + background: #edf9fb; + } + } + span { + color: #ababab; + cursor: default; + } + &.current { + span { + color: @page-main-action-color; + background: #eee; + } + } + } + .store-switcher-store { + a, + span { + padding-left: 26px; + } + } + .store-switcher-store-view { + a, + span { + padding-left: 39px; + } + } + .dropdown-toolbar { + border-top: 1px #ededed solid; + margin-top: 10px; + a { + .icon-font( + @_icon-font-content: @icon-settings, + @_icon-font-size: 20px, + @_icon-font-line-height: normal, + @_icon-font-vertical-align: text-top, + @_icon-font-margin: 0 3px 0 -4px + ); + display: block; + } + } + } + } +} + +.tooltip { + display: inline-block; + margin-left: 5px; + .help span, + .help a { + width: 16px; + height: 16px; + text-align: center; + background: rgba(194,186,169,.5); + cursor: pointer; + &:hover { + background: rgba(194,186,169,1); + } + border-radius: 10px; + vertical-align: middle; + .icon-font( + @_icon-font: @font-family-base, + @_icon-font-content: '?', + @_icon-font-size: 13px, + @_icon-font-line-height: 16px, + @_icon-font-color: #5a534a, + @_icon-font-text-hide: true, + @_icon-font-vertical-align: top + ); + &:before { + font-weight: 700; + } + } + //TODO Tooltips + .tooltip-content { + display: none; + position: absolute; + max-width: 200px; + margin-top: 10px; + margin-left: -19px; + padding: 4px 8px; + border-radius: 3px; + background: #000; + background: rgba(49, 48, 43, .8); + color: #fff; + text-shadow: none; + z-index: 20; + &:before { + content: ''; + position: absolute; + width: 0; + height: 0; + top: -5px; + left: 20px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-bottom: 5px solid #000; + opacity: .8; + } + &.loading { + position: absolute; + &:before { + border-bottom-color: rgba(0, 0, 0, .3); + } + } + } + &:hover > .tooltip-content { + display: block; + } +} + +.actions-split { + button { + margin-left: 0!important; + } + .dropdown-split( + @_toggle-selector: ~".action-toggle", + @_button-selector: ~".action-default", + @_options-selector : ~".dropdown-menu", + @_dropdown-split-button-border-radius-fix: true + ); + vertical-align: middle; +} diff --git a/app/design/adminhtml/Magento/backend/css/styles.less b/app/design/adminhtml/Magento/backend/css/styles.less new file mode 100644 index 0000000000000000000000000000000000000000..0c7ae7b261918812b10e6bd8c793ca50356f51be --- /dev/null +++ b/app/design/adminhtml/Magento/backend/css/styles.less @@ -0,0 +1,42 @@ +/** +// * Magento +// * +// * NOTICE OF LICENSE +// * +// * This source file is subject to the Academic Free License (AFL 3.0) +// * that is bundled with this package in the file LICENSE_AFL.txt. +// * It is also available through the world-wide-web at this URL: +// * http://opensource.org/licenses/afl-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 design + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/* Magento/backend */ + +//.magento-reset(); // Reset default styles with magento_reset + +// Import theme vars overrides and mixins +@import "source/lib/lib.less"; // Import all lib files +@import "../less/styles/vars.less"; +@import "source/theme.less"; // import theme styles + +@baseDir: "../"; //default + +@import "source/navigation.less"; // import theme navigation +@import "source/dashboard.less"; // import theme navigation + +// Magento Import instructions +//@magento_import "source/module.less"; // import theme styles + +@import (reference) "source/abstract.less"; // import theme styles diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.eot b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.eot rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.eot diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.svg b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.svg rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.svg diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.ttf b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.ttf rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.woff b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBlack-webfont.woff rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBlack-webfont.woff diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.eot b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.eot rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.eot diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.svg b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.svg rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.svg diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.ttf b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.ttf rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.woff b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansBold-webfont.woff rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansBold-webfont.woff diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.eot b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.eot rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.eot diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.svg b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.svg rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.svg diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.ttf b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.ttf rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.woff b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansLight-webfont.woff rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansLight-webfont.woff diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.eot b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.eot rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.eot diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.svg b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.svg rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.svg diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.ttf b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.ttf rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.woff b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansRegular-webfont.woff rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansRegular-webfont.woff diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.eot b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.eot rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.eot diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.svg b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.svg rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.svg diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.ttf b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.ttf rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.woff b/app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/calluna/CallunaSansSemiBold-webfont.woff rename to app/design/adminhtml/Magento/backend/fonts/calluna/CallunaSansSemiBold-webfont.woff diff --git a/app/design/adminhtml/magento_backend/fonts/icons/admin-icons.eot b/app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.eot similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/icons/admin-icons.eot rename to app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.eot diff --git a/app/design/adminhtml/magento_backend/fonts/icons/admin-icons.svg b/app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.svg similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/icons/admin-icons.svg rename to app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.svg diff --git a/app/design/adminhtml/magento_backend/fonts/icons/admin-icons.ttf b/app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/icons/admin-icons.ttf rename to app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.ttf diff --git a/app/design/adminhtml/magento_backend/fonts/icons/admin-icons.woff b/app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.woff similarity index 100% rename from app/design/adminhtml/magento_backend/fonts/icons/admin-icons.woff rename to app/design/adminhtml/Magento/backend/fonts/icons/admin-icons.woff diff --git a/app/design/adminhtml/magento_backend/i18n/en_US.csv b/app/design/adminhtml/Magento/backend/i18n/en_US.csv similarity index 100% rename from app/design/adminhtml/magento_backend/i18n/en_US.csv rename to app/design/adminhtml/Magento/backend/i18n/en_US.csv diff --git a/app/design/adminhtml/magento_backend/images/ajax-loader-tr.gif b/app/design/adminhtml/Magento/backend/images/ajax-loader-tr.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/ajax-loader-tr.gif rename to app/design/adminhtml/Magento/backend/images/ajax-loader-tr.gif diff --git a/app/design/adminhtml/magento_backend/images/ajax-loader.gif b/app/design/adminhtml/Magento/backend/images/ajax-loader.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/ajax-loader.gif rename to app/design/adminhtml/Magento/backend/images/ajax-loader.gif diff --git a/app/design/adminhtml/magento_backend/images/body-bg.jpg b/app/design/adminhtml/Magento/backend/images/body-bg.jpg similarity index 100% rename from app/design/adminhtml/magento_backend/images/body-bg.jpg rename to app/design/adminhtml/Magento/backend/images/body-bg.jpg diff --git a/app/design/adminhtml/magento_backend/images/cancel_icon.gif b/app/design/adminhtml/Magento/backend/images/cancel_icon.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/cancel_icon.gif rename to app/design/adminhtml/Magento/backend/images/cancel_icon.gif diff --git a/app/design/adminhtml/magento_backend/images/edit_icon.gif b/app/design/adminhtml/Magento/backend/images/edit_icon.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/edit_icon.gif rename to app/design/adminhtml/Magento/backend/images/edit_icon.gif diff --git a/app/design/adminhtml/magento_backend/images/fam_application_form_delete.png b/app/design/adminhtml/Magento/backend/images/fam_application_form_delete.png similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_application_form_delete.png rename to app/design/adminhtml/Magento/backend/images/fam_application_form_delete.png diff --git a/app/design/adminhtml/magento_backend/images/fam_bin.gif b/app/design/adminhtml/Magento/backend/images/fam_bin.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_bin.gif rename to app/design/adminhtml/Magento/backend/images/fam_bin.gif diff --git a/app/design/adminhtml/magento_backend/images/fam_bullet_disk.gif b/app/design/adminhtml/Magento/backend/images/fam_bullet_disk.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_bullet_disk.gif rename to app/design/adminhtml/Magento/backend/images/fam_bullet_disk.gif diff --git a/app/design/adminhtml/magento_backend/images/fam_leaf.png b/app/design/adminhtml/Magento/backend/images/fam_leaf.png similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_leaf.png rename to app/design/adminhtml/Magento/backend/images/fam_leaf.png diff --git a/app/design/adminhtml/magento_backend/images/fam_link.gif b/app/design/adminhtml/Magento/backend/images/fam_link.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_link.gif rename to app/design/adminhtml/Magento/backend/images/fam_link.gif diff --git a/app/design/adminhtml/magento_backend/images/fam_package_go.gif b/app/design/adminhtml/Magento/backend/images/fam_package_go.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_package_go.gif rename to app/design/adminhtml/Magento/backend/images/fam_package_go.gif diff --git a/app/design/adminhtml/magento_backend/images/fam_refresh.gif b/app/design/adminhtml/Magento/backend/images/fam_refresh.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/fam_refresh.gif rename to app/design/adminhtml/Magento/backend/images/fam_refresh.gif diff --git a/app/design/adminhtml/magento_backend/images/grid-cal.gif b/app/design/adminhtml/Magento/backend/images/grid-cal.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/grid-cal.gif rename to app/design/adminhtml/Magento/backend/images/grid-cal.gif diff --git a/app/design/adminhtml/magento_backend/images/grouped_to_order_icon.png b/app/design/adminhtml/Magento/backend/images/grouped_to_order_icon.png similarity index 100% rename from app/design/adminhtml/magento_backend/images/grouped_to_order_icon.png rename to app/design/adminhtml/Magento/backend/images/grouped_to_order_icon.png diff --git a/app/design/adminhtml/magento_backend/images/ico_success.gif b/app/design/adminhtml/Magento/backend/images/ico_success.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/ico_success.gif rename to app/design/adminhtml/Magento/backend/images/ico_success.gif diff --git a/app/design/adminhtml/magento_backend/images/pager_arrow_left_off.gif b/app/design/adminhtml/Magento/backend/images/pager_arrow_left_off.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/pager_arrow_left_off.gif rename to app/design/adminhtml/Magento/backend/images/pager_arrow_left_off.gif diff --git a/app/design/adminhtml/magento_backend/images/pager_arrow_right_off.gif b/app/design/adminhtml/Magento/backend/images/pager_arrow_right_off.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/pager_arrow_right_off.gif rename to app/design/adminhtml/Magento/backend/images/pager_arrow_right_off.gif diff --git a/app/design/adminhtml/magento_backend/images/process_spinner.gif b/app/design/adminhtml/Magento/backend/images/process_spinner.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/process_spinner.gif rename to app/design/adminhtml/Magento/backend/images/process_spinner.gif diff --git a/app/design/adminhtml/magento_backend/images/rule_chooser_trigger.gif b/app/design/adminhtml/Magento/backend/images/rule_chooser_trigger.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/rule_chooser_trigger.gif rename to app/design/adminhtml/Magento/backend/images/rule_chooser_trigger.gif diff --git a/app/design/adminhtml/magento_backend/images/rule_component_add.gif b/app/design/adminhtml/Magento/backend/images/rule_component_add.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/rule_component_add.gif rename to app/design/adminhtml/Magento/backend/images/rule_component_add.gif diff --git a/app/design/adminhtml/magento_backend/images/rule_component_apply.gif b/app/design/adminhtml/Magento/backend/images/rule_component_apply.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/rule_component_apply.gif rename to app/design/adminhtml/Magento/backend/images/rule_component_apply.gif diff --git a/app/design/adminhtml/magento_backend/images/rule_component_remove.gif b/app/design/adminhtml/Magento/backend/images/rule_component_remove.gif similarity index 100% rename from app/design/adminhtml/magento_backend/images/rule_component_remove.gif rename to app/design/adminhtml/Magento/backend/images/rule_component_remove.gif diff --git a/app/design/adminhtml/Magento/backend/images/select-bg.svg b/app/design/adminhtml/Magento/backend/images/select-bg.svg new file mode 100644 index 0000000000000000000000000000000000000000..fd9a1c5e42870e655c857419a8a985afa1be1355 --- /dev/null +++ b/app/design/adminhtml/Magento/backend/images/select-bg.svg @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + width="30px" height="60px" viewBox="0 0 30 60" enable-background="new 0 0 30 60" xml:space="preserve"> +<rect fill="#F2EBDE" width="30" height="60"/> +<line fill="none" stroke="#ADA89E" stroke-miterlimit="10" x1="0.5" y1="60" x2="0.5" y2="0"/> +<path fill="#676056" d="M15.581,32.889l-4.003-5.369h8.006L15.581,32.889z"/> +</svg> diff --git a/app/design/adminhtml/magento_backend/images/subconfig-bg.png b/app/design/adminhtml/Magento/backend/images/subconfig-bg.png similarity index 100% rename from app/design/adminhtml/magento_backend/images/subconfig-bg.png rename to app/design/adminhtml/Magento/backend/images/subconfig-bg.png diff --git a/app/design/adminhtml/magento_backend/images/switcher.png b/app/design/adminhtml/Magento/backend/images/switcher.png similarity index 100% rename from app/design/adminhtml/magento_backend/images/switcher.png rename to app/design/adminhtml/Magento/backend/images/switcher.png diff --git a/app/design/adminhtml/magento_backend/js/theme.js b/app/design/adminhtml/Magento/backend/js/theme.js similarity index 86% rename from app/design/adminhtml/magento_backend/js/theme.js rename to app/design/adminhtml/Magento/backend/js/theme.js index 3d8f629d89a5d0900fb06e56684aaaf3a3718e20..dd606382f887ef00fb3d668d352693e953ae9d3e 100644 --- a/app/design/adminhtml/magento_backend/js/theme.js +++ b/app/design/adminhtml/Magento/backend/js/theme.js @@ -21,71 +21,33 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -; -(function($, document) { +;(function($, document) { 'use strict'; $.widget('mage.globalSearch', { options: { - header: '.header', - headerActiveClass: 'active', - form: '#form-search', - input: 'input', - inputDefaultWidth: 50, - inputOpenedWidth: 350, - submitButton: 'button[type="submit"]', - timeoutId: null, - actionSpeed: 500 + field: '.search-global-field', + fieldActiveClass: 'active', + input: '#search-global' }, _create: function() { - this.header = $(this.options.header); - this.form = $(this.options.form); - this.input = $(this.options.input, this.form); - this.submitButton = $(this.options.submitButton, this.form); - + this.field = $(this.options.field); + this.input = $(this.options.input); this._events(); }, _events: function() { var self = this; - - this.form - .on('submit.submitGlobalSearchRequest', function() { - if (!self.input.val()) { - self.header.addClass(self.options.headerActiveClass); - self.input - .animate({ - width: self.options.inputOpenedWidth - }, self.options.actionSpeed) - .focus(); - } else { - this.submit(); - } - - return false; - }); - this.input .on('blur.resetGlobalSearchForm', function() { if (!self.input.val()) { - self.timeoutId && clearTimeout(self.timeoutId); - self.timeoutId = setTimeout(function() { - self.input - .animate({ - width: self.options.inputDefaultWidth - }, 200, function() { - var callbackTimeout = setTimeout(function() { - self.header.removeClass(self.options.headerActiveClass); - }, self.options.actionSpeed); - }); - }, self.options.actionSpeed); + self.field.removeClass(self.options.fieldActiveClass) } }); - - this.submitButton - .on('click.activateGlobalSearch', function() { - self.timeoutId && clearTimeout(self.timeoutId); + this.input + .on('focus.activateGlobalSearchForm', function() { + self.field.addClass(self.options.fieldActiveClass) }); } }); @@ -392,7 +354,7 @@ }; $(document).ready(function() { - $('.header-panel .search').globalSearch(); + $('.search-global.miniform').globalSearch(); $('.navigation').globalNavigation({ categoriesConfig: { '[data-ui-id="menu-mage-adminhtml-system"]': { diff --git a/app/design/adminhtml/magento_backend/less/clearless/all.less b/app/design/adminhtml/Magento/backend/less/clearless/all.less similarity index 98% rename from app/design/adminhtml/magento_backend/less/clearless/all.less rename to app/design/adminhtml/Magento/backend/less/clearless/all.less index adcffe4fcb6314586502fd86d7b9ef3979111e5c..df5d0d4beb474efc908a3a9983ad090dd7887aac 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/all.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/all.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,21 +15,21 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Handily import all ClearLess mixins -// ============================================== - -@import "settings"; -@import "typography"; -@import "resets"; -@import "helpers"; -@import "sprites"; -@import "icons"; -@import "arrows"; +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Handily import all ClearLess mixins +// ============================================== + +@import "settings"; +@import "typography"; +@import "resets"; +@import "helpers"; +@import "sprites"; +@import "icons"; +@import "arrows"; @import "grids"; \ No newline at end of file diff --git a/app/design/adminhtml/magento_backend/less/clearless/arrows.less b/app/design/adminhtml/Magento/backend/less/clearless/arrows.less similarity index 96% rename from app/design/adminhtml/magento_backend/less/clearless/arrows.less rename to app/design/adminhtml/Magento/backend/less/clearless/arrows.less index c687b7f7fc0ab34d073c66d191ed8223790fe19a..be04b7994901defce050b700a24d0fc01ad5d6b4 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/arrows.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/arrows.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,157 +15,157 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.arrow(@pos, @size, @bg-color) { - width: 0; - height: 0; - border: @size solid transparent; - ._abbor_el( @pos, @bg-color ); -} - -.arrowbox(@pos, @size, @bg-color, @offset:50%) { - - @after-margin: @size * -1px; - - position: relative; - background: @bg-color; - - &:after, - &:before { - ._abpos(@pos); - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; - } - - &:after { - border-color: transparent; - ._abbor_el(@pos, @bg-color); - border-width: @size; - ._abpos_el(@pos, @size, @offset); - ._abmar_el(@pos, @after-margin); - } - -} - -.arrowbox(@pos, @size, @bg-color, @border-width, @border-color, @offset:50%) { - - @before-margin: (@size + round(@border-width * 1.41421356)) * -1px; - - .arrowbox(@pos, @size, @bg-color, @offset); - - border: @border-width solid @border-color; - - &:before { - border-color: transparent; - ._abbor_el(@pos, @border-color); - border-width: @before-margin * -1; - ._abpos_el(@pos, @size, @offset); - ._abmar_el(@pos, @before-margin); - } - -} - -._abpos( @pos ) when ( @pos = left ) { - right: 100%; -} - -._abpos( @pos ) when ( @pos = right ) { - left: 100%; -} - -._abpos( @pos ) when ( @pos = up ) { - bottom: 100%; -} - -._abpos( @pos ) when ( @pos = down ) { - top: 100%; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = left ) { - top: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = right ) { - top: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = up ) { - left: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = down ) { - left: @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = left ) { - top: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = right ) { - top: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = up ) { - left: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = down ) { - left: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = left ) { - top: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = right ) { - top: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = up ) { - left: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = down ) { - left: @offset + @size; -} - -._abbor_el( @pos, @color ) when ( @pos = left ) { - border-right-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = right ) { - border-left-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = up ) { - border-bottom-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = down ) { - border-top-color: @color; -} - -._abmar_el( @pos, @margin ) when ( @pos = left ) { - margin-top: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = right ) { - margin-top: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = up ) { - margin-left: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = down ) { - margin-left: @margin; -} +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +.arrow(@pos, @size, @bg-color) { + width: 0; + height: 0; + border: @size solid transparent; + ._abbor_el( @pos, @bg-color ); +} + +.arrowbox(@pos, @size, @bg-color, @offset:50%) { + + @after-margin: @size * -1px; + + position: relative; + background: @bg-color; + + &:after, + &:before { + ._abpos(@pos); + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; + } + + &:after { + border-color: transparent; + ._abbor_el(@pos, @bg-color); + border-width: @size; + ._abpos_el(@pos, @size, @offset); + ._abmar_el(@pos, @after-margin); + } + +} + +.arrowbox(@pos, @size, @bg-color, @border-width, @border-color, @offset:50%) { + + @before-margin: (@size + round(@border-width * 1.41421356)) * -1px; + + .arrowbox(@pos, @size, @bg-color, @offset); + + border: @border-width solid @border-color; + + &:before { + border-color: transparent; + ._abbor_el(@pos, @border-color); + border-width: @before-margin * -1; + ._abpos_el(@pos, @size, @offset); + ._abmar_el(@pos, @before-margin); + } + +} + +._abpos( @pos ) when ( @pos = left ) { + right: 100%; +} + +._abpos( @pos ) when ( @pos = right ) { + left: 100%; +} + +._abpos( @pos ) when ( @pos = up ) { + bottom: 100%; +} + +._abpos( @pos ) when ( @pos = down ) { + top: 100%; +} + +._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = left ) { + top: @size; +} + +._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = right ) { + top: @size; +} + +._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = up ) { + left: @size; +} + +._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = down ) { + left: @size; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = left ) { + top: @offset; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = right ) { + top: @offset; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = up ) { + left: @offset; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = down ) { + left: @offset; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = left ) { + top: @offset + @size; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = right ) { + top: @offset + @size; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = up ) { + left: @offset + @size; +} + +._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = down ) { + left: @offset + @size; +} + +._abbor_el( @pos, @color ) when ( @pos = left ) { + border-right-color: @color; +} + +._abbor_el( @pos, @color ) when ( @pos = right ) { + border-left-color: @color; +} + +._abbor_el( @pos, @color ) when ( @pos = up ) { + border-bottom-color: @color; +} + +._abbor_el( @pos, @color ) when ( @pos = down ) { + border-top-color: @color; +} + +._abmar_el( @pos, @margin ) when ( @pos = left ) { + margin-top: @margin; +} + +._abmar_el( @pos, @margin ) when ( @pos = right ) { + margin-top: @margin; +} + +._abmar_el( @pos, @margin ) when ( @pos = up ) { + margin-left: @margin; +} + +._abmar_el( @pos, @margin ) when ( @pos = down ) { + margin-left: @margin; +} diff --git a/app/design/adminhtml/magento_backend/less/clearless/grids.less b/app/design/adminhtml/Magento/backend/less/clearless/grids.less similarity index 96% rename from app/design/adminhtml/magento_backend/less/clearless/grids.less rename to app/design/adminhtml/Magento/backend/less/clearless/grids.less index 8b3b377aa98f93a5d8f10022ec7de3c93bb9eaa6..8be3a2b2b02a7700978f4e1b976f91be07d586f5 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/grids.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/grids.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,171 +15,171 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Grid mixins -// ============================================== - -// You shouldn't need to touch this! Internal use only. -@column-width: 1; -@total-columns: 1; -@gutter-width: 1; -@grid-width: (@column-width*@total-columns) + (@gutter-width*(@total-columns - 1)); - -.column-wrapper() { - width: 100%; -} - -.inline-column-wrapper() when not (@using-ieclasses) { - letter-spacing: -0.31em; - *letter-spacing: normal; - word-spacing: -0.43em; -} - -.inline-column-wrapper() when (@using-ieclasses) { - letter-spacing: -0.31em; - word-spacing: -0.43em; - .ie7 & { - letter-spacing: normal; - } -} - -.column() { - float: left; - .column-gutter(); -} - -.column( @span ) when (@span = false) { - float: left; -} - -.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and not (isnumber(@end-column)) { - @showgutter: false; - .column(@showgutter); - .span( @span, @total-columns ); -} - -.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and (@end-column = true) { - @showgutter: false; - .column(@showgutter); - .span( @span, @total-columns ); - .end-column(); -} - -.column( @span, @end-column ) when (isnumber(@span)) and not (isnumber(@end-column)) { - @showgutter: false; - .column(@showgutter); - .span( @span ); -} - -.column( @span, @end-column ) when (isnumber(@span)) and ( @end-column = true ) { - @showgutter: false; - .column(@showgutter); - .span( @span ); - .end-column(); -} - -.inline-column() { - .inline-block(); - vertical-align: top; - letter-spacing: normal; - word-spacing: normal; - .column-gutter(); -} - -.inline-column( @span ) when (@span = false) { - .inline-block(); - vertical-align: top; - letter-spacing: normal; - word-spacing: normal; -} - -.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span, @total-columns ); -} - -.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (@end-column = true) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span, @total-columns ); - .inline-end-column(); -} - -.inline-column( @span, @end-column ) when not (isnumber(@end-column)) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span ); -} - -.inline-column( @span, @end-column ) when (@end-column = true) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span ); - .inline-end-column(); -} - -.end-column() { - margin-right: 0; - float: right; -} - -.inline-end-column() { - margin-right: 0; -} - -.span( @span ) { - .column-width(@span, @total-columns); -} - -.span( @span, @total-columns ) when (isnumber(@total-columns)) { - .column-width(@span, @total-columns); - .column-gutter(@total-columns); -} - -.pre-pad( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - padding-left: @calc-column-width; -} - -.post-pad( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - padding-right: @calc-column-width; -} - -.pre-push( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - margin-left: @calc-column-width; -} - -.post-push( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)+@gutter-width) / @grid-width); - margin-right: @calc-column-width; -} - -.post-push-end( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - margin-right: @calc-column-width; -} - -.column-width(@span, @total-columns:@total-columns) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)-@gutter-width) / @grid-width); - width: @calc-column-width; -} - -.column-gutter(@total-columns:@total-columns, @end-column:false) when (@end-column) { - margin-right: 0; -} - -.column-gutter(@total-columns:@total-columns, @end-column:false) when not (@end-column) { - @calc-gutter-width: 100%*(@gutter-width/@grid-width); - margin-right: @calc-gutter-width; -} - - +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Grid mixins +// ============================================== + +// You shouldn't need to touch this! Internal use only. +@column-width: 1; +@total-columns: 1; +@gutter-width: 1; +@grid-width: (@column-width*@total-columns) + (@gutter-width*(@total-columns - 1)); + +.column-wrapper() { + width: 100%; +} + +.inline-column-wrapper() when not (@using-ieclasses) { + letter-spacing: -0.31em; + *letter-spacing: normal; + word-spacing: -0.43em; +} + +.inline-column-wrapper() when (@using-ieclasses) { + letter-spacing: -0.31em; + word-spacing: -0.43em; + .ie7 & { + letter-spacing: normal; + } +} + +.column() { + float: left; + .column-gutter(); +} + +.column( @span ) when (@span = false) { + float: left; +} + +.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and not (isnumber(@end-column)) { + @showgutter: false; + .column(@showgutter); + .span( @span, @total-columns ); +} + +.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and (@end-column = true) { + @showgutter: false; + .column(@showgutter); + .span( @span, @total-columns ); + .end-column(); +} + +.column( @span, @end-column ) when (isnumber(@span)) and not (isnumber(@end-column)) { + @showgutter: false; + .column(@showgutter); + .span( @span ); +} + +.column( @span, @end-column ) when (isnumber(@span)) and ( @end-column = true ) { + @showgutter: false; + .column(@showgutter); + .span( @span ); + .end-column(); +} + +.inline-column() { + .inline-block(); + vertical-align: top; + letter-spacing: normal; + word-spacing: normal; + .column-gutter(); +} + +.inline-column( @span ) when (@span = false) { + .inline-block(); + vertical-align: top; + letter-spacing: normal; + word-spacing: normal; +} + +.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) { + @showgutter: false; + .inline-column(@showgutter); + .span( @span, @total-columns ); +} + +.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (@end-column = true) { + @showgutter: false; + .inline-column(@showgutter); + .span( @span, @total-columns ); + .inline-end-column(); +} + +.inline-column( @span, @end-column ) when not (isnumber(@end-column)) { + @showgutter: false; + .inline-column(@showgutter); + .span( @span ); +} + +.inline-column( @span, @end-column ) when (@end-column = true) { + @showgutter: false; + .inline-column(@showgutter); + .span( @span ); + .inline-end-column(); +} + +.end-column() { + margin-right: 0; + float: right; +} + +.inline-end-column() { + margin-right: 0; +} + +.span( @span ) { + .column-width(@span, @total-columns); +} + +.span( @span, @total-columns ) when (isnumber(@total-columns)) { + .column-width(@span, @total-columns); + .column-gutter(@total-columns); +} + +.pre-pad( @span, @total-columns:@total-columns ) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); + padding-left: @calc-column-width; +} + +.post-pad( @span, @total-columns:@total-columns ) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); + padding-right: @calc-column-width; +} + +.pre-push( @span, @total-columns:@total-columns ) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); + margin-left: @calc-column-width; +} + +.post-push( @span, @total-columns:@total-columns ) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)+@gutter-width) / @grid-width); + margin-right: @calc-column-width; +} + +.post-push-end( @span, @total-columns:@total-columns ) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); + margin-right: @calc-column-width; +} + +.column-width(@span, @total-columns:@total-columns) { + @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)-@gutter-width) / @grid-width); + width: @calc-column-width; +} + +.column-gutter(@total-columns:@total-columns, @end-column:false) when (@end-column) { + margin-right: 0; +} + +.column-gutter(@total-columns:@total-columns, @end-column:false) when not (@end-column) { + @calc-gutter-width: 100%*(@gutter-width/@grid-width); + margin-right: @calc-gutter-width; +} + + diff --git a/app/design/adminhtml/magento_backend/less/clearless/helpers.less b/app/design/adminhtml/Magento/backend/less/clearless/helpers.less similarity index 97% rename from app/design/adminhtml/magento_backend/less/clearless/helpers.less rename to app/design/adminhtml/Magento/backend/less/clearless/helpers.less index baaefaccdfce7fa01abd45aa1cb203fba07f6267..902e55c8f686718143b59826b5b8abc5640c6a68 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/helpers.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/helpers.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,233 +15,233 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Misc helpers and shortcuts -// ============================================== - -// Shortcuts -------------------------------- - -.border-radius(@radius:5px) { - -webkit-border-radius: @arguments; - -moz-border-radius: @arguments; - border-radius: @arguments; -} - -.box-sizing(@type: border-box) { - -moz-box-sizing: @type; - -webkit-box-sizing: @type; - -ms-box-sizing: @type; - box-sizing: @type; -} - -.box-shadow(@shadow: 1px 1px 2px rgba(0,0,0,0.25)) { - -webkit-box-shadow: @shadow; - -moz-box-shadow: @shadow; - box-shadow: @shadow; -} - -.filter(@filter: grayscale(100%)) { - -webkit-filter: @filter; - -moz-filter: @filter; - -ms-filter: @filter; - -o-filter: @filter; - filter: @filter; -} - -.transition(@transition) { - -webkit-transition: @transition; - -moz-transition: @transition; - transition: @transition; -} - -.rotate(@rotation) { - -webkit-transform: rotate(@rotation); - -moz-transform: rotate(@rotation); - -o-transform: rotate(@rotation); - transform: rotate(@rotation); -} - -.placeholder(@color: #DDD) { - :-moz-placeholder { - color: @color; - } - ::-webkit-input-placeholder { - color: @color; - } -} - -#gradient { - .horizontal (@start-color, @end-color) when not (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ - filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color)); /* IE6 & IE7 */ - -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color); /* IE8+ */ - } - .horizontal (@start-color, @end-color) when (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ - } - .vertical (@start-color, @end-color) when (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(@start-color, @end-color); /* the standard */ - } - .vertical (@start-color, @end-color) when not (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(@start-color, @end-color); /* the standard */ - filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color)); /* IE6 & IE7 */ - -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color); /* IE8+ */ - } -} - -// Helpers -------------------------------- - -.clearfix() when not (@using-ieclasses) { - &:before, - &:after { - content: ""; - display: table; - } - &:after { - clear: both; - } - *zoom: 1; -} - -.clearfix() when (@using-ieclasses) { - &:before, - &:after { - content: ""; - display: table; - } - &:after { - clear: both; - } - .ie6 &, .ie7 & { - zoom: 1; - } -} - -.inline-block() when (@using-ieclasses) { - display: inline-block; - .ie7 & { - display: inline; - zoom: 1; - } -} - -.inline-block() when not (@using-ieclasses) { - display: inline-block; - *display: inline; - *zoom: 1; -} - -.ir() { - border: 0; - font: 0/0 a; - text-shadow: none; - color: transparent; - background-color: transparent; -} - -.hidden() { - display: none !important; - visibility: hidden; -} - -.visually-hidden() { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - &.focusable:active, - &.focusable:focus { - clip: auto; - height: auto; - margin: 0; - overflow: visible; - position: static; - width: auto; - } -} - -.size(@thesize) { - width: @thesize; - height: @thesize; -} - -.size(@width, @height) { - width: @width; - height: @height; -} - -// System -------------------------------- - -.nudge-l( @pos ) when ( @pos = 0 ) { -} - -.nudge-l( @pos ) when not ( @pos = 0 ) { - left: @pos; -} - -.nudge-r( @pos ) when ( @pos = 0 ) { -} - -.nudge-r( @pos ) when not ( @pos = 0 ) { - right: @pos; -} - -.nudge-t( @pos ) when ( @pos = 0 ) { -} - -.nudge-t( @pos ) when not ( @pos = 0 ) { - top: @pos; -} - -.nudge-b( @pos ) when ( @pos = 0 ) { -} - -.nudge-b( @pos ) when not ( @pos = 0 ) { - bottom: @pos; -} +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Misc helpers and shortcuts +// ============================================== + +// Shortcuts -------------------------------- + +.border-radius(@radius:5px) { + -webkit-border-radius: @arguments; + -moz-border-radius: @arguments; + border-radius: @arguments; +} + +.box-sizing(@type: border-box) { + -moz-box-sizing: @type; + -webkit-box-sizing: @type; + -ms-box-sizing: @type; + box-sizing: @type; +} + +.box-shadow(@shadow: 1px 1px 2px rgba(0,0,0,0.25)) { + -webkit-box-shadow: @shadow; + -moz-box-shadow: @shadow; + box-shadow: @shadow; +} + +.filter(@filter: grayscale(100%)) { + -webkit-filter: @filter; + -moz-filter: @filter; + -ms-filter: @filter; + -o-filter: @filter; + filter: @filter; +} + +.transition(@transition) { + -webkit-transition: @transition; + -moz-transition: @transition; + transition: @transition; +} + +.rotate(@rotation) { + -webkit-transform: rotate(@rotation); + -moz-transform: rotate(@rotation); + -o-transform: rotate(@rotation); + transform: rotate(@rotation); +} + +.placeholder(@color: #DDD) { + :-moz-placeholder { + color: @color; + } + ::-webkit-input-placeholder { + color: @color; + } +} + +#gradient { + .horizontal (@start-color, @end-color) when not (@disable-filters) { + background-color: @end-color; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ + background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ + background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ + background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ + background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ + background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ + background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ + background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color)); /* IE6 & IE7 */ + -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color); /* IE8+ */ + } + .horizontal (@start-color, @end-color) when (@disable-filters) { + background-color: @end-color; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ + background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ + background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ + background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ + background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ + background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ + background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ + background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ + } + .vertical (@start-color, @end-color) when (@disable-filters) { + background-color: @end-color; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ + background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ + background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ + background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ + background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ + background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ + background-image: linear-gradient(@start-color, @end-color); /* the standard */ + } + .vertical (@start-color, @end-color) when not (@disable-filters) { + background-color: @end-color; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ + background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ + background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ + background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ + background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ + background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ + background-image: linear-gradient(@start-color, @end-color); /* the standard */ + filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color)); /* IE6 & IE7 */ + -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color); /* IE8+ */ + } +} + +// Helpers -------------------------------- + +.clearfix() when not (@using-ieclasses) { + &:before, + &:after { + content: ""; + display: table; + } + &:after { + clear: both; + } + *zoom: 1; +} + +.clearfix() when (@using-ieclasses) { + &:before, + &:after { + content: ""; + display: table; + } + &:after { + clear: both; + } + .ie6 &, .ie7 & { + zoom: 1; + } +} + +.inline-block() when (@using-ieclasses) { + display: inline-block; + .ie7 & { + display: inline; + zoom: 1; + } +} + +.inline-block() when not (@using-ieclasses) { + display: inline-block; + *display: inline; + *zoom: 1; +} + +.ir() { + border: 0; + font: 0/0 a; + text-shadow: none; + color: transparent; + background-color: transparent; +} + +.hidden() { + display: none !important; + visibility: hidden; +} + +.visually-hidden() { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; + &.focusable:active, + &.focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; + } +} + +.size(@thesize) { + width: @thesize; + height: @thesize; +} + +.size(@width, @height) { + width: @width; + height: @height; +} + +// System -------------------------------- + +.nudge-l( @pos ) when ( @pos = 0 ) { +} + +.nudge-l( @pos ) when not ( @pos = 0 ) { + left: @pos; +} + +.nudge-r( @pos ) when ( @pos = 0 ) { +} + +.nudge-r( @pos ) when not ( @pos = 0 ) { + right: @pos; +} + +.nudge-t( @pos ) when ( @pos = 0 ) { +} + +.nudge-t( @pos ) when not ( @pos = 0 ) { + top: @pos; +} + +.nudge-b( @pos ) when ( @pos = 0 ) { +} + +.nudge-b( @pos ) when not ( @pos = 0 ) { + bottom: @pos; +} diff --git a/app/design/adminhtml/magento_backend/less/clearless/icons.less b/app/design/adminhtml/Magento/backend/less/clearless/icons.less similarity index 96% rename from app/design/adminhtml/magento_backend/less/clearless/icons.less rename to app/design/adminhtml/Magento/backend/less/clearless/icons.less index 849dd2512aa93e5259990c40ad36447ce643f2d0..fbc18d1b3d7e15d4eeba01c55710f1a36a8af183 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/icons.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/icons.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,312 +15,312 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Generated content icon helpers -// ---------------------------------------------- -// These can only be used on block or inline-block elements. -// ============================================== - -// Non-sprited icons -------------------------------- - -.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-left: @width + @pad; - } - .generatedcontent &:before { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - left: @nudge-left; - } -} - -.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { - position: relative; - padding-left: @width + @pad; - &:before { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - left: @nudge-left; - } -} - -.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-right: @width + @pad; - } - .generatedcontent &:after { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - right: @nudge-right; - } -} - -.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { - position: relative; - padding-right: @width + @pad; - .generatedcontent &:after { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - right: @nudge-right; - } -} - -// Sprited icons -------------------------------- - -.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-left: @width + @pad; - } - .generatedcontent &:before { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - left: @nudge-left; - } -} - -.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - position: relative; - padding-left: @width + @pad; - &:before { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - left: @nudge-left; - } -} - -.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent & { - padding-right: @width + @pad; - position: relative; - } - .generatedcontent &:after { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - right: @nudge-right; - } -} - -.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - position: relative; - padding-right: @width + @pad; - &:after { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - right: @nudge-right; - } -} - -.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent &:before { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - &:before { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent &:after { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - &:after { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -// ---- Partials ----------------------- - -.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - .generatedcontent & { - position: relative; - ._pad-left(@width, @pad); - } - .generatedcontent &:before { - position: absolute; - display: block; - content: ' '; - top: 0; - left: 0; - ._size(@width, @height); - } -} - -.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - position: relative; - ._pad-left(@width, @pad); - &:before { - position: absolute; - display: block; - content: ' '; - top: 0; - left: 0; - ._size(@width, @height); - } -} - -.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - .generatedcontent & { - position: relative; - ._pad-right(@width, @pad); - } - .generatedcontent &:after { - position: absolute; - display: block; - content: ' '; - top: 0; - right: 0; - ._size(@width, @height); - } -} - -.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - position: relative; - ._pad-right(@width, @pad); - &:after { - position: absolute; - display: block; - content: ' '; - top: 0; - right: 0; - ._size(@width, @height); - } -} - -.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - ._gc-pad-left(@width, @pad); - .generatedcontent &:before { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - ._pad-left(@width, @pad); - &:before { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - ._gc-pad-right(@width, @pad); - .generatedcontent &:after { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - ._pad-right(@width, @pad); - &:after { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -// ---- internal use mixins ----------------------- - -._generated-icon(@width, @height, @icon-image) { - position: absolute; - display: block; - content: ' '; - background: url(@icon-image) no-repeat 0 0; - .size(@width, @height); -} - -._generated-sprite-icon(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { - position: absolute; - display: block; - content: ' '; - .sprite-sized(@x, @y, @width, @height, @sprite-image, @sprite-grid); -} - -._pad-left(@width, @pad) when (@width = 0) { -} - -._pad-left(@width, @pad) when not (@width = 0) { - padding-left: @width + @pad; -} - -._pad-right(@width, @pad) when (@width = 0) { -} - -._pad-right(@width, @pad) when not (@width = 0) { - padding-right: @width + @pad; -} - -._gc-pad-left(@width, @pad) when (@width = 0) { -} - -._gc-pad-right(@width, @pad) when (@width = 0) { -} - -._gc-pad-left(@width, @pad) when not (@width = 0) and (@using-modernizr) { - .generatedcontent & { - ._pad-left(@width, @pad); - } -} - -._gc-pad-left(@width, @pad) when not (@width = 0) and not (@using-modernizr) { - ._pad-left(@width, @pad); -} - -._gc-pad-right(@width, @pad) when not (@width = 0) { - .generatedcontent & { - ._pad-right(@width, @pad); - } -} - -._gc-pad-right(@width, @pad) when not (@width = 0) and not (@using-modernizr) { - ._pad-right(@width, @pad); -} - -._size(@width, @height) when (@width = 0) and (@height = 0) { -} - -._size(@width, @height) when (@width = 0) and not (@height = 0) { - height: @height; -} - -._size(@width, @height) when not (@width = 0) and (@height = 0) { - width: @width; -} - -._size(@width, @height) when not (@width = 0) and not (@height = 0) { - width: @width; - height: @height; -} - - - +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Generated content icon helpers +// ---------------------------------------------- +// These can only be used on block or inline-block elements. +// ============================================== + +// Non-sprited icons -------------------------------- + +.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { + .generatedcontent & { + position: relative; + padding-left: @width + @pad; + } + .generatedcontent &:before { + ._generated-icon( @width, @height, @icon-image ); + top: @nudge-top; + left: @nudge-left; + } +} + +.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { + position: relative; + padding-left: @width + @pad; + &:before { + ._generated-icon( @width, @height, @icon-image ); + top: @nudge-top; + left: @nudge-left; + } +} + +.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { + .generatedcontent & { + position: relative; + padding-right: @width + @pad; + } + .generatedcontent &:after { + ._generated-icon( @width, @height, @icon-image ); + top: @nudge-top; + right: @nudge-right; + } +} + +.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { + position: relative; + padding-right: @width + @pad; + .generatedcontent &:after { + ._generated-icon( @width, @height, @icon-image ); + top: @nudge-top; + right: @nudge-right; + } +} + +// Sprited icons -------------------------------- + +.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { + .generatedcontent & { + position: relative; + padding-left: @width + @pad; + } + .generatedcontent &:before { + ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); + top: @nudge-top; + left: @nudge-left; + } +} + +.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { + position: relative; + padding-left: @width + @pad; + &:before { + ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); + top: @nudge-top; + left: @nudge-left; + } +} + +.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { + .generatedcontent & { + padding-right: @width + @pad; + position: relative; + } + .generatedcontent &:after { + ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); + top: @nudge-top; + right: @nudge-right; + } +} + +.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { + position: relative; + padding-right: @width + @pad; + &:after { + ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); + top: @nudge-top; + right: @nudge-right; + } +} + +.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { + .generatedcontent &:before { + .sprite-pos(@x, @y, @sprite-grid); + .nudge-l(@nudge-left); + .nudge-t(@nudge-top); + } +} + +.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { + &:before { + .sprite-pos(@x, @y, @sprite-grid); + .nudge-l(@nudge-left); + .nudge-t(@nudge-top); + } +} + +.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { + .generatedcontent &:after { + .sprite-pos(@x, @y, @sprite-grid); + .nudge-r(@nudge-right); + .nudge-t(@nudge-top); + } +} + +.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { + &:after { + .sprite-pos(@x, @y, @sprite-grid); + .nudge-r(@nudge-right); + .nudge-t(@nudge-top); + } +} + +// ---- Partials ----------------------- + +.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { + .generatedcontent & { + position: relative; + ._pad-left(@width, @pad); + } + .generatedcontent &:before { + position: absolute; + display: block; + content: ' '; + top: 0; + left: 0; + ._size(@width, @height); + } +} + +.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { + position: relative; + ._pad-left(@width, @pad); + &:before { + position: absolute; + display: block; + content: ' '; + top: 0; + left: 0; + ._size(@width, @height); + } +} + +.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { + .generatedcontent & { + position: relative; + ._pad-right(@width, @pad); + } + .generatedcontent &:after { + position: absolute; + display: block; + content: ' '; + top: 0; + right: 0; + ._size(@width, @height); + } +} + +.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { + position: relative; + ._pad-right(@width, @pad); + &:after { + position: absolute; + display: block; + content: ' '; + top: 0; + right: 0; + ._size(@width, @height); + } +} + +.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { + ._gc-pad-left(@width, @pad); + .generatedcontent &:before { + background: url(@icon-image) no-repeat 0 0; + ._size(@width, @height); + .nudge-l(@nudge-left); + .nudge-t(@nudge-top); + } +} + +.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { + ._pad-left(@width, @pad); + &:before { + background: url(@icon-image) no-repeat 0 0; + ._size(@width, @height); + .nudge-l(@nudge-left); + .nudge-t(@nudge-top); + } +} + +.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { + ._gc-pad-right(@width, @pad); + .generatedcontent &:after { + background: url(@icon-image) no-repeat 0 0; + ._size(@width, @height); + .nudge-r(@nudge-right); + .nudge-t(@nudge-top); + } +} + +.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { + ._pad-right(@width, @pad); + &:after { + background: url(@icon-image) no-repeat 0 0; + ._size(@width, @height); + .nudge-r(@nudge-right); + .nudge-t(@nudge-top); + } +} + +// ---- internal use mixins ----------------------- + +._generated-icon(@width, @height, @icon-image) { + position: absolute; + display: block; + content: ' '; + background: url(@icon-image) no-repeat 0 0; + .size(@width, @height); +} + +._generated-sprite-icon(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { + position: absolute; + display: block; + content: ' '; + .sprite-sized(@x, @y, @width, @height, @sprite-image, @sprite-grid); +} + +._pad-left(@width, @pad) when (@width = 0) { +} + +._pad-left(@width, @pad) when not (@width = 0) { + padding-left: @width + @pad; +} + +._pad-right(@width, @pad) when (@width = 0) { +} + +._pad-right(@width, @pad) when not (@width = 0) { + padding-right: @width + @pad; +} + +._gc-pad-left(@width, @pad) when (@width = 0) { +} + +._gc-pad-right(@width, @pad) when (@width = 0) { +} + +._gc-pad-left(@width, @pad) when not (@width = 0) and (@using-modernizr) { + .generatedcontent & { + ._pad-left(@width, @pad); + } +} + +._gc-pad-left(@width, @pad) when not (@width = 0) and not (@using-modernizr) { + ._pad-left(@width, @pad); +} + +._gc-pad-right(@width, @pad) when not (@width = 0) { + .generatedcontent & { + ._pad-right(@width, @pad); + } +} + +._gc-pad-right(@width, @pad) when not (@width = 0) and not (@using-modernizr) { + ._pad-right(@width, @pad); +} + +._size(@width, @height) when (@width = 0) and (@height = 0) { +} + +._size(@width, @height) when (@width = 0) and not (@height = 0) { + height: @height; +} + +._size(@width, @height) when not (@width = 0) and (@height = 0) { + width: @width; +} + +._size(@width, @height) when not (@width = 0) and not (@height = 0) { + width: @width; + height: @height; +} + + + diff --git a/app/design/adminhtml/magento_backend/less/clearless/resets.less b/app/design/adminhtml/Magento/backend/less/clearless/resets.less similarity index 95% rename from app/design/adminhtml/magento_backend/less/clearless/resets.less rename to app/design/adminhtml/Magento/backend/less/clearless/resets.less index 7dbf97020995bdfab63799038b320e957aae481f..2a7b2f8a5f1f51fd90f4f844bb790681cb7fa15f 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/resets.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/resets.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,292 +15,292 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.normalize() { - - /* normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ - - article, - aside, - details, - figcaption, - figure, - footer, - header, - hgroup, - nav, - section, - summary { - display: block; - } - audio, - canvas, - video { - display: inline-block; - *display: inline; - *zoom: 1; - } - audio:not([controls]) { - display: none; - height: 0; - } - [hidden] { - display: none; - } - html { - font-size: 100%; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - html, - button, - input, - select, - textarea { - font-family: sans-serif; - } - body { - margin: 0; - } - a:focus { - outline: thin dotted; - } - a:hover, - a:active { - outline: 0; - } - h1 { - font-size: 2em; - margin: 0.67em 0; - } - h2 { - font-size: 1.5em; - margin: 0.83em 0; - } - h3 { - font-size: 1.17em; - margin: 1em 0; - } - h4 { - font-size: 1em; - margin: 1.33em 0; - } - h5 { - font-size: 0.83em; - margin: 1.67em 0; - } - h6 { - font-size: 0.75em; - margin: 2.33em 0; - } - abbr[title] { - border-bottom: 1px dotted; - } - b, - strong { - font-weight: bold; - } - blockquote { - margin: 1em 40px; - } - dfn { - font-style: italic; - } - mark { - background: #ff0; - color: #000; - } - p, - pre { - margin: 1em 0; - } - pre, - code, - kbd, - samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; - } - pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; - } - q { - quotes: none; - } - q:before, - q:after { - content: ''; - content: none; - } - small { - font-size: 75%; - } - sub, - sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - sup { - top: -0.5em; - } - sub { - bottom: -0.25em; - } - dl, - menu, - ol, - ul { - margin: 1em 0; - } - dd { - margin: 0 0 0 40px; - } - menu, - ol, - ul { - padding: 0 0 0 40px; - } - nav ul, - nav ol { - list-style: none; - list-style-image: none; - } - img { - border: 0; - -ms-interpolation-mode: bicubic; - } - svg:not(:root) { - overflow: hidden; - } - figure { - margin: 0; - } - form { - margin: 0; - } - fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; - } - legend { - border: 0; - padding: 0; - white-space: normal; - *margin-left: -7px; - } - button, - input, - select, - textarea { - font-size: 100%; - margin: 0; - vertical-align: baseline; - *vertical-align: middle; - } - button, - input { - line-height: normal; - } - button, - input[type="button"], - input[type="reset"], - input[type="submit"] { - cursor: pointer; - -webkit-appearance: button; - *overflow: visible; - } - button[disabled], - input[disabled] { - cursor: default; - } - input[type="checkbox"], - input[type="radio"] { - box-sizing: border-box; - padding: 0; - *height: 13px; - *width: 13px; - } - input[type="search"] { - -webkit-appearance: textfield; - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - box-sizing: content-box; - } - input[type="search"]::-webkit-search-decoration, - input[type="search"]::-webkit-search-cancel-button { - -webkit-appearance: none; - } - button::-moz-focus-inner, - input::-moz-focus-inner { - border: 0; - padding: 0; - } - textarea { - overflow: auto; - vertical-align: top; - } - table { - border-collapse: collapse; - border-spacing: 0; - } -} - -.reset() { - - /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ - - html, body, div, span, applet, object, iframe, - h1, h2, h3, h4, h5, h6, p, blockquote, pre, - a, abbr, acronym, address, big, cite, code, - del, dfn, em, img, ins, kbd, q, s, samp, - small, strike, strong, sub, sup, tt, var, - b, u, i, center, - dl, dt, dd, ol, ul, li, - fieldset, form, label, legend, - table, caption, tbody, tfoot, thead, tr, th, td, - article, aside, canvas, details, embed, - figure, figcaption, footer, header, hgroup, - menu, nav, output, ruby, section, summary, - time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; - } - article, aside, details, figcaption, figure, - footer, header, hgroup, menu, nav, section { - display: block; - } - body { - line-height: 1; - } - ol, ul { - list-style: none; - } - blockquote, q { - quotes: none; - } - blockquote:before, blockquote:after, - q:before, q:after { - content: ''; - content: none; - } - table { - border-collapse: collapse; - border-spacing: 0; - } - +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +.normalize() { + + /* normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ + + article, + aside, + details, + figcaption, + figure, + footer, + header, + hgroup, + nav, + section, + summary { + display: block; + } + audio, + canvas, + video { + display: inline-block; + *display: inline; + *zoom: 1; + } + audio:not([controls]) { + display: none; + height: 0; + } + [hidden] { + display: none; + } + html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + } + html, + button, + input, + select, + textarea { + font-family: sans-serif; + } + body { + margin: 0; + } + a:focus { + outline: thin dotted; + } + a:hover, + a:active { + outline: 0; + } + h1 { + font-size: 2em; + margin: 0.67em 0; + } + h2 { + font-size: 1.5em; + margin: 0.83em 0; + } + h3 { + font-size: 1.17em; + margin: 1em 0; + } + h4 { + font-size: 1em; + margin: 1.33em 0; + } + h5 { + font-size: 0.83em; + margin: 1.67em 0; + } + h6 { + font-size: 0.75em; + margin: 2.33em 0; + } + abbr[title] { + border-bottom: 1px dotted; + } + b, + strong { + font-weight: bold; + } + blockquote { + margin: 1em 40px; + } + dfn { + font-style: italic; + } + mark { + background: #ff0; + color: #000; + } + p, + pre { + margin: 1em 0; + } + pre, + code, + kbd, + samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; + } + pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; + } + q { + quotes: none; + } + q:before, + q:after { + content: ''; + content: none; + } + small { + font-size: 75%; + } + sub, + sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + sup { + top: -0.5em; + } + sub { + bottom: -0.25em; + } + dl, + menu, + ol, + ul { + margin: 1em 0; + } + dd { + margin: 0 0 0 40px; + } + menu, + ol, + ul { + padding: 0 0 0 40px; + } + nav ul, + nav ol { + list-style: none; + list-style-image: none; + } + img { + border: 0; + -ms-interpolation-mode: bicubic; + } + svg:not(:root) { + overflow: hidden; + } + figure { + margin: 0; + } + form { + margin: 0; + } + fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; + } + legend { + border: 0; + padding: 0; + white-space: normal; + *margin-left: -7px; + } + button, + input, + select, + textarea { + font-size: 100%; + margin: 0; + vertical-align: baseline; + *vertical-align: middle; + } + button, + input { + line-height: normal; + } + button, + input[type="button"], + input[type="reset"], + input[type="submit"] { + cursor: pointer; + -webkit-appearance: button; + *overflow: visible; + } + button[disabled], + input[disabled] { + cursor: default; + } + input[type="checkbox"], + input[type="radio"] { + box-sizing: border-box; + padding: 0; + *height: 13px; + *width: 13px; + } + input[type="search"] { + -webkit-appearance: textfield; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; + } + input[type="search"]::-webkit-search-decoration, + input[type="search"]::-webkit-search-cancel-button { + -webkit-appearance: none; + } + button::-moz-focus-inner, + input::-moz-focus-inner { + border: 0; + padding: 0; + } + textarea { + overflow: auto; + vertical-align: top; + } + table { + border-collapse: collapse; + border-spacing: 0; + } +} + +.reset() { + + /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ + + html, body, div, span, applet, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + a, abbr, acronym, address, big, cite, code, + del, dfn, em, img, ins, kbd, q, s, samp, + small, strike, strong, sub, sup, tt, var, + b, u, i, center, + dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, embed, + figure, figcaption, footer, header, hgroup, + menu, nav, output, ruby, section, summary, + time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + } + article, aside, details, figcaption, figure, + footer, header, hgroup, menu, nav, section { + display: block; + } + body { + line-height: 1; + } + ol, ul { + list-style: none; + } + blockquote, q { + quotes: none; + } + blockquote:before, blockquote:after, + q:before, q:after { + content: ''; + content: none; + } + table { + border-collapse: collapse; + border-spacing: 0; + } + } \ No newline at end of file diff --git a/app/design/adminhtml/magento_backend/less/clearless/settings.less b/app/design/adminhtml/Magento/backend/less/clearless/settings.less similarity index 98% rename from app/design/adminhtml/magento_backend/less/clearless/settings.less rename to app/design/adminhtml/Magento/backend/less/clearless/settings.less index 2543cb65b00b75ed15b3ab93112d979f3d365d36..454c41f395ec65005d0d1870a80b14da59ff71a4 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/settings.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/settings.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,35 +15,35 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// ClearLess default settings -// ---------------------------------------------- -// Override on a per-project basis as required. -// ============================================== - -// General -------------------------------- - -@using-ieclasses: true; // whether or not the markup has html5-boilerplate style IE classes in it or not -@using-modernizr: false; // whether or not modernizer feature-detection classes are being used -@disable-filters: true; // whether or not to disable MS-specific 'filter' properties (can make IE slow!) - -// Typography -------------------------------- - -@base-font-size: 16; // base pixel font size. Used as a default for px -> (r)em conversions - -// Sprites -------------------------------- - -@sprite-image: '/example.png'; -@sprite-grid: 50px; - -// Grid -------------------------------- - -@total-columns: 12; -@column-width: 60px; -@gutter-width: 20px; +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// ClearLess default settings +// ---------------------------------------------- +// Override on a per-project basis as required. +// ============================================== + +// General -------------------------------- + +@using-ieclasses: true; // whether or not the markup has html5-boilerplate style IE classes in it or not +@using-modernizr: false; // whether or not modernizer feature-detection classes are being used +@disable-filters: true; // whether or not to disable MS-specific 'filter' properties (can make IE slow!) + +// Typography -------------------------------- + +@base-font-size: 16; // base pixel font size. Used as a default for px -> (r)em conversions + +// Sprites -------------------------------- + +@sprite-image: '/example.png'; +@sprite-grid: 50px; + +// Grid -------------------------------- + +@total-columns: 12; +@column-width: 60px; +@gutter-width: 20px; diff --git a/app/design/adminhtml/magento_backend/less/clearless/sprites.less b/app/design/adminhtml/Magento/backend/less/clearless/sprites.less similarity index 97% rename from app/design/adminhtml/magento_backend/less/clearless/sprites.less rename to app/design/adminhtml/Magento/backend/less/clearless/sprites.less index 706a36faa9526fae39cc94556edc02b05c4659af..2bdb00d34cf1ec782680237a3ad554f0dc7e3b99 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/sprites.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/sprites.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,60 +15,60 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Sprite helpers -// ============================================== - -.sprite(@x, @y, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { - .sprite-image(@sprite-image); - .sprite-pos(@x, @y, @sprite-grid); -} - -.sprite-sized(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@size); -} - -.sprite-sized(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@width,@height); -} - -.sprite-ir(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .ir(); - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@size); -} - -.sprite-ir(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .ir(); - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@width,@height); -} - -.sprite-image(@sprite-image:@sprite-image) { - background-image: url(@sprite-image); - background-repeat: no-repeat; -} - -.sprite-pos(@x, @y, @sprite-grid:@sprite-grid) { - background-position: -(@x*@sprite-grid*1px) -(@y*@sprite-grid*1px); -} - -.sprite-pos-sized(@x, @y, @size, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .sprite-pos(@x, @y, @sprite-grid); - .size(@size); -} - -.sprite-pos-sized(@x, @y, @width, @height, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .sprite-pos(@x, @y, @sprite-grid); - .size(@width,@height); -} - - +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Sprite helpers +// ============================================== + +.sprite(@x, @y, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { + .sprite-image(@sprite-image); + .sprite-pos(@x, @y, @sprite-grid); +} + +.sprite-sized(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { + .sprite(@x, @y, @sprite-image, @sprite-grid); + .size(@size); +} + +.sprite-sized(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { + .sprite(@x, @y, @sprite-image, @sprite-grid); + .size(@width,@height); +} + +.sprite-ir(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { + .ir(); + .sprite(@x, @y, @sprite-image, @sprite-grid); + .size(@size); +} + +.sprite-ir(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { + .ir(); + .sprite(@x, @y, @sprite-image, @sprite-grid); + .size(@width,@height); +} + +.sprite-image(@sprite-image:@sprite-image) { + background-image: url(@sprite-image); + background-repeat: no-repeat; +} + +.sprite-pos(@x, @y, @sprite-grid:@sprite-grid) { + background-position: -(@x*@sprite-grid*1px) -(@y*@sprite-grid*1px); +} + +.sprite-pos-sized(@x, @y, @size, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { + .sprite-pos(@x, @y, @sprite-grid); + .size(@size); +} + +.sprite-pos-sized(@x, @y, @width, @height, @sprite-grid:@sprite-grid) when (isnumber(@height)) { + .sprite-pos(@x, @y, @sprite-grid); + .size(@width,@height); +} + + diff --git a/app/design/adminhtml/magento_backend/less/clearless/typography.less b/app/design/adminhtml/Magento/backend/less/clearless/typography.less similarity index 98% rename from app/design/adminhtml/magento_backend/less/clearless/typography.less rename to app/design/adminhtml/Magento/backend/less/clearless/typography.less index 370b22d6545fab0a80a77f909ef3bc69e991f23d..bad4d38466e354eef8c7a7db5cb1803c906cbbb9 100644 --- a/app/design/adminhtml/magento_backend/less/clearless/typography.less +++ b/app/design/adminhtml/Magento/backend/less/clearless/typography.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,51 +15,51 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// ============================================== -// Typography related mixins -// ============================================== - -.font-size-rems(@px-size) { - @rem-size: @px-size / @base-font-size; - font-size: ~"@{px-size}px"; - font-size: ~"@{rem-size}rem"; -} - -.font-size-ems(@target-px-size, @context-px-size:@base-font-size) { - font-size: (@target-px-size / @context-px-size) * 1em; -} - -.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when not (@include-svg) { - @font-face { - font-family: @family-name; - src: url('@{font-path}.eot'); - src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'); - font-weight: @font-weight; - font-style: @font-style; - } -} - -.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when (@include-svg) { - @font-face { - font-family: @family-name; - src: url('@{font-path}.eot'); - src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'), url('@{font-path}.svg#@{family-name}') format('svg'); - font-weight: @font-weight; - font-style: @font-style; - } -} - -.wrap-words() { - -ms-word-break: break-all; - word-break: break-all; - word-break: break-word; - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// ============================================== +// Typography related mixins +// ============================================== + +.font-size-rems(@px-size) { + @rem-size: @px-size / @base-font-size; + font-size: ~"@{px-size}px"; + font-size: ~"@{rem-size}rem"; +} + +.font-size-ems(@target-px-size, @context-px-size:@base-font-size) { + font-size: (@target-px-size / @context-px-size) * 1em; +} + +.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when not (@include-svg) { + @font-face { + font-family: @family-name; + src: url('@{font-path}.eot'); + src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'); + font-weight: @font-weight; + font-style: @font-style; + } +} + +.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when (@include-svg) { + @font-face { + font-family: @family-name; + src: url('@{font-path}.eot'); + src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'), url('@{font-path}.svg#@{family-name}') format('svg'); + font-weight: @font-weight; + font-style: @font-style; + } +} + +.wrap-words() { + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; } \ No newline at end of file diff --git a/app/design/adminhtml/magento_backend/less/lib/buttons.less b/app/design/adminhtml/Magento/backend/less/lib/buttons.less similarity index 78% rename from app/design/adminhtml/magento_backend/less/lib/buttons.less rename to app/design/adminhtml/Magento/backend/less/lib/buttons.less index f01508a486af67f32464c74ecf8e130bb23976fa..e8993ab3e1a984c7f4fcd05606e6e92fd67029d9 100644 --- a/app/design/adminhtml/magento_backend/less/lib/buttons.less +++ b/app/design/adminhtml/Magento/backend/less/lib/buttons.less @@ -1,4 +1,4 @@ -// /** +// /** // // * Magento // * // * NOTICE OF LICENSE @@ -15,180 +15,180 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// Default Button -.DefaultButton { - font: 14px/19px @baseFont; - font-weight: 500; - background: @defaultButton1; - border: 1px solid @defaultButton2; - color: @defaultButton3; - display: inline-block; - padding: 5px 14px; - text-align: center; - text-decoration: none; - vertical-align: top; - cursor: pointer; - border-radius: 2px; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - &:hover, - &:focus, - &:active { - text-decoration: none; - background: @defaultButton4; - color: @defaultButton3; - } - &:active { - border: 1px solid @defaultButton5; - } - &:visited { - color: @defaultButton3; - } - &[disabled], - &.disabled { - &:hover, - &:active { - color: @defaultButton3; - background: @defaultButton1; - border: 1px solid @defaultButton2; - } - cursor: not-allowed; - opacity: 0.5; - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); - } -} - -// Primary Button -.PrimaryButton { - &:extend(.DefaultButton all); - color: #fff; - background: @primaryButton1; - border: 1px solid @primaryButton2; - &:focus, - &:hover { - color: #fff; - background: @primaryButton3; - border: 1px solid @primaryButton3; - } - &:active { - color: #fff; - background: @primaryButton3; - border: 1px solid @primaryButton4; - } - &:visited { - color: #fff; - } - &[disabled], - &.disabled { - &:hover, - &:active { - color: #fff; - background: @primaryButton1; - border: 1px solid @primaryButton2; - } - } -} - -// Primary Add Button -.PrimaryAddButton { - &:extend(.PrimaryButton all); - width: 36px; - height: 31px; - overflow: hidden; - position: relative; - z-index: 1; - padding: 0; - &:focus { - outline: none; - } - > span { - text-indent: -999em; - display: block; - width: 34px; - height: 29px; - &:before { - text-indent: 0; - font-family: 'MUI-Icons'; - font-weight: normal; - font-size: 22px; - content: '\e02d'; - color: #fff; - position: absolute; - width: 34px; - height: 29px; - line-height: 29px; - text-align: center; - vertical-align: middle; - top: 0; - left: 0; - overflow: hidden; - .eq-ie9 & { - line-height: 31px; - } - } - } -} - -// Primary Split and Primary Add Split Button -.PrimarySplitButton { - &.btn-round { - .action-default.primary { - &:extend(.PrimaryAddButton all); - border-radius: 2px 0 0 2px; - &:focus { - outline: none; - } - } - } - > .action-default.primary { - border-radius: 2px 0 0 2px; - &:focus { - outline: none; - } - } - > .action-toggle.primary { - &:extend(.PrimaryButton all); - overflow: hidden; - z-index: 1; - padding: 0; - border-radius: 0 2px 2px 0; - font-size: 15px; - width: 30px; - height: 31px; - line-height: 30px; - margin-left: -1px; - position: relative; - z-index: 2; - filter: none; - &:focus { - outline: none; - } - &:before { - text-align: center; - } - } - .dropdown-menu { - left: 0; - right: auto; - z-index: 1; - > li > .item { - padding: 9px 10px 10px; - } - } - &.active { - > .action-toggle.primary, - > .action-toggle.primary:hover { - background: @primaryButton3; - border: 1px solid @primaryButton4; - } - } -} +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// Default Button +.DefaultButton { + font: 14px/19px @baseFont; + font-weight: 500; + background: @defaultButton1; + border: 1px solid @defaultButton2; + color: @defaultButton3; + display: inline-block; + padding: 5px 14px; + text-align: center; + text-decoration: none; + vertical-align: top; + cursor: pointer; + border-radius: 2px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + &:hover, + &:focus, + &:active { + text-decoration: none; + background: @defaultButton4; + color: @defaultButton3; + } + &:active { + border: 1px solid @defaultButton5; + } + &:visited { + color: @defaultButton3; + } + &[disabled], + &.disabled { + &:hover, + &:active { + color: @defaultButton3; + background: @defaultButton1; + border: 1px solid @defaultButton2; + } + cursor: not-allowed; + opacity: 0.5; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); + } +} + +// Primary Button +.PrimaryButton { + &:extend(.DefaultButton all); + color: #fff; + background: @primaryButton1; + border: 1px solid @primaryButton2; + &:focus, + &:hover { + color: #fff; + background: @primaryButton3; + border: 1px solid @primaryButton3; + } + &:active { + color: #fff; + background: @primaryButton3; + border: 1px solid @primaryButton4; + } + &:visited { + color: #fff; + } + &[disabled], + &.disabled { + &:hover, + &:active { + color: #fff; + background: @primaryButton1; + border: 1px solid @primaryButton2; + } + } +} + +// Primary Add Button +// .PrimaryAddButton { +// &:extend(.PrimaryButton all); +// width: 36px; +// height: 31px; +// overflow: hidden; +// position: relative; +// z-index: 1; +// padding: 0; +// &:focus { +// outline: none; +// } +// > span { +// text-indent: -999em; +// display: block; +// width: 34px; +// height: 29px; +// &:before { +// text-indent: 0; +// font-family: 'MUI-Icons'; +// font-weight: normal; +// font-size: 22px; +// content: '\e02d'; +// color: #fff; +// position: absolute; +// width: 34px; +// height: 29px; +// line-height: 29px; +// text-align: center; +// vertical-align: middle; +// top: 0; +// left: 0; +// overflow: hidden; +// .eq-ie9 & { +// line-height: 31px; +// } +// } +// } +// } + +// Primary Split and Primary Add Split Button +.PrimarySplitButton { + &.btn-round { + .action-default.primary { + //&:extend(.PrimaryAddButton all); + border-radius: 2px 0 0 2px; + &:focus { + outline: none; + } + } + } + > .action-default.primary { + border-radius: 2px 0 0 2px; + &:focus { + outline: none; + } + } + > .action-toggle.primary { + &:extend(.PrimaryButton all); + overflow: hidden; + z-index: 1; + padding: 0; + border-radius: 0 2px 2px 0; + font-size: 15px; + width: 30px; + height: 31px; + line-height: 30px; + margin-left: -1px; + position: relative; + z-index: 2; + filter: none; + &:focus { + outline: none; + } + &:before { + text-align: center; + } + } + .dropdown-menu { + left: 0; + right: auto; + z-index: 1; + > li > .item { + padding: 9px 10px 10px; + } + } + &.active { + > .action-toggle.primary, + > .action-toggle.primary:hover { + background: @primaryButton3; + border: 1px solid @primaryButton4; + } + } +} diff --git a/app/design/adminhtml/magento_backend/less/styles/admin.less b/app/design/adminhtml/Magento/backend/less/styles/admin.less similarity index 76% rename from app/design/adminhtml/magento_backend/less/styles/admin.less rename to app/design/adminhtml/Magento/backend/less/styles/admin.less index b7b55e3069428b779560b3657577fd88e5a05cc5..e465516ab3509347c958c6f3fe6e52bcaebda3d0 100644 --- a/app/design/adminhtml/magento_backend/less/styles/admin.less +++ b/app/design/adminhtml/Magento/backend/less/styles/admin.less @@ -1,5 +1,5 @@ -///** -//// * Magento +/** +// * Magento // * // * NOTICE OF LICENSE // * @@ -16,10 +16,10 @@ // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ @import "vars.less"; @import "base.less"; @@ -206,16 +206,16 @@ .image .action-delete[disabled], .fieldset-wrapper-title .actions .action-delete[disabled], .address-list-item-actions .action-delete[disabled], -[class^=" catalog-product-"] .page-actions .action-back, -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" catalog-product-"] .page-actions .action-back:active, -[class^=" catalog-product-"] .page-actions .action-back.active, -[class^=" catalog-product-"] .page-actions .action-back[disabled], -[class^=" newsletter-"] .page-actions .action-back, -[class^=" newsletter-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:active, -[class^=" newsletter-"] .page-actions .action-back.active, -[class^=" newsletter-"] .page-actions .action-back[disabled], +// [class^=" catalog-product-"] .page-actions .action-back, +// [class^=" catalog-product-"] .page-actions .action-back:hover, +// [class^=" catalog-product-"] .page-actions .action-back:active, +// [class^=" catalog-product-"] .page-actions .action-back.active, +// [class^=" catalog-product-"] .page-actions .action-back[disabled], +// [class^=" newsletter-"] .page-actions .action-back, +// [class^=" newsletter-"] .page-actions .action-back:hover, +// [class^=" newsletter-"] .page-actions .action-back:active, +// [class^=" newsletter-"] .page-actions .action-back.active, +// [class^=" newsletter-"] .page-actions .action-back[disabled], .notifications [class^="action-"], .notifications [class^="action-"]:hover, .notifications [class^="action-"]:active, @@ -225,12 +225,13 @@ .notification .action-close:hover, .notification .action-close:active, .notification .action-close.active, -.notification .action-close[disabled], -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active, -.sales-order-create-index .page-actions-inner .cancel.active, -.sales-order-create-index .page-actions-inner .cancel[disabled] { +.notification .action-close[disabled] +// .sales-order-create-index .page-actions-inner .cancel, +// .sales-order-create-index .page-actions-inner .cancel:hover, +// .sales-order-create-index .page-actions-inner .cancel:active, +// .sales-order-create-index .page-actions-inner .cancel.active, +// .sales-order-create-index .page-actions-inner .cancel[disabled] + { border: 0; border-radius: 0; background: none; @@ -320,12 +321,11 @@ display: none; list-style: none; min-width: 100px; - margin: 3px 0 0 0; + margin: 1px 0 0 0; padding: 0; right: 0; top: 100%; border: 1px solid #cac2b5; - border-radius: 3px; background: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); z-index: 990; @@ -384,282 +384,40 @@ background: #f5f5f5; } -/* - Suggest --------------------------------------- */ -.mage-suggest { - position: relative; - display: inline-block; - vertical-align: top; - width: 100%; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 3px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} - -.mage-suggest:after { - position: absolute; - top: 0; - right: 3px; - bottom: 0; - width: 22px; - text-align: center; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e01f'; /* search icon */ - font-size: 20px; - color: #b2b2b2; -} - -.mage-suggest input[type="search"], -.mage-suggest input.search { - width: 100%; - border: none; - background: none; - padding-right: 30px; -} - -.mage-suggest-dropdown { - position: absolute; - left: 0; - right: 0; - top: 100%; - margin: 3px -1px 0 -1px; - border: 1px solid #cac2b5; - border-radius: 3px; - background: #fff; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); - z-index: 990; -} - -.mage-suggest-dropdown ul { - margin: 0; - padding: 0; - list-style: none; -} - -.mage-suggest-dropdown li { - border-bottom: 1px solid #e5e5e5; - padding: 0; -} - -.field-category_ids .mage-suggest-dropdown, -.field-new_category_parent .mage-suggest-dropdown { - max-height: 200px; - overflow: auto; -} - -.mage-suggest-dropdown li a { +.active .dropdown-menu { display: block; } -.mage-suggest-dropdown li a, -.mage-suggest-dropdown .jstree li a:hover, -.mage-suggest-dropdown .jstree .jstree-hovered, -.mage-suggest-dropdown .jstree .jstree-clicked { - padding: 6px 12px 5px; - text-decoration: none; - color: #333; -} - -.mage-suggest-dropdown .jstree li a:hover, -.mage-suggest-dropdown .jstree .jstree-hovered, -.mage-suggest-dropdown .jstree .jstree-clicked { - border: none; -} - -.mage-suggest-dropdown li a.ui-state-focus { - background: #f5f5f5; -} - -.mage-suggest-dropdown .jstree li { - border-bottom: 0; -} - -.mage-suggest-dropdown .jstree li a { - display: inline-block; -} - -.mage-suggest-dropdown .jstree .mage-suggest-selected > a { - color: #000000; - background: #F1FFEB; -} - -.mage-suggest-dropdown .jstree .mage-suggest-selected > a:hover, -.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-clicked, -.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-clicked { - background: #E5FFD9; -} - -.mage-suggest-dropdown .jstree .mage-suggest-not-active > a { - color: #D4D4D4; -} - -.mage-suggest-dropdown .jstree .mage-suggest-not-active > a:hover, -.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-clicked { - background: #F5F5F5; -} - -.mage-suggest-dropdown .category-path { - font-size: 11px; - margin-left: 10px; - color: #9ba8b5; -} - -.suggest-expandable .actions-split .action-toggle { - display: inline-block; - max-width: 500px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - background: none; - border: none; - box-shadow: none; - color: #676056; - font-size: 12px; - padding: 5px 4px; - filter: none; -} - -.suggest-expandable .actions-split .action-toggle span { - display: inline; -} - -.suggest-expandable .actions-split .action-toggle:before { - display: inline-block; - float: right; - margin-left: 4px; - font-size: 13px; - color: #b2b0ad; -} - -.suggest-expandable .actions-split .action-toggle:hover:before { - color: #7e7e7e; -} - -.suggest-expandable .dropdown-menu { - margin: 1px 0 0; - left: 0; - right: auto; - width: 221px; -} - -.suggest-expandable .mage-suggest { - border: none; -} - -.suggest-expandable .mage-suggest:after { - top: 6px; - right: 6px; -} - -.suggest-expandable .mage-suggest-inner .title { - margin: 0; - padding: 0 10px 4px; - text-transform: uppercase; - color: #a6a098; - font-size: 12px; - border-bottom: 1px solid #e5e5e5; -} - -.suggest-expandable .mage-suggest-inner > input[type="search"], -.suggest-expandable .mage-suggest-inner > input.search { - position: relative; - margin: 6px 5px 5px; - padding-right: 20px; - border: 1px solid #ccc; - width: 211px; - z-index: 1; -} - -.suggest-expandable .mage-suggest-inner > input.ui-autocomplete-loading, -.suggest-expandable .mage-suggest-inner > input.mage-suggest-state-loading { - background: #fff url(../mui/images/ajax-loader-small.gif) no-repeat 190px 50%; -} - -.suggest-expandable .mage-suggest { - border-radius: 3px 3px 0 0; -} - -.suggest-expandable .mage-suggest-dropdown { - margin-top: 0; - border-top: 0; - border-radius: 0 0 3px 3px; - max-height: 300px; - overflow: auto; - width: 100%; - float: left; -} - -.suggest-expandable .mage-suggest-dropdown ul { - margin: 0; - padding: 0; - list-style: none; -} - -.suggest-expandable .action-show-all, -.suggest-expandable .action-show-all:hover, -.suggest-expandable .action-show-all:active, -.suggest-expandable .action-show-all:focus, -.suggest-expandable .action-show-all[disabled] { - border-top: 1px solid #e5e5e5; - display: block; - width: 100%; - padding: 8px 10px 10px; - text-align: left; - font: 12px/1.333 Arial, Verdana, sans-serif; - color: #676056; -} - -.page-actions .suggest-expandable { - max-width: 500px; - float: left; - margin-top: 1px; -} - -.page-actions.fixed #product-template-suggest-container { - display: none; -} - /* - Actions Split + Actions Dropdown -------------------------------------- */ -.actions-split { +.action-dropdown { text-align: left; position: relative; display: inline-block; } -.actions-split > [class^='action-'] { +.action-dropdown > [class^='action-'] { float: left; border-radius: 0; } -.actions-split > .action-default { +.action-dropdown > .action-default { border-radius: 5px 0 0 5px; } -.actions-split > .action-toggle { +.action-dropdown > .action-toggle { border-left: 1px solid #c5c0b9; border-radius: 0 5px 5px 0; margin-left: -1px; padding: 4px 7px; } -.actions-split > .action-toggle > span { +.action-dropdown > .action-toggle > span { display: none; } -.actions-split > .action-toggle:before { +.action-dropdown > .action-toggle:before { display: block; font-family: 'MUI-Icons'; font-style: normal; @@ -670,78 +428,35 @@ font-size: 11px; } -.actions-split > .action-toggle.active:before { +.action-dropdown > .action-toggle.active:before { content: '\e029'; /* arrow up */ } -.actions-split > .action-toggle.primary { +.action-dropdown > .action-toggle.primary { border-left: 1px solid #e1721d; } -.actions-split > .action-toggle.primary:hover { +.action-dropdown > .action-toggle.primary:hover { background: #e2701a; margin-left: -1px; } -.actions-split.active .dropdown-menu { +.action-dropdown.active .dropdown-menu { display: block; white-space: nowrap; } -.actions-split.active .dropdown-menu > li { +.action-dropdown.active .dropdown-menu > li { padding: 0; } -.actions-split .dropdown-menu > li > .item { +.action-dropdown .dropdown-menu > li > .item { display: block; padding: 6px 10px 5px; color: #333; text-decoration: none; } -/* Variations Image Uploader */ -.actions-image-uploader > img { - float: left; - border: solid #b7b2a7; - border-width: 1px 0 1px 1px; - width: 32px; - height: 31px; -} - -.actions-image-uploader .action-toggle, -.actions-image-uploader .action-toggle:hover, -.actions-image-uploader .action-toggle:active, -.actions-image-uploader .action-toggle:focus, -.actions-image-uploader .action-toggle[disabled] { - position: relative; - height: 33px; - padding-left: 2px; - padding-right: 2px; - background: #fff; - filter: none; - color: #888; -} - -.actions-image-uploader.active .action-toggle { - border-radius: 0 5px 0 0; -} - -.actions-image-uploader.active .action-toggle:after { - position: absolute; - left: 0; - right: 0; - bottom: -1px; - height: 1px; - background: #fff; - z-index: 991; - content: ''; -} - -.actions-image-uploader .dropdown-menu { - margin-top: -1px; - border-radius: 3px 0 3px 3px; -} - /* Action delete icon -------------------------------------- */ @@ -1038,7 +753,7 @@ fieldset.field [class^='fields-group-'] .field .control { } .control > input.hasDatepicker { - width: 130px; + width: 160px; } .control > input[type="radio"], @@ -2007,556 +1722,91 @@ table tbody tr:nth-child(odd):hover th { padding: 0 10px; } -.fade .popup .popup-inner { - padding: 20px; - border-radius: 3px; -} - -.fade .popup .popup-title { - margin: 0 0 10px; -} - -.popup-loading { - position: fixed; - z-index: 1003; - width: 200px; - background: rgba(255, 255, 255, .8); - left: 50%; - top: 40%; - margin-left: -100px; - color: #d85909; - border-color: #d85909; - font-size: 14px; - font-weight: bold; - text-align: center; - padding: 100px 0 10px; -} - -.popup-loading:after { - position: absolute; - left: 50%; - top: 40%; - background-image: url(../mui/images/ajax-loader-big.gif); - width: 64px; - height: 64px; - margin: -32px 0 0 -32px; - content: ''; - z-index: 2; -} - -/* Loading mask */ -.loading-old, -.loading-mask { - background: rgba(255, 255, 255, .4); - z-index: 999; -} - -.loading-old, -.loading-mask { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; -} - -.loading-old .loader, -.loading-mask .loader { - position: absolute; - margin: auto; - left: 0; - top: 0; - right: 0; - bottom: 0; - width: 160px; - height: 160px; - color: #5e5b56; - font-size: 14px; - font-weight: bold; - text-align: center; - background: #e5e2dd url(../mui/images/ajax-loader-big.gif) no-repeat 50% 30%; - border-radius: 5px; - opacity: .95; -} - -.loading-mask img { - display: none; -} - -.loading-old p, -.loading-mask p { - margin-top: 118px; -} - -/* Backup popup */ -/* TODO: remove after backups page js refactoring */ -.backup-dialog { - margin-top: inherit !important; -} - -/* - Global Navigation --------------------------------------- */ - -.navigation { - position: relative; - border-bottom: 1px solid #aaa69c; - background: #726c62; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzcyNmM2MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2NTYwNTciIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #726c62 0%, #656057 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #726c62), color-stop(100%, #656057)); - background: -webkit-linear-gradient(top, #726c62 0%, #656057 100%); - background: -o-linear-gradient(top, #726c62 0%, #656057 100%); - background: -ms-linear-gradient(top, #726c62 0%, #656057 100%); - background: linear-gradient(to bottom, #726c62 0%, #656057 100%); - padding: 0 20px; -} - -.navigation:before { - position: absolute; - left: 0; - top: 0; - right: 0; - height: 5px; - box-shadow: 0 2px 4px #46433d inset; - content: ''; - z-index: 991; -} - -.navigation:after { - position: absolute; - left: 0; - bottom: 0; - right: 0; - height: 1px; - background: #4e483f; - content: ''; - z-index: 1; -} - -.navigation .level-0.reverse > .submenu { - right: 1px; -} - -.navigation > ul { - position: relative; - min-width: 960px; - max-width: 1300px; - margin: 0 auto; - text-align: right; - z-index: 900; -} - -.navigation .level-0 > .submenu { - display: none; - position: absolute; - top: 100%; - padding: 19px 10px; -} - -.navigation .level-0 > .submenu a { - display: block; - .style6(); - line-height: 1.385; - padding: 5px 20px 4px; - text-decoration: none; - -webkit-transition: color .15s ease-out; - -moz-transition: color .15s ease-out; -} - -.navigation .level-0 > .submenu li { - margin-bottom: 1px; -} - -.navigation .level-0 > .submenu a[href="#"] { - cursor: default; - display: block; - .style30(); - line-height: 1; - margin: 7px 0 6px; - padding: 0 20px; - - &:focus, - &:hover { - text-decoration: none; - } -} - -.navigation .level-0 { - display: inline-block; - float: left; - text-align: left; - -webkit-transition: display .15s ease-out; - -moz-transition: display .15s ease-out; -} - -.navigation .level-0 > a { - background: none; - position: relative; - display: inline-block; - padding: 37px 21px 11px; - .style15(); - text-shadow: 0 1px 3px #222; - text-transform: uppercase; - text-decoration: none; - -webkit-transition: background .15s ease-out; - -moz-transition: background .15s ease-out; -} - -.navigation .level-0.active > a { - background: #625d54; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iIzYyNWQ1NCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM1NjUyNDkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #625d54 1%, #565249 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #625d54), color-stop(100%, #565249)); - background: -webkit-linear-gradient(top, #625d54 1%, #565249 100%); - background: -o-linear-gradient(top, #625d54 1%, #565249 100%); - background: -ms-linear-gradient(top, #625d54 1%, #565249 100%); - background: linear-gradient(to bottom, #625d54 1%, #565249 100%); -} - -//.navigation .level-0:hover > a, -.navigation .level-0.hover.recent > a { - background: #fff; - .style15I(); - text-shadow: 0 1px 3px #c1bfbb; -} - -.navigation .level-0 > a:focus { - outline: none; -} - -.navigation .level-0 > .submenu { - opacity: 0; - visibility: hidden; -} - -.navigation .level-0.recent.hover > .submenu { - opacity: 1; - visibility: visible; -} - -.no-js .navigation .level-0:hover > .submenu, -.no-js .navigation .level-0.hover > .submenu, -.no-js .navigation .level-0 > a:focus + .submenu { - display: block; -} - -.navigation .level-0 > a:before { - position: absolute; - left: 0; - right: 0; - top: 12px; - text-align: center; - height: 20px; - content: ''; - font-family: 'admin-icons'; - font-size: 18px; - speak: none; - font-weight: normal; - line-height: 1; - -webkit-font-smoothing: antialiased; - text-shadow: none; -} - -.navigation .level-0.item-dashboard > a:before, -.navigation .level-0.item-hub > a:before { - content: '\e007'; - font-size: 17px; -} - -.navigation .level-0.item-sales > a:before, -.navigation .level-0.item-sales-and-orders > a:before { - content: '\e008'; -} - -.navigation .level-0.item-catalog > a:before { - content: '\e00b'; -} - -.navigation .level-0.item-customer > a:before, -.navigation .level-0.item-customers > a:before { - content: '\e009'; - font-size: 24px; - top: 10px; -} - -.navigation .level-0.item-promo > a:before, -.navigation .level-0.item-marketing > a:before { - content: '\e00a'; - font-size: 17px; - top: 13px; -} - -.navigation .level-0.item-cms > a:before, -.navigation .level-0.item-content > a:before { - content: '\e006'; - font-size: 16px; -} - -.navigation .level-0.item-report > a:before, -.navigation .level-0.item-reports > a:before { - content: '\e00c'; - font-size: 16px; - top: 13px; -} - -.navigation .level-0.item-newsletter > a:before { - font-family: 'MUI-Icons'; - content: '\e03c'; - font-size: 22px; - top: 9px; -} - -.navigation .level-0 > .submenu { - background: #fff; - box-shadow: 0 3px 3px rgba(49, 48, 43, .5); - border-radius: 0 0 5px 5px; -} - -.no-boxshadow .navigation .level-0 > .submenu { - border: 1px solid #cbc1b4; - border-width: 0 1px 1px; - margin-left: -1px; -} - -.navigation .level-0 > .submenu li { - max-width: 200px; -} - -.navigation .level-0 > .submenu > ul { - white-space: nowrap; -} - -.navigation .level-0 > .submenu .column { - display: inline-block; - vertical-align: top; -} - -.navigation .level-0 .submenu .level-1 { - white-space: normal; -} - -.navigation .level-0.parent .submenu .level-1.parent { - margin: 17px 0; -} - -.navigation .level-0.parent .level-1.parent:first-child { - margin-top: 0; -} - -.navigation .level-2 .submenu { - margin-left: 7px; -} - -.navigation .level-0 > .submenu .level-2 > a[href="#"] { - font-size: 13px; - margin-top: 10px; - margin-left: 7px; -} - -.navigation .level-2 > .submenu a { - font-size: 12px; - line-height: 1.231; -} - -.navigation .level-0 > .submenu .level-3 > a[href="#"], -.navigation .level-3 .submenu { - margin-left: 15px; -} - -/* - Admin and Store Settings --------------------------------------- */ -.navigation .level-0.item-system, -.navigation .level-0.item-stores { - float: none; - margin: 21px 0 0; -} - -.navigation .level-0.item-system > .submenu, -.navigation .level-0.item-stores > .submenu { - left: auto; - right: 1px; -} - -.navigation .level-0.item-system.hover:after, -.navigation .level-0.item-stores.hover:after { - color: #c2b59c; -} - -.navigation .level-0.item-system > a, -.navigation .level-0.item-stores > a { - position: relative; - padding: 0; -} - -.navigation .level-0.item-system:hover > a, -.navigation .level-0.item-system.hover > a, -.navigation .level-0.item-stores:hover > a, -.navigation .level-0.item-stores.hover > a { - background: transparent; -} - -.no-js .navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system.hover > a:before, -.no-js .navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores.hover > a:before { - display: none; - position: absolute; - top: 1.4em; - left: auto; - right: -19px; - height: 20px; - width: 20px; - content: ''; - border: 10px solid #fff; - border-width: 0 0 10px 10px; - border-radius: 0 0 0 20px; - z-index: 2; -} - -.navigation .level-0.item-system > a:after, -.navigation .level-0.item-stores > a:after { - display: none; - position: absolute; - top: 2em; - left: -20px; - margin-top: -1px; - width: 20px; - height: 20px; - content: ''; - border: 10px solid #fff; - border-width: 0 10px 10px 0; - border-radius: 0 0 20px; - z-index: 1; -} - -.no-js .navigation .level-0.item-system:hover > a:after, -.navigation .level-0.item-system.hover > a:after, -.no-js .navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system.hover > a:before, -.no-js .navigation .level-0.item-stores:hover > a:after, -.navigation .level-0.item-stores.hover > a:after, -.no-js .navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores.hover > a:before { - display: block; -} - -.no-js .navigation .level-0.last:hover > a:before, -.navigation .level-0.last.hover > a:before { - display: none; -} - -.navigation .level-0.item-system > a span, -.navigation .level-0.item-stores > a span { - display: block; - position: relative; - padding: 4px 20px 5px 10px; - border: 1px solid #4c483f; - border-left: 0; - font: 12px/1.333 "Helvetica", Arial, serif; - text-transform: none; - text-shadow: none; - background: #58534a; - color: #f2ebde; - height: 1.333em; +.fade .popup .popup-inner { + padding: 20px; + border-radius: 3px; } -.navigation .level-0.item-system:hover > a span, -.navigation .level-0.item-stores:hover > a span { - background: #31302B; +.fade .popup .popup-title { + margin: 0 0 10px; } -.navigation .level-0.item-system:hover > a span:after, -.navigation .level-0.item-stores:hover > a span:after { - color: #58534a; +.popup-loading { + position: fixed; + z-index: 1003; + width: 200px; + background: rgba(255, 255, 255, .8); + left: 50%; + top: 40%; + margin-left: -100px; + color: #d85909; + border-color: #d85909; + font-size: 14px; + font-weight: bold; + text-align: center; + padding: 100px 0 10px; } -.no-js .navigation .level-0.item-system:hover > a span, -.navigation .level-0.item-system.hover > a span, -.no-js .navigation .level-0.item-stores:hover > a span, -.navigation .level-0.item-stores.hover > a span { - background: #fff; - color: #676056; - text-shadow: none; - border-bottom: 0; - border-right: 0; - padding-right: 21px; - padding-bottom: 2em; - margin-bottom: -2em; +.popup-loading:after { + position: absolute; + left: 50%; + top: 40%; + background-image: url(../mui/images/ajax-loader-big.gif); + width: 64px; + height: 64px; + margin: -32px 0 0 -32px; + content: ''; + z-index: 2; } -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span { - background: #fff; - color: #676056; - text-shadow: none; - border-bottom: 0; - border-right: 0; - padding-right: 21px; - padding-bottom: 2em; - margin-bottom: -2em; +/* Loading mask */ +.loading-old, +.loading-mask { + background: rgba(255, 255, 255, .4); + z-index: 999; } -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span { - border-right: 1px solid; - padding-right: 20px; +.loading-old, +.loading-mask { + position: fixed; + left: 0; + top: 0; + right: 0; + bottom: 0; } -.navigation .level-0.item-system > a span:after, -.navigation .level-0.item-stores > a span:after { +.loading-old .loader, +.loading-mask .loader { position: absolute; - top: 7px; - right: 7px; - width: 10px; - height: 10px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: "\e02c"; - font-size: 8px; + margin: auto; + left: 0; + top: 0; + right: 0; + bottom: 0; + width: 160px; + height: 160px; + color: #5e5b56; + font-size: 14px; + font-weight: bold; text-align: center; - color: #31302b; - z-index: 2; + background: #e5e2dd url(../mui/images/ajax-loader-big.gif) no-repeat 50% 30%; + border-radius: 5px; + opacity: .95; } -.navigation .level-0.item-stores > a span:before { - position: absolute; - left: -22px; - top: -1px; - bottom: -1px; - height: 1.333em; - padding: 0 0 9px; - width: 21px; - border: 1px solid #4c483f; - border-right: 0; - border-radius: 5px 0 0 5px; - font-family: 'MUI-Icons'; - font-style: normal; - font-size: 12px; - line-height: 2; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e07e'; - text-align: center; - color: #31302b; +.loading-mask img { + display: none; } -.navigation .level-0.last > a, -.navigation .level-0.last > a span { - border-radius: 0 5px 5px 0; +.loading-old p, +.loading-mask p { + margin-top: 118px; } -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span, -.navigation .level-0.last > a:focus span { - border-radius: 0; +/* Backup popup */ +/* TODO: remove after backups page js refactoring */ +.backup-dialog { + margin-top: inherit !important; } /* @@ -2578,9 +1828,10 @@ table tbody tr:nth-child(odd):hover th { .page-login .footer { clear: both; - height: 140px; - margin-top: -140px; + height: 100px; + margin-top: -100px; position: relative; + .box-sizing(); } .page-login .footer-content { @@ -2589,7 +1840,7 @@ table tbody tr:nth-child(odd):hover th { } .page-login .footer-copyright { - text-align: right; + text-align: left; } .page-login .form-login { @@ -2659,6 +1910,85 @@ table tbody tr:nth-child(odd):hover th { background: url(Magento_Backend::images/logo-magento.png) no-repeat; } +.page-login { + button { + border-radius: 2px; + } + button:not(.primary) { + background-image: none; + background-color: #f7f3eb; + padding: 0 13px; + color: #676056; + border: 1px solid #ada89e; + cursor: pointer; + display: inline-block; + font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: 500; + line-height: 26px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + vertical-align: middle; + } + button:not(.primary):focus, + button:not(.primary):active { + background-color: #cac3b4; + border: 1px solid #989287; + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + } + button:not(.primary):hover { + background-color: #cac3b4; + } + button:not(.primary).disabled, + button:not(.primary)[disabled] { + cursor: default; + pointer-events: none; + opacity: 0.5; + } + button.primary { + background-image: none; + background-color: #007dbd; + padding: 0 13px; + color: #ffffff; + border: 1px solid #0a6c9f; + cursor: pointer; + display: inline-block; + font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: 500; + line-height: 26px; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + vertical-align: middle; + } + button.primary:focus, + button.primary:active { + background-color: #026294; + border: 1px solid #004c74; + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; + color: #ffffff; + } + button.primary:hover { + background-color: #026294; + border: 1px solid #026294; + } + button.primary.disabled, + button.primary[disabled] { + cursor: default; + pointer-events: none; + opacity: 0.5; + } +} + ///* //.page-login .logo { // display: block; @@ -2744,14 +2074,14 @@ table tbody tr:nth-child(odd):hover th { color: #bebab1 !important; } -.page-login .action-login, -.page-login .action-retrieve { +.page-login button.action-login, +.page-login button.action-retrieve { font-size: 22px; padding: 14px 22px 16px; } -.page-login .action-retrieve, -.page-login .action-reset { +.page-login button.action-retrieve, +.page-login button.action-reset { font-size: 18px; padding: 10px 17px 10px; } @@ -2780,10 +2110,7 @@ table tbody tr:nth-child(odd):hover th { } .page-content > .page-title { - max-width: 1300px; - min-width: 960px; - margin-left: auto; - margin-right: auto; + } .page-title-inner > .title { @@ -3152,15 +2479,6 @@ table tbody tr:nth-child(odd):hover th { /* Page Structure -------------------------------------- */ -.wrapper { - padding: 0 0 60px; - min-width: 1000px; -} - -.page-content { - margin: 0 auto; - padding: 0 20px; -} .page-title.complex .title { float: left; @@ -3217,16 +2535,11 @@ table tbody tr:nth-child(odd):hover th { position: relative; background: #f5f2ed; border: 1px solid #d5d0ca; - border-radius: 5px; - min-width: 960px; - max-width: 1300px; margin: 0 auto; } .col-1-layout { padding: 20px; - min-width: 920px; - max-width: 1260px; } .col-2-left-layout:before { @@ -3279,59 +2592,19 @@ table tbody tr:nth-child(odd):hover th { min-width: 730px; } -/* Sidebar title and store view switcher*/ +/* Sidebar title */ /* TODO: temporary styles */ .side-col h3 { padding: 0 17px; margin-top: 16px; } -.field-store-switcher { - padding: 0 0 20px; - margin: 0; -} - .side-col .ui-tabs h3 { margin-bottom: 5px; color: #524c44; text-shadow: 0 1px 0 #fff; } -.side-col > .store-switcher { - padding-top: 6px; -} - -.field-store-switcher, -.field-store-switcher > .label + .control { - display: inline-block; -} - -.field-store-switcher > .tooltip + div > a { - .style22(); -} - -.field-store-switcher > .label { - margin: 0; -} - -.side-col > .field-store-switcher { - padding: 19px 18px 0; -} - -.side-col > .field-store-switcher > .label { - margin: 0 0 6px; - display: block; -} - -.dashboard-container .field-store-switcher { - padding: 20px 0; -} - -.toolbar .field-store-switcher { - padding: 0; - margin-right: 20px; -} - /* Universal Sidebar Tabs -------------------------------------- */ @@ -3667,10 +2940,10 @@ table tbody tr:nth-child(odd):hover th { /* Content actions panel (with buttons, switchers...) -------------------------------------- */ -.page-actions { - padding: 0 0 20px; - text-align: right; -} +// .page-actions { +// padding: 0 0 20px; +// text-align: right; +// } .page-actions .buttons-group { vertical-align: top; @@ -3683,9 +2956,9 @@ table tbody tr:nth-child(odd):hover th { margin: 6px 10px 0 0; } -.main-col .page-actions { - padding: 20px 0; -} +// .main-col .page-actions { +// padding: 20px 0; +// } .page-actions .store-switcher { float: left; @@ -3701,43 +2974,6 @@ table tbody tr:nth-child(odd):hover th { padding: 0; } -.page-actions.fixed { - padding: 0 21px; - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 998; -} - -.page-actions.fixed .page-actions-inner { - background: -moz-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(245, 242, 237, 1)), color-stop(56%, rgba(245, 242, 237, 1)), color-stop(100%, rgba(245, 242, 237, 0))); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* IE10+ */ - background: linear-gradient(to bottom, rgba(245, 242, 237, 1) 0%, rgba(245, 242, 237, 1) 56%, rgba(245, 242, 237, 0) 100%); /* W3C */ - padding: 11px 20px 11px; - min-height: 36px; - margin: 0 auto; - min-width: 916px; - max-width: 1259px; -} - -.lt-ie10 .page-actions.fixed .page-actions-inner { - background: #f5f2ed; -} - -.page-actions.fixed .page-actions-inner:before { - content: attr(data-title); - float: left; - font-size: 20px; - max-width: 50%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - /* Table Grid -------------------------------------- */ @@ -4381,7 +3617,6 @@ tr.dynamic-grid input.input-text { #productGrid_table, #setGrid_table, #attributeGrid_table, -.custom-options .data-table, .ui-dialog .data { word-wrap: break-word; table-layout: fixed; @@ -4393,7 +3628,6 @@ tr.dynamic-grid input.input-text { #productGrid_table th, #setGrid_table th, #attributeGrid_table th, -.custom-options .data-table th, .ui-dialog .data th { word-wrap: normal; overflow: hidden; @@ -4407,7 +3641,6 @@ tr.dynamic-grid input.input-text { #customerGrid_table th > span, #setGrid_table th > span, #attributeGrid_table th > span, -.custom-options .data-table th > span, .ui-dialog .data th > span { white-space: normal; } @@ -4986,7 +4219,6 @@ table .col-draggable .draggable-handle { .widget-layout-updates .data-table tbody td { border: none; padding: 5px 10px; - vertical-align: top; } .widget-layout-updates .data-table select { @@ -5057,106 +4289,6 @@ table .col-draggable .draggable-handle { margin-right: 4px; } -/* - System Messages --------------------------------------- */ -.message-system { - min-width: 960px; - max-width: 1300px; - margin: 0 auto; - overflow: hidden; -} - -.message-system-inner { - background: #f7f3eb; - border: 1px solid #c0bbaf; - border-top: 0; - border-radius: 0 0 5px 5px; - float: right; - overflow: hidden; -} - -.message-system-unread .message-system-inner { - float: none; -} - -.message-system-list { - margin: 0; - padding: 0; - list-style: none; - float: left; -} - -.message-system .message-system-list { - width: 75%; -} - -.message-system-list li { - padding: 5px 13px 7px 36px; - position: relative; -} - -.message-system-short { - padding: 5px 13px 7px; - float: right; -} - -.message-system-short span { - display: inline-block; - margin-left: 7px; - border-left: 1px #d1ccc3 solid; -} - -.message-system-short span:first-child { - border: 0; - margin-left: 0; -} - -.message-system-short a { - padding-left: 27px; - position: relative; - height: 16px; -} - -.message-system .message-system-short a:before, -.message-system-list li:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - height: 16px; - width: 16px; - font-size: 16px; - line-height: 16px; - text-align: center; - position: absolute; - left: 7px; - top: 2px; -} - -.message-system-list li:before { - top: 5px; - left: 13px; -} - -.message-system .message-system-short .warning a:before, -.message-system-list li.warning:before { - content: "\e006"; - color: #f2a825; -} - -.message-system .message-system-short .error a:before, -.message-system-list li.error:before { - content: "\e086"; - font-family: 'MUI-Icons'; - color: #c00815; -} - -.ui-dialog .message-system-list { - margin-bottom: 25px; -} - /* Add Attribute Popup -------------------------------------- */ @@ -5287,17 +4419,17 @@ table .col-draggable .draggable-handle { } // Default & Primary Button -input[type=button], -input[type=submit], -input[type=reset], -button, -[class^="action-"], -.popup-window .add-widget { - &:extend(.DefaultButton all); - &.primary { - &:extend(.PrimaryButton all); - } -} +// input[type=button], +// input[type=submit], +// input[type=reset], +// button, +// [class^="action-"], +// .popup-window .add-widget { +// &:extend(.DefaultButton all); +// &.primary { +// &:extend(.PrimaryButton all); +// } +// } // Custom grids view .CustomGridView { @@ -5333,135 +4465,136 @@ button, } } -// Primary Add Button for grid tables on pages: -// sales -.sales-order-index, -.adminhtml-rma-index, -// marketing -.adminhtml-catalog-event-index, -.adminhtml-urlrewrite-index, -.catalog-search-index, -.catalog-product-review-index, -.catalog-rule-promo-catalog-index, -.sales-rule-promo-quote-index, -.adminhtml-reminder-index, -.newsletter-template-index, -.adminhtml-system-email-template-index, -.adminhtml-sitemap-index, -// products -.adminhtml-googleshopping-types-index, -// customers -.customer-index-index, -// cms -.adminhtml-cms-page-index, -.cms-block-index, -.adminhtml-banner-index, -.adminhtml-widget-instance-index, -.cms-page-index, -// system -.adminhtml-webapi-user-index, -.adminhtml-webapi-role-index, -.adminhtml-system-variable-index, -.adminhtml-user-index, -.adminhtml-user-role-index, -.adminhtml-integration-index, -// content -.adminhtml-system-design-theme-index, -.adminhtml-system-design-index, -// stores -.adminhtml-customer-attribute-index, -.adminhtml-customer-address-attribute-index, -.rating-index-index, -.tax-rule-index, -.tax-rate-index, -.adminhtml-rma-item-attribute-index, -.adminhtml-reward-rate-index, -.customer-group-index, -.checkout-agreement-index, -.catalog-product-attribute-index, -.catalog-product-set-index { - &:extend(.CustomGridView all); - &:extend(.CustomGridAction all); - .page-actions { - .add { - &:extend(.PrimaryAddButton all); - } - } -} - -.catalog-product-index { - &:extend(.CustomGridView all); - &:extend(.CustomGridAction all); -} +// // Primary Add Button for grid tables on pages: +// // sales +// .sales-order-index, +// .adminhtml-rma-index, +// // marketing +// .adminhtml-catalog-event-index, +// .adminhtml-urlrewrite-index, +// .catalog-search-index, +// .review-product-index, +// .catalog-rule-promo-catalog-index, +// .sales-rule-promo-quote-index, +// .adminhtml-reminder-index, +// .newsletter-template-index, +// .adminhtml-system-email-template-index, +// .adminhtml-sitemap-index, +// // products +// .adminhtml-googleshopping-types-index, +// // customers +// .customer-index-index, +// // cms +// .adminhtml-cms-page-index, +// .cms-block-index, +// .adminhtml-banner-index, +// .adminhtml-widget-instance-index, +// .cms-page-index, +// // system +// .adminhtml-webapi-user-index, +// .adminhtml-webapi-role-index, +// .adminhtml-system-variable-index, +// .adminhtml-user-index, +// .adminhtml-user-role-index, +// .adminhtml-integration-index, +// // content +// .adminhtml-system-design-theme-index, +// .adminhtml-system-design-index, +// // stores +// .adminhtml-customer-attribute-index, +// .adminhtml-customer-address-attribute-index, +// .rating-index-index, +// .tax-rule-index, +// .tax-rate-index, +// .adminhtml-rma-item-attribute-index, +// .adminhtml-reward-rate-index, +// .customer-group-index, +// .checkout-agreement-index, +// .catalog-product-attribute-index, +// .catalog-product-set-index { +// &:extend(.CustomGridView all); +// &:extend(.CustomGridAction all); +// .page-actions { +// .add { +// &:extend(.PrimaryAddButton all); +// } +// } +// } + +// .catalog-product-index { +// &:extend(.CustomGridView all); +// &:extend(.CustomGridAction all); +// } // Primary Add Split Button or Primary Split Button -.catalog-product-new, -.catalog-product-edit, -.catalog-product-index, -.adminhtml-integration-new { - .actions-split { - &:extend(.PrimarySplitButton all); - } -} - -// Custom Grid View for pages: -// sales -.sales-invoice-index, -.sales-shipment-index, -.sales-creditmemo-index, -.sales-billing-agreement-index, -.sales-transactions-index, -.sales-recurring-payment-index, -// products -.adminhtml-googleshopping-items-index, -// customer -.customer-online-index, -// marketing -.newsletter-queue-index, -.newsletter-subscriber-index, -// reports -.adminhtml-report-shopcart-product, -.adminhtml-report-shopcart-abandoned -.adminhtml-report-product-downloads, -.adminhtml-report-product-sold, -.adminhtml-report-product-lowstock, -.adminhtml-report-customer-accounts, -.adminhtml-report-customer-totals, -.adminhtml-report-customer-orders, -.adminhtml-report-customer-wishlist-wishlist, -.adminhtml-report-review-customer, -.adminhtml-report-review-product, -.adminhtml-report-search, -.adminhtml-report-statistics-index, -.newsletter-problem-index, -//store -.adminhtml-system-store-index, -.sales-order-status-index, -.adminhtml-system-currency-index, -.adminhtml-system-currencysymbol-index, -.adminhtml-scheduled-operation-index, -// system -.adminhtml-cache-index, -.adminhtml-system-backup-index, -.adminhtml-locks-index, -.adminhtml-notification-index, -.adminhtml-logging-archive, -.adminhtml-logging-index, -.adminhtml-process-list, -// product -.catalog-product-index { - &:extend(.CustomGridView all); -} +// .catalog-product-new, +// .catalog-product-edit, +// .catalog-product-index, +// .adminhtml-integration-new { +// .actions-split { +// &:extend(.PrimarySplitButton all); +// } +// } + +// // Custom Grid View for pages: +// // sales +// .sales-invoice-index, +// .sales-shipment-index, +// .sales-creditmemo-index, +// .sales-billing-agreement-index, +// .sales-transactions-index, +// .sales-recurring-payment-index, +// // products +// .adminhtml-googleshopping-items-index, +// // customer +// .customer-online-index, +// // marketing +// .newsletter-queue-index, +// .newsletter-subscriber-index, +// // reports +// .adminhtml-report-shopcart-product, +// .adminhtml-report-shopcart-abandoned +// .adminhtml-report-product-downloads, +// .adminhtml-report-product-sold, +// .adminhtml-report-product-lowstock, +// .adminhtml-report-customer-accounts, +// .adminhtml-report-customer-totals, +// .adminhtml-report-customer-orders, +// .adminhtml-report-customer-wishlist-wishlist, +// .adminhtml-report-review-customer, +// .adminhtml-report-review-product, +// .adminhtml-report-search, +// .adminhtml-report-statistics-index, +// .newsletter-problem-index, +// //store +// .adminhtml-system-store-index, +// .sales-order-status-index, +// .adminhtml-system-currency-index, +// .adminhtml-system-currencysymbol-index, +// .adminhtml-scheduled-operation-index, +// // system +// .adminhtml-cache-index, +// .adminhtml-system-backup-index, +// .adminhtml-locks-index, +// .adminhtml-notification-index, +// .adminhtml-logging-archive, +// .adminhtml-logging-index, +// .adminhtml-process-list, +// // product +// .catalog-product-index { +// &:extend(.CustomGridView all); +// } // Custom page-actions view .adminhtml-googleshopping-items-index .grid-title, -.adminhtml-system-backup-index .page-actions, -.adminhtml-scheduled-operation-index .page-actions, -.adminhtml-system-currency-index .page-actions, -.adminhtml-system-currencysymbol-index .page-actions, -.adminhtml-cache-index .page-actions, -.adminhtml-system-store-index .page-actions, -.sales-order-status-index .page-actions { +//.adminhtml-system-backup-index .page-actions, +//.adminhtml-scheduled-operation-index .page-actions, +//.adminhtml-system-currency-index .page-actions +//.adminhtml-system-currencysymbol-index .page-actions, +//.adminhtml-cache-index .page-actions, +//.adminhtml-system-store-index .page-actions, +//.sales-order-status-index .page-actions + { border: 1px solid #c0bbaf; border-bottom: 0; background: rgb(246, 243, 236); @@ -5506,18 +4639,14 @@ button, padding-left: 90px; } -.catalog-rule-promo-catalog-index .grid-actions { - padding-left: 210px; -} - -.catalog-rule-promo-catalog-index .page-actions .apply { - float: right; - margin: 0 0 0 10px; -} +// .catalog-rule-promo-catalog-index .grid-actions { +// padding-left: 210px; +// } -.catalog-product-index .field-store-switcher { - padding: 0; -} +// .catalog-rule-promo-catalog-index .page-actions .apply { +// float: right; +// margin: 0 0 0 10px; +// } .sidebar-actions { padding: 14px 0; @@ -5558,8 +4687,6 @@ button, .page-title-inner:after, .tabs-horiz:before, .tabs-horiz:after, -.navigation > ul:before, -.navigation > ul:after, .actions-split:before, .actions-split:after, .page-create-order:before, @@ -5585,7 +4712,6 @@ button, .footer-content:after, .page-title-inner:after, .tabs-horiz:after, -.navigation > ul:after, .actions-split:after, .page-create-order:after, .order-addresses:after, diff --git a/app/design/adminhtml/magento_backend/less/styles/base.less b/app/design/adminhtml/Magento/backend/less/styles/base.less similarity index 92% rename from app/design/adminhtml/magento_backend/less/styles/base.less rename to app/design/adminhtml/Magento/backend/less/styles/base.less index 0f0742e3ff447ae15ad21e0729f128aa0f2a30f1..83caacbc71cf73881db98bbc45c37edf1ed6b2fc 100644 --- a/app/design/adminhtml/magento_backend/less/styles/base.less +++ b/app/design/adminhtml/Magento/backend/less/styles/base.less @@ -1,4 +1,4 @@ -///** +///** //// * Magento // * // * NOTICE OF LICENSE @@ -15,106 +15,101 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// Fonts - -@font-face { - font-family: 'admin-icons'; - src: url('../fonts/icons/admin-icons.eot'); - src: url('../fonts/icons/admin-icons.eot?#iefix') format('embedded-opentype'), url('../fonts/icons/admin-icons.svg#admin-icons') format('svg'), url('../fonts/icons/admin-icons.woff') format('woff'), url('../fonts/icons/admin-icons.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'MUI-Icons'; - src: url('../mui/fonts/MUI-Icons.eot'); - src: url('../mui/fonts/MUI-Icons.eot?#iefix') format('embedded-opentype'), url('../mui/fonts/MUI-Icons.svg#MUI-Icons') format('svg'), url('../mui/fonts/MUI-Icons.woff') format('woff'), url('../mui/fonts/MUI-Icons.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -/* @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700 <http://fonts.googleapis.com/css?family=Open+Sans:400italic%2c400%2c600%2c700>); */ - -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 600; - src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 700; - src: local('Open Sans Bold'), local('OpenSans-Bold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: italic; - font-weight: 400; - src: local('Open Sans Italic'), local('OpenSans-Italic'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); -} - -// Base - -body, html { - min-height: 100%; - height: 100%; -} - -body { - color: @baseColor; - font: @baseFontWeight @baseFontSize/@baseLineHeight @baseFont; - background: #f2ebde; - position: relative; - height: auto; -} - -// Headings - -h1 { - color: @h1color; - font: @h1font; -} - -h2 { - color: @h2color; - font: @h2font; -} - -h3 { - color: @h3color; - font: @h3font; -} - -h4 { - color: @h4color; - font: @h4font; -} - -h5 { - color: @h5color; - font: @h5font; -} - -h6 { - color: @h6color; - font: @h6font; -} - -// Links - -a { - .actionLink(); -} +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +// Fonts + +@font-face { + font-family: 'admin-icons'; + src: url('../fonts/icons/admin-icons.eot'); + src: url('../fonts/icons/admin-icons.eot?#iefix') format('embedded-opentype'), url('../fonts/icons/admin-icons.svg#admin-icons') format('svg'), url('../fonts/icons/admin-icons.woff') format('woff'), url('../fonts/icons/admin-icons.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'MUI-Icons'; + src: url('../mui/fonts/MUI-Icons.eot'); + src: url('../mui/fonts/MUI-Icons.eot?#iefix') format('embedded-opentype'), url('../mui/fonts/MUI-Icons.svg#MUI-Icons') format('svg'), url('../mui/fonts/MUI-Icons.woff') format('woff'), url('../mui/fonts/MUI-Icons.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +/* @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700 <http://fonts.googleapis.com/css?family=Open+Sans:400italic%2c400%2c600%2c700>); */ + +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 600; + src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 700; + src: local('Open Sans Bold'), local('OpenSans-Bold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 400; + src: local('Open Sans Italic'), local('OpenSans-Italic'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); +} + +// Headings + +h1 { + color: @h1color; + font: @h1font; +} + +h2 { + color: @h2color; + font: @h2font; +} + +h3 { + color: @h3color; + font: @h3font; +} + +h4 { + color: @h4color; + font: @h4font; +} + +h5 { + color: @h5color; + font: @h5font; +} + +h6 { + color: @h6color; + font: @h6font; +} + +// Links + +a { + .actionLink(); +} + + +body, +html { + height: 100%; + min-height: 100%; +} +body { + background: @primary7; +} diff --git a/app/design/adminhtml/magento_backend/less/styles/debug.less b/app/design/adminhtml/Magento/backend/less/styles/debug.less similarity index 100% rename from app/design/adminhtml/magento_backend/less/styles/debug.less rename to app/design/adminhtml/Magento/backend/less/styles/debug.less diff --git a/app/design/adminhtml/magento_backend/less/styles/header.less b/app/design/adminhtml/Magento/backend/less/styles/header.less similarity index 99% rename from app/design/adminhtml/magento_backend/less/styles/header.less rename to app/design/adminhtml/Magento/backend/less/styles/header.less index d3d88c34487c3fe9db1de769cb0a418d9b70322d..a2700123867b13c09e18a491efbad89725144146 100644 --- a/app/design/adminhtml/magento_backend/less/styles/header.less +++ b/app/design/adminhtml/Magento/backend/less/styles/header.less @@ -21,7 +21,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -@import "vars.less"; +@import "vars"; /* Header -------------------------------------- */ diff --git a/app/design/adminhtml/magento_backend/less/styles/pages.less b/app/design/adminhtml/Magento/backend/less/styles/pages.less similarity index 91% rename from app/design/adminhtml/magento_backend/less/styles/pages.less rename to app/design/adminhtml/Magento/backend/less/styles/pages.less index 99ef87dbd24cb305a1b9c27a32b01e538c4c6763..13b6df76e0b18d5289a112f9ef1c1436bd391191 100644 --- a/app/design/adminhtml/magento_backend/less/styles/pages.less +++ b/app/design/adminhtml/Magento/backend/less/styles/pages.less @@ -27,63 +27,63 @@ Product Creation -------------------------------------- */ -/* Action "Back" as cross */ -[class^=" catalog-product-"] .page-actions .action-back, -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" catalog-product-"] .page-actions .action-back:active, -[class^=" newsletter-"] .page-actions .action-back, -[class^=" newsletter-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:active { - overflow: hidden; - padding: 5px 6px 3px; - margin-left: 12px; - color: #7a7976; -} - -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active { - filter: none; - border: 0; -} - -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:hover, -.sales-order-create-index .page-actions-inner .cancel:hover { - color: #000; -} +// /* Action "Back" as cross */ +// [class^=" catalog-product-"] .page-actions .action-back, +// [class^=" catalog-product-"] .page-actions .action-back:hover, +// [class^=" catalog-product-"] .page-actions .action-back:active, +// [class^=" newsletter-"] .page-actions .action-back, +// [class^=" newsletter-"] .page-actions .action-back:hover, +// [class^=" newsletter-"] .page-actions .action-back:active { +// overflow: hidden; +// padding: 5px 6px 3px; +// margin-left: 12px; +// color: #7a7976; +// } + +// .sales-order-create-index .page-actions-inner .cancel, +// .sales-order-create-index .page-actions-inner .cancel:hover, +// .sales-order-create-index .page-actions-inner .cancel:active { +// filter: none; +// border: 0; +// } + +// [class^=" catalog-product-"] .page-actions .action-back:hover, +// [class^=" newsletter-"] .page-actions .action-back:hover, +// .sales-order-create-index .page-actions-inner .cancel:hover { +// color: #000; +// } [class^=" catalog-product-"] .page-actions .action-back.mage-error, [class^=" newsletter-"] .page-actions .action-back.mage-error { color: #b57c72; } -[class^=" catalog-product-"] .page-actions .action-back:before, -[class^=" newsletter-"] .page-actions .action-back:before, -.sales-order-create-index .page-actions-inner .cancel:before { - display: inline-block; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e07d'; /* close icon */ - font-size: 16px; -} - -[class^=" catalog-product-"] .page-actions .action-back span, -[class^=" newsletter-"] .page-actions .action-back span, -.sales-order-create-index .page-actions-inner .cancel span { - display: inline-block; - overflow: hidden; - text-indent: -999em; -} - -.page-actions .switcher { - display: inline-block; - vertical-align: top; - margin: 6px 17px 6px 6px; -} +// [class^=" catalog-product-"] .page-actions .action-back:before, +// [class^=" newsletter-"] .page-actions .action-back:before, +// .sales-order-create-index .page-actions-inner .cancel:before { +// display: inline-block; +// font-family: 'MUI-Icons'; +// font-style: normal; +// speak: none; +// font-weight: normal; +// -webkit-font-smoothing: antialiased; +// content: '\e07d'; /* close icon */ +// font-size: 16px; +// } + +// [class^=" catalog-product-"] .page-actions .action-back span, +// [class^=" newsletter-"] .page-actions .action-back span, +// .sales-order-create-index .page-actions-inner .cancel span { +// display: inline-block; +// overflow: hidden; +// text-indent: -999em; +// } + +// .page-actions .switcher { +// display: inline-block; +// vertical-align: top; +// margin: 6px 17px 6px 6px; +// } .field-weight .control .field:first-child { width: 36%; @@ -952,9 +952,9 @@ /* Newsletter -------------------------------------- */ -[class^=" newsletter-"] .page-actions .action-back { - float: right; -} +// [class^=" newsletter-"] .page-actions .action-back { +// float: right; +// } /* Newsletter Templates @@ -1151,144 +1151,6 @@ margin-top: -6px; } -/* - Dashboard --------------------------------------- */ -.adminhtml-dashboard-index .col-2-left-layout, -.adminhtml-dashboard-index .col-1-layout { - min-width: 0; -} - -.adminhtml-dashboard-index .side-col { - width: 38%; - padding: 1%; - .entry-edit { - padding: 10px 15px 10px 10px; - margin-bottom: 5px; - .entry-edit-head { - h4 { - margin: 0; - } - margin-bottom: 20px; - } - fieldset { - padding: 0; - border: 0; - .grid { - padding-bottom: 0; - } - } - } -} - -.adminhtml-dashboard-index .col-2-left-layout .main-col { - min-width: 0; - width: 60%; - padding: 16px 30px 30px; - .store-switcher-alt { - margin-bottom: 15px; - > strong { - padding-left: 0; - } - } -} - -.dashboard-container { - border-radius: 0; -} - -.dashboard-container.col-2-left-layout:before { - left: 40%; -} - -.dashboard-inner .tabs-horiz > li a { - padding-left: 14px; - padding-right: 14px; -} - -.dashboard-container #diagram_tab_content { - background: #fff; - border: 1px solid #eae6e0; - border-radius: 5px; - border-top-left-radius: 0; - margin: 0 0 20px; - padding: 18px; - position: relative; -} - -.dashboard-container .dashboard-diagram .store-switcher + div { /* loader under a diagram */ - background: url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; - min-height: 75px; - text-align: center; -} - -.dashboard-container .dashboard-diagram .store-switcher + div img { - max-width: 100%; -} - -.dashboard-container .dashboard-diagram .store-switcher + div.dashboard-diagram-nodata { /* when there is no data to display the diagram */ - background-image: none; - min-height: 15px; -} - -.dashboard-container #grid_tab_content { - background: #fff url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; - border: 1px solid #eae6e0; - border-radius: 5px; - border-top-left-radius: 0; - min-height: 50px; -} - -.dashboard-container #grid_tab_content .grid { - padding: 0; -} - -.dashboard-container .store-switcher { - margin: 20px 0 10px; -} - -.dashboard-container .dashboard-diagram .store-switcher { - margin-top: 0; -} - -.dashboard-diagram-nodata { - border: 1px solid #ccc; - padding: 20px 0; - text-align: center; -} - -.action-switch-to-analytics:link, -.action-switch-to-analytics:visited, -.action-switch-to-hub:link, -.action-switch-to-hub:visited { - font-weight: 400; - font-size: 16px; - color: #19a3d1; - position: relative; - padding: 0 0 0 20px; - margin: 11px 0 0 20px; - background: none; - box-shadow: none; -} - -.action-switch-to-hub:before, -.action-switch-to-analytics:before { - position: absolute; - width: 17px; - height: 12px; - background: url(../images/icons-dashboard-switcher.png) 0 0 no-repeat; - left: 0; - top: 4px; - content: ''; -} - -.action-switch-to-hub:before { - top: 2px; -} - -.action-switch-to-analytics:before { - background-position: 0 -13px; -} /* Sales @@ -1349,6 +1211,15 @@ width: 49%; } +[class*="-order-"] .order-card-validation { + width: 49.5%; + box-sizing: border-box; + + .actions { + margin-top: 17px; + } +} + #order-data .order-account-information { float: none; width: auto; @@ -1494,13 +1365,13 @@ margin: 17px 0 0; } -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active { - float: right; - margin: 0 0 0 12px; - padding: 3px 0 3px 6px; -} +// .sales-order-create-index .page-actions-inner .cancel, +// .sales-order-create-index .page-actions-inner .cancel:hover, +// .sales-order-create-index .page-actions-inner .cancel:active { +// float: right; +// margin: 0 0 0 12px; +// padding: 3px 0 3px 6px; +// } .sales-order-create-index #order-message .messages .message, .sales-order-edit-index #order-message .messages .message { @@ -1691,11 +1562,11 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d padding-top: 0; } -#order-data .store-switcher { - margin: -46px 0 0; - position: relative; - width: 50%; -} +// #order-data .store-switcher { +// margin: -46px 0 0; +// position: relative; +// width: 50%; +// } .create-order-sidebar-container > div + div { border-top: 1px solid #ededed; @@ -2200,6 +2071,10 @@ table.items-to-invoice tbody tr:hover td { margin-top: 15px; } +[class^=" sales-"] .order-payment-additional { + margin-top: 15px; +} + [class^=" sales-"] .grid tbody td { vertical-align: top; } @@ -2726,6 +2601,14 @@ table.items-to-invoice tbody tr:hover td { width: 100%; } +#affected-attribute-set-form .fieldset .field { + margin-bottom: 12px; + + &:last-child { + margin-bottom: 0; + } +} + /* Cache Management -------------------------------------- */ diff --git a/app/design/adminhtml/magento_backend/less/styles/vars.less b/app/design/adminhtml/Magento/backend/less/styles/vars.less similarity index 97% rename from app/design/adminhtml/magento_backend/less/styles/vars.less rename to app/design/adminhtml/Magento/backend/less/styles/vars.less index 66c0a9c1115344a3370939827338e2c77e50da6a..7343b38255092fa575bae0116af65089c397a383 100644 --- a/app/design/adminhtml/magento_backend/less/styles/vars.less +++ b/app/design/adminhtml/Magento/backend/less/styles/vars.less @@ -146,7 +146,7 @@ } .style6() { - color: @primary5; + color: @primary1; font-size: 13px; font-weight: @baseFontWeight; @@ -198,13 +198,13 @@ .style15() { color: @primary7; font-size: 13px; - font-weight: @baseFontWeight; + font-weight: @baseFontWeightSemibold; } .style15I() { color: @primary1; font-size: 13px; - font-weight: @baseFontWeight; + font-weight: @baseFontWeightSemibold; } .style16() { @@ -299,7 +299,7 @@ .style30() { color: @primary1; font-size: 14px; - font-weight: @baseFontWeightSemibold; + font-weight: @baseFontWeightBold; } .style31() { @@ -316,14 +316,9 @@ } .style33() { - color: @primary3; + color: @primary2; font-size: 12px; font-weight: @baseFontWeightSemibold; - - &:focus, - &:hover { - text-decoration: underline; - } } .style34() { // no such html yet diff --git a/app/design/adminhtml/magento_backend/less/vars.less b/app/design/adminhtml/Magento/backend/less/vars.less similarity index 96% rename from app/design/adminhtml/magento_backend/less/vars.less rename to app/design/adminhtml/Magento/backend/less/vars.less index 13cd8e1cb195968a2beecb91ca5c0197166280e4..d6353e4bba6ba667aa3e3de954037249e988839c 100644 --- a/app/design/adminhtml/magento_backend/less/vars.less +++ b/app/design/adminhtml/Magento/backend/less/vars.less @@ -1,4 +1,4 @@ -// /** +// /** // // * Magento // * // * NOTICE OF LICENSE @@ -15,73 +15,73 @@ // * // * 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. -// * -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -@baseDir: ~".."; - -// Primary colors -@primary1: #676056; -@primary2: #ed4f2e; -@primary3: #026294; -@primary4: #fff; -@primary5: #007dbd; -@primary6: #e22626; -@primary7: #f2ebde; -@primary8: #31302b; -@primary9: #ef672f; - -// Buttons -// Default Buttons -@defaultButton1: #f2ebde; -@defaultButton2: #ada89e; -@defaultButton3: #676056; -@defaultButton4: #cac3b4; -@defaultButton5: #989287; - -// Primary Buttons -@primaryButton1: #007dbd; -@primaryButton2: #0574ad; -@primaryButton3: #026294; -@primaryButton4: #004c74; - -// Links -@linkColor: @primary3; -@linkColor2: @primary4; - -// Base font -@baseFont: 'Open Sans', sans-serif; -@baseFontSize: 14px; -@baseFontWeight: 400; -@baseFontWeightSemibold: 600; -@baseFontWeightBold: 700; -@baseLineHeight: 1.33; -@baseColor: @primary1; - -// Headings -// H1 -@h1color: @primary1; -@h1font: 400 28px/1.2 @baseFont; - -// H2 -@h2color: @primary1; -@h2font: 400 20px/1.2 @baseFont; - -// H3 -@h3color: @primary1; -@h3font: 600 16px/1.2 @baseFont; - -// H4 -@h4color: @primary1; -@h4font: 600 14px/1.2 @baseFont; - -// H5 -@h5color: @primary1; -@h5font: 600 13px/1.2 @baseFont; - -// H6 -@h6color: @primary1; +// * needs please refer to http://www.magentocommerce.com for more information. +// * +// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) +// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +// */ + +@baseDir: ~".."; + +// Primary colors +@primary1: #676056; +@primary2: #ed4f2e; +@primary3: #026294; +@primary4: #fff; +@primary5: #007dbd; +@primary6: #e22626; +@primary7: #f2ebde; +@primary8: #31302b; +@primary9: #ef672f; + +// Buttons +// Default Buttons +@defaultButton1: #f2ebde; +@defaultButton2: #ada89e; +@defaultButton3: #676056; +@defaultButton4: #cac3b4; +@defaultButton5: #989287; + +// Primary Buttons +@primaryButton1: #007dbd; +@primaryButton2: #0574ad; +@primaryButton3: #026294; +@primaryButton4: #004c74; + +// Links +@linkColor: @primary3; +@linkColor2: @primary4; + +// Base font +@baseFont: 'Open Sans', sans-serif; +@baseFontSize: 14px; +@baseFontWeight: 400; +@baseFontWeightSemibold: 600; +@baseFontWeightBold: 700; +@baseLineHeight: 1.33; +@baseColor: @primary1; + +// Headings +// H1 +@h1color: @primary1; +@h1font: 400 28px/1.2 @baseFont; + +// H2 +@h2color: @primary1; +@h2font: 400 20px/1.2 @baseFont; + +// H3 +@h3color: @primary1; +@h3font: 600 16px/1.2 @baseFont; + +// H4 +@h4color: @primary1; +@h4font: 600 14px/1.2 @baseFont; + +// H5 +@h5color: @primary1; +@h5font: 600 13px/1.2 @baseFont; + +// H6 +@h6color: @primary1; @h6font: 600 12px/1.2 @baseFont; diff --git a/app/design/adminhtml/magento_backend/mui/base.css b/app/design/adminhtml/Magento/backend/mui/base.css similarity index 84% rename from app/design/adminhtml/magento_backend/mui/base.css rename to app/design/adminhtml/Magento/backend/mui/base.css index 24cec91d1d8fe40d55704ddc4e505b56edef41fb..6427dec572f06eb96724811eb6bdc74c71867dc2 100644 --- a/app/design/adminhtml/magento_backend/mui/base.css +++ b/app/design/adminhtml/Magento/backend/mui/base.css @@ -93,65 +93,6 @@ border-radius: 0 0 4px 4px; } -/* - Button toggle (with dropdown menu) --------------------------------------- */ - -.dropdown-menu { - position: absolute; - display: none; - list-style: none; - margin: 3px 0 0 0; - padding: 0; - right: 0; - top: 100%; - border: 1px solid #b5b5b5; - border-radius: 3px; - background: #fff; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2); -} - -.dropdown-menu li { - padding: 5px; - border-bottom: 1px solid #e5e5e5; -} - -.dropdown-menu li.selected { - background: #f5f5f5; -} - -.dropdown-menu li:hover { - background: #f5f5f5; -} - -.dropdown-menu li:last-child { - border-bottom: none; -} - -.dropdown-menu-top { - margin: 0 0 3px 0; - top: auto; - bottom: 100%; -} - -.buttons-group.active { - z-index: 20; -} - -.buttons-group.active .dropdown-menu { - display: block; -} - -.button .arrow { - color: #919191; - margin: 0 -3px 0 3px; -} - -.button > .arrow { - display: inline-block; - margin: 0 -3px; -} - /* Forms -------------------------------------- */ diff --git a/app/design/adminhtml/magento_backend/mui/components.css b/app/design/adminhtml/Magento/backend/mui/components.css similarity index 99% rename from app/design/adminhtml/magento_backend/mui/components.css rename to app/design/adminhtml/Magento/backend/mui/components.css index d22113fad3b049a6fb9d3ec19f7b5f421163cd85..994e47d07226378f225803fc9bc846b291bef1a8 100644 --- a/app/design/adminhtml/magento_backend/mui/components.css +++ b/app/design/adminhtml/Magento/backend/mui/components.css @@ -176,6 +176,8 @@ /* ============================================================================= Logo ========================================================================== */ +/* @MOVED to theme module styles + .logo { float:left; margin:0 0 10px 0; @@ -188,7 +190,7 @@ a.logo { } .logo strong { display:none; -} +}*/ /* ============================================================================= Search Form diff --git a/app/design/adminhtml/magento_backend/mui/elements.css b/app/design/adminhtml/Magento/backend/mui/elements.css similarity index 99% rename from app/design/adminhtml/magento_backend/mui/elements.css rename to app/design/adminhtml/Magento/backend/mui/elements.css index 4cdd298b60fd338ca75ce856da6b136f0d412488..15a429cba47413dfc43942b938bb1b40140c7111 100644 --- a/app/design/adminhtml/magento_backend/mui/elements.css +++ b/app/design/adminhtml/Magento/backend/mui/elements.css @@ -33,7 +33,7 @@ -------------------------------------- */ /* Simple "css" tooltip */ -.tooltip { +/*.tooltip { display: inline-block; vertical-align: middle; line-height: 1.1; @@ -126,7 +126,7 @@ .tooltip:hover > .tooltip-content { display: block; } - +*/ /* "js" tooltip with positions */ .tipsy { position: absolute; diff --git a/app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.eot b/app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.eot similarity index 100% rename from app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.eot rename to app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.eot diff --git a/app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.svg b/app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.svg similarity index 100% rename from app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.svg rename to app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.svg diff --git a/app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.ttf b/app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.ttf similarity index 100% rename from app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.ttf rename to app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.ttf diff --git a/app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.woff b/app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.woff similarity index 100% rename from app/design/adminhtml/magento_backend/mui/fonts/MUI-Icons.woff rename to app/design/adminhtml/Magento/backend/mui/fonts/MUI-Icons.woff diff --git a/app/design/adminhtml/magento_backend/mui/form.css b/app/design/adminhtml/Magento/backend/mui/form.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/form.css rename to app/design/adminhtml/Magento/backend/mui/form.css diff --git a/app/design/adminhtml/magento_backend/mui/grid.css b/app/design/adminhtml/Magento/backend/mui/grid.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/grid.css rename to app/design/adminhtml/Magento/backend/mui/grid.css diff --git a/app/design/adminhtml/magento_backend/mui/icons.css b/app/design/adminhtml/Magento/backend/mui/icons.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/icons.css rename to app/design/adminhtml/Magento/backend/mui/icons.css diff --git a/app/design/adminhtml/magento_backend/mui/images/ajax-loader-big.gif b/app/design/adminhtml/Magento/backend/mui/images/ajax-loader-big.gif similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/ajax-loader-big.gif rename to app/design/adminhtml/Magento/backend/mui/images/ajax-loader-big.gif diff --git a/app/design/adminhtml/magento_backend/mui/images/ajax-loader-small.gif b/app/design/adminhtml/Magento/backend/mui/images/ajax-loader-small.gif similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/ajax-loader-small.gif rename to app/design/adminhtml/Magento/backend/mui/images/ajax-loader-small.gif diff --git a/app/design/adminhtml/magento_backend/mui/images/ajax-loader-white.gif b/app/design/adminhtml/Magento/backend/mui/images/ajax-loader-white.gif similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/ajax-loader-white.gif rename to app/design/adminhtml/Magento/backend/mui/images/ajax-loader-white.gif diff --git a/app/design/adminhtml/magento_backend/mui/images/ajax-loader.gif b/app/design/adminhtml/Magento/backend/mui/images/ajax-loader.gif similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/ajax-loader.gif rename to app/design/adminhtml/Magento/backend/mui/images/ajax-loader.gif diff --git a/app/design/adminhtml/magento_backend/mui/images/ajax-loader.svg b/app/design/adminhtml/Magento/backend/mui/images/ajax-loader.svg similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/ajax-loader.svg rename to app/design/adminhtml/Magento/backend/mui/images/ajax-loader.svg diff --git a/app/design/adminhtml/magento_backend/mui/images/pagination-arrows-bg.png b/app/design/adminhtml/Magento/backend/mui/images/pagination-arrows-bg.png similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/pagination-arrows-bg.png rename to app/design/adminhtml/Magento/backend/mui/images/pagination-arrows-bg.png diff --git a/app/design/adminhtml/magento_backend/mui/images/rating-bg.png b/app/design/adminhtml/Magento/backend/mui/images/rating-bg.png similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/rating-bg.png rename to app/design/adminhtml/Magento/backend/mui/images/rating-bg.png diff --git a/app/design/adminhtml/magento_backend/mui/images/sorter-bg.png b/app/design/adminhtml/Magento/backend/mui/images/sorter-bg.png similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/sorter-bg.png rename to app/design/adminhtml/Magento/backend/mui/images/sorter-bg.png diff --git a/app/design/adminhtml/magento_backend/mui/images/view-mode-bg.png b/app/design/adminhtml/Magento/backend/mui/images/view-mode-bg.png similarity index 100% rename from app/design/adminhtml/magento_backend/mui/images/view-mode-bg.png rename to app/design/adminhtml/Magento/backend/mui/images/view-mode-bg.png diff --git a/app/design/adminhtml/magento_backend/mui/print.css b/app/design/adminhtml/Magento/backend/mui/print.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/print.css rename to app/design/adminhtml/Magento/backend/mui/print.css diff --git a/app/design/adminhtml/magento_backend/mui/reset.css b/app/design/adminhtml/Magento/backend/mui/reset.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/reset.css rename to app/design/adminhtml/Magento/backend/mui/reset.css diff --git a/app/design/adminhtml/magento_backend/mui/utils.css b/app/design/adminhtml/Magento/backend/mui/utils.css similarity index 100% rename from app/design/adminhtml/magento_backend/mui/utils.css rename to app/design/adminhtml/Magento/backend/mui/utils.css diff --git a/app/design/adminhtml/magento_backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml similarity index 93% rename from app/design/adminhtml/magento_backend/theme.xml rename to app/design/adminhtml/Magento/backend/theme.xml index a4c6bbc031231721cfb0acef835da1c7a3ed88bc..d8a7b3594ea643f2f6ffaf6ae7fc504f7a8cfe62 100644 --- a/app/design/adminhtml/magento_backend/theme.xml +++ b/app/design/adminhtml/Magento/backend/theme.xml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/theme.xsd"> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Magento 2 backend</title> <version>1.0.0.0</version> </theme> diff --git a/app/design/adminhtml/magento_backend/css/admin.css b/app/design/adminhtml/magento_backend/css/admin.css deleted file mode 100644 index f35e355d900341a23b8a9ab9c3fca2ea0de1d943..0000000000000000000000000000000000000000 --- a/app/design/adminhtml/magento_backend/css/admin.css +++ /dev/null @@ -1,6629 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -@font-face { - font-family: 'admin-icons'; - src: url('../fonts/icons/admin-icons.eot'); - src: url('../fonts/icons/admin-icons.eot?#iefix') format('embedded-opentype'), url('../fonts/icons/admin-icons.svg#admin-icons') format('svg'), url('../fonts/icons/admin-icons.woff') format('woff'), url('../fonts/icons/admin-icons.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} -@font-face { - font-family: 'MUI-Icons'; - src: url('../mui/fonts/MUI-Icons.eot'); - src: url('../mui/fonts/MUI-Icons.eot?#iefix') format('embedded-opentype'), url('../mui/fonts/MUI-Icons.svg#MUI-Icons') format('svg'), url('../mui/fonts/MUI-Icons.woff') format('woff'), url('../mui/fonts/MUI-Icons.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} -/* @import url(http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700 <http://fonts.googleapis.com/css?family=Open+Sans:400italic%2c400%2c600%2c700>); */ -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: local('Open Sans'), local('OpenSans'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 600; - src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 700; - src: local('Open Sans Bold'), local('OpenSans-Bold'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); -} -@font-face { - font-family: 'Open Sans'; - font-style: italic; - font-weight: 400; - src: local('Open Sans Italic'), local('OpenSans-Italic'), url(//themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); -} -body, -html { - min-height: 100%; - height: 100%; -} -body { - color: #676056; - font: 400 14px/1.33 'Open Sans', sans-serif; - background: #f2ebde; - position: relative; - height: auto; -} -h1 { - color: #676056; - font: 400 28px/1.2 'Open Sans', sans-serif; -} -h2 { - color: #676056; - font: 400 20px/1.2 'Open Sans', sans-serif; -} -h3 { - color: #676056; - font: 600 16px/1.2 'Open Sans', sans-serif; -} -h4 { - color: #676056; - font: 600 14px/1.2 'Open Sans', sans-serif; -} -h5 { - color: #676056; - font: 600 13px/1.2 'Open Sans', sans-serif; -} -h6 { - color: #676056; - font: 600 12px/1.2 'Open Sans', sans-serif; -} -a { - display: inline; - color: #026294; - text-decoration: none; -} -a:visited, -a:active { - color: #026294; -} -a:focus, -a:hover { - color: #026294; - text-decoration: underline; -} -.DefaultButton, -.PrimaryButton, -input[type=button], -input[type=submit], -input[type=reset], -button, -[class^="action-"], -.popup-window .add-widget, -.PrimaryAddButton, -.PrimarySplitButton > .action-toggle.primary, -input[type=button].primary, -input[type=submit].primary, -input[type=reset].primary, -button.primary, -[class^="action-"].primary, -.popup-window .add-widget.primary, -.PrimarySplitButton.btn-round .action-default.primary, -.sales-order-index .page-actions .add, -.adminhtml-rma-index .page-actions .add, -.adminhtml-catalog-event-index .page-actions .add, -.adminhtml-urlrewrite-index .page-actions .add, -.catalog-search-index .page-actions .add, -.review-product-index .page-actions .add, -.catalog-rule-promo-catalog-index .page-actions .add, -.sales-rule-promo-quote-index .page-actions .add, -.adminhtml-reminder-index .page-actions .add, -.newsletter-template-index .page-actions .add, -.adminhtml-system-email-template-index .page-actions .add, -.adminhtml-sitemap-index .page-actions .add, -.adminhtml-googleshopping-types-index .page-actions .add, -.customer-index-index .page-actions .add, -.adminhtml-cms-page-index .page-actions .add, -.cms-block-index .page-actions .add, -.adminhtml-banner-index .page-actions .add, -.adminhtml-widget-instance-index .page-actions .add, -.cms-page-index .page-actions .add, -.adminhtml-webapi-user-index .page-actions .add, -.adminhtml-webapi-role-index .page-actions .add, -.adminhtml-system-variable-index .page-actions .add, -.adminhtml-user-index .page-actions .add, -.adminhtml-user-role-index .page-actions .add, -.adminhtml-integration-index .page-actions .add, -.adminhtml-system-design-theme-index .page-actions .add, -.adminhtml-system-design-index .page-actions .add, -.adminhtml-customer-attribute-index .page-actions .add, -.adminhtml-customer-address-attribute-index .page-actions .add, -.rating-index-index .page-actions .add, -.tax-rule-index .page-actions .add, -.tax-rate-index .page-actions .add, -.adminhtml-rma-item-attribute-index .page-actions .add, -.adminhtml-reward-rate-index .page-actions .add, -.customer-group-index .page-actions .add, -.checkout-agreement-index .page-actions .add, -.catalog-product-attribute-index .page-actions .add, -.catalog-product-set-index .page-actions .add, -.catalog-product-new .actions-split > .action-toggle.primary, -.catalog-product-edit .actions-split > .action-toggle.primary, -.catalog-product-index .actions-split > .action-toggle.primary, -.adminhtml-integration-new .actions-split > .action-toggle.primary, -.catalog-product-new .actions-split.btn-round .action-default.primary, -.catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary { - font: 14px/19px 'Open Sans', sans-serif; - font-weight: 500; - background: #f2ebde; - border: 1px solid #ada89e; - color: #676056; - display: inline-block; - padding: 5px 14px; - text-align: center; - text-decoration: none; - vertical-align: top; - cursor: pointer; - border-radius: 2px; - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.DefaultButton:hover, -.DefaultButton:focus, -.DefaultButton:active, -.PrimaryButton:hover, -.PrimaryButton:focus, -.PrimaryButton:active, -input[type=button]:hover, -input[type=button]:focus, -input[type=button]:active, -input[type=submit]:hover, -input[type=submit]:focus, -input[type=submit]:active, -input[type=reset]:hover, -input[type=reset]:focus, -input[type=reset]:active, -button:hover, -button:focus, -button:active, -[class^="action-"]:hover, -[class^="action-"]:focus, -[class^="action-"]:active, -.popup-window .add-widget:hover, -.popup-window .add-widget:focus, -.popup-window .add-widget:active, -.PrimaryAddButton:hover, -.PrimaryAddButton:focus, -.PrimaryAddButton:active, -.PrimarySplitButton > .action-toggle.primary:hover, -.PrimarySplitButton > .action-toggle.primary:focus, -.PrimarySplitButton > .action-toggle.primary:active, -input[type=button].primary:hover, -input[type=button].primary:focus, -input[type=button].primary:active, -input[type=submit].primary:hover, -input[type=submit].primary:focus, -input[type=submit].primary:active, -input[type=reset].primary:hover, -input[type=reset].primary:focus, -input[type=reset].primary:active, -button.primary:hover, -button.primary:focus, -button.primary:active, -[class^="action-"].primary:hover, -[class^="action-"].primary:focus, -[class^="action-"].primary:active, -.popup-window .add-widget.primary:hover, -.popup-window .add-widget.primary:focus, -.popup-window .add-widget.primary:active, -.PrimarySplitButton.btn-round .action-default.primary:hover, -.PrimarySplitButton.btn-round .action-default.primary:focus, -.PrimarySplitButton.btn-round .action-default.primary:active, -.sales-order-index .page-actions .add:hover, -.sales-order-index .page-actions .add:focus, -.sales-order-index .page-actions .add:active, -.adminhtml-rma-index .page-actions .add:hover, -.adminhtml-rma-index .page-actions .add:focus, -.adminhtml-rma-index .page-actions .add:active, -.adminhtml-catalog-event-index .page-actions .add:hover, -.adminhtml-catalog-event-index .page-actions .add:focus, -.adminhtml-catalog-event-index .page-actions .add:active, -.adminhtml-urlrewrite-index .page-actions .add:hover, -.adminhtml-urlrewrite-index .page-actions .add:focus, -.adminhtml-urlrewrite-index .page-actions .add:active, -.catalog-search-index .page-actions .add:hover, -.catalog-search-index .page-actions .add:focus, -.catalog-search-index .page-actions .add:active, -.review-product-index .page-actions .add:hover, -.review-product-index .page-actions .add:focus, -.review-product-index .page-actions .add:active, -.catalog-rule-promo-catalog-index .page-actions .add:hover, -.catalog-rule-promo-catalog-index .page-actions .add:focus, -.catalog-rule-promo-catalog-index .page-actions .add:active, -.sales-rule-promo-quote-index .page-actions .add:hover, -.sales-rule-promo-quote-index .page-actions .add:focus, -.sales-rule-promo-quote-index .page-actions .add:active, -.adminhtml-reminder-index .page-actions .add:hover, -.adminhtml-reminder-index .page-actions .add:focus, -.adminhtml-reminder-index .page-actions .add:active, -.newsletter-template-index .page-actions .add:hover, -.newsletter-template-index .page-actions .add:focus, -.newsletter-template-index .page-actions .add:active, -.adminhtml-system-email-template-index .page-actions .add:hover, -.adminhtml-system-email-template-index .page-actions .add:focus, -.adminhtml-system-email-template-index .page-actions .add:active, -.adminhtml-sitemap-index .page-actions .add:hover, -.adminhtml-sitemap-index .page-actions .add:focus, -.adminhtml-sitemap-index .page-actions .add:active, -.adminhtml-googleshopping-types-index .page-actions .add:hover, -.adminhtml-googleshopping-types-index .page-actions .add:focus, -.adminhtml-googleshopping-types-index .page-actions .add:active, -.customer-index-index .page-actions .add:hover, -.customer-index-index .page-actions .add:focus, -.customer-index-index .page-actions .add:active, -.adminhtml-cms-page-index .page-actions .add:hover, -.adminhtml-cms-page-index .page-actions .add:focus, -.adminhtml-cms-page-index .page-actions .add:active, -.cms-block-index .page-actions .add:hover, -.cms-block-index .page-actions .add:focus, -.cms-block-index .page-actions .add:active, -.adminhtml-banner-index .page-actions .add:hover, -.adminhtml-banner-index .page-actions .add:focus, -.adminhtml-banner-index .page-actions .add:active, -.adminhtml-widget-instance-index .page-actions .add:hover, -.adminhtml-widget-instance-index .page-actions .add:focus, -.adminhtml-widget-instance-index .page-actions .add:active, -.cms-page-index .page-actions .add:hover, -.cms-page-index .page-actions .add:focus, -.cms-page-index .page-actions .add:active, -.adminhtml-webapi-user-index .page-actions .add:hover, -.adminhtml-webapi-user-index .page-actions .add:focus, -.adminhtml-webapi-user-index .page-actions .add:active, -.adminhtml-webapi-role-index .page-actions .add:hover, -.adminhtml-webapi-role-index .page-actions .add:focus, -.adminhtml-webapi-role-index .page-actions .add:active, -.adminhtml-system-variable-index .page-actions .add:hover, -.adminhtml-system-variable-index .page-actions .add:focus, -.adminhtml-system-variable-index .page-actions .add:active, -.adminhtml-user-index .page-actions .add:hover, -.adminhtml-user-index .page-actions .add:focus, -.adminhtml-user-index .page-actions .add:active, -.adminhtml-user-role-index .page-actions .add:hover, -.adminhtml-user-role-index .page-actions .add:focus, -.adminhtml-user-role-index .page-actions .add:active, -.adminhtml-integration-index .page-actions .add:hover, -.adminhtml-integration-index .page-actions .add:focus, -.adminhtml-integration-index .page-actions .add:active, -.adminhtml-system-design-theme-index .page-actions .add:hover, -.adminhtml-system-design-theme-index .page-actions .add:focus, -.adminhtml-system-design-theme-index .page-actions .add:active, -.adminhtml-system-design-index .page-actions .add:hover, -.adminhtml-system-design-index .page-actions .add:focus, -.adminhtml-system-design-index .page-actions .add:active, -.adminhtml-customer-attribute-index .page-actions .add:hover, -.adminhtml-customer-attribute-index .page-actions .add:focus, -.adminhtml-customer-attribute-index .page-actions .add:active, -.adminhtml-customer-address-attribute-index .page-actions .add:hover, -.adminhtml-customer-address-attribute-index .page-actions .add:focus, -.adminhtml-customer-address-attribute-index .page-actions .add:active, -.rating-index-index .page-actions .add:hover, -.rating-index-index .page-actions .add:focus, -.rating-index-index .page-actions .add:active, -.tax-rule-index .page-actions .add:hover, -.tax-rule-index .page-actions .add:focus, -.tax-rule-index .page-actions .add:active, -.tax-rate-index .page-actions .add:hover, -.tax-rate-index .page-actions .add:focus, -.tax-rate-index .page-actions .add:active, -.adminhtml-rma-item-attribute-index .page-actions .add:hover, -.adminhtml-rma-item-attribute-index .page-actions .add:focus, -.adminhtml-rma-item-attribute-index .page-actions .add:active, -.adminhtml-reward-rate-index .page-actions .add:hover, -.adminhtml-reward-rate-index .page-actions .add:focus, -.adminhtml-reward-rate-index .page-actions .add:active, -.customer-group-index .page-actions .add:hover, -.customer-group-index .page-actions .add:focus, -.customer-group-index .page-actions .add:active, -.checkout-agreement-index .page-actions .add:hover, -.checkout-agreement-index .page-actions .add:focus, -.checkout-agreement-index .page-actions .add:active, -.catalog-product-attribute-index .page-actions .add:hover, -.catalog-product-attribute-index .page-actions .add:focus, -.catalog-product-attribute-index .page-actions .add:active, -.catalog-product-set-index .page-actions .add:hover, -.catalog-product-set-index .page-actions .add:focus, -.catalog-product-set-index .page-actions .add:active, -.catalog-product-new .actions-split > .action-toggle.primary:hover, -.catalog-product-new .actions-split > .action-toggle.primary:focus, -.catalog-product-new .actions-split > .action-toggle.primary:active, -.catalog-product-edit .actions-split > .action-toggle.primary:hover, -.catalog-product-edit .actions-split > .action-toggle.primary:focus, -.catalog-product-edit .actions-split > .action-toggle.primary:active, -.catalog-product-index .actions-split > .action-toggle.primary:hover, -.catalog-product-index .actions-split > .action-toggle.primary:focus, -.catalog-product-index .actions-split > .action-toggle.primary:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary:focus, -.adminhtml-integration-new .actions-split > .action-toggle.primary:active, -.catalog-product-new .actions-split.btn-round .action-default.primary:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary:focus, -.catalog-product-new .actions-split.btn-round .action-default.primary:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-edit .actions-split.btn-round .action-default.primary:active, -.catalog-product-index .actions-split.btn-round .action-default.primary:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { - text-decoration: none; - background: #cac3b4; - color: #676056; -} -.DefaultButton:active, -.PrimaryButton:active, -input[type=button]:active, -input[type=submit]:active, -input[type=reset]:active, -button:active, -[class^="action-"]:active, -.popup-window .add-widget:active, -.PrimaryAddButton:active, -.PrimarySplitButton > .action-toggle.primary:active, -input[type=button].primary:active, -input[type=submit].primary:active, -input[type=reset].primary:active, -button.primary:active, -[class^="action-"].primary:active, -.popup-window .add-widget.primary:active, -.PrimarySplitButton.btn-round .action-default.primary:active, -.sales-order-index .page-actions .add:active, -.adminhtml-rma-index .page-actions .add:active, -.adminhtml-catalog-event-index .page-actions .add:active, -.adminhtml-urlrewrite-index .page-actions .add:active, -.catalog-search-index .page-actions .add:active, -.review-product-index .page-actions .add:active, -.catalog-rule-promo-catalog-index .page-actions .add:active, -.sales-rule-promo-quote-index .page-actions .add:active, -.adminhtml-reminder-index .page-actions .add:active, -.newsletter-template-index .page-actions .add:active, -.adminhtml-system-email-template-index .page-actions .add:active, -.adminhtml-sitemap-index .page-actions .add:active, -.adminhtml-googleshopping-types-index .page-actions .add:active, -.customer-index-index .page-actions .add:active, -.adminhtml-cms-page-index .page-actions .add:active, -.cms-block-index .page-actions .add:active, -.adminhtml-banner-index .page-actions .add:active, -.adminhtml-widget-instance-index .page-actions .add:active, -.cms-page-index .page-actions .add:active, -.adminhtml-webapi-user-index .page-actions .add:active, -.adminhtml-webapi-role-index .page-actions .add:active, -.adminhtml-system-variable-index .page-actions .add:active, -.adminhtml-user-index .page-actions .add:active, -.adminhtml-user-role-index .page-actions .add:active, -.adminhtml-integration-index .page-actions .add:active, -.adminhtml-system-design-theme-index .page-actions .add:active, -.adminhtml-system-design-index .page-actions .add:active, -.adminhtml-customer-attribute-index .page-actions .add:active, -.adminhtml-customer-address-attribute-index .page-actions .add:active, -.rating-index-index .page-actions .add:active, -.tax-rule-index .page-actions .add:active, -.tax-rate-index .page-actions .add:active, -.adminhtml-rma-item-attribute-index .page-actions .add:active, -.adminhtml-reward-rate-index .page-actions .add:active, -.customer-group-index .page-actions .add:active, -.checkout-agreement-index .page-actions .add:active, -.catalog-product-attribute-index .page-actions .add:active, -.catalog-product-set-index .page-actions .add:active, -.catalog-product-new .actions-split > .action-toggle.primary:active, -.catalog-product-edit .actions-split > .action-toggle.primary:active, -.catalog-product-index .actions-split > .action-toggle.primary:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary:active, -.catalog-product-new .actions-split.btn-round .action-default.primary:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary:active, -.catalog-product-index .actions-split.btn-round .action-default.primary:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { - border: 1px solid #989287; -} -.DefaultButton:visited, -.PrimaryButton:visited, -input[type=button]:visited, -input[type=submit]:visited, -input[type=reset]:visited, -button:visited, -[class^="action-"]:visited, -.popup-window .add-widget:visited, -.PrimaryAddButton:visited, -.PrimarySplitButton > .action-toggle.primary:visited, -input[type=button].primary:visited, -input[type=submit].primary:visited, -input[type=reset].primary:visited, -button.primary:visited, -[class^="action-"].primary:visited, -.popup-window .add-widget.primary:visited, -.PrimarySplitButton.btn-round .action-default.primary:visited, -.sales-order-index .page-actions .add:visited, -.adminhtml-rma-index .page-actions .add:visited, -.adminhtml-catalog-event-index .page-actions .add:visited, -.adminhtml-urlrewrite-index .page-actions .add:visited, -.catalog-search-index .page-actions .add:visited, -.review-product-index .page-actions .add:visited, -.catalog-rule-promo-catalog-index .page-actions .add:visited, -.sales-rule-promo-quote-index .page-actions .add:visited, -.adminhtml-reminder-index .page-actions .add:visited, -.newsletter-template-index .page-actions .add:visited, -.adminhtml-system-email-template-index .page-actions .add:visited, -.adminhtml-sitemap-index .page-actions .add:visited, -.adminhtml-googleshopping-types-index .page-actions .add:visited, -.customer-index-index .page-actions .add:visited, -.adminhtml-cms-page-index .page-actions .add:visited, -.cms-block-index .page-actions .add:visited, -.adminhtml-banner-index .page-actions .add:visited, -.adminhtml-widget-instance-index .page-actions .add:visited, -.cms-page-index .page-actions .add:visited, -.adminhtml-webapi-user-index .page-actions .add:visited, -.adminhtml-webapi-role-index .page-actions .add:visited, -.adminhtml-system-variable-index .page-actions .add:visited, -.adminhtml-user-index .page-actions .add:visited, -.adminhtml-user-role-index .page-actions .add:visited, -.adminhtml-integration-index .page-actions .add:visited, -.adminhtml-system-design-theme-index .page-actions .add:visited, -.adminhtml-system-design-index .page-actions .add:visited, -.adminhtml-customer-attribute-index .page-actions .add:visited, -.adminhtml-customer-address-attribute-index .page-actions .add:visited, -.rating-index-index .page-actions .add:visited, -.tax-rule-index .page-actions .add:visited, -.tax-rate-index .page-actions .add:visited, -.adminhtml-rma-item-attribute-index .page-actions .add:visited, -.adminhtml-reward-rate-index .page-actions .add:visited, -.customer-group-index .page-actions .add:visited, -.checkout-agreement-index .page-actions .add:visited, -.catalog-product-attribute-index .page-actions .add:visited, -.catalog-product-set-index .page-actions .add:visited, -.catalog-product-new .actions-split > .action-toggle.primary:visited, -.catalog-product-edit .actions-split > .action-toggle.primary:visited, -.catalog-product-index .actions-split > .action-toggle.primary:visited, -.adminhtml-integration-new .actions-split > .action-toggle.primary:visited, -.catalog-product-new .actions-split.btn-round .action-default.primary:visited, -.catalog-product-edit .actions-split.btn-round .action-default.primary:visited, -.catalog-product-index .actions-split.btn-round .action-default.primary:visited, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:visited { - color: #676056; -} -.DefaultButton[disabled], -.DefaultButton.disabled, -.PrimaryButton[disabled], -.PrimaryButton.disabled, -input[type=button][disabled], -input[type=button].disabled, -input[type=submit][disabled], -input[type=submit].disabled, -input[type=reset][disabled], -input[type=reset].disabled, -button[disabled], -button.disabled, -[class^="action-"][disabled], -[class^="action-"].disabled, -.popup-window .add-widget[disabled], -.popup-window .add-widget.disabled, -.PrimaryAddButton[disabled], -.PrimaryAddButton.disabled, -.PrimarySplitButton > .action-toggle.primary[disabled], -.PrimarySplitButton > .action-toggle.primary.disabled, -input[type=button].primary[disabled], -input[type=button].primary.disabled, -input[type=submit].primary[disabled], -input[type=submit].primary.disabled, -input[type=reset].primary[disabled], -input[type=reset].primary.disabled, -button.primary[disabled], -button.primary.disabled, -[class^="action-"].primary[disabled], -[class^="action-"].primary.disabled, -.popup-window .add-widget.primary[disabled], -.popup-window .add-widget.primary.disabled, -.PrimarySplitButton.btn-round .action-default.primary[disabled], -.PrimarySplitButton.btn-round .action-default.primary.disabled, -.sales-order-index .page-actions .add[disabled], -.sales-order-index .page-actions .add.disabled, -.adminhtml-rma-index .page-actions .add[disabled], -.adminhtml-rma-index .page-actions .add.disabled, -.adminhtml-catalog-event-index .page-actions .add[disabled], -.adminhtml-catalog-event-index .page-actions .add.disabled, -.adminhtml-urlrewrite-index .page-actions .add[disabled], -.adminhtml-urlrewrite-index .page-actions .add.disabled, -.catalog-search-index .page-actions .add[disabled], -.catalog-search-index .page-actions .add.disabled, -.review-product-index .page-actions .add[disabled], -.review-product-index .page-actions .add.disabled, -.catalog-rule-promo-catalog-index .page-actions .add[disabled], -.catalog-rule-promo-catalog-index .page-actions .add.disabled, -.sales-rule-promo-quote-index .page-actions .add[disabled], -.sales-rule-promo-quote-index .page-actions .add.disabled, -.adminhtml-reminder-index .page-actions .add[disabled], -.adminhtml-reminder-index .page-actions .add.disabled, -.newsletter-template-index .page-actions .add[disabled], -.newsletter-template-index .page-actions .add.disabled, -.adminhtml-system-email-template-index .page-actions .add[disabled], -.adminhtml-system-email-template-index .page-actions .add.disabled, -.adminhtml-sitemap-index .page-actions .add[disabled], -.adminhtml-sitemap-index .page-actions .add.disabled, -.adminhtml-googleshopping-types-index .page-actions .add[disabled], -.adminhtml-googleshopping-types-index .page-actions .add.disabled, -.customer-index-index .page-actions .add[disabled], -.customer-index-index .page-actions .add.disabled, -.adminhtml-cms-page-index .page-actions .add[disabled], -.adminhtml-cms-page-index .page-actions .add.disabled, -.cms-block-index .page-actions .add[disabled], -.cms-block-index .page-actions .add.disabled, -.adminhtml-banner-index .page-actions .add[disabled], -.adminhtml-banner-index .page-actions .add.disabled, -.adminhtml-widget-instance-index .page-actions .add[disabled], -.adminhtml-widget-instance-index .page-actions .add.disabled, -.cms-page-index .page-actions .add[disabled], -.cms-page-index .page-actions .add.disabled, -.adminhtml-webapi-user-index .page-actions .add[disabled], -.adminhtml-webapi-user-index .page-actions .add.disabled, -.adminhtml-webapi-role-index .page-actions .add[disabled], -.adminhtml-webapi-role-index .page-actions .add.disabled, -.adminhtml-system-variable-index .page-actions .add[disabled], -.adminhtml-system-variable-index .page-actions .add.disabled, -.adminhtml-user-index .page-actions .add[disabled], -.adminhtml-user-index .page-actions .add.disabled, -.adminhtml-user-role-index .page-actions .add[disabled], -.adminhtml-user-role-index .page-actions .add.disabled, -.adminhtml-integration-index .page-actions .add[disabled], -.adminhtml-integration-index .page-actions .add.disabled, -.adminhtml-system-design-theme-index .page-actions .add[disabled], -.adminhtml-system-design-theme-index .page-actions .add.disabled, -.adminhtml-system-design-index .page-actions .add[disabled], -.adminhtml-system-design-index .page-actions .add.disabled, -.adminhtml-customer-attribute-index .page-actions .add[disabled], -.adminhtml-customer-attribute-index .page-actions .add.disabled, -.adminhtml-customer-address-attribute-index .page-actions .add[disabled], -.adminhtml-customer-address-attribute-index .page-actions .add.disabled, -.rating-index-index .page-actions .add[disabled], -.rating-index-index .page-actions .add.disabled, -.tax-rule-index .page-actions .add[disabled], -.tax-rule-index .page-actions .add.disabled, -.tax-rate-index .page-actions .add[disabled], -.tax-rate-index .page-actions .add.disabled, -.adminhtml-rma-item-attribute-index .page-actions .add[disabled], -.adminhtml-rma-item-attribute-index .page-actions .add.disabled, -.adminhtml-reward-rate-index .page-actions .add[disabled], -.adminhtml-reward-rate-index .page-actions .add.disabled, -.customer-group-index .page-actions .add[disabled], -.customer-group-index .page-actions .add.disabled, -.checkout-agreement-index .page-actions .add[disabled], -.checkout-agreement-index .page-actions .add.disabled, -.catalog-product-attribute-index .page-actions .add[disabled], -.catalog-product-attribute-index .page-actions .add.disabled, -.catalog-product-set-index .page-actions .add[disabled], -.catalog-product-set-index .page-actions .add.disabled, -.catalog-product-new .actions-split > .action-toggle.primary[disabled], -.catalog-product-new .actions-split > .action-toggle.primary.disabled, -.catalog-product-edit .actions-split > .action-toggle.primary[disabled], -.catalog-product-edit .actions-split > .action-toggle.primary.disabled, -.catalog-product-index .actions-split > .action-toggle.primary[disabled], -.catalog-product-index .actions-split > .action-toggle.primary.disabled, -.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled], -.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled, -.catalog-product-new .actions-split.btn-round .action-default.primary[disabled], -.catalog-product-new .actions-split.btn-round .action-default.primary.disabled, -.catalog-product-edit .actions-split.btn-round .action-default.primary[disabled], -.catalog-product-edit .actions-split.btn-round .action-default.primary.disabled, -.catalog-product-index .actions-split.btn-round .action-default.primary[disabled], -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled], -.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled { - cursor: not-allowed; - opacity: 0.5; - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); -} -.DefaultButton[disabled]:hover, -.DefaultButton.disabled:hover, -.DefaultButton[disabled]:active, -.DefaultButton.disabled:active, -.PrimaryButton[disabled]:hover, -.PrimaryButton.disabled:hover, -.PrimaryButton[disabled]:active, -.PrimaryButton.disabled:active, -input[type=button][disabled]:hover, -input[type=button].disabled:hover, -input[type=button][disabled]:active, -input[type=button].disabled:active, -input[type=submit][disabled]:hover, -input[type=submit].disabled:hover, -input[type=submit][disabled]:active, -input[type=submit].disabled:active, -input[type=reset][disabled]:hover, -input[type=reset].disabled:hover, -input[type=reset][disabled]:active, -input[type=reset].disabled:active, -button[disabled]:hover, -button.disabled:hover, -button[disabled]:active, -button.disabled:active, -[class^="action-"][disabled]:hover, -[class^="action-"].disabled:hover, -[class^="action-"][disabled]:active, -[class^="action-"].disabled:active, -.popup-window .add-widget[disabled]:hover, -.popup-window .add-widget.disabled:hover, -.popup-window .add-widget[disabled]:active, -.popup-window .add-widget.disabled:active, -.PrimaryAddButton[disabled]:hover, -.PrimaryAddButton.disabled:hover, -.PrimaryAddButton[disabled]:active, -.PrimaryAddButton.disabled:active, -.PrimarySplitButton > .action-toggle.primary[disabled]:hover, -.PrimarySplitButton > .action-toggle.primary.disabled:hover, -.PrimarySplitButton > .action-toggle.primary[disabled]:active, -.PrimarySplitButton > .action-toggle.primary.disabled:active, -input[type=button].primary[disabled]:hover, -input[type=button].primary.disabled:hover, -input[type=button].primary[disabled]:active, -input[type=button].primary.disabled:active, -input[type=submit].primary[disabled]:hover, -input[type=submit].primary.disabled:hover, -input[type=submit].primary[disabled]:active, -input[type=submit].primary.disabled:active, -input[type=reset].primary[disabled]:hover, -input[type=reset].primary.disabled:hover, -input[type=reset].primary[disabled]:active, -input[type=reset].primary.disabled:active, -button.primary[disabled]:hover, -button.primary.disabled:hover, -button.primary[disabled]:active, -button.primary.disabled:active, -[class^="action-"].primary[disabled]:hover, -[class^="action-"].primary.disabled:hover, -[class^="action-"].primary[disabled]:active, -[class^="action-"].primary.disabled:active, -.popup-window .add-widget.primary[disabled]:hover, -.popup-window .add-widget.primary.disabled:hover, -.popup-window .add-widget.primary[disabled]:active, -.popup-window .add-widget.primary.disabled:active, -.PrimarySplitButton.btn-round .action-default.primary[disabled]:hover, -.PrimarySplitButton.btn-round .action-default.primary.disabled:hover, -.PrimarySplitButton.btn-round .action-default.primary[disabled]:active, -.PrimarySplitButton.btn-round .action-default.primary.disabled:active, -.sales-order-index .page-actions .add[disabled]:hover, -.sales-order-index .page-actions .add.disabled:hover, -.sales-order-index .page-actions .add[disabled]:active, -.sales-order-index .page-actions .add.disabled:active, -.adminhtml-rma-index .page-actions .add[disabled]:hover, -.adminhtml-rma-index .page-actions .add.disabled:hover, -.adminhtml-rma-index .page-actions .add[disabled]:active, -.adminhtml-rma-index .page-actions .add.disabled:active, -.adminhtml-catalog-event-index .page-actions .add[disabled]:hover, -.adminhtml-catalog-event-index .page-actions .add.disabled:hover, -.adminhtml-catalog-event-index .page-actions .add[disabled]:active, -.adminhtml-catalog-event-index .page-actions .add.disabled:active, -.adminhtml-urlrewrite-index .page-actions .add[disabled]:hover, -.adminhtml-urlrewrite-index .page-actions .add.disabled:hover, -.adminhtml-urlrewrite-index .page-actions .add[disabled]:active, -.adminhtml-urlrewrite-index .page-actions .add.disabled:active, -.catalog-search-index .page-actions .add[disabled]:hover, -.catalog-search-index .page-actions .add.disabled:hover, -.catalog-search-index .page-actions .add[disabled]:active, -.catalog-search-index .page-actions .add.disabled:active, -.review-product-index .page-actions .add[disabled]:hover, -.review-product-index .page-actions .add.disabled:hover, -.review-product-index .page-actions .add[disabled]:active, -.review-product-index .page-actions .add.disabled:active, -.catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, -.catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, -.catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, -.catalog-rule-promo-catalog-index .page-actions .add.disabled:active, -.sales-rule-promo-quote-index .page-actions .add[disabled]:hover, -.sales-rule-promo-quote-index .page-actions .add.disabled:hover, -.sales-rule-promo-quote-index .page-actions .add[disabled]:active, -.sales-rule-promo-quote-index .page-actions .add.disabled:active, -.adminhtml-reminder-index .page-actions .add[disabled]:hover, -.adminhtml-reminder-index .page-actions .add.disabled:hover, -.adminhtml-reminder-index .page-actions .add[disabled]:active, -.adminhtml-reminder-index .page-actions .add.disabled:active, -.newsletter-template-index .page-actions .add[disabled]:hover, -.newsletter-template-index .page-actions .add.disabled:hover, -.newsletter-template-index .page-actions .add[disabled]:active, -.newsletter-template-index .page-actions .add.disabled:active, -.adminhtml-system-email-template-index .page-actions .add[disabled]:hover, -.adminhtml-system-email-template-index .page-actions .add.disabled:hover, -.adminhtml-system-email-template-index .page-actions .add[disabled]:active, -.adminhtml-system-email-template-index .page-actions .add.disabled:active, -.adminhtml-sitemap-index .page-actions .add[disabled]:hover, -.adminhtml-sitemap-index .page-actions .add.disabled:hover, -.adminhtml-sitemap-index .page-actions .add[disabled]:active, -.adminhtml-sitemap-index .page-actions .add.disabled:active, -.adminhtml-googleshopping-types-index .page-actions .add[disabled]:hover, -.adminhtml-googleshopping-types-index .page-actions .add.disabled:hover, -.adminhtml-googleshopping-types-index .page-actions .add[disabled]:active, -.adminhtml-googleshopping-types-index .page-actions .add.disabled:active, -.customer-index-index .page-actions .add[disabled]:hover, -.customer-index-index .page-actions .add.disabled:hover, -.customer-index-index .page-actions .add[disabled]:active, -.customer-index-index .page-actions .add.disabled:active, -.adminhtml-cms-page-index .page-actions .add[disabled]:hover, -.adminhtml-cms-page-index .page-actions .add.disabled:hover, -.adminhtml-cms-page-index .page-actions .add[disabled]:active, -.adminhtml-cms-page-index .page-actions .add.disabled:active, -.cms-block-index .page-actions .add[disabled]:hover, -.cms-block-index .page-actions .add.disabled:hover, -.cms-block-index .page-actions .add[disabled]:active, -.cms-block-index .page-actions .add.disabled:active, -.adminhtml-banner-index .page-actions .add[disabled]:hover, -.adminhtml-banner-index .page-actions .add.disabled:hover, -.adminhtml-banner-index .page-actions .add[disabled]:active, -.adminhtml-banner-index .page-actions .add.disabled:active, -.adminhtml-widget-instance-index .page-actions .add[disabled]:hover, -.adminhtml-widget-instance-index .page-actions .add.disabled:hover, -.adminhtml-widget-instance-index .page-actions .add[disabled]:active, -.adminhtml-widget-instance-index .page-actions .add.disabled:active, -.cms-page-index .page-actions .add[disabled]:hover, -.cms-page-index .page-actions .add.disabled:hover, -.cms-page-index .page-actions .add[disabled]:active, -.cms-page-index .page-actions .add.disabled:active, -.adminhtml-webapi-user-index .page-actions .add[disabled]:hover, -.adminhtml-webapi-user-index .page-actions .add.disabled:hover, -.adminhtml-webapi-user-index .page-actions .add[disabled]:active, -.adminhtml-webapi-user-index .page-actions .add.disabled:active, -.adminhtml-webapi-role-index .page-actions .add[disabled]:hover, -.adminhtml-webapi-role-index .page-actions .add.disabled:hover, -.adminhtml-webapi-role-index .page-actions .add[disabled]:active, -.adminhtml-webapi-role-index .page-actions .add.disabled:active, -.adminhtml-system-variable-index .page-actions .add[disabled]:hover, -.adminhtml-system-variable-index .page-actions .add.disabled:hover, -.adminhtml-system-variable-index .page-actions .add[disabled]:active, -.adminhtml-system-variable-index .page-actions .add.disabled:active, -.adminhtml-user-index .page-actions .add[disabled]:hover, -.adminhtml-user-index .page-actions .add.disabled:hover, -.adminhtml-user-index .page-actions .add[disabled]:active, -.adminhtml-user-index .page-actions .add.disabled:active, -.adminhtml-user-role-index .page-actions .add[disabled]:hover, -.adminhtml-user-role-index .page-actions .add.disabled:hover, -.adminhtml-user-role-index .page-actions .add[disabled]:active, -.adminhtml-user-role-index .page-actions .add.disabled:active, -.adminhtml-integration-index .page-actions .add[disabled]:hover, -.adminhtml-integration-index .page-actions .add.disabled:hover, -.adminhtml-integration-index .page-actions .add[disabled]:active, -.adminhtml-integration-index .page-actions .add.disabled:active, -.adminhtml-system-design-theme-index .page-actions .add[disabled]:hover, -.adminhtml-system-design-theme-index .page-actions .add.disabled:hover, -.adminhtml-system-design-theme-index .page-actions .add[disabled]:active, -.adminhtml-system-design-theme-index .page-actions .add.disabled:active, -.adminhtml-system-design-index .page-actions .add[disabled]:hover, -.adminhtml-system-design-index .page-actions .add.disabled:hover, -.adminhtml-system-design-index .page-actions .add[disabled]:active, -.adminhtml-system-design-index .page-actions .add.disabled:active, -.adminhtml-customer-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-customer-attribute-index .page-actions .add.disabled:hover, -.adminhtml-customer-attribute-index .page-actions .add[disabled]:active, -.adminhtml-customer-attribute-index .page-actions .add.disabled:active, -.adminhtml-customer-address-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-customer-address-attribute-index .page-actions .add.disabled:hover, -.adminhtml-customer-address-attribute-index .page-actions .add[disabled]:active, -.adminhtml-customer-address-attribute-index .page-actions .add.disabled:active, -.rating-index-index .page-actions .add[disabled]:hover, -.rating-index-index .page-actions .add.disabled:hover, -.rating-index-index .page-actions .add[disabled]:active, -.rating-index-index .page-actions .add.disabled:active, -.tax-rule-index .page-actions .add[disabled]:hover, -.tax-rule-index .page-actions .add.disabled:hover, -.tax-rule-index .page-actions .add[disabled]:active, -.tax-rule-index .page-actions .add.disabled:active, -.tax-rate-index .page-actions .add[disabled]:hover, -.tax-rate-index .page-actions .add.disabled:hover, -.tax-rate-index .page-actions .add[disabled]:active, -.tax-rate-index .page-actions .add.disabled:active, -.adminhtml-rma-item-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-rma-item-attribute-index .page-actions .add.disabled:hover, -.adminhtml-rma-item-attribute-index .page-actions .add[disabled]:active, -.adminhtml-rma-item-attribute-index .page-actions .add.disabled:active, -.adminhtml-reward-rate-index .page-actions .add[disabled]:hover, -.adminhtml-reward-rate-index .page-actions .add.disabled:hover, -.adminhtml-reward-rate-index .page-actions .add[disabled]:active, -.adminhtml-reward-rate-index .page-actions .add.disabled:active, -.customer-group-index .page-actions .add[disabled]:hover, -.customer-group-index .page-actions .add.disabled:hover, -.customer-group-index .page-actions .add[disabled]:active, -.customer-group-index .page-actions .add.disabled:active, -.checkout-agreement-index .page-actions .add[disabled]:hover, -.checkout-agreement-index .page-actions .add.disabled:hover, -.checkout-agreement-index .page-actions .add[disabled]:active, -.checkout-agreement-index .page-actions .add.disabled:active, -.catalog-product-attribute-index .page-actions .add[disabled]:hover, -.catalog-product-attribute-index .page-actions .add.disabled:hover, -.catalog-product-attribute-index .page-actions .add[disabled]:active, -.catalog-product-attribute-index .page-actions .add.disabled:active, -.catalog-product-set-index .page-actions .add[disabled]:hover, -.catalog-product-set-index .page-actions .add.disabled:hover, -.catalog-product-set-index .page-actions .add[disabled]:active, -.catalog-product-set-index .page-actions .add.disabled:active, -.catalog-product-new .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-new .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-new .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-new .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-edit .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-edit .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-edit .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-edit .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-index .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-index .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-index .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-index .actions-split > .action-toggle.primary.disabled:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-new .actions-split.btn-round .action-default.primary.disabled:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary.disabled:active, -.catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:active { - color: #676056; - background: #f2ebde; - border: 1px solid #ada89e; -} -.PrimaryButton, -.PrimaryAddButton, -.PrimarySplitButton > .action-toggle.primary, -input[type=button].primary, -input[type=submit].primary, -input[type=reset].primary, -button.primary, -[class^="action-"].primary, -.popup-window .add-widget.primary, -.PrimarySplitButton.btn-round .action-default.primary, -.sales-order-index .page-actions .add, -.adminhtml-rma-index .page-actions .add, -.adminhtml-catalog-event-index .page-actions .add, -.adminhtml-urlrewrite-index .page-actions .add, -.catalog-search-index .page-actions .add, -.review-product-index .page-actions .add, -.catalog-rule-promo-catalog-index .page-actions .add, -.sales-rule-promo-quote-index .page-actions .add, -.adminhtml-reminder-index .page-actions .add, -.newsletter-template-index .page-actions .add, -.adminhtml-system-email-template-index .page-actions .add, -.adminhtml-sitemap-index .page-actions .add, -.adminhtml-googleshopping-types-index .page-actions .add, -.customer-index-index .page-actions .add, -.adminhtml-cms-page-index .page-actions .add, -.cms-block-index .page-actions .add, -.adminhtml-banner-index .page-actions .add, -.adminhtml-widget-instance-index .page-actions .add, -.cms-page-index .page-actions .add, -.adminhtml-webapi-user-index .page-actions .add, -.adminhtml-webapi-role-index .page-actions .add, -.adminhtml-system-variable-index .page-actions .add, -.adminhtml-user-index .page-actions .add, -.adminhtml-user-role-index .page-actions .add, -.adminhtml-integration-index .page-actions .add, -.adminhtml-system-design-theme-index .page-actions .add, -.adminhtml-system-design-index .page-actions .add, -.adminhtml-customer-attribute-index .page-actions .add, -.adminhtml-customer-address-attribute-index .page-actions .add, -.rating-index-index .page-actions .add, -.tax-rule-index .page-actions .add, -.tax-rate-index .page-actions .add, -.adminhtml-rma-item-attribute-index .page-actions .add, -.adminhtml-reward-rate-index .page-actions .add, -.customer-group-index .page-actions .add, -.checkout-agreement-index .page-actions .add, -.catalog-product-attribute-index .page-actions .add, -.catalog-product-set-index .page-actions .add, -.catalog-product-new .actions-split > .action-toggle.primary, -.catalog-product-edit .actions-split > .action-toggle.primary, -.catalog-product-index .actions-split > .action-toggle.primary, -.adminhtml-integration-new .actions-split > .action-toggle.primary, -.catalog-product-new .actions-split.btn-round .action-default.primary, -.catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary { - color: #fff; - background: #007dbd; - border: 1px solid #0574ad; -} -.PrimaryButton:focus, -.PrimaryButton:hover, -.PrimaryAddButton:focus, -.PrimaryAddButton:hover, -.PrimarySplitButton > .action-toggle.primary:focus, -.PrimarySplitButton > .action-toggle.primary:hover, -input[type=button].primary:focus, -input[type=button].primary:hover, -input[type=submit].primary:focus, -input[type=submit].primary:hover, -input[type=reset].primary:focus, -input[type=reset].primary:hover, -button.primary:focus, -button.primary:hover, -[class^="action-"].primary:focus, -[class^="action-"].primary:hover, -.popup-window .add-widget.primary:focus, -.popup-window .add-widget.primary:hover, -.PrimarySplitButton.btn-round .action-default.primary:focus, -.PrimarySplitButton.btn-round .action-default.primary:hover, -.sales-order-index .page-actions .add:focus, -.sales-order-index .page-actions .add:hover, -.adminhtml-rma-index .page-actions .add:focus, -.adminhtml-rma-index .page-actions .add:hover, -.adminhtml-catalog-event-index .page-actions .add:focus, -.adminhtml-catalog-event-index .page-actions .add:hover, -.adminhtml-urlrewrite-index .page-actions .add:focus, -.adminhtml-urlrewrite-index .page-actions .add:hover, -.catalog-search-index .page-actions .add:focus, -.catalog-search-index .page-actions .add:hover, -.review-product-index .page-actions .add:focus, -.review-product-index .page-actions .add:hover, -.catalog-rule-promo-catalog-index .page-actions .add:focus, -.catalog-rule-promo-catalog-index .page-actions .add:hover, -.sales-rule-promo-quote-index .page-actions .add:focus, -.sales-rule-promo-quote-index .page-actions .add:hover, -.adminhtml-reminder-index .page-actions .add:focus, -.adminhtml-reminder-index .page-actions .add:hover, -.newsletter-template-index .page-actions .add:focus, -.newsletter-template-index .page-actions .add:hover, -.adminhtml-system-email-template-index .page-actions .add:focus, -.adminhtml-system-email-template-index .page-actions .add:hover, -.adminhtml-sitemap-index .page-actions .add:focus, -.adminhtml-sitemap-index .page-actions .add:hover, -.adminhtml-googleshopping-types-index .page-actions .add:focus, -.adminhtml-googleshopping-types-index .page-actions .add:hover, -.customer-index-index .page-actions .add:focus, -.customer-index-index .page-actions .add:hover, -.adminhtml-cms-page-index .page-actions .add:focus, -.adminhtml-cms-page-index .page-actions .add:hover, -.cms-block-index .page-actions .add:focus, -.cms-block-index .page-actions .add:hover, -.adminhtml-banner-index .page-actions .add:focus, -.adminhtml-banner-index .page-actions .add:hover, -.adminhtml-widget-instance-index .page-actions .add:focus, -.adminhtml-widget-instance-index .page-actions .add:hover, -.cms-page-index .page-actions .add:focus, -.cms-page-index .page-actions .add:hover, -.adminhtml-webapi-user-index .page-actions .add:focus, -.adminhtml-webapi-user-index .page-actions .add:hover, -.adminhtml-webapi-role-index .page-actions .add:focus, -.adminhtml-webapi-role-index .page-actions .add:hover, -.adminhtml-system-variable-index .page-actions .add:focus, -.adminhtml-system-variable-index .page-actions .add:hover, -.adminhtml-user-index .page-actions .add:focus, -.adminhtml-user-index .page-actions .add:hover, -.adminhtml-user-role-index .page-actions .add:focus, -.adminhtml-user-role-index .page-actions .add:hover, -.adminhtml-integration-index .page-actions .add:focus, -.adminhtml-integration-index .page-actions .add:hover, -.adminhtml-system-design-theme-index .page-actions .add:focus, -.adminhtml-system-design-theme-index .page-actions .add:hover, -.adminhtml-system-design-index .page-actions .add:focus, -.adminhtml-system-design-index .page-actions .add:hover, -.adminhtml-customer-attribute-index .page-actions .add:focus, -.adminhtml-customer-attribute-index .page-actions .add:hover, -.adminhtml-customer-address-attribute-index .page-actions .add:focus, -.adminhtml-customer-address-attribute-index .page-actions .add:hover, -.rating-index-index .page-actions .add:focus, -.rating-index-index .page-actions .add:hover, -.tax-rule-index .page-actions .add:focus, -.tax-rule-index .page-actions .add:hover, -.tax-rate-index .page-actions .add:focus, -.tax-rate-index .page-actions .add:hover, -.adminhtml-rma-item-attribute-index .page-actions .add:focus, -.adminhtml-rma-item-attribute-index .page-actions .add:hover, -.adminhtml-reward-rate-index .page-actions .add:focus, -.adminhtml-reward-rate-index .page-actions .add:hover, -.customer-group-index .page-actions .add:focus, -.customer-group-index .page-actions .add:hover, -.checkout-agreement-index .page-actions .add:focus, -.checkout-agreement-index .page-actions .add:hover, -.catalog-product-attribute-index .page-actions .add:focus, -.catalog-product-attribute-index .page-actions .add:hover, -.catalog-product-set-index .page-actions .add:focus, -.catalog-product-set-index .page-actions .add:hover, -.catalog-product-new .actions-split > .action-toggle.primary:focus, -.catalog-product-new .actions-split > .action-toggle.primary:hover, -.catalog-product-edit .actions-split > .action-toggle.primary:focus, -.catalog-product-edit .actions-split > .action-toggle.primary:hover, -.catalog-product-index .actions-split > .action-toggle.primary:focus, -.catalog-product-index .actions-split > .action-toggle.primary:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary:focus, -.adminhtml-integration-new .actions-split > .action-toggle.primary:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary:focus, -.catalog-product-new .actions-split.btn-round .action-default.primary:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-edit .actions-split.btn-round .action-default.primary:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:hover { - color: #fff; - background: #026294; - border: 1px solid #026294; -} -.PrimaryButton:active, -.PrimaryAddButton:active, -.PrimarySplitButton > .action-toggle.primary:active, -input[type=button].primary:active, -input[type=submit].primary:active, -input[type=reset].primary:active, -button.primary:active, -[class^="action-"].primary:active, -.popup-window .add-widget.primary:active, -.PrimarySplitButton.btn-round .action-default.primary:active, -.sales-order-index .page-actions .add:active, -.adminhtml-rma-index .page-actions .add:active, -.adminhtml-catalog-event-index .page-actions .add:active, -.adminhtml-urlrewrite-index .page-actions .add:active, -.catalog-search-index .page-actions .add:active, -.review-product-index .page-actions .add:active, -.catalog-rule-promo-catalog-index .page-actions .add:active, -.sales-rule-promo-quote-index .page-actions .add:active, -.adminhtml-reminder-index .page-actions .add:active, -.newsletter-template-index .page-actions .add:active, -.adminhtml-system-email-template-index .page-actions .add:active, -.adminhtml-sitemap-index .page-actions .add:active, -.adminhtml-googleshopping-types-index .page-actions .add:active, -.customer-index-index .page-actions .add:active, -.adminhtml-cms-page-index .page-actions .add:active, -.cms-block-index .page-actions .add:active, -.adminhtml-banner-index .page-actions .add:active, -.adminhtml-widget-instance-index .page-actions .add:active, -.cms-page-index .page-actions .add:active, -.adminhtml-webapi-user-index .page-actions .add:active, -.adminhtml-webapi-role-index .page-actions .add:active, -.adminhtml-system-variable-index .page-actions .add:active, -.adminhtml-user-index .page-actions .add:active, -.adminhtml-user-role-index .page-actions .add:active, -.adminhtml-integration-index .page-actions .add:active, -.adminhtml-system-design-theme-index .page-actions .add:active, -.adminhtml-system-design-index .page-actions .add:active, -.adminhtml-customer-attribute-index .page-actions .add:active, -.adminhtml-customer-address-attribute-index .page-actions .add:active, -.rating-index-index .page-actions .add:active, -.tax-rule-index .page-actions .add:active, -.tax-rate-index .page-actions .add:active, -.adminhtml-rma-item-attribute-index .page-actions .add:active, -.adminhtml-reward-rate-index .page-actions .add:active, -.customer-group-index .page-actions .add:active, -.checkout-agreement-index .page-actions .add:active, -.catalog-product-attribute-index .page-actions .add:active, -.catalog-product-set-index .page-actions .add:active, -.catalog-product-new .actions-split > .action-toggle.primary:active, -.catalog-product-edit .actions-split > .action-toggle.primary:active, -.catalog-product-index .actions-split > .action-toggle.primary:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary:active, -.catalog-product-new .actions-split.btn-round .action-default.primary:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary:active, -.catalog-product-index .actions-split.btn-round .action-default.primary:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:active { - color: #fff; - background: #026294; - border: 1px solid #004c74; -} -.PrimaryButton:visited, -.PrimaryAddButton:visited, -.PrimarySplitButton > .action-toggle.primary:visited, -input[type=button].primary:visited, -input[type=submit].primary:visited, -input[type=reset].primary:visited, -button.primary:visited, -[class^="action-"].primary:visited, -.popup-window .add-widget.primary:visited, -.PrimarySplitButton.btn-round .action-default.primary:visited, -.sales-order-index .page-actions .add:visited, -.adminhtml-rma-index .page-actions .add:visited, -.adminhtml-catalog-event-index .page-actions .add:visited, -.adminhtml-urlrewrite-index .page-actions .add:visited, -.catalog-search-index .page-actions .add:visited, -.review-product-index .page-actions .add:visited, -.catalog-rule-promo-catalog-index .page-actions .add:visited, -.sales-rule-promo-quote-index .page-actions .add:visited, -.adminhtml-reminder-index .page-actions .add:visited, -.newsletter-template-index .page-actions .add:visited, -.adminhtml-system-email-template-index .page-actions .add:visited, -.adminhtml-sitemap-index .page-actions .add:visited, -.adminhtml-googleshopping-types-index .page-actions .add:visited, -.customer-index-index .page-actions .add:visited, -.adminhtml-cms-page-index .page-actions .add:visited, -.cms-block-index .page-actions .add:visited, -.adminhtml-banner-index .page-actions .add:visited, -.adminhtml-widget-instance-index .page-actions .add:visited, -.cms-page-index .page-actions .add:visited, -.adminhtml-webapi-user-index .page-actions .add:visited, -.adminhtml-webapi-role-index .page-actions .add:visited, -.adminhtml-system-variable-index .page-actions .add:visited, -.adminhtml-user-index .page-actions .add:visited, -.adminhtml-user-role-index .page-actions .add:visited, -.adminhtml-integration-index .page-actions .add:visited, -.adminhtml-system-design-theme-index .page-actions .add:visited, -.adminhtml-system-design-index .page-actions .add:visited, -.adminhtml-customer-attribute-index .page-actions .add:visited, -.adminhtml-customer-address-attribute-index .page-actions .add:visited, -.rating-index-index .page-actions .add:visited, -.tax-rule-index .page-actions .add:visited, -.tax-rate-index .page-actions .add:visited, -.adminhtml-rma-item-attribute-index .page-actions .add:visited, -.adminhtml-reward-rate-index .page-actions .add:visited, -.customer-group-index .page-actions .add:visited, -.checkout-agreement-index .page-actions .add:visited, -.catalog-product-attribute-index .page-actions .add:visited, -.catalog-product-set-index .page-actions .add:visited, -.catalog-product-new .actions-split > .action-toggle.primary:visited, -.catalog-product-edit .actions-split > .action-toggle.primary:visited, -.catalog-product-index .actions-split > .action-toggle.primary:visited, -.adminhtml-integration-new .actions-split > .action-toggle.primary:visited, -.catalog-product-new .actions-split.btn-round .action-default.primary:visited, -.catalog-product-edit .actions-split.btn-round .action-default.primary:visited, -.catalog-product-index .actions-split.btn-round .action-default.primary:visited, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:visited { - color: #fff; -} -.PrimaryButton[disabled]:hover, -.PrimaryButton.disabled:hover, -.PrimaryButton[disabled]:active, -.PrimaryButton.disabled:active, -.PrimaryAddButton[disabled]:hover, -.PrimaryAddButton.disabled:hover, -.PrimaryAddButton[disabled]:active, -.PrimaryAddButton.disabled:active, -.PrimarySplitButton > .action-toggle.primary[disabled]:hover, -.PrimarySplitButton > .action-toggle.primary.disabled:hover, -.PrimarySplitButton > .action-toggle.primary[disabled]:active, -.PrimarySplitButton > .action-toggle.primary.disabled:active, -input[type=button].primary[disabled]:hover, -input[type=button].primary.disabled:hover, -input[type=button].primary[disabled]:active, -input[type=button].primary.disabled:active, -input[type=submit].primary[disabled]:hover, -input[type=submit].primary.disabled:hover, -input[type=submit].primary[disabled]:active, -input[type=submit].primary.disabled:active, -input[type=reset].primary[disabled]:hover, -input[type=reset].primary.disabled:hover, -input[type=reset].primary[disabled]:active, -input[type=reset].primary.disabled:active, -button.primary[disabled]:hover, -button.primary.disabled:hover, -button.primary[disabled]:active, -button.primary.disabled:active, -[class^="action-"].primary[disabled]:hover, -[class^="action-"].primary.disabled:hover, -[class^="action-"].primary[disabled]:active, -[class^="action-"].primary.disabled:active, -.popup-window .add-widget.primary[disabled]:hover, -.popup-window .add-widget.primary.disabled:hover, -.popup-window .add-widget.primary[disabled]:active, -.popup-window .add-widget.primary.disabled:active, -.PrimarySplitButton.btn-round .action-default.primary[disabled]:hover, -.PrimarySplitButton.btn-round .action-default.primary.disabled:hover, -.PrimarySplitButton.btn-round .action-default.primary[disabled]:active, -.PrimarySplitButton.btn-round .action-default.primary.disabled:active, -.sales-order-index .page-actions .add[disabled]:hover, -.sales-order-index .page-actions .add.disabled:hover, -.sales-order-index .page-actions .add[disabled]:active, -.sales-order-index .page-actions .add.disabled:active, -.adminhtml-rma-index .page-actions .add[disabled]:hover, -.adminhtml-rma-index .page-actions .add.disabled:hover, -.adminhtml-rma-index .page-actions .add[disabled]:active, -.adminhtml-rma-index .page-actions .add.disabled:active, -.adminhtml-catalog-event-index .page-actions .add[disabled]:hover, -.adminhtml-catalog-event-index .page-actions .add.disabled:hover, -.adminhtml-catalog-event-index .page-actions .add[disabled]:active, -.adminhtml-catalog-event-index .page-actions .add.disabled:active, -.adminhtml-urlrewrite-index .page-actions .add[disabled]:hover, -.adminhtml-urlrewrite-index .page-actions .add.disabled:hover, -.adminhtml-urlrewrite-index .page-actions .add[disabled]:active, -.adminhtml-urlrewrite-index .page-actions .add.disabled:active, -.catalog-search-index .page-actions .add[disabled]:hover, -.catalog-search-index .page-actions .add.disabled:hover, -.catalog-search-index .page-actions .add[disabled]:active, -.catalog-search-index .page-actions .add.disabled:active, -.review-product-index .page-actions .add[disabled]:hover, -.review-product-index .page-actions .add.disabled:hover, -.review-product-index .page-actions .add[disabled]:active, -.review-product-index .page-actions .add.disabled:active, -.catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, -.catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, -.catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, -.catalog-rule-promo-catalog-index .page-actions .add.disabled:active, -.sales-rule-promo-quote-index .page-actions .add[disabled]:hover, -.sales-rule-promo-quote-index .page-actions .add.disabled:hover, -.sales-rule-promo-quote-index .page-actions .add[disabled]:active, -.sales-rule-promo-quote-index .page-actions .add.disabled:active, -.adminhtml-reminder-index .page-actions .add[disabled]:hover, -.adminhtml-reminder-index .page-actions .add.disabled:hover, -.adminhtml-reminder-index .page-actions .add[disabled]:active, -.adminhtml-reminder-index .page-actions .add.disabled:active, -.newsletter-template-index .page-actions .add[disabled]:hover, -.newsletter-template-index .page-actions .add.disabled:hover, -.newsletter-template-index .page-actions .add[disabled]:active, -.newsletter-template-index .page-actions .add.disabled:active, -.adminhtml-system-email-template-index .page-actions .add[disabled]:hover, -.adminhtml-system-email-template-index .page-actions .add.disabled:hover, -.adminhtml-system-email-template-index .page-actions .add[disabled]:active, -.adminhtml-system-email-template-index .page-actions .add.disabled:active, -.adminhtml-sitemap-index .page-actions .add[disabled]:hover, -.adminhtml-sitemap-index .page-actions .add.disabled:hover, -.adminhtml-sitemap-index .page-actions .add[disabled]:active, -.adminhtml-sitemap-index .page-actions .add.disabled:active, -.adminhtml-googleshopping-types-index .page-actions .add[disabled]:hover, -.adminhtml-googleshopping-types-index .page-actions .add.disabled:hover, -.adminhtml-googleshopping-types-index .page-actions .add[disabled]:active, -.adminhtml-googleshopping-types-index .page-actions .add.disabled:active, -.customer-index-index .page-actions .add[disabled]:hover, -.customer-index-index .page-actions .add.disabled:hover, -.customer-index-index .page-actions .add[disabled]:active, -.customer-index-index .page-actions .add.disabled:active, -.adminhtml-cms-page-index .page-actions .add[disabled]:hover, -.adminhtml-cms-page-index .page-actions .add.disabled:hover, -.adminhtml-cms-page-index .page-actions .add[disabled]:active, -.adminhtml-cms-page-index .page-actions .add.disabled:active, -.cms-block-index .page-actions .add[disabled]:hover, -.cms-block-index .page-actions .add.disabled:hover, -.cms-block-index .page-actions .add[disabled]:active, -.cms-block-index .page-actions .add.disabled:active, -.adminhtml-banner-index .page-actions .add[disabled]:hover, -.adminhtml-banner-index .page-actions .add.disabled:hover, -.adminhtml-banner-index .page-actions .add[disabled]:active, -.adminhtml-banner-index .page-actions .add.disabled:active, -.adminhtml-widget-instance-index .page-actions .add[disabled]:hover, -.adminhtml-widget-instance-index .page-actions .add.disabled:hover, -.adminhtml-widget-instance-index .page-actions .add[disabled]:active, -.adminhtml-widget-instance-index .page-actions .add.disabled:active, -.cms-page-index .page-actions .add[disabled]:hover, -.cms-page-index .page-actions .add.disabled:hover, -.cms-page-index .page-actions .add[disabled]:active, -.cms-page-index .page-actions .add.disabled:active, -.adminhtml-webapi-user-index .page-actions .add[disabled]:hover, -.adminhtml-webapi-user-index .page-actions .add.disabled:hover, -.adminhtml-webapi-user-index .page-actions .add[disabled]:active, -.adminhtml-webapi-user-index .page-actions .add.disabled:active, -.adminhtml-webapi-role-index .page-actions .add[disabled]:hover, -.adminhtml-webapi-role-index .page-actions .add.disabled:hover, -.adminhtml-webapi-role-index .page-actions .add[disabled]:active, -.adminhtml-webapi-role-index .page-actions .add.disabled:active, -.adminhtml-system-variable-index .page-actions .add[disabled]:hover, -.adminhtml-system-variable-index .page-actions .add.disabled:hover, -.adminhtml-system-variable-index .page-actions .add[disabled]:active, -.adminhtml-system-variable-index .page-actions .add.disabled:active, -.adminhtml-user-index .page-actions .add[disabled]:hover, -.adminhtml-user-index .page-actions .add.disabled:hover, -.adminhtml-user-index .page-actions .add[disabled]:active, -.adminhtml-user-index .page-actions .add.disabled:active, -.adminhtml-user-role-index .page-actions .add[disabled]:hover, -.adminhtml-user-role-index .page-actions .add.disabled:hover, -.adminhtml-user-role-index .page-actions .add[disabled]:active, -.adminhtml-user-role-index .page-actions .add.disabled:active, -.adminhtml-integration-index .page-actions .add[disabled]:hover, -.adminhtml-integration-index .page-actions .add.disabled:hover, -.adminhtml-integration-index .page-actions .add[disabled]:active, -.adminhtml-integration-index .page-actions .add.disabled:active, -.adminhtml-system-design-theme-index .page-actions .add[disabled]:hover, -.adminhtml-system-design-theme-index .page-actions .add.disabled:hover, -.adminhtml-system-design-theme-index .page-actions .add[disabled]:active, -.adminhtml-system-design-theme-index .page-actions .add.disabled:active, -.adminhtml-system-design-index .page-actions .add[disabled]:hover, -.adminhtml-system-design-index .page-actions .add.disabled:hover, -.adminhtml-system-design-index .page-actions .add[disabled]:active, -.adminhtml-system-design-index .page-actions .add.disabled:active, -.adminhtml-customer-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-customer-attribute-index .page-actions .add.disabled:hover, -.adminhtml-customer-attribute-index .page-actions .add[disabled]:active, -.adminhtml-customer-attribute-index .page-actions .add.disabled:active, -.adminhtml-customer-address-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-customer-address-attribute-index .page-actions .add.disabled:hover, -.adminhtml-customer-address-attribute-index .page-actions .add[disabled]:active, -.adminhtml-customer-address-attribute-index .page-actions .add.disabled:active, -.rating-index-index .page-actions .add[disabled]:hover, -.rating-index-index .page-actions .add.disabled:hover, -.rating-index-index .page-actions .add[disabled]:active, -.rating-index-index .page-actions .add.disabled:active, -.tax-rule-index .page-actions .add[disabled]:hover, -.tax-rule-index .page-actions .add.disabled:hover, -.tax-rule-index .page-actions .add[disabled]:active, -.tax-rule-index .page-actions .add.disabled:active, -.tax-rate-index .page-actions .add[disabled]:hover, -.tax-rate-index .page-actions .add.disabled:hover, -.tax-rate-index .page-actions .add[disabled]:active, -.tax-rate-index .page-actions .add.disabled:active, -.adminhtml-rma-item-attribute-index .page-actions .add[disabled]:hover, -.adminhtml-rma-item-attribute-index .page-actions .add.disabled:hover, -.adminhtml-rma-item-attribute-index .page-actions .add[disabled]:active, -.adminhtml-rma-item-attribute-index .page-actions .add.disabled:active, -.adminhtml-reward-rate-index .page-actions .add[disabled]:hover, -.adminhtml-reward-rate-index .page-actions .add.disabled:hover, -.adminhtml-reward-rate-index .page-actions .add[disabled]:active, -.adminhtml-reward-rate-index .page-actions .add.disabled:active, -.customer-group-index .page-actions .add[disabled]:hover, -.customer-group-index .page-actions .add.disabled:hover, -.customer-group-index .page-actions .add[disabled]:active, -.customer-group-index .page-actions .add.disabled:active, -.checkout-agreement-index .page-actions .add[disabled]:hover, -.checkout-agreement-index .page-actions .add.disabled:hover, -.checkout-agreement-index .page-actions .add[disabled]:active, -.checkout-agreement-index .page-actions .add.disabled:active, -.catalog-product-attribute-index .page-actions .add[disabled]:hover, -.catalog-product-attribute-index .page-actions .add.disabled:hover, -.catalog-product-attribute-index .page-actions .add[disabled]:active, -.catalog-product-attribute-index .page-actions .add.disabled:active, -.catalog-product-set-index .page-actions .add[disabled]:hover, -.catalog-product-set-index .page-actions .add.disabled:hover, -.catalog-product-set-index .page-actions .add[disabled]:active, -.catalog-product-set-index .page-actions .add.disabled:active, -.catalog-product-new .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-new .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-new .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-new .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-edit .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-edit .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-edit .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-edit .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-index .actions-split > .action-toggle.primary[disabled]:hover, -.catalog-product-index .actions-split > .action-toggle.primary.disabled:hover, -.catalog-product-index .actions-split > .action-toggle.primary[disabled]:active, -.catalog-product-index .actions-split > .action-toggle.primary.disabled:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:hover, -.adminhtml-integration-new .actions-split > .action-toggle.primary[disabled]:active, -.adminhtml-integration-new .actions-split > .action-toggle.primary.disabled:active, -.catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-new .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-new .actions-split.btn-round .action-default.primary.disabled:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-edit .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-edit .actions-split.btn-round .action-default.primary.disabled:active, -.catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:hover, -.catalog-product-index .actions-split.btn-round .action-default.primary[disabled]:active, -.catalog-product-index .actions-split.btn-round .action-default.primary.disabled:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:hover, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary[disabled]:active, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary.disabled:active { - color: #fff; - background: #007dbd; - border: 1px solid #0574ad; -} -.PrimaryAddButton, -.PrimarySplitButton.btn-round .action-default.primary, -.sales-order-index .page-actions .add, -.adminhtml-rma-index .page-actions .add, -.adminhtml-catalog-event-index .page-actions .add, -.adminhtml-urlrewrite-index .page-actions .add, -.catalog-search-index .page-actions .add, -.review-product-index .page-actions .add, -.catalog-rule-promo-catalog-index .page-actions .add, -.sales-rule-promo-quote-index .page-actions .add, -.adminhtml-reminder-index .page-actions .add, -.newsletter-template-index .page-actions .add, -.adminhtml-system-email-template-index .page-actions .add, -.adminhtml-sitemap-index .page-actions .add, -.adminhtml-googleshopping-types-index .page-actions .add, -.customer-index-index .page-actions .add, -.adminhtml-cms-page-index .page-actions .add, -.cms-block-index .page-actions .add, -.adminhtml-banner-index .page-actions .add, -.adminhtml-widget-instance-index .page-actions .add, -.cms-page-index .page-actions .add, -.adminhtml-webapi-user-index .page-actions .add, -.adminhtml-webapi-role-index .page-actions .add, -.adminhtml-system-variable-index .page-actions .add, -.adminhtml-user-index .page-actions .add, -.adminhtml-user-role-index .page-actions .add, -.adminhtml-integration-index .page-actions .add, -.adminhtml-system-design-theme-index .page-actions .add, -.adminhtml-system-design-index .page-actions .add, -.adminhtml-customer-attribute-index .page-actions .add, -.adminhtml-customer-address-attribute-index .page-actions .add, -.rating-index-index .page-actions .add, -.tax-rule-index .page-actions .add, -.tax-rate-index .page-actions .add, -.adminhtml-rma-item-attribute-index .page-actions .add, -.adminhtml-reward-rate-index .page-actions .add, -.customer-group-index .page-actions .add, -.checkout-agreement-index .page-actions .add, -.catalog-product-attribute-index .page-actions .add, -.catalog-product-set-index .page-actions .add, -.catalog-product-new .actions-split.btn-round .action-default.primary, -.catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary { - width: 36px; - height: 31px; - overflow: hidden; - position: relative; - z-index: 1; - padding: 0; -} -.PrimaryAddButton:focus, -.PrimarySplitButton.btn-round .action-default.primary:focus, -.sales-order-index .page-actions .add:focus, -.adminhtml-rma-index .page-actions .add:focus, -.adminhtml-catalog-event-index .page-actions .add:focus, -.adminhtml-urlrewrite-index .page-actions .add:focus, -.catalog-search-index .page-actions .add:focus, -.review-product-index .page-actions .add:focus, -.catalog-rule-promo-catalog-index .page-actions .add:focus, -.sales-rule-promo-quote-index .page-actions .add:focus, -.adminhtml-reminder-index .page-actions .add:focus, -.newsletter-template-index .page-actions .add:focus, -.adminhtml-system-email-template-index .page-actions .add:focus, -.adminhtml-sitemap-index .page-actions .add:focus, -.adminhtml-googleshopping-types-index .page-actions .add:focus, -.customer-index-index .page-actions .add:focus, -.adminhtml-cms-page-index .page-actions .add:focus, -.cms-block-index .page-actions .add:focus, -.adminhtml-banner-index .page-actions .add:focus, -.adminhtml-widget-instance-index .page-actions .add:focus, -.cms-page-index .page-actions .add:focus, -.adminhtml-webapi-user-index .page-actions .add:focus, -.adminhtml-webapi-role-index .page-actions .add:focus, -.adminhtml-system-variable-index .page-actions .add:focus, -.adminhtml-user-index .page-actions .add:focus, -.adminhtml-user-role-index .page-actions .add:focus, -.adminhtml-integration-index .page-actions .add:focus, -.adminhtml-system-design-theme-index .page-actions .add:focus, -.adminhtml-system-design-index .page-actions .add:focus, -.adminhtml-customer-attribute-index .page-actions .add:focus, -.adminhtml-customer-address-attribute-index .page-actions .add:focus, -.rating-index-index .page-actions .add:focus, -.tax-rule-index .page-actions .add:focus, -.tax-rate-index .page-actions .add:focus, -.adminhtml-rma-item-attribute-index .page-actions .add:focus, -.adminhtml-reward-rate-index .page-actions .add:focus, -.customer-group-index .page-actions .add:focus, -.checkout-agreement-index .page-actions .add:focus, -.catalog-product-attribute-index .page-actions .add:focus, -.catalog-product-set-index .page-actions .add:focus, -.catalog-product-new .actions-split.btn-round .action-default.primary:focus, -.catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus { - outline: none; -} -.PrimaryAddButton > span, -.PrimarySplitButton.btn-round .action-default.primary > span, -.sales-order-index .page-actions .add > span, -.adminhtml-rma-index .page-actions .add > span, -.adminhtml-catalog-event-index .page-actions .add > span, -.adminhtml-urlrewrite-index .page-actions .add > span, -.catalog-search-index .page-actions .add > span, -.review-product-index .page-actions .add > span, -.catalog-rule-promo-catalog-index .page-actions .add > span, -.sales-rule-promo-quote-index .page-actions .add > span, -.adminhtml-reminder-index .page-actions .add > span, -.newsletter-template-index .page-actions .add > span, -.adminhtml-system-email-template-index .page-actions .add > span, -.adminhtml-sitemap-index .page-actions .add > span, -.adminhtml-googleshopping-types-index .page-actions .add > span, -.customer-index-index .page-actions .add > span, -.adminhtml-cms-page-index .page-actions .add > span, -.cms-block-index .page-actions .add > span, -.adminhtml-banner-index .page-actions .add > span, -.adminhtml-widget-instance-index .page-actions .add > span, -.cms-page-index .page-actions .add > span, -.adminhtml-webapi-user-index .page-actions .add > span, -.adminhtml-webapi-role-index .page-actions .add > span, -.adminhtml-system-variable-index .page-actions .add > span, -.adminhtml-user-index .page-actions .add > span, -.adminhtml-user-role-index .page-actions .add > span, -.adminhtml-integration-index .page-actions .add > span, -.adminhtml-system-design-theme-index .page-actions .add > span, -.adminhtml-system-design-index .page-actions .add > span, -.adminhtml-customer-attribute-index .page-actions .add > span, -.adminhtml-customer-address-attribute-index .page-actions .add > span, -.rating-index-index .page-actions .add > span, -.tax-rule-index .page-actions .add > span, -.tax-rate-index .page-actions .add > span, -.adminhtml-rma-item-attribute-index .page-actions .add > span, -.adminhtml-reward-rate-index .page-actions .add > span, -.customer-group-index .page-actions .add > span, -.checkout-agreement-index .page-actions .add > span, -.catalog-product-attribute-index .page-actions .add > span, -.catalog-product-set-index .page-actions .add > span, -.catalog-product-new .actions-split.btn-round .action-default.primary > span, -.catalog-product-edit .actions-split.btn-round .action-default.primary > span, -.catalog-product-index .actions-split.btn-round .action-default.primary > span, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary > span { - text-indent: -999em; - display: block; - width: 34px; - height: 29px; -} -.PrimaryAddButton > span:before, -.PrimarySplitButton.btn-round .action-default.primary > span:before, -.sales-order-index .page-actions .add > span:before, -.adminhtml-rma-index .page-actions .add > span:before, -.adminhtml-catalog-event-index .page-actions .add > span:before, -.adminhtml-urlrewrite-index .page-actions .add > span:before, -.catalog-search-index .page-actions .add > span:before, -.review-product-index .page-actions .add > span:before, -.catalog-rule-promo-catalog-index .page-actions .add > span:before, -.sales-rule-promo-quote-index .page-actions .add > span:before, -.adminhtml-reminder-index .page-actions .add > span:before, -.newsletter-template-index .page-actions .add > span:before, -.adminhtml-system-email-template-index .page-actions .add > span:before, -.adminhtml-sitemap-index .page-actions .add > span:before, -.adminhtml-googleshopping-types-index .page-actions .add > span:before, -.customer-index-index .page-actions .add > span:before, -.adminhtml-cms-page-index .page-actions .add > span:before, -.cms-block-index .page-actions .add > span:before, -.adminhtml-banner-index .page-actions .add > span:before, -.adminhtml-widget-instance-index .page-actions .add > span:before, -.cms-page-index .page-actions .add > span:before, -.adminhtml-webapi-user-index .page-actions .add > span:before, -.adminhtml-webapi-role-index .page-actions .add > span:before, -.adminhtml-system-variable-index .page-actions .add > span:before, -.adminhtml-user-index .page-actions .add > span:before, -.adminhtml-user-role-index .page-actions .add > span:before, -.adminhtml-integration-index .page-actions .add > span:before, -.adminhtml-system-design-theme-index .page-actions .add > span:before, -.adminhtml-system-design-index .page-actions .add > span:before, -.adminhtml-customer-attribute-index .page-actions .add > span:before, -.adminhtml-customer-address-attribute-index .page-actions .add > span:before, -.rating-index-index .page-actions .add > span:before, -.tax-rule-index .page-actions .add > span:before, -.tax-rate-index .page-actions .add > span:before, -.adminhtml-rma-item-attribute-index .page-actions .add > span:before, -.adminhtml-reward-rate-index .page-actions .add > span:before, -.customer-group-index .page-actions .add > span:before, -.checkout-agreement-index .page-actions .add > span:before, -.catalog-product-attribute-index .page-actions .add > span:before, -.catalog-product-set-index .page-actions .add > span:before, -.catalog-product-new .actions-split.btn-round .action-default.primary > span:before, -.catalog-product-edit .actions-split.btn-round .action-default.primary > span:before, -.catalog-product-index .actions-split.btn-round .action-default.primary > span:before, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary > span:before { - text-indent: 0; - font-family: 'MUI-Icons'; - font-weight: normal; - font-size: 22px; - content: '\e02d'; - color: #fff; - position: absolute; - width: 34px; - height: 29px; - line-height: 29px; - text-align: center; - vertical-align: middle; - top: 0; - left: 0; - overflow: hidden; -} -.eq-ie9 .PrimaryAddButton > span:before, -.eq-ie9 .PrimarySplitButton.btn-round .action-default.primary > span:before, -.eq-ie9 .sales-order-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-rma-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-catalog-event-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-urlrewrite-index .page-actions .add > span:before, -.eq-ie9 .catalog-search-index .page-actions .add > span:before, -.eq-ie9 .review-product-index .page-actions .add > span:before, -.eq-ie9 .catalog-rule-promo-catalog-index .page-actions .add > span:before, -.eq-ie9 .sales-rule-promo-quote-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-reminder-index .page-actions .add > span:before, -.eq-ie9 .newsletter-template-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-system-email-template-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-sitemap-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-googleshopping-types-index .page-actions .add > span:before, -.eq-ie9 .customer-index-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-cms-page-index .page-actions .add > span:before, -.eq-ie9 .cms-block-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-banner-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-widget-instance-index .page-actions .add > span:before, -.eq-ie9 .cms-page-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-webapi-user-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-webapi-role-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-system-variable-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-user-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-user-role-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-integration-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-system-design-theme-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-system-design-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-customer-attribute-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-customer-address-attribute-index .page-actions .add > span:before, -.eq-ie9 .rating-index-index .page-actions .add > span:before, -.eq-ie9 .tax-rule-index .page-actions .add > span:before, -.eq-ie9 .tax-rate-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-rma-item-attribute-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-reward-rate-index .page-actions .add > span:before, -.eq-ie9 .customer-group-index .page-actions .add > span:before, -.eq-ie9 .checkout-agreement-index .page-actions .add > span:before, -.eq-ie9 .catalog-product-attribute-index .page-actions .add > span:before, -.eq-ie9 .catalog-product-set-index .page-actions .add > span:before, -.eq-ie9 .catalog-product-new .actions-split.btn-round .action-default.primary > span:before, -.eq-ie9 .catalog-product-edit .actions-split.btn-round .action-default.primary > span:before, -.eq-ie9 .catalog-product-index .actions-split.btn-round .action-default.primary > span:before, -.eq-ie9 .adminhtml-integration-new .actions-split.btn-round .action-default.primary > span:before { - line-height: 31px; -} -.PrimarySplitButton.btn-round .action-default.primary, -.catalog-product-new .actions-split.btn-round .action-default.primary, -.catalog-product-edit .actions-split.btn-round .action-default.primary, -.catalog-product-index .actions-split.btn-round .action-default.primary, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary { - border-radius: 2px 0 0 2px; -} -.PrimarySplitButton.btn-round .action-default.primary:focus, -.catalog-product-new .actions-split.btn-round .action-default.primary:focus, -.catalog-product-edit .actions-split.btn-round .action-default.primary:focus, -.catalog-product-index .actions-split.btn-round .action-default.primary:focus, -.adminhtml-integration-new .actions-split.btn-round .action-default.primary:focus { - outline: none; -} -.PrimarySplitButton > .action-default.primary, -.catalog-product-new .actions-split > .action-default.primary, -.catalog-product-edit .actions-split > .action-default.primary, -.catalog-product-index .actions-split > .action-default.primary, -.adminhtml-integration-new .actions-split > .action-default.primary { - border-radius: 2px 0 0 2px; -} -.PrimarySplitButton > .action-default.primary:focus, -.catalog-product-new .actions-split > .action-default.primary:focus, -.catalog-product-edit .actions-split > .action-default.primary:focus, -.catalog-product-index .actions-split > .action-default.primary:focus, -.adminhtml-integration-new .actions-split > .action-default.primary:focus { - outline: none; -} -.PrimarySplitButton > .action-toggle.primary, -.catalog-product-new .actions-split > .action-toggle.primary, -.catalog-product-edit .actions-split > .action-toggle.primary, -.catalog-product-index .actions-split > .action-toggle.primary, -.adminhtml-integration-new .actions-split > .action-toggle.primary { - overflow: hidden; - z-index: 1; - padding: 0; - border-radius: 0 2px 2px 0; - font-size: 15px; - width: 30px; - height: 31px; - line-height: 30px; - margin-left: -1px; - position: relative; - z-index: 2; - filter: none; -} -.PrimarySplitButton > .action-toggle.primary:focus, -.catalog-product-new .actions-split > .action-toggle.primary:focus, -.catalog-product-edit .actions-split > .action-toggle.primary:focus, -.catalog-product-index .actions-split > .action-toggle.primary:focus, -.adminhtml-integration-new .actions-split > .action-toggle.primary:focus { - outline: none; -} -.PrimarySplitButton > .action-toggle.primary:before, -.catalog-product-new .actions-split > .action-toggle.primary:before, -.catalog-product-edit .actions-split > .action-toggle.primary:before, -.catalog-product-index .actions-split > .action-toggle.primary:before, -.adminhtml-integration-new .actions-split > .action-toggle.primary:before { - text-align: center; -} -.PrimarySplitButton .dropdown-menu, -.catalog-product-new .actions-split .dropdown-menu, -.catalog-product-edit .actions-split .dropdown-menu, -.catalog-product-index .actions-split .dropdown-menu, -.adminhtml-integration-new .actions-split .dropdown-menu { - left: 0; - right: auto; - z-index: 1; -} -.PrimarySplitButton .dropdown-menu > li > .item, -.catalog-product-new .actions-split .dropdown-menu > li > .item, -.catalog-product-edit .actions-split .dropdown-menu > li > .item, -.catalog-product-index .actions-split .dropdown-menu > li > .item, -.adminhtml-integration-new .actions-split .dropdown-menu > li > .item { - padding: 9px 10px 10px; -} -.PrimarySplitButton.active > .action-toggle.primary, -.PrimarySplitButton.active > .action-toggle.primary:hover, -.catalog-product-new .actions-split.active > .action-toggle.primary, -.catalog-product-new .actions-split.active > .action-toggle.primary:hover, -.catalog-product-edit .actions-split.active > .action-toggle.primary, -.catalog-product-edit .actions-split.active > .action-toggle.primary:hover, -.catalog-product-index .actions-split.active > .action-toggle.primary, -.catalog-product-index .actions-split.active > .action-toggle.primary:hover, -.adminhtml-integration-new .actions-split.active > .action-toggle.primary, -.adminhtml-integration-new .actions-split.active > .action-toggle.primary:hover { - background: #026294; - border: 1px solid #004c74; -} -.dont-use-this-class-big-size { - font-size: 18px; - line-height: 24px; - padding: 8px 19px; -} -/* - Reset 'button view' for actions --------------------------------------- */ -.customer-current-activity .action-refresh, -.pager .action-next, -.pager .action-previous, -.pager .action-next:hover, -.pager .action-previous:hover, -.pager .action-next.disabled:focus, -.pager .action-previous.disabled:focus, -.pager .action-next.disabled:active, -.pager .action-previous.disabled:active, -.data-table .action-.delete, -.data-table .action-.delete:hover, -.data-table .action-.delete:active, -.data-table .action-.delete.active, -.data-table .action-delete, -.data-table .action-delete:hover, -.data-table .action-delete:active, -.data-table .action-delete.active, -.data-table .action-locked, -.data-table .action-locked:hover, -.data-table .action-locked:active, -.data-table .action-locked.active, -.data-table .action-locked[disabled], -#product-variations-matrix .action-choose, -#product-variations-matrix .action-choose:hover, -#product-variations-matrix .action-choose:active, -#product-variations-matrix .action-choose.active, -#product-variations-matrix .action-choose[disabled], -.action-manage-images, -.action-manage-images:hover, -.action-manage-images:active, -.action-manage-images.active, -.action-manage-images[disabled], -.image-panel .action-close, -.image-panel .action-close:hover, -.image-panel .action-close:active, -.image-panel .action-close.active, -.image-panel .action-close[disabled], -.image-panel-controls .action-remove, -.image-panel-controls .action-remove:hover, -.image-panel-controls .action-remove:active, -.image-panel-controls .action-remove.active, -.image-panel-controls .action-remove[disabled], -.vde-image-sizing .action-connect, -.vde-image-sizing .action-connect:hover, -.vde-image-sizing .action-connect:active, -.vde-image-sizing .action-connect.active, -.vde-image-sizing .action-connect[disabled], -.suggest-expandable .action-show-all, -.suggest-expandable .action-show-all:hover, -.suggest-expandable .action-show-all:active, -.suggest-expandable .action-show-all.active, -.suggest-expandable .action-show-all[disabled], -.custom-file > .action-add, -.custom-file > .action-add:hover, -.custom-file > .action-add:active, -.custom-file > .action-add.active, -.custom-file > .action-add[disabled], -.vde-tools-header .action-close, -.vde-tools-header .action-close:hover, -.vde-tools-header .action-close:active, -.vde-tools-header .action-close.active, -.image .action-delete, -.image .action-delete:hover, -.image .action-delete:active, -.image .action-delete.active, -.fieldset-wrapper-title .actions .action-delete, -.fieldset-wrapper-title .actions .action-delete:hover, -.fieldset-wrapper-title .actions .action-delete:active, -.fieldset-wrapper-title .actions .action-delete.active, -.address-list-item-actions .action-delete, -.address-list-item-actions .action-delete:hover, -.address-list-item-actions .action-delete:active, -.address-list-item-actions .action-delete.active, -.notification .action-close, -.notification .action-close:hover, -.notification .action-close:active, -.notification .action-close.active, -.page-login .action-forgotpassword, -.page-login .action-forgotpassword:hover, -.page-login .action-forgotpassword:active, -.page-login .action-forgotpassword.active, -.page-login .action-back, -.page-login .action-back:hover, -.page-login .action-back:active, -.page-login .action-back.active, -.attribute-popup .page-actions #reset, -.attribute-popup .page-actions #reset:hover, -.attribute-popup .page-actions #reset:active, -.attribute-popup .page-actions #reset.active, -.attribute-popup .page-actions #reset[disabled] { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - filter: none; -} -.attribute-popup .messages { - margin: 0 15px; -} -.data-table .action-.delete[disabled], -.data-table .action-delete[disabled], -.data-table .action-locked[disabled], -#product-variations-matrix .action-choose[disabled], -.image-panel .action-close[disabled], -.image-panel-controls .action-remove[disabled], -.suggest-expandable .action-show-all[disabled], -#store-view-window [class^='action-close'], -#store-view-window [class^='action-close']:hover, -#store-view-window [class^='action-close']:active, -#store-view-window [class^='action-close'].active, -#store-view-window [class^='action-close'][disabled], -.custom-file > .action-add[disabled], -.image .action-delete, -.image .action-delete:hover, -.image .action-delete:active, -.image .action-delete.active, -.fieldset-wrapper-title .actions .action-delete, -.fieldset-wrapper-title .actions .action-delete:hover, -.fieldset-wrapper-title .actions .action-delete:active, -.fieldset-wrapper-title .actions .action-delete.active, -.address-list-item-actions .action-delete, -.address-list-item-actions .action-delete:hover, -.address-list-item-actions .action-delete:active, -.address-list-item-actions .action-delete.active, -.notification .action-close, -.notification .action-close:hover, -.notification .action-close:active, -.notification .action-close.active { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - filter: none; -} -.fade.critical-notification { - display: block; -} -.fade.critical-notification .popup { - top: 200px; -} -.data-table .action-.delete[disabled], -.data-table .action-delete[disabled], -.data-table .action-locked[disabled], -#product-variations-matrix .action-choose[disabled], -.image-panel .action-close[disabled], -.image-panel-controls .action-remove[disabled], -.suggest-expandable .action-show-all[disabled], -#store-view-window [class^='action-close'], -#store-view-window [class^='action-close']:hover, -#store-view-window [class^='action-close']:active, -#store-view-window [class^='action-close'].active, -#store-view-window [class^='action-close'][disabled], -.custom-file > .action-add[disabled], -.vde-tools-header .action-close[disabled], -.vde-image-sizing .action-reset, -.vde-image-sizing .action-reset:hover, -.vde-image-sizing .action-reset:active, -.vde-image-sizing .action-reset.active, -.vde-image-sizing .action-reset[disabled], -.image .action-delete[disabled], -.fieldset-wrapper-title .actions .action-delete[disabled], -.address-list-item-actions .action-delete[disabled], -[class^=" catalog-product-"] .page-actions .action-back, -[class^=" catalog-product-"] .page-actions .action-back:hover, -[class^=" catalog-product-"] .page-actions .action-back:active, -[class^=" catalog-product-"] .page-actions .action-back.active, -[class^=" catalog-product-"] .page-actions .action-back[disabled], -[class^=" newsletter-"] .page-actions .action-back, -[class^=" newsletter-"] .page-actions .action-back:hover, -[class^=" newsletter-"] .page-actions .action-back:active, -[class^=" newsletter-"] .page-actions .action-back.active, -[class^=" newsletter-"] .page-actions .action-back[disabled], -.notifications [class^="action-"], -.notifications [class^="action-"]:hover, -.notifications [class^="action-"]:active, -.notifications [class^="action-"].active, -.notifications [class^="action-"][disabled], -.notification .action-close, -.notification .action-close:hover, -.notification .action-close:active, -.notification .action-close.active, -.notification .action-close[disabled], -.sales-order-create-index .page-actions-inner .cancel, -.sales-order-create-index .page-actions-inner .cancel:hover, -.sales-order-create-index .page-actions-inner .cancel:active, -.sales-order-create-index .page-actions-inner .cancel.active, -.sales-order-create-index .page-actions-inner .cancel[disabled] { - border: 0; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - filter: none; -} -.vde-image-sizing .action-connect, -.vde-image-sizing .action-connect:hover, -.vde-image-sizing .action-connect:active, -.vde-image-sizing .action-connect.active, -.vde-image-sizing .action-connect[disabled], -.vde-tab-data .action-download, -.vde-tab-data .action-download:hover, -.vde-tab-data .action-download:active, -.vde-tab-data .action-download.active, -.vde-tab-data .action-download[disabled], -.vde-tab-data .action-delete, -.vde-tab-data .action-delete:hover, -.vde-tab-data .action-delete:active, -.vde-tab-data .action-delete.active, -.vde-tab-data .action-delete[disabled], -.vde-tab-data .action-edit, -.vde-tab-data .action-edit:hover, -.vde-tab-data .action-edit:active, -.vde-tab-data .action-edit.active, -.vde-tab-data .action-edit[disabled] { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; -} -/* - Actions as links --------------------------------------- */ -.notification-entry-dialog .action-cancel, -.attribute-popup .page-actions #reset { - background: none; - border: none; - color: #6d665e; - font-weight: normal; - font-size: 12px; - cursor: pointer; - text-decoration: underline; -} -.notification-entry-dialog .action-cancel:hover, -.attribute-popup .page-actions #reset:hover { - color: #000; - border-bottom-color: #000; - filter: none; -} -/* - Fileupload button --------------------------------------- */ -.action-upload { - position: relative; -} -.action-upload > input[type="file"] { - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - opacity: 0; - font-size: 10em; -} -/* - Dropdown menu --------------------------------------- */ -.dropdown-menu, -.ui-autocomplete { - position: absolute; - display: none; - list-style: none; - min-width: 100px; - margin: 3px 0 0 0; - padding: 0; - right: 0; - top: 100%; - border: 1px solid #cac2b5; - border-radius: 3px; - background: #fff; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); - z-index: 990; -} -.dropdown-menu > li, -.ui-autocomplete > li { - padding: 5px; - border-bottom: 1px solid #e5e5e5; -} -.dropdown-menu > li.selected, -.ui-autocomplete > li.selected { - background: #eef8fc; -} -.dropdown-menu > li:hover, -.ui-autocomplete > li:hover { - background: #eef8fc; -} -.dropdown-menu > li:last-child, -.ui-autocomplete > li:last-child { - border-bottom: none; -} -.dropdown-menu > li > .item, -.ui-autocomplete > li > .item { - cursor: pointer; -} -.dropdown-menu-top { - margin: 0 0 3px 0; - top: auto; - bottom: 100%; -} -.ui-autocomplete { - right: auto; -} -.ui-autocomplete > li { - padding: 0; -} -.ui-autocomplete > li > a { - display: block; - padding: 5px; -} -.ui-autocomplete > li > a.level-0 { - padding-left: 5px !important; -} -.ui-autocomplete .ui-state-focus { - background: #f5f5f5; -} -/* - Suggest --------------------------------------- */ -.mage-suggest { - position: relative; - display: inline-block; - vertical-align: top; - width: 100%; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 3px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.mage-suggest:after { - position: absolute; - top: 0; - right: 3px; - bottom: 0; - width: 22px; - text-align: center; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e01f'; - /* search icon */ - font-size: 20px; - color: #b2b2b2; -} -.mage-suggest input[type="search"], -.mage-suggest input.search { - width: 100%; - border: none; - background: none; - padding-right: 30px; -} -.mage-suggest-dropdown { - position: absolute; - left: 0; - right: 0; - top: 100%; - margin: 3px -1px 0 -1px; - border: 1px solid #cac2b5; - border-radius: 3px; - background: #fff; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); - z-index: 990; -} -.mage-suggest-dropdown ul { - margin: 0; - padding: 0; - list-style: none; -} -.mage-suggest-dropdown li { - border-bottom: 1px solid #e5e5e5; - padding: 0; -} -.field-category_ids .mage-suggest-dropdown, -.field-new_category_parent .mage-suggest-dropdown { - max-height: 200px; - overflow: auto; -} -.mage-suggest-dropdown li a { - display: block; -} -.mage-suggest-dropdown li a, -.mage-suggest-dropdown .jstree li a:hover, -.mage-suggest-dropdown .jstree .jstree-hovered, -.mage-suggest-dropdown .jstree .jstree-clicked { - padding: 6px 12px 5px; - text-decoration: none; - color: #333; -} -.mage-suggest-dropdown .jstree li a:hover, -.mage-suggest-dropdown .jstree .jstree-hovered, -.mage-suggest-dropdown .jstree .jstree-clicked { - border: none; -} -.mage-suggest-dropdown li a.ui-state-focus { - background: #f5f5f5; -} -.mage-suggest-dropdown .jstree li { - border-bottom: 0; -} -.mage-suggest-dropdown .jstree li a { - display: inline-block; -} -.mage-suggest-dropdown .jstree .mage-suggest-selected > a { - color: #000000; - background: #F1FFEB; -} -.mage-suggest-dropdown .jstree .mage-suggest-selected > a:hover, -.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-selected > .jstree-clicked, -.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-selected.mage-suggest-not-active > .jstree-clicked { - background: #E5FFD9; -} -.mage-suggest-dropdown .jstree .mage-suggest-not-active > a { - color: #D4D4D4; -} -.mage-suggest-dropdown .jstree .mage-suggest-not-active > a:hover, -.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-hovered, -.mage-suggest-dropdown .jstree .mage-suggest-not-active > .jstree-clicked { - background: #F5F5F5; -} -.mage-suggest-dropdown .category-path { - font-size: 11px; - margin-left: 10px; - color: #9ba8b5; -} -.suggest-expandable .actions-split .action-toggle { - display: inline-block; - max-width: 500px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - background: none; - border: none; - box-shadow: none; - color: #676056; - font-size: 12px; - padding: 5px 4px; - filter: none; -} -.suggest-expandable .actions-split .action-toggle span { - display: inline; -} -.suggest-expandable .actions-split .action-toggle:before { - display: inline-block; - float: right; - margin-left: 4px; - font-size: 13px; - color: #b2b0ad; -} -.suggest-expandable .actions-split .action-toggle:hover:before { - color: #7e7e7e; -} -.suggest-expandable .dropdown-menu { - margin: 1px 0 0; - left: 0; - right: auto; - width: 221px; -} -.suggest-expandable .mage-suggest { - border: none; -} -.suggest-expandable .mage-suggest:after { - top: 6px; - right: 6px; -} -.suggest-expandable .mage-suggest-inner .title { - margin: 0; - padding: 0 10px 4px; - text-transform: uppercase; - color: #a6a098; - font-size: 12px; - border-bottom: 1px solid #e5e5e5; -} -.suggest-expandable .mage-suggest-inner > input[type="search"], -.suggest-expandable .mage-suggest-inner > input.search { - position: relative; - margin: 6px 5px 5px; - padding-right: 20px; - border: 1px solid #ccc; - width: 211px; - z-index: 1; -} -.suggest-expandable .mage-suggest-inner > input.ui-autocomplete-loading, -.suggest-expandable .mage-suggest-inner > input.mage-suggest-state-loading { - background: #ffffff url(../mui/images/ajax-loader-small.gif) no-repeat 190px 50%; -} -.suggest-expandable .mage-suggest { - border-radius: 3px 3px 0 0; -} -.suggest-expandable .mage-suggest-dropdown { - margin-top: 0; - border-top: 0; - border-radius: 0 0 3px 3px; - max-height: 300px; - overflow: auto; - width: 100%; - float: left; -} -.suggest-expandable .mage-suggest-dropdown ul { - margin: 0; - padding: 0; - list-style: none; -} -.suggest-expandable .action-show-all, -.suggest-expandable .action-show-all:hover, -.suggest-expandable .action-show-all:active, -.suggest-expandable .action-show-all:focus, -.suggest-expandable .action-show-all[disabled] { - border-top: 1px solid #e5e5e5; - display: block; - width: 100%; - padding: 8px 10px 10px; - text-align: left; - font: 12px/1.333 Arial, Verdana, sans-serif; - color: #676056; -} -.page-actions .suggest-expandable { - max-width: 500px; - float: left; - margin-top: 1px; -} -.page-actions.fixed #product-template-suggest-container { - display: none; -} -/* - Actions Split --------------------------------------- */ -.actions-split { - text-align: left; - position: relative; - display: inline-block; -} -.actions-split > [class^='action-'] { - float: left; - border-radius: 0; -} -.actions-split > .action-default { - border-radius: 5px 0 0 5px; -} -.actions-split > .action-toggle { - border-left: 1px solid #c5c0b9; - border-radius: 0 5px 5px 0; - margin-left: -1px; - padding: 4px 7px; -} -.actions-split > .action-toggle > span { - display: none; -} -.actions-split > .action-toggle:before { - display: block; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02c'; - /* arrow down */ - font-size: 11px; -} -.actions-split > .action-toggle.active:before { - content: '\e029'; - /* arrow up */ -} -.actions-split > .action-toggle.primary { - border-left: 1px solid #e1721d; -} -.actions-split > .action-toggle.primary:hover { - background: #e2701a; - margin-left: -1px; -} -.actions-split.active .dropdown-menu { - display: block; - white-space: nowrap; -} -.actions-split.active .dropdown-menu > li { - padding: 0; -} -.actions-split .dropdown-menu > li > .item { - display: block; - padding: 6px 10px 5px; - color: #333; - text-decoration: none; -} -/* Variations Image Uploader */ -.actions-image-uploader > img { - float: left; - border: solid #b7b2a7; - border-width: 1px 0 1px 1px; - width: 32px; - height: 31px; -} -.actions-image-uploader .action-toggle, -.actions-image-uploader .action-toggle:hover, -.actions-image-uploader .action-toggle:active, -.actions-image-uploader .action-toggle:focus, -.actions-image-uploader .action-toggle[disabled] { - position: relative; - height: 33px; - padding-left: 2px; - padding-right: 2px; - background: #fff; - filter: none; - color: #888; -} -.actions-image-uploader.active .action-toggle { - border-radius: 0 5px 0 0; -} -.actions-image-uploader.active .action-toggle:after { - position: absolute; - left: 0; - right: 0; - bottom: -1px; - height: 1px; - background: #fff; - z-index: 991; - content: ''; -} -.actions-image-uploader .dropdown-menu { - margin-top: -1px; - border-radius: 3px 0 3px 3px; -} -/* - Action delete icon --------------------------------------- */ -/* TODO: replase ".action-.delete" to ".action-delete" after buttons refactoring */ -.data-table .action-.delete span, -.data-table .action-delete span, -.data-table .action-locked span, -.image .action-delete span, -.fieldset-wrapper-title .actions .action-delete span, -.address-list-item-actions .action-delete span { - display: none; -} -.data-table .action-.delete:before, -.data-table .action-delete:before, -.image .action-delete:before, -.fieldset-wrapper-title .actions .action-delete:before, -.address-list-item-actions .action-delete:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - font-size: 18px; - -webkit-font-smoothing: antialiased; - content: '\e07f'; - /* delete icon */ - color: #b7b3ad; -} -/* - Locked action icon --------------------------------------- */ -.data-table .action-locked:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - font-size: 20px; - -webkit-font-smoothing: antialiased; - content: '\e03e'; - /* lock icon */ - color: #b7b3ad; -} -.data-table .action-.delete:hover:before, -.data-table .action-delete:hover:before, -.data-table .action-locked:hover:before, -.image .action-delete:hover:before, -.fieldset-wrapper-title .actions .action-delete:hover:before, -.address-list-item-actions .action-delete:hover:before { - color: #7e7e7e; -} -.data-table input.action-.delete[type="button"], -.data-table input.action-.delete[type="submit"], -.data-table input.action-.delete[type="reset"], -.data-table button.action-.delete, -.data-table input.action-.delete[type="button"]:visited, -.data-table input.action-.delete[type="submit"]:visited, -.data-table input.action-.delete[type="reset"]:visited, -.data-table button.action-.delete:visited, -.data-table input.action-.delete[type="button"]:hover, -.data-table input.action-.delete[type="submit"]:hover, -.data-table input.action-.delete[type="reset"]:hover, -.data-table button.action-.delete:hover, -.data-table input.action-.delete[type="button"]:active, -.data-table input.action-.delete[type="submit"]:active, -.data-table input.action-.delete[type="reset"]:active, -.data-table button.action-.delete:active { - background: transparent; - padding: 3px 7px 0; -} -.data-table input.action-.delete[type=button]:hover:before, -.data-table input.action-.delete[type=submit]:hover:before, -.data-table input.action-.delete[type=reset]:hover:before, -.data-table button.action-.delete:hover:before, -.data-table input.action-.delete[type=button]:focus:before, -.data-table input.action-.delete[type=submit]:focus:before, -.data-table input.action-.delete[type=reset]:focus:before, -.data-table button.action-.delete:focus:before { - background: transparent; - color: #a5a29d; -} -/* - Forms --------------------------------------- */ -fieldset { - border: 1px solid #ccc; - padding: 20px; -} -legend { - padding: 0 10px; - margin: 0 -10px; -} -fieldset legend + br { - display: none; -} -label { - display: inline-block; -} -label > input[type="radio"], -label > input[type="checkbox"] { - margin: -3px 3px 0 0; - vertical-align: middle; -} -input[type=text], -input[type=password], -input[type=datetime], -input[type=datetime-local], -input[type=date], -input[type=month], -input[type=time], -input[type=week], -input[type=number], -input[type=range], -input[type=email], -input[type=url], -input[type=search], -input.search, -input[type=tel], -input[type=color], -textarea, -.input-text { - display: inline-block; - padding: 4px; - margin: 0; - background-color: #fff; - height: 28px; - color: #676056; - font-size: 14px; - font-weight: 400; - border: 1px solid #ccc; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - border-radius: 4px; - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} -textarea, -.input-text { - height: auto; -} -textarea { - resize: vertical; -} -select { - height: 28px; - padding: 4px 4px 5px; - margin: 0 0 8px; - border: 1px solid #ccc; - border-radius: 4px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; -} -select[multiple], -select[size] { - height: auto; -} -input[type=text]:focus, -input[type=password]:focus, -input[type=datetime]:focus, -input[type=datetime-local]:focus, -input[type=date]:focus, -input[type=month]:focus, -input[type=time]:focus, -input[type=week]:focus, -input[type=number]:focus, -input[type=range]:focus, -input[type=email]:focus, -input[type=url]:focus, -input[type=search]:focus, -input.search:focus, -input[type=tel]:focus, -input[type=color]:focus, -textarea:focus, -select:focus { - outline: 0; - border-color: #75b9f0; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); -} -input[type="radio"], -input[type="checkbox"] { - margin: 3px 0; - line-height: normal; -} -input[disabled], -select[disabled], -textarea[disabled], -input[readonly], -select[readonly], -textarea[readonly] { - cursor: not-allowed; - background-color: #fff; - border-color: #eee; - box-shadow: none; - color: #999; -} -select[disabled].multiselect > option[selected] { - color: #fff; - background: #6d6d6d; -} -textarea:-moz-placeholder, -input:-moz-placeholder { - color: #999 !important; - font-style: italic; -} -option.placeholder { - color: #999 !important; - font-style: italic !important; -} -:-ms-input-placeholder { - color: #999 !important; - font-style: italic; -} -::-webkit-input-placeholder { - color: #999 !important; -} -:-moz-placeholder { - color: #999 !important; -} -.form-inline .control { - width: 100%; -} -.form-inline .label { - width: 20%; - padding-top: 6px; -} -.form-inline .label ~ .control { - width: 60%; -} -.form-inline .no-label .control { - margin-left: 20%; - width: 60%; -} -fieldset.field [class^='fields-group-'] .field .control { - width: auto; - margin: 0 0 0 20px; -} -.form-inline .field-service { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - float: left; - width: 20%; - padding: 7px 0 0 15px; - color: #999; - font-size: 12px; - letter-spacing: 0.05em; -} -.form-inline .field-service[value-scope]:before { - content: attr(value-scope) !important; - white-space: nowrap; - display: block; - margin-bottom: 5px; -} -.form-inline .field-service .checkbox { - margin: 0; - vertical-align: middle; -} -.control > input { - width: 100%; -} -.control > input[type="button"] { - width: auto; -} -.control > input.hasDatepicker { - width: 130px; -} -.control > input[type="radio"], -.control > input[type="checkbox"], -.control > input[type="file"] { - width: auto; -} -.control > table { - width: 100%; -} -.multi-input { - margin: 0 0 20px; -} -.multi-input > input { - width: 100%; -} -.control .input-file { - margin-top: 4px; -} -/* TODO: remove styles for images when images will be replaced by font icons */ -.control .hasDatepicker + img { - margin: -3px 0 0 5px; - vertical-align: middle; -} -.nobr { - white-space: nowrap; -} -/* - Form Validation --------------------------------------- */ -label.mage-error { - display: block; - color: red; - text-align: left; - clear: both; - margin: 3px 0 0 0; -} -textarea.mage-error, -select.mage-error, -input.mage-error { - border-color: #fa7973 !important; - box-shadow: 0 0 8px rgba(250, 121, 115, 0.6) !important; -} -input.mage-error ~ .addafter { - border-color: #fa7973 !important; - box-shadow: 0 0 8px rgba(250, 121, 115, 0.6) !important; -} -/* - Forms for Store Scope --------------------------------------- */ -.form-inline .field-store_id .label + .control, -.form-inline .field-store_ids .label + .control, -.form-inline .field-website_ids .label + .control, -.form-inline .field-website_id .label + .control, -.form-inline .field-select_stores .label + .control, -.form-inline .field-stores .label + .control { - width: auto; -} -/* - Forms styles --------------------------------------- */ -.page-content-inner { - position: relative; - background: #f5f2ed; - border: 1px solid #b7b2a6; - border-radius: 5px; - padding: 20px; -} -.fieldset-wrapper, -.fieldset { - background: #fff; - border: 1px solid #eae6e0; - border-radius: 5px; - margin: 0 0 8px; - padding: 5px 18px 18px; - position: relative; -} -.fieldset-wrapper > .fieldset-wrapper-title, -.fieldset > .legend { - position: static; - float: left; - width: 100%; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - padding: 0; - border-bottom: 1px solid #ededed; - margin: 0 0 18px; -} -.fieldset-wrapper > .fieldset-wrapper-title { - float: none; -} -.fieldset-wrapper > .fieldset-wrapper-title .title, -.fieldset > .legend span { - color: #676056; - font-size: 20px; - font-weight: 400; - padding: 7px 0 10px; - display: inline-block; -} -/* Collapsable fieldset-wrapper */ -.collapsable-wrapper { - padding-bottom: 2px; -} -.collapsable-wrapper.opened { - padding-bottom: 18px; -} -.collapsable-wrapper > .fieldset-wrapper-title { - border-bottom: none; - margin-bottom: 0; -} -.collapsable-wrapper.opened > .fieldset-wrapper-title { - border-bottom: 1px solid #ededed; - margin-bottom: 18px; -} -.collapsable-wrapper .fieldset-wrapper-title > .title { - position: relative; - padding-left: 22px; - cursor: pointer; - float: left; -} -.collapsable-wrapper .fieldset-wrapper-title > .title:before { - position: absolute; - left: 0; - top: 7px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02a'; - /* arrow right icon */ - color: #b2b0ad; -} -.collapsable-wrapper.opened > .fieldset-wrapper-title > .title:before { - content: '\e02c'; - /* arrow down icon */ -} -.collapsable-wrapper .fieldset-wrapper-title > .title:hover:before { - color: #7e7e7e; -} -/* Fieldset styles in another fieldset */ -.fieldset .fieldset-wrapper, -.fieldset-wrapper .fieldset-wrapper { - border-color: #cccbca; - padding: 0; -} -.fieldset .fieldset-wrapper .fieldset-wrapper-title, -.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title { - background: #f4f2ef; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y0ZjJlZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWViZTYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f2ef), color-stop(100%, #eeebe6)); - background: -webkit-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); - background: -o-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); - background: -ms-linear-gradient(top, #f4f2ef 0%, #eeebe6 100%); - background: linear-gradient(to bottom, #f4f2ef 0%, #eeebe6 100%); - padding: 0 18px; - border-radius: 5px; -} -.fieldset .fieldset-wrapper.opened .fieldset-wrapper-title, -.fieldset-wrapper .fieldset-wrapper.opened .fieldset-wrapper-title { - border-radius: 5px 5px 0 0; - border-bottom: 1px solid #cccbca; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - min-height: 39px; -} -.fieldset .fieldset-wrapper .fieldset-wrapper-title .actions, -.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .actions { - padding: 10px 2px 0 0; -} -.fieldset .fieldset-wrapper .fieldset-wrapper-title .title, -.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .title { - padding-top: 9px; - padding-bottom: 8px; - color: #555; - font: normal 16px/1.333 Arial, Verdana, sans-serif; -} -.fieldset .fieldset-wrapper .fieldset-wrapper-title .title:before, -.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title .title:before { - top: 9px; -} -.fieldset-wrapper-content .fieldset > .title { - margin-top: 0; - padding-left: 22px; -} -.fieldset-wrapper .draggable-handle, -.fieldset .draggable-handle { - width: 8px; - height: 14px; - line-height: 14px; - background: url(Magento_Backend::images/draggable-handle-vertical.gif) no-repeat 0 0; - cursor: ns-resize; - color: #b2b0ad; -} -.fieldset-wrapper-title > .draggable-handle { - position: absolute; - left: 10px; - top: 12px; -} -.fieldset .fieldset-wrapper .fieldset-wrapper-content, -.fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-content { - padding: 0 10px; -} -/* Sortable fieldsets */ -.ui-sortable .entry-edit .fieldset-wrapper-title, -#product_options_container_top .fieldset-wrapper-title { - padding-left: 30px; -} -.fieldset-wrapper-title > .actions, -.fieldset .legend > .actions { - float: right; - padding-top: 8px; -} -.fieldset > .legend + br { - display: block; - height: 0; - overflow: hidden; - clear: left; -} -.fieldset-wrapper .fieldset, -.fieldset .fieldset { - background: transparent; - padding: 9px 0; - border: none; - border-radius: 0; - margin: 0 0 29px; -} -.fieldset .comment { - margin: 0 0 29px 10px; -} -.fieldset .field { - margin: 0 0 29px; -} -.with-note .note, -.field .note { - color: #676056; - font-size: 12px; - font-weight: 400; -} -.fieldset .field .options-list { - list-style: none; - margin: 0; - padding: 0; -} -.fieldset .field .options-list input[type="checkbox"], -.fieldset .field .options-list input[type="radio"] { - margin-right: 5px; -} -[class^="fields-group-"] .field { - margin-bottom: 0; -} -.fieldset-wrapper .fieldset:last-child, -.fieldset .fieldset:last-child, -.fieldset .field:last-child { - margin-bottom: 0; -} -.fieldset .label { - color: #676056; - font-size: 13px; - font-weight: 600; -} -.fieldset .control .label { - color: #676056; - font-size: 14px; - font-weight: 400; -} -.field.required > .label:after { - color: #e22626; - font-size: 13px; - font-weight: 400; -} -.with-addon .textarea { - margin: 0 0 6px; -} -.fieldset .control .textarea, -.fieldset .control .addon .textarea { - border-radius: 4px; - width: 100%; -} -.fieldset > .field > input[type="checkbox"] { - margin-top: 12px; -} -.fieldset-alt { - position: relative; - display: table-row; - border: 0; - padding: 0; - margin-bottom: 20px; - width: 100%; -} -.fieldset-alt > .field { - display: table-cell; - vertical-align: top; - padding-right: 4%; -} -.fieldset-alt > .field.no-display { - display: none; -} -.fieldset-alt .field > .label { - display: block; - width: 100%; - clear: both; - text-align: left; - margin: 0 0 10px; -} -.fieldset-alt .label + .control { - width: 100%; -} -.fieldset-alt .field-option-title { - width: 50%; -} -.fieldset .tooltip .help { - margin: 7px 0 0 15px; -} -.fieldset-alt .field-option-store-view { - width: 20%; -} -.fieldset-alt .field-option-input-type { - width: 20%; -} -.fieldset-alt .field-option-input-type select { - width: 100%; -} -.fieldset-alt .field-option-req { - width: 105px; - white-space: nowrap; -} -.fieldset-alt .field-option-req .control { - position: relative; - top: 32px; -} -.fieldset-alt .field-option-position, -.fieldset-alt .field-option-position .control { - width: 60px; -} -/* "Use default" checkbox */ -.use-default-control { - display: none; -} -.use-default-label { - cursor: pointer; - text-decoration: underline; - font-size: 11px; - color: #a29c94; -} -.use-default-label:hover { - color: #7e7e7e; -} -/* - Custom Multiselect --------------------------------------- */ -.multiselect-alt { - margin: 0; - padding: 0; - list-style: none; - border: 1px solid #ccc; - border-radius: 5px; - color: #333; -} -.multiselect-alt .item { - position: relative; - border-top: 1px solid #fff; - cursor: pointer; -} -.multiselect-alt .item:first-child { - border-top: 0; -} -.multiselect-alt .item.selected { - background: #d7ebf5; -} -.multiselect-alt .item.selected:hover { - background: #afdef2; -} -.multiselect-alt label { - display: block; - cursor: pointer; - padding: 6px 25px 5px; -} -.multiselect-alt .item.selected label:before { - position: absolute; - left: 8px; - top: 1px; - bottom: 0; - width: 10px; - line-height: 28px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e01e'; - /* checked icon */ - text-align: center; - color: #7ba4b1; - font-size: 9px; - text-shadow: 0 -1px 1px #60727b; -} -.multiselect-alt input[type="checkbox"] { - width: 0; - height: 0; - opacity: 0; - margin: 0; - padding: 0; -} -/* - Form item with table --------------------------------------- */ -.with-table .label { - float: none; - text-align: left; - width: 100%; -} -.with-table .control { - clear: left; - float: none; - width: 100%; -} -/* - Form currency label --------------------------------------- */ -.addon input { - border-width: 1px 0 1px 1px; -} -.addon input:focus ~ .addafter { - border-color: #75b9f0; - box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); -} -.addon input ~ .addafter strong { - display: inline-block; - background: #fff; - line-height: 24px; - margin: 0 3px 0 -2px; - padding-left: 4px; - padding-right: 4px; - position: relative; - font-size: 12px; - top: 0; -} -.addon input:focus ~ .addafter strong { - margin-top: 0; -} -.addon .addafter { - background: none; - color: #a6a6a6; - border-width: 1px 1px 1px 0; - border-radius: 4px 4px 0 0; - padding: 0; - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.075) inset; -} -.field .control input[type='text'][disabled], -.field .control input[type='text'][disabled] ~ .addafter, -.field .control select[disabled], -.field .control select[disabled] ~ .addafter { - background-color: #fff; - border-color: #eee; - box-shadow: none; - color: #999; -} -.field .control input[type='text'][disabled] ~ .addafter strong, -.field .control select[disabled] ~ .addafter strong { - background-color: #fff; -} -.field.type-price .addon, -.field-price .addon, -.field-special_price .addon, -.field-msrp .addon { - direction: rtl; -} -.field.type-price .addon > *, -.field-price .addon > *, -.field-special_price .addon > *, -.field-msrp .addon > * { - direction: ltr; -} -.field.type-price .addon .addafter, -.field-price .addon .addafter, -.field-special_price .addon .addafter, -.field-msrp .addon .addafter { - border-width: 1px 0 1px 1px; - border-radius: 4px 0 0 4px; -} -.field.type-price .addon input:first-child, -.field-price .addon input:first-child, -.field-special_price .addon input:first-child, -.field-msrp .addon input:first-child { - border-radius: 0 4px 4px 0; -} -.field.type-price input, -.field-price input, -.field-special_price input, -.field-msrp input { - border-width: 1px 1px 1px 0; - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.075) inset; -} -.field.type-price input:focus, -.field-price input:focus, -.field-special_price input:focus, -.field-msrp input:focus { - box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); -} -.field.type-price input:focus ~ label.addafter, -.field-price input:focus ~ label.addafter, -.field-special_price input:focus ~ label.addafter, -.field-msrp input:focus ~ label.addafter { - box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); -} -.field.type-price input ~ label.addafter strong, -.field-price input ~ label.addafter strong, -.field-special_price input ~ label.addafter strong, -.field-msrp input ~ label.addafter strong { - margin-left: 2px; - margin-right: -2px; -} -/* - Calendar --------------------------------------- */ -.ui-datepicker { - z-index: 998 !important; -} -.ui-datepicker .ui-datepicker-calendar td { - padding: 0; -} -.ui-datepicker .ui-datepicker-calendar th { - background: #efefef; - border: 1px solid #cfcfcf; - padding: 4px; - color: #676056; - font-weight: bold; -} -.ui-datepicker-calendar tbody tr td, -.ui-datepicker-calendar tbody tr:nth-child(2n+1) td { - background: #fff; -} -.ui-datepicker .ui-datepicker-prev span, -.ui-datepicker .ui-datepicker-next span { - margin-top: -1px; -} -/* - Details element --------------------------------------- */ -summary { - cursor: pointer; - display: inline-block; -} -.no-details details > * { - display: none; -} -.no-details details > summary:before { - float: left; - width: 20px; - content: '► '; -} -.no-details details.open > summary:before { - content: '▼ '; -} -.no-details details summary { - display: block; -} -/* - Blockquotes --------------------------------------- */ -blockquote { - border-left: 2px solid #ccc; - padding-left: 5px; -} -blockquote small:before { - content: '\2014 \00A0'; -} -/* - Addresses --------------------------------------- */ -address { - font-style: normal; -} -/* - Tables --------------------------------------- */ -table > caption { - margin-bottom: 5px; -} -table tfoot, -table th { - background: #e6e6e6; -} -table tfoot, -table thead { - background: #666158; - color: #cac3b4; -} -table thead.active { - /*background:#F37B21;*/ -} -table th { - text-align: left; - background: transparent; - font-weight: normal; -} -table th, -table td { - border: 1px solid #C0BBAF; - padding: 6px 10px 7px; -} -table tbody tr td { - background: #F5F2ED; - color: #676056; - padding-top: 12px; -} -table tbody tr:not(:last-child) td { - border-top: 1px solid transparent; - border-bottom: 1px solid transparent; -} -table .dropdown-menu li { - padding: 7px 15px; - line-height: 14px; - cursor: pointer; -} -table tbody tr td:first-child input[type="checkbox"] { - margin: 0; -} -table tbody tr:nth-child(odd) td, -table tbody tr:nth-child(odd) th { - background-color: #E6E3DE; -} -table tbody tr.selected td, -table tbody tr.selected th { - border: 1px solid #C0BBAF; -} -table tbody tr.selected td, -table tbody tr.selected th, -table tbody tr:hover td, -table tbody tr:hover th, -table tbody tr:nth-child(odd):hover td, -table tbody tr:nth-child(odd):hover th { - background-color: #fff; -} -/* - X-tree styles --------------------------------------- */ -.x-tree-node .leaf .x-tree-node-icon { - background-image: url(../images/fam_leaf.png); -} -.x-tree-node .system-leaf .x-tree-node-icon { - background-image: url(../images/fam_application_form_delete.png); -} -.x-tree-node-ct { - overflow: hidden; -} -/* - Styles for "js" tooltip with positionings --------------------------------------- */ -.tipsy { - padding: 11px; -} -.tipsy-inner { - padding: 12px 15px; - max-width: 185px; - background: #faf8f6; - border: 1px solid #dcd8ce; - box-shadow: 0 2px 5px rgba(49, 48, 43, 0.4); -} -.tipsy-inner .error { - width: 158px; -} -.tipsy-inner .error h5 { - color: #be0a0a; - font-size: 16px; - font-weight: 500; - margin: 0 0 6px 0; -} -.tipsy-inner .error p { - color: #676056; - line-height: 1.5; - margin: 0; -} -.tipsy-e .tipsy-arrow { - top: 50%; - left: 1px; - margin-top: -10px; - border-top: 10px solid transparent; - border-right: 10px solid #dcd8ce; - border-bottom: 10px solid transparent; - border-left: none; -} -.tipsy-w .tipsy-arrow { - top: 50%; - right: 0; - margin-top: -10px; - border-top: 10px solid transparent; - border-right: none; - border-bottom: 10px solid transparent; - border-left: 10px solid #dcd8ce; -} -.tipsy-n .tipsy-arrow, -.tipsy-ne .tipsy-arrow, -.tipsy-nw .tipsy-arrow { - bottom: 1px; - border-top: 10px solid #dcd8ce; - border-right: 10px solid transparent; - border-bottom: none; - border-left: 10px solid transparent; -} -.tipsy-ne .tipsy-arrow { - left: 16px; -} -.tipsy-nw .tipsy-arrow { - right: 16px; -} -.tipsy-s .tipsy-arrow, -.tipsy-se .tipsy-arrow, -.tipsy-sw .tipsy-arrow { - top: 1px; - border-left: 10px solid transparent; - border-right: 10px solid transparent; - border-bottom: 10px solid #dcd8ce; - border-top: none; -} -.tipsy-se .tipsy-arrow { - left: 16px; -} -.tipsy-sw .tipsy-arrow { - right: 16px; -} -.tipsy-arrow:after, -.tipsy-arrow:before { - position: absolute; - width: 0; - height: 0; - content: ''; -} -.tipsy-e .tipsy-arrow:after { - top: -5px; - left: 2px; - margin-top: -4px; - border-top: 9px solid transparent; - border-right: 9px solid #faf8f6; - border-bottom: 9px solid transparent; -} -.tipsy-e .tipsy-arrow:before { - top: -8px; - margin-top: 0; - border-top: 10px solid transparent; - border-right: 10px solid rgba(49, 48, 43, 0.1); - border-bottom: 10px solid transparent; -} -.tipsy-w .tipsy-arrow:after { - top: -5px; - left: -12px; - margin-top: -4px; - border-top: 9px solid transparent; - border-right: none; - border-bottom: 9px solid transparent; - border-left: 9px solid #faf8f6; -} -.tipsy-w .tipsy-arrow:before { - top: -8px; - left: -10px; - margin-top: 0; - border-top: 10px solid transparent; - border-right: none; - border-bottom: 10px solid transparent; - border-left: 10px solid rgba(49, 48, 43, 0.1); -} -.tipsy-n .tipsy-arrow:after, -.tipsy-ne .tipsy-arrow:after, -.tipsy-nw .tipsy-arrow:after { - margin-top: -4px; - left: -9px; - top: -7px; - border-top: 9px solid #faf8f6; - border-right: 9px solid transparent; - border-left: 9px solid transparent; -} -.tipsy-n .tipsy-arrow:before, -.tipsy-ne .tipsy-arrow:before, -.tipsy-nw .tipsy-arrow:before { - left: -10px; - top: -8px; - margin-top: 0; - border-top: 10px solid rgba(49, 48, 43, 0.1); - border-right: 10px solid transparent; - border-left: 10px solid transparent; -} -.tipsy-s .tipsy-arrow:after, -.tipsy-sw .tipsy-arrow:after, -.tipsy-se .tipsy-arrow:after { - left: -9px; - top: 6px; - margin-top: -4px; - border-top: none; - border-right: 9px solid transparent; - border-bottom: 9px solid #faf8f6; - border-left: 9px solid transparent; -} -.tipsy-inner dl { - margin: 0; -} -.tipsy-inner dt { - margin: 0 0 4px; - font-size: 16px; - font-weight: 400; - color: #f47b20; -} -.tipsy-inner dd { - margin: 0; - color: #676056; - font-size: 12px; - line-height: 18px; - font-family: Arial, Helvetica, sans-serif; -} -/* - Popups --------------------------------------- */ -.fade .popup { - padding: 0; - border: 5px solid #969288; - border-radius: 8px; -} -.wrapper-popup { - padding: 0 10px; -} -.fade .popup .popup-inner { - padding: 20px; - border-radius: 3px; -} -.fade .popup .popup-title { - margin: 0 0 10px; -} -.popup-loading { - position: fixed; - z-index: 1003; - width: 200px; - background: rgba(255, 255, 255, 0.8); - left: 50%; - top: 40%; - margin-left: -100px; - color: #d85909; - border-color: #d85909; - font-size: 14px; - font-weight: bold; - text-align: center; - padding: 100px 0 10px; -} -.popup-loading:after { - position: absolute; - left: 50%; - top: 40%; - background-image: url(../mui/images/ajax-loader-big.gif); - width: 64px; - height: 64px; - margin: -32px 0 0 -32px; - content: ''; - z-index: 2; -} -/* Loading mask */ -.loading-old, -.loading-mask { - background: rgba(255, 255, 255, 0.4); - z-index: 999; -} -.loading-old, -.loading-mask { - position: fixed; - left: 0; - top: 0; - right: 0; - bottom: 0; -} -.loading-old .loader, -.loading-mask .loader { - position: absolute; - margin: auto; - left: 0; - top: 0; - right: 0; - bottom: 0; - width: 160px; - height: 160px; - color: #5e5b56; - font-size: 14px; - font-weight: bold; - text-align: center; - background: #e5e2dd url(../mui/images/ajax-loader-big.gif) no-repeat 50% 30%; - border-radius: 5px; - opacity: .95; -} -.loading-mask img { - display: none; -} -.loading-old p, -.loading-mask p { - margin-top: 118px; -} -/* Backup popup */ -/* TODO: remove after backups page js refactoring */ -.backup-dialog { - margin-top: inherit !important; -} -/* - Global Navigation --------------------------------------- */ -.navigation { - position: relative; - border-bottom: 1px solid #aaa69c; - background: #726c62; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzcyNmM2MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2NTYwNTciIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #726c62 0%, #656057 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #726c62), color-stop(100%, #656057)); - background: -webkit-linear-gradient(top, #726c62 0%, #656057 100%); - background: -o-linear-gradient(top, #726c62 0%, #656057 100%); - background: -ms-linear-gradient(top, #726c62 0%, #656057 100%); - background: linear-gradient(to bottom, #726c62 0%, #656057 100%); - padding: 0 20px; -} -.navigation:before { - position: absolute; - left: 0; - top: 0; - right: 0; - height: 5px; - box-shadow: 0 2px 4px #46433d inset; - content: ''; - z-index: 991; -} -.navigation:after { - position: absolute; - left: 0; - bottom: 0; - right: 0; - height: 1px; - background: #4e483f; - content: ''; - z-index: 1; -} -.navigation .level-0.reverse > .submenu { - right: 1px; -} -.navigation > ul { - position: relative; - min-width: 960px; - max-width: 1300px; - margin: 0 auto; - text-align: right; - z-index: 900; -} -.navigation .level-0 > .submenu { - display: none; - position: absolute; - top: 100%; - padding: 19px 10px; -} -.navigation .level-0 > .submenu a { - display: block; - color: #007dbd; - font-size: 13px; - font-weight: 400; - line-height: 1.385; - padding: 5px 20px 4px; - text-decoration: none; - -webkit-transition: color 0.15s ease-out; - -moz-transition: color 0.15s ease-out; -} -.navigation .level-0 > .submenu a:focus, -.navigation .level-0 > .submenu a:hover { - text-decoration: underline; -} -.navigation .level-0 > .submenu li { - margin-bottom: 1px; -} -.navigation .level-0 > .submenu a[href="#"] { - cursor: default; - display: block; - color: #676056; - font-size: 14px; - font-weight: 600; - line-height: 1; - margin: 7px 0 6px; - padding: 0 20px; -} -.navigation .level-0 > .submenu a[href="#"]:focus, -.navigation .level-0 > .submenu a[href="#"]:hover { - text-decoration: none; -} -.navigation .level-0 { - display: inline-block; - float: left; - text-align: left; - -webkit-transition: display 0.15s ease-out; - -moz-transition: display 0.15s ease-out; -} -.navigation .level-0 > a { - background: none; - position: relative; - display: inline-block; - padding: 37px 21px 11px; - color: #f2ebde; - font-size: 13px; - font-weight: 400; - text-shadow: 0 1px 3px #222; - text-transform: uppercase; - text-decoration: none; - -webkit-transition: background 0.15s ease-out; - -moz-transition: background 0.15s ease-out; -} -.navigation .level-0.active > a { - background: #625d54; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIxJSIgc3RvcC1jb2xvcj0iIzYyNWQ1NCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM1NjUyNDkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #625d54 1%, #565249 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #625d54), color-stop(100%, #565249)); - background: -webkit-linear-gradient(top, #625d54 1%, #565249 100%); - background: -o-linear-gradient(top, #625d54 1%, #565249 100%); - background: -ms-linear-gradient(top, #625d54 1%, #565249 100%); - background: linear-gradient(to bottom, #625d54 1%, #565249 100%); -} -.navigation .level-0.hover.recent > a { - background: #fff; - color: #676056; - font-size: 13px; - font-weight: 400; - text-shadow: 0 1px 3px #c1bfbb; -} -.navigation .level-0 > a:focus { - outline: none; -} -.navigation .level-0 > .submenu { - opacity: 0; - visibility: hidden; -} -.navigation .level-0.recent.hover > .submenu { - opacity: 1; - visibility: visible; -} -.no-js .navigation .level-0:hover > .submenu, -.no-js .navigation .level-0.hover > .submenu, -.no-js .navigation .level-0 > a:focus + .submenu { - display: block; -} -.navigation .level-0 > a:before { - position: absolute; - left: 0; - right: 0; - top: 12px; - text-align: center; - height: 20px; - content: ''; - font-family: 'admin-icons'; - font-size: 18px; - speak: none; - font-weight: normal; - line-height: 1; - -webkit-font-smoothing: antialiased; - text-shadow: none; -} -.navigation .level-0.item-dashboard > a:before, -.navigation .level-0.item-hub > a:before { - content: '\e007'; - font-size: 17px; -} -.navigation .level-0.item-sales > a:before, -.navigation .level-0.item-sales-and-orders > a:before { - content: '\e008'; -} -.navigation .level-0.item-catalog > a:before { - content: '\e00b'; -} -.navigation .level-0.item-customer > a:before, -.navigation .level-0.item-customers > a:before { - content: '\e009'; - font-size: 24px; - top: 10px; -} -.navigation .level-0.item-promo > a:before, -.navigation .level-0.item-marketing > a:before { - content: '\e00a'; - font-size: 17px; - top: 13px; -} -.navigation .level-0.item-cms > a:before, -.navigation .level-0.item-content > a:before { - content: '\e006'; - font-size: 16px; -} -.navigation .level-0.item-report > a:before, -.navigation .level-0.item-reports > a:before { - content: '\e00c'; - font-size: 16px; - top: 13px; -} -.navigation .level-0.item-newsletter > a:before { - font-family: 'MUI-Icons'; - content: '\e03c'; - font-size: 22px; - top: 9px; -} -.navigation .level-0 > .submenu { - background: #fff; - box-shadow: 0 3px 3px rgba(49, 48, 43, 0.5); - border-radius: 0 0 5px 5px; -} -.no-boxshadow .navigation .level-0 > .submenu { - border: 1px solid #cbc1b4; - border-width: 0 1px 1px; - margin-left: -1px; -} -.navigation .level-0 > .submenu li { - max-width: 200px; -} -.navigation .level-0 > .submenu > ul { - white-space: nowrap; -} -.navigation .level-0 > .submenu .column { - display: inline-block; - vertical-align: top; -} -.navigation .level-0 .submenu .level-1 { - white-space: normal; -} -.navigation .level-0.parent .submenu .level-1.parent { - margin: 17px 0; -} -.navigation .level-0.parent .level-1.parent:first-child { - margin-top: 0; -} -.navigation .level-2 .submenu { - margin-left: 7px; -} -.navigation .level-0 > .submenu .level-2 > a[href="#"] { - font-size: 13px; - margin-top: 10px; - margin-left: 7px; -} -.navigation .level-2 > .submenu a { - font-size: 12px; - line-height: 1.231; -} -.navigation .level-0 > .submenu .level-3 > a[href="#"], -.navigation .level-3 .submenu { - margin-left: 15px; -} -/* - Admin and Store Settings --------------------------------------- */ -.navigation .level-0.item-system, -.navigation .level-0.item-stores { - float: none; - margin: 21px 0 0; -} -.navigation .level-0.item-system > .submenu, -.navigation .level-0.item-stores > .submenu { - left: auto; - right: 1px; -} -.navigation .level-0.item-system.hover:after, -.navigation .level-0.item-stores.hover:after { - color: #c2b59c; -} -.navigation .level-0.item-system > a, -.navigation .level-0.item-stores > a { - position: relative; - padding: 0; -} -.navigation .level-0.item-system:hover > a, -.navigation .level-0.item-system.hover > a, -.navigation .level-0.item-stores:hover > a, -.navigation .level-0.item-stores.hover > a { - background: transparent; -} -.no-js .navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system.hover > a:before, -.no-js .navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores.hover > a:before { - display: none; - position: absolute; - top: 1.4em; - left: auto; - right: -19px; - height: 20px; - width: 20px; - content: ''; - border: 10px solid #fff; - border-width: 0 0 10px 10px; - border-radius: 0 0 0 20px; - z-index: 2; -} -.navigation .level-0.item-system > a:after, -.navigation .level-0.item-stores > a:after { - display: none; - position: absolute; - top: 2em; - left: -20px; - margin-top: -1px; - width: 20px; - height: 20px; - content: ''; - border: 10px solid #fff; - border-width: 0 10px 10px 0; - border-radius: 0 0 20px; - z-index: 1; -} -.no-js .navigation .level-0.item-system:hover > a:after, -.navigation .level-0.item-system.hover > a:after, -.no-js .navigation .level-0.item-system:hover > a:before, -.navigation .level-0.item-system.hover > a:before, -.no-js .navigation .level-0.item-stores:hover > a:after, -.navigation .level-0.item-stores.hover > a:after, -.no-js .navigation .level-0.item-stores:hover > a:before, -.navigation .level-0.item-stores.hover > a:before { - display: block; -} -.no-js .navigation .level-0.last:hover > a:before, -.navigation .level-0.last.hover > a:before { - display: none; -} -.navigation .level-0.item-system > a span, -.navigation .level-0.item-stores > a span { - display: block; - position: relative; - padding: 4px 20px 5px 10px; - border: 1px solid #4c483f; - border-left: 0; - font: 12px/1.333 "Helvetica", Arial, serif; - text-transform: none; - text-shadow: none; - background: #58534a; - color: #f2ebde; - height: 1.333em; -} -.navigation .level-0.item-system:hover > a span, -.navigation .level-0.item-stores:hover > a span { - background: #31302B; -} -.navigation .level-0.item-system:hover > a span:after, -.navigation .level-0.item-stores:hover > a span:after { - color: #58534a; -} -.no-js .navigation .level-0.item-system:hover > a span, -.navigation .level-0.item-system.hover > a span, -.no-js .navigation .level-0.item-stores:hover > a span, -.navigation .level-0.item-stores.hover > a span { - background: #fff; - color: #676056; - text-shadow: none; - border-bottom: 0; - border-right: 0; - padding-right: 21px; - padding-bottom: 2em; - margin-bottom: -2em; -} -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span { - background: #fff; - color: #676056; - text-shadow: none; - border-bottom: 0; - border-right: 0; - padding-right: 21px; - padding-bottom: 2em; - margin-bottom: -2em; -} -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span { - border-right: 1px solid; - padding-right: 20px; -} -.navigation .level-0.item-system > a span:after, -.navigation .level-0.item-stores > a span:after { - position: absolute; - top: 7px; - right: 7px; - width: 10px; - height: 10px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: "\e02c"; - font-size: 8px; - text-align: center; - color: #31302b; - z-index: 2; -} -.navigation .level-0.item-stores > a span:before { - position: absolute; - left: -22px; - top: -1px; - bottom: -1px; - height: 1.333em; - padding: 0 0 9px; - width: 21px; - border: 1px solid #4c483f; - border-right: 0; - border-radius: 5px 0 0 5px; - font-family: 'MUI-Icons'; - font-style: normal; - font-size: 12px; - line-height: 2; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e07e'; - text-align: center; - color: #31302b; -} -.navigation .level-0.last > a, -.navigation .level-0.last > a span { - border-radius: 0 5px 5px 0; -} -.no-js .navigation .level-0.last:hover > a span, -.navigation .level-0.last.hover > a span, -.navigation .level-0.last > a:focus span { - border-radius: 0; -} -/* - Login page --------------------------------------- */ -.page-login { - height: 100%; -} -.page-login .wrapper { - min-height: 100%; - padding: 0; -} -.page-login .wrapper-inner { - overflow: auto; - padding-bottom: 140px; -} -.page-login .footer { - clear: both; - height: 140px; - margin-top: -140px; - position: relative; -} -.page-login .footer-content { - max-width: none; - min-width: 0; -} -.page-login .footer-copyright { - text-align: right; -} -.page-login .form-login { - width: 280px; - margin: 160px auto 60px; - padding: 30px 25px; - border: 1px solid #e3ded5; - border-radius: 5px; - background: #f7f2ec; -} -.page-login .fieldset { - background: transparent; - border: 0; - border-radius: 0; - margin: 0; - padding: 0; -} -.page-login .fieldset > .legend { - border-bottom: 0; - margin-bottom: 15px; -} -.page-login .fieldset > .legend span { - font-size: 32px; - line-height: 32px; - padding: 0; - color: #8a847c; - display: inline; -} -.page-login .fieldset .field { - margin: 0 0 13px; -} -.page-login .form-inline .label { - width: auto; - padding: 0; - margin-bottom: 13px; -} -.page-login .field-username label, -.page-login .field-password label, -.page-login .field-confirmation label { - display: none; -} -.page-login .form-inline .label + .control { - width: auto; - float: none; -} -.page-login .header { - margin-bottom: 30px; - background: transparent; - padding: 0; - z-index: auto; - position: static; -} -.page-login .header .logo { - display: block; - width: 262px; - height: 64px; - text-indent: -999em; - background: url(Magento_Backend::images/logo-magento.png) no-repeat; -} -.page-login .form-actions { - padding: 0; - margin: 0; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.page-login .actions, -.page-login .links { - display: inline-block; - vertical-align: middle; -} -.page-login input[type=text], -.page-login input[type=password] { - border-color: #cac3b4; - font-size: 18px; - padding: 12px 12px 14px; - height: auto; -} -.page-login :-ms-input-placeholder { - color: #bebab1 !important; -} -.page-login ::-webkit-input-placeholder { - color: #bebab1 !important; -} -.page-login :-moz-placeholder { - color: #bebab1 !important; -} -.page-login .action-login, -.page-login .action-retrieve { - font-size: 22px; - padding: 14px 22px 16px; -} -.page-login .action-retrieve, -.page-login .action-reset { - font-size: 18px; - padding: 10px 17px 10px; -} -.page-login .action-forgotpassword, -.page-login .action-back { - font-size: 12px; - color: #1c8bb8; - text-decoration: underline; - position: absolute; - left: 0; - bottom: -70px; -} -.page-login .action-forgotpassword:hover, -.page-login .action-back:hover { - text-decoration: none; -} -/* - Page title --------------------------------------- */ -.page-title { - position: relative; - margin: 20px 0; -} -.page-content > .page-title { - max-width: 1300px; - min-width: 960px; - margin-left: auto; - margin-right: auto; -} -.page-title-inner > .title { - color: #676056; - font-size: 28px; - font-weight: 400; - display: inline-block; - margin: 0; - width: 100%; - word-wrap: break-word; -} -.page-title-inner .title > h3 { - margin: 0; -} -.page-title-inner .actions { - float: right; -} -.page-title-inner .actions form { - display: inline-block; -} -/* - Messages (Global) --------------------------------------- */ -.wrapper > .message { - padding: 0 20px; -} -.page-content > #messages { - max-width: 1300px; - min-width: 960px; - margin: 0 auto; -} -.messages { - margin: 20px 0; -} -.messages > .message:last-child { - margin-bottom: 0; -} -.messages.license { - font-size: 20px; - line-height: 1.2; - margin: 20px auto; - max-width: 1300px; - min-width: 960px; - padding: 0 20px; -} -.message { - background: #f9f5ec; - border-bottom: 1px solid #c7c2b6; - border-radius: 5px; - color: #676056; - margin: 20px 0; - padding: 10px 26px 10px 35px; - position: relative; - text-shadow: none; -} -.message:before { - position: absolute; - left: 11px; - top: 50%; - margin-top: -11px; - background: none; - text-shadow: none; - width: auto; - height: auto; - border: 0; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - font-size: 16px; - line-height: inherit; - content: '\e046'; - /* icon-info */ - color: #d87e34; -} -.message.error { - color: #963535; - border-color: #963535; - background: #f3dcd8; -} -.message.error:before { - content: '\e069'; - color: #963535; -} -.message.success { - border-color: #ceceb6; - background: #e4eecb; - color: #185b00; -} -.message.success:before { - content: '\e067'; - color: #185b00; -} -.messages-inbox { - float: right; -} -.messages-inbox .critical { - color: red; -} -/* System Messages */ -.message-system { - padding: 0; -} -.message-system:before { - display: none; -} -.message-system .message-inner { - position: relative; - min-width: 960px; - max-width: 1300px; - margin: 0 auto; -} -.message-system .message-inner:before { - background: none; - border: 0; - content: '\e006'; - /* notification icon */ - color: #6e685e; - font-family: 'MUI-Icons'; - font-style: normal; - font-weight: normal; - speak: none; - -webkit-font-smoothing: antialiased; - height: auto; - left: 8px; - margin-top: -10px; - position: absolute; - text-shadow: none; - top: 50%; - width: auto; - font-size: 16px; -} -.message-system .message-content { - padding: 10px 26px 10px 32px; -} -/* - No-javaScript-Enabled message --------------------------------------- */ -.message-noscript { - background: #ff9; - padding: 0; - border: 0; - box-shadow: 0 1px 2px #46433d; - z-index: 994; -} -.message-noscript:before { - content: ''; -} -.message-noscript .message-content { - margin: 0 auto; - max-width: 1300px; - min-width: 960px; - padding: 3px 0; - position: relative; - text-align: center; -} -.message-noscript .message-content:before { - position: relative; - background: none; - text-shadow: none; - width: auto; - height: auto; - vertical-align: middle; - border: 0; - font-family: 'MUI-Icons'; - font-style: normal; - font-weight: normal; - font-size: 32px; - speak: none; - -webkit-font-smoothing: antialiased; - content: '\e006'; - /* notification icon */ - color: #6e685e; -} -.message-demo-mode { - background: #d75f07; - border: 0; - color: #fff; - text-align: center; - padding: 5px 0; - box-shadow: 0 1px 2px #46433d; - z-index: 993; -} -.message-demo-mode:before { - content: ''; -} -.message-demo-mode .message-content { - margin: 0 auto; - max-width: 1300px; - min-width: 960px; - position: relative; - text-align: center; -} -.message-demo-mode .message-content:before { - position: relative; - background: none; - text-shadow: none; - width: auto; - height: auto; - vertical-align: middle; - border: 0; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - font-size: 16px; - content: '\e006'; - /* notification icon */ -} -/* - Information message --------------------------------------- */ -.message-info, -.message.info { - background: #fffbf0; - border: 1px solid #d87e34; - margin-bottom: 20px; -} -.message-info:before, -.message.info:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e046'; - /* icon-info */ - color: #d87e34; -} -/* - Error message --------------------------------------- */ -.message-error, -.message.error { - color: #963535; - background: #f3dcd8; - border: 1px solid #963535; - margin-bottom: 20px; -} -.message-error:before, -.message.error:before { - content: '\e069'; - color: #963535; -} -/* - Store Switcher --------------------------------------- */ -.store-switcher-alt { - position: relative; - display: inline-block; -} -.store-switcher-alt .dropdown-menu { - white-space: nowrap; - margin-top: 2px; -} -.store-switcher-alt.active .dropdown-menu { - display: block; -} -.store-switcher-alt .dropdown-menu ul { - margin: 0; - padding: 0; - list-style: none; -} -.store-switcher-alt strong { - display: block; - font-size: 14px; - font-weight: 500; - line-height: 1.333; - color: #a6a098; - padding: 5px 10px; -} -.store-switcher-alt .store-selected { - font-size: 12px; - font-weight: 400; - line-height: 1.333; - color: #676056; - cursor: pointer; -} -.store-switcher-alt .store-selected:after { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02c'; - /* arrow down icon */ - color: #b3b0ad; - margin: 0 0 0 3px; - vertical-align: text-top; -} -.store-switcher-alt .store-switcher-website, -.store-switcher-alt .store-switcher-store { - padding: 0; -} -.store-switcher-alt .store-switcher-website:hover, -.store-switcher-alt .store-switcher-store:hover { - background: none; -} -.store-switcher-website { - margin: 5px 0 0; -} -.store-switcher-website > strong { - padding-left: 13px; -} -.store-switcher-store { - margin: 1px 0 0; -} -.store-switcher-store > strong { - padding-left: 20px; -} -.store-switcher-alt .store-switcher-store > ul { - margin-top: 1px; -} -.store-switcher-alt .store-switcher-store-view { - padding: 0; -} -.store-switcher-store-view:first-child { - border-top: 1px solid #e5e5e5; -} -.store-switcher-store-view > a { - display: block; - padding: 5px 15px 5px 24px; - color: #333; - font-size: 13px; - text-decoration: none; -} -.store-switcher-alt .store-switcher-all, -.store-switcher-alt .manage-stores { - padding: 0; -} -.store-switcher-alt .store-switcher-all > a, -.store-switcher-alt .manage-stores > a { - display: block; - padding: 8px 15px; - color: #676056; - text-decoration: none; - font-size: 12px; -} -/* - Page Structure --------------------------------------- */ -.wrapper { - padding: 0 0 60px; - min-width: 1000px; -} -.page-content { - margin: 0 auto; - padding: 0 20px; -} -.page-title.complex .title { - float: left; - width: 70%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.page-title.complex .store-switcher-alt { - float: right; - margin: 12px 0 0; -} -.side-col { - position: relative; - width: 20%; -} -.main-col { - position: relative; - width: 80%; - padding: 0 20px 20px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; -} -.col-left { - float: left; -} -.col-right { - float: right; -} -.col-1-layout .main-col { - width: auto; -} -.col-2-left-layout .main-col, -.col-2-right-layout .side-col { - float: right; -} -.col-2-right-layout .main-col, -.col-2-left-layout .side-col { - float: left; -} -.col-2-left-layout, -.col-1-layout { - position: relative; - background: #f5f2ed; - border: 1px solid #d5d0ca; - border-radius: 5px; - min-width: 960px; - max-width: 1300px; - margin: 0 auto; -} -.col-1-layout { - padding: 20px; - min-width: 920px; - max-width: 1260px; -} -.col-2-left-layout:before { - position: absolute; - display: block; - left: 20%; - top: 0; - bottom: 0; - width: 6px; - margin-left: -7px; - content: ''; - background: -moz-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); - /* FF3.6+ */ - background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(0, 0, 0, 0)), color-stop(100%, rgba(0, 0, 0, 0.06))); - /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); - /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); - /* Opera 11.10+ */ - background: -ms-linear-gradient(left, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); - /* IE10+ */ - background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.06) 100%); - /* W3C */ - z-index: 2; -} -/* Sidebar and main column vertical separator */ -.main-col:after, -.side-col:after { - position: absolute; - top: 0; - bottom: 0; - width: 1px; - background: #ded9d3; - content: ''; -} -.col-2-left-layout .side-col:after { - right: 0; -} -.col-2-right-layout .side-col:after { - left: 0; -} -.col-2-right-layout .main-col:after { - right: -1px; -} -.col-2-left-layout .main-col:after { - left: -1px; -} -.col-2-left-layout .main-col, -.col-2-right-layout .main-col { - min-width: 730px; -} -/* Sidebar title and store view switcher*/ -/* TODO: temporary styles */ -.side-col h3 { - padding: 0 17px; - margin-top: 16px; -} -.field-store-switcher { - padding: 0 0 20px; - margin: 0; -} -.side-col .ui-tabs h3 { - margin-bottom: 5px; - color: #524c44; - text-shadow: 0 1px 0 #fff; -} -.side-col > .store-switcher { - padding-top: 6px; -} -.field-store-switcher, -.field-store-switcher > .label + .control { - display: inline-block; -} -.field-store-switcher > .tooltip + div > a { - color: #007dbd; - font-size: 12px; - font-weight: 400; -} -.field-store-switcher > .tooltip + div > a:focus, -.field-store-switcher > .tooltip + div > a:hover { - text-decoration: underline; -} -.field-store-switcher > .label { - margin: 0; -} -.side-col > .field-store-switcher { - padding: 19px 18px 0; -} -.side-col > .field-store-switcher > .label { - margin: 0 0 6px; - display: block; -} -.dashboard-container .field-store-switcher { - padding: 20px 0; -} -.toolbar .field-store-switcher { - padding: 0; - margin-right: 20px; -} -/* - Universal Sidebar Tabs --------------------------------------- */ -.side-col .ui-tabs .ui-accordion-header { - position: relative; - margin: 10px 0 0; - padding: 5px 20px; - cursor: pointer; - color: #524c44; - text-shadow: 0 1px 0 #fff; -} -.side-col .ui-tabs .ui-accordion-header:focus { - outline: none; -} -.side-col .ui-accordion-header:before { - position: absolute; - left: 4px; - top: 7px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02a'; - /* arrow right icon */ - font-size: 14px; - color: #ada79e; -} -.side-col .ui-accordion-header:hover:before { - color: #777; -} -.side-col .ui-accordion-header-active:before { - content: '\e02c'; - /* arrow down icon */ -} -.side-col .tabs { - margin: 0 0 30px; - padding: 0; - list-style: none; - font-weight: 500; -} -.side-col > .ui-tabs > .tabs:first-child > li:first-child > a { - border-top-left-radius: 5px; -} -.side-col .tabs > li { - border-bottom: 1px solid #e5e1db; -} -.side-col .tabs > li:first-child { - border-top: 1px solid #e5e1db; -} -.side-col .tabs > li a { - position: relative; - display: block; - padding: 8px 18px; - text-decoration: none; - color: #676056; - -webkit-transition: background 0.3s ease-in-out; - -moz-transition: background 0.3s ease-in-out; - transition: background 0.3s ease-in-out; -} -.side-col .tabs > li a:active, -.side-col .tabs > li a:focus { - outline: none; -} -.side-col .tabs > li a:hover { - background: #fff; -} -.side-col .tabs > .ui-state-active a { - border-left: 3px solid #d87e34; - padding-left: 15px; - background: #dedcd8; - box-shadow: 0 1px 2px #ccc inset; -} -.side-col .tabs > .ui-state-active a:after, -.side-col .tabs > .ui-state-active a:before { - position: absolute; - top: 50%; - right: 0; - width: 14px; - margin-top: -14px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02b'; - /* left turned triangle icon */ - font-size: 22px; - color: #f5f2ed; - overflow: hidden; - z-index: 4; -} -.side-col .tabs > .ui-state-active a:before { - color: #bdbbb7; - margin-top: -13px; - z-index: 3; -} -.side-col .tabs span.error, -.side-col .tabs span.loader { - display: none; - position: absolute; - right: 12px; - top: 7px; - width: 16px; - height: 16px; - font-size: 16px; -} -.side-col .tab-item-link.changed { - font-style: italic; -} -.side-col .tab-item-link.error span.error, -.side-col .ui-tabs-loading span.loader { - display: block; -} -.side-col .tab-item-link.error span.error:after { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e006'; - /* warning icon */ - color: #d87e34; -} -.side-col .ui-tabs-loading span.loader:after { - background: url(../mui/images/ajax-loader-small.gif) no-repeat 50% 50%; - display: block; - content: ''; - width: 16px; - height: 16px; -} -/* TODO: styles for navigation on System > Configuration page */ -/* - Horizontal Tabs --------------------------------------- */ -.tabs-horiz { - list-style: none; - margin: 0; - padding: 3px 0 0; -} -.tabs-horiz > li { - float: left; - border: 1px solid #e9e4db; - border-bottom-width: 0; - margin: 0 -1px 0 0; -} -.tabs-horiz > li a { - position: relative; - display: block; - padding: 7px 18px 9px; - text-decoration: none; - font-size: 12px; - line-height: 1.666; - color: #676056; -} -.tabs-horiz > .ui-state-active a { - background: #fff; - border-top: 3px solid #f3771e; - margin-top: -3px; - box-shadow: 1px 0 3px #e9e4db; -} -/* - System -> Configuration page navigation in sidebar --------------------------------------- */ -.config-nav, -.config-nav .items { - margin: 0; - padding: 0; - list-style: none; -} -.config-nav-block:last-child { - margin-bottom: 30px; -} -.config-nav .item { - border-top: 1px solid #E5E1DB; -} -.config-nav .item:first-child { - border-top: 0; -} -.config-nav .title { - margin-bottom: 0; - text-transform: uppercase; - color: #444; - border: solid #CCC; - border-width: 1px 0; - opacity: .8; - padding: 7px 17px; - background: #E6E3DE; -} -.config-nav .item-nav { - display: block; - padding: 8px 18px; - text-decoration: none; - color: #676056; - -webkit-transition: background 0.3s ease-in-out; - -moz-transition: background 0.3s ease-in-out; - transition: background 0.3s ease-in-out; -} -.config-nav .item-nav:hover { - background: #fff; -} -.config-nav .item-nav.active { - position: relative; - border-left: 3px solid #d87e34; - padding-left: 15px; - background: #dedcd8; - box-shadow: 0 1px 2px #ccc inset; -} -.config-nav .item-nav.active:after { - position: absolute; - top: 50%; - right: 0; - width: 14px; - margin-top: -14px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e02b'; - /* left turned triangle icon */ - font-size: 22px; - text-shadow: -1px 1px 0 #bdbbb7; - color: #f5f2ed; - overflow: hidden; - z-index: 3; -} -/* - Footer --------------------------------------- */ -.footer { - position: absolute; - left: 0; - right: 0; - bottom: 0; - color: #989288; - font-size: 11px; -} -.footer-content { - margin: 0 auto; - max-width: 1300px; - min-width: 960px; - padding: 20px; -} -/* - Switcher --------------------------------------- */ -.switcher { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - cursor: pointer; - display: inline-block; - overflow: hidden; -} -.switcher input[type="checkbox"] { - position: absolute; - left: -999em; -} -.switcher-label { - color: #676056; - font-size: 13px; - font-weight: 600; - text-transform: uppercase; -} -.switcher-label:before { - content: attr(data-text-off); -} -.switcher-label:after { - display: inline-block; - margin-left: 10px; - vertical-align: bottom; - width: 34px; - height: 17px; - background: url(../images/switcher.png) no-repeat; - content: ''; -} -.switcher input[type="checkbox"]:focus + .switcher-label:after { - border-color: #75b9f0; -} -.switcher input[type="checkbox"]:checked + .switcher-label:after { - background-position: -34px 0; -} -.switcher input[type="checkbox"]:checked + .switcher-label:before { - content: attr(data-text-on); -} -/* - Content actions panel (with buttons, switchers...) --------------------------------------- */ -.page-actions { - padding: 0 0 20px; - text-align: right; -} -.page-actions .buttons-group { - vertical-align: top; - text-align: left; -} -.page-actions > .switcher { - display: inline-block; - vertical-align: top; - margin: 6px 10px 0 0; -} -.main-col .page-actions { - padding: 20px 0; -} -.page-actions .store-switcher { - float: left; -} -.catalog-product-index .page-actions { - padding-top: 0; -} -/* TODO: refactor trees */ -.x-tree ul { - margin: 0; - padding: 0; -} -.page-actions.fixed { - padding: 0 21px; - position: fixed; - top: 0; - left: 0; - right: 0; - z-index: 998; -} -.page-actions.fixed .page-actions-inner { - background: -moz-linear-gradient(top, #f5f2ed 0%, #f5f2ed 56%, rgba(245, 242, 237, 0) 100%); - /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f2ed), color-stop(56%, #f5f2ed), color-stop(100%, rgba(245, 242, 237, 0))); - /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #f5f2ed 0%, #f5f2ed 56%, rgba(245, 242, 237, 0) 100%); - /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #f5f2ed 0%, #f5f2ed 56%, rgba(245, 242, 237, 0) 100%); - /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #f5f2ed 0%, #f5f2ed 56%, rgba(245, 242, 237, 0) 100%); - /* IE10+ */ - background: linear-gradient(to bottom, #f5f2ed 0%, #f5f2ed 56%, rgba(245, 242, 237, 0) 100%); - /* W3C */ - padding: 11px 20px 11px; - min-height: 36px; - margin: 0 auto; - min-width: 916px; - max-width: 1259px; -} -.lt-ie10 .page-actions.fixed .page-actions-inner { - background: #f5f2ed; -} -.page-actions.fixed .page-actions-inner:before { - content: attr(data-title); - float: left; - font-size: 20px; - max-width: 50%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -/* - Table Grid --------------------------------------- */ -/* Grid - General */ -.grid-container { - margin-bottom: 10px; -} -.grid { - border-bottom: 0; - color: #676056; - font-size: 13px; - font-weight: 400; - padding-bottom: .5em; -} -.grid table { - border-collapse: collapse; - border: none; - width: 100%; -} -.grid table.border { - border: 1px solid #c0bbaf; -} -.grid tbody { - background: #e6e3de; -} -.grid tr.even, -.grid tr.even tr { - background: #f5f2ed; -} -.grid tr.on-mouse { - cursor: pointer; -} -.grid tr.on-mouse td, -.grid table tbody tr.on-mouse:hover td, -.grid table tbody tr.on-mouse:hover th, -.grid table tbody tr.on-mouse:nth-child(odd):hover td, -.grid table tbody tr.on-mouse:nth-child(odd):hover th { - background-color: #fff; -} -/* Rows mouse-over */ -.grid tr.invalid { - background-color: #f5d6c7; -} -.grid th, -.grid td { - padding: 2px 4px 2px 4px; - vertical-align: top; -} -.grid th { - border: none; -} -.grid td.editable input.input-text { - width: 50px; - margin-left: 4px; -} -.grid td input.input-text { - width: 86%; -} -.grid td input.input-inactive { - background: #eee; -} -.grid table td { - border: solid #c0bbaf; - border-width: 0 1px 1px; - padding: 5px; -} -.grid table.border td { - background: #fff; -} -.grid table td.product { - text-align: right; -} -.grid table td.empty-text { - border: solid #c0bbaf; - border-width: 0 1px; - color: #676056; - font-size: 16px; - font-weight: 400; - text-align: center; - padding: 15px; -} -.grid table tr:last-child td.empty-text { - border-width: 0 1px 1px; -} -.grid table td.empty-text:hover { - background: #e6e3de; -} -.grid table td .action-select { - width: 100%; -} -.grid tbody.odd tr { - background: #fff; -} -.grid tbody.even tr { - background: #f6f6f6; -} -.grid tbody.odd tr td, -.grid tbody.even tr td { - border-bottom: 0; -} -.grid tbody.odd tr.border td, -.grid tbody.even tr.border td { - border-bottom: 1px solid #dadfe0; -} -/* - Grid - Pager and Buttons row --------------------------------------- */ -.grid-actions { - border: 1px solid #c0bbaf; - border-bottom: 0; - background: #f6f3ec; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y2ZjNlYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVhZTEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f6f3ec), color-stop(100%, #edeae1)); - background: -webkit-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -o-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -ms-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: linear-gradient(to bottom, #f6f3ec 0%, #edeae1 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f6f3ec', endColorstr='#edeae1', GradientType=0); - padding: 7px 8px 8px; - position: relative; -} -[id$='Grid'] .separator { - padding: 0 4px; - color: #b9b9b9; -} -.grid-actions select { - margin: 0 5px; -} -.grid-actions .export, -.grid-actions .filter-actions { - float: right; - margin-left: 30px; -} -.grid-actions .filter-actions button { - float: left; - margin-left: 4px; -} -.grid-actions .pager { - color: #676056; - font-size: 13px; - font-weight: 400; -} -.grid-actions .pager select { - width: 5em; - margin: 0 4px; -} -.grid-actions .pager input.page { - width: 2em; -} -.pager .action-next, -.pager .action-previous { - display: inline-block; - position: relative; - text-indent: 100%; - overflow: hidden; - height: 16px; - width: 16px; - vertical-align: middle; - text-decoration: none; -} -.pager .action-next:after, -.pager .action-previous:after { - font-family: 'MUI-Icons'; - content: "\e02a"; - font-size: 16px; - color: #333; - position: absolute; - top: 0; - left: 0; - line-height: 1; - text-indent: 0; -} -.pager .action-previous:after { - content: "\e02b"; -} -.pager span.action-next:after, -.pager span.action-previous:after { - color: #7f7f7f; -} -.grid-actions .date { - float: left; - margin: 0 15px 0 0; - position: relative; -} -.grid-actions .date input { - margin: 0 5px; - width: 80px; -} -.grid-actions .required:after { - content: '*'; - color: #f00; -} -[class^=" reports-report-"] .grid-actions .required:after { - content: ''; -} -[class^=" reports-report-"] .grid-actions .required .label span:after { - content: '*'; - color: #f00; -} -.grid-actions img { - vertical-align: middle; - height: 22px; - width: 22px; -} -.grid-actions .pager img { - width: auto; - height: auto; -} -.grid-actions .validation-advice { - background: #f3dcd8; - border: 1px solid #963535; - border-radius: 3px; - color: #963535; - margin: 5px 0 0; - padding: 3px 7px; - position: absolute; - white-space: nowrap; - z-index: 5; -} -.grid-actions .validation-advice:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - content: '\e029'; - /* user icon */ - position: absolute; - top: -12px; - left: 50%; - margin-left: -3px; -} -.grid-actions .link-feed { - white-space: nowrap; -} -.grid-actions input[type="text"].validation-failed { - border-color: #fa7973; - box-shadow: 0 0 8px rgba(250, 121, 115, 0.6); -} -/* - Grid - Headings --------------------------------------- */ -.grid tr.headings th { - color: #ffffff; - font-size: 13px; - font-weight: 700; - border-right: 1px solid #837f79; - padding: 0; - vertical-align: bottom; -} -.grid tr th:first-child { - border-left: 1px solid #837f79; -} -.grid tr.headings th > span { - display: block; - border-bottom: 2px solid transparent; - padding: 5px 5px 2px; - white-space: nowrap; -} -.grid tr.headings th:hover > span { - border-color: #504841; -} -.grid tr.headings th.no-link:hover > span, -.grid tr.headings th.col-select:hover > span { - border-color: transparent; -} -.grid tr.headings th a label { - display: block; - padding-right: 20px; -} -.grid tr.headings th a { - display: block; - color: #ffffff; - font-size: 13px; - font-weight: 700; - position: relative; - text-decoration: none; -} -.grid tr.headings th a:after { - display: none; - height: 8px; - width: 15px; - position: absolute; - bottom: 4px; - right: 0; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - font-size: 20px; - line-height: 8px; - -webkit-font-smoothing: antialiased; - content: '\e038'; - /* arrow down icon */ - color: #8c8172; -} -.grid tr.headings th a:hover:after { - display: block; -} -.grid tr.headings th a.sort-arrow-desc:after { - color: #c7b299; - display: block; -} -.grid tr.headings th a.sort-arrow-asc:after { - color: #c7b299; - content: '\e035'; - /* arrow up icon */ - display: block; -} -.grid tr.headings th a.sort-arrow-desc:hover:after, -.grid tr.headings th a.sort-arrow-asc:hover:after { - color: #fff; -} -/* Grid - Filter */ -.grid .filter { - cursor: default; -} -.grid .filter th { - padding: 5px; - border-right: 1px solid #837F79; - vertical-align: top; - white-space: normal; -} -.grid .filter input.input-text { - background: #5e5a52; - border-radius: 2px; - border: none; - color: #bcb795; - padding: 0 5px; - height: 20px; - width: 99%; -} -.grid .filter input.input-text::-webkit-input-placeholder { - color: #858376 !important; - text-transform: lowercase; -} -.grid .filter input.input-text:-moz-placeholder { - color: #858376 !important; - text-transform: lowercase; -} -.grid .filter input.input-text::-moz-placeholder { - color: #858376 !important; - text-transform: lowercase; -} -:-ms-input-placeholder { - color: #858376 !important; - text-transform: lowercase; -} -.grid .filter select { - background: #5e5a52; - border-radius: 2px; - border: none; - color: #bcb795; - margin: 0; - padding: 0; - height: 20px; - width: 99%; -} -.grid td select { - font-family: Arial, Helvetica, sans-serif; - font-size: 13px; - padding: 4px 4px 5px; - text-align: left; -} -.grid .action-select { - background: #fff; - border: 1px solid #ccc; - margin: 0; -} -.grid .filter .range .range-line { - margin-bottom: 3px; -} -.grid .filter .range div.date { - min-width: 121px; -} -.grid .filter .range .date input { - margin-top: 0; - vertical-align: middle; - width: 80%; -} -.grid .filter .range select { - margin: 0; - color: #676056; - font-size: 11px; - font-weight: 400; - color: #bcb795; -} -.grid .filter .date { - position: relative; -} -.grid .filter .date img { - width: 15px; - height: 15px; - cursor: pointer; - vertical-align: middle; - margin-left: 5px; - position: relative; - z-index: 2; - opacity: 0; -} -.grid .filter .date:before { - position: absolute; - left: 80%; - top: 1px; - margin-left: 5px; - text-shadow: none; - width: 16px; - height: 16px; - line-height: 16px; - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - font-size: 16px; - content: '\e06a'; - /* icon calendar */ - color: #cac3b4; - z-index: 1; -} -.grid .head-massaction select { - width: 50px; -} -/* Grid - Mass Action */ -.massaction { - color: #cac3b4; - padding: 7px 8px; - background: #666158; - box-shadow: 0 1px 2px 0 #504d46 inset, 0 -1px 2px 0 #504d46 inset; - overflow: hidden; -} -.massaction ul { - list-style: none; - margin: 0; - padding: 6px 0 0; -} -.massaction li { - display: inline-block; -} -.massaction li:before { - color: #837F79; - content: '|'; - display: inline-block; - margin: 0 5px; -} -.massaction li:first-child:before { - display: none; -} -.massaction .entry-edit { - float: right; - display: inline-block; -} -.massaction .entry-edit fieldset { - margin: 0; - padding: 0; - background: none; - border: none; -} -.massaction .entry-edit fieldset select { - border-radius: 2px; - margin: 0; -} -.massaction .entry-edit fieldset select.validation-failed { - border: 1px dashed #eb340a; - background: #faebe7; -} -.massaction .entry-edit .field-row { - display: inline-block; - vertical-align: middle; -} -.massaction .entry-edit .outer-span .entry-edit { - float: none; -} -.massaction .entry-edit .field-row label { - color: #cac3b4; - line-height: 26px; - margin: 0 5px 0 20px; - padding: 0; - vertical-align: middle; - width: auto; - float: none; -} -.massaction .entry-edit .validation-advice { - display: none !important; -} -.massaction a { - color: #e7e2d7; - text-decoration: none; -} -.massaction a:hover { - color: #fff; -} -/* Grid Footer */ -.grid table tfoot tr { - background: #656156; -} -.grid table tfoot tr th, -.grid table tfoot tr td { - border-right: 1px solid #837f79; - line-height: 1.7em; - padding: 3px 10px; -} -.grid table tfoot tr th:first-child, -.grid table tfoot tr td:first-child { - border-left: 1px solid #837f79; -} -.grid table.border tfoot tr td { - background: #656156; -} -.grid .col-price, -.grid .col-number { - text-align: right; -} -/* Dynamic Grid */ -/* Used in pages like Catalog -> Attributes */ -.dynamic-grid th { - padding: 2px; - width: 100px; -} -.dynamic-grid td { - padding: 2px; -} -.dynamic-grid td input { - width: 94px; -} -tr.dynamic-grid td, -tr.dynamic-grid th { - padding: 2px 10px 2px 0; - width: auto; -} -tr.dynamic-grid input.input-text { - width: 154px; -} -.available { - color: #080; - font-weight: bold; -} -.not-available { - color: #800; -} -.categories-side-col { - padding: 0 3%; -} -/* - TODO: change ids to 'table.data' after refactoring of all templates for grids - Manage Products Grid --------------------------------------- */ -#cross_sell_product_grid table.data, -#up_sell_product_grid table.data, -#related_product_grid table.data, -#productGrid_table, -#setGrid_table, -#attributeGrid_table, -.custom-options .data-table, -.ui-dialog .data { - word-wrap: break-word; - table-layout: fixed; -} -#cross_sell_product_grid table.data th, -#up_sell_product_grid table.data th, -#related_product_grid table.data th, -#productGrid_table th, -#setGrid_table th, -#attributeGrid_table th, -.custom-options .data-table th, -.ui-dialog .data th { - word-wrap: normal; - overflow: hidden; - vertical-align: top; -} -#cross_sell_product_grid table.data th > span, -#up_sell_product_grid table.data th > span, -#related_product_grid table.data th > span, -#productGrid_table th > span, -#customerGrid_table th > span, -#setGrid_table th > span, -#attributeGrid_table th > span, -.custom-options .data-table th > span, -.ui-dialog .data th > span { - white-space: normal; -} -table .col-draggable .draggable-handle { - position: relative; - top: 0; - float: left; -} -.grid table .col-id { - text-align: left; -} -/* - Data table --------------------------------------- */ -.data-table { - border-collapse: separate; - /* do not remove this! without this rule in FF when table has only 1 row bottom and side borders disappear*/ - width: 100%; -} -.data-table thead, -.data-table tfoot, -.data-table th, -.accordion .config .data-table thead th, -.accordion .config .data-table tfoot td { - background: #fff; - color: #676056; - font-size: 13px; - font-weight: 600; -} -.data-table th { - border-color: #c9c2b8; - border-width: 0 0 1px; - padding: 7px; -} -.data-table td, -.data-table tbody tr td, -.accordion .config .data-table td { - background: #fff; - padding: 5px 7px; - color: #676056; - font-size: 14px; - font-weight: 400; - vertical-align: middle; - border: solid #eae8e4; - border-width: 0 0 1px; -} -.data-table tbody tr.selected td, -.data-table tbody tr.selected th, -.data-table tbody tr:hover td, -.data-table tbody tr:hover th { - background: #fff; -} -.data-table tbody tr:nth-child(odd) td, -.data-table tbody tr:nth-child(odd):hover td, -.accordion .config .data-table tbody tr:nth-child(odd) td { - background: #fbfaf6; -} -.data-table tbody tr.odd td { - background: #fbfaf6; -} -.data-table tfoot tr:last-child td, -.data-table tfoot tr:last-child th, -.accordion .config .data-table tfoot tr:last-child td { - border: 0; -} -.data-table input[type="text"] { - width: 98%; - padding-left: 1%; - padding-right: 1%; -} -.data-table select { - margin: 0; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - border-radius: 4px; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -} -.data-table th.required-entry:after, -.data-table td.required-entry:after { - content: '*'; - color: red; -} -.data-table .col-actions .actions-split { - margin-top: 4px; -} -.data-table .col-actions .actions-split [class^='action-'] { - background: none; - border: 1px solid #c8c3b5; - padding: 3px 5px; - color: #bbb3a6; - font-size: 12px; -} -.data-table .col-actions .actions-split [class^='action-']:first-child { - border-right: 0; -} -.data-table .col-actions .actions-split .dropdown-menu { - margin-top: -1px; -} -.data-table .col-actions .actions-split .dropdown-menu a { - display: block; - color: #333; - text-decoration: none; -} -.data-table .col-actions .actions-split.active .action-toggle { - position: relative; - border-bottom-right-radius: 0; - box-shadow: none; - background: #fff; -} -.data-table .col-actions .actions-split.active .action-toggle:after { - position: absolute; - top: 100%; - left: 0; - right: 0; - height: 2px; - margin-top: -1px; - background: #fff; - content: ''; - z-index: 2; -} -.data-table .col-actions .actions-split.active .dropdown-menu { - border-top-right-radius: 0; -} -/* - Data table - alternative view --------------------------------------- */ -.customer-information .data-table, -.order-information .data-table, -.order-account-information .data-table, -.adminhtml-rma-new .data-table { - width: 100%; -} -.customer-information .data-table tbody tr th, -.order-information .data-table tbody tr th, -.order-account-information .data-table tbody tr th, -.adminhtml-rma-new .data-table tbody tr th, -.adminhtml-logging-details .log-details .data-table th, -[class^=" sales-transactions-"] .data-table tbody tr th, -[class^=" sales-"] .order-payment-method .data-table tbody tr th, -[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th { - font-weight: bold; -} -.customer-information .data-table tbody tr td, -.customer-information .data-table tbody tr th, -.order-information .data-table tbody tr td, -.order-information .data-table tbody tr th, -.order-account-information .data-table tbody tr td, -.order-account-information .data-table tbody tr th, -.adminhtml-logging-details .log-details .data-table td, -.adminhtml-logging-details .log-details .data-table th, -[class^=" adminhtml-rma-"] .data-table tbody tr td, -[class^=" adminhtml-rma-"] .data-table tbody tr th, -[class^=" sales-transactions-"] .data-table tbody tr th, -[class^=" sales-transactions-"] .data-table tbody tr td, -[class^=" sales-"] .order-payment-method .data-table tbody tr th, -[class^=" sales-"] .order-payment-method .data-table tbody tr td, -[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th, -[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr td { - background-color: #fff; - border: 0; - padding: 9px 10px 10px; - color: #666; - vertical-align: top; -} -.customer-information .data-table tbody tr:nth-child(2n+1) td, -.customer-information .data-table tbody tr:nth-child(2n+1) th, -.order-information .data-table tbody tr:nth-child(2n+1) td, -.order-information .data-table tbody tr:nth-child(2n+1) th, -.order-account-information .data-table tbody tr:nth-child(2n+1) td, -.order-account-information .data-table tbody tr:nth-child(2n+1) th, -.adminhtml-logging-details .log-details .data-table tr:nth-child(odd) td, -.adminhtml-logging-details .log-details .data-table tr:nth-child(odd) th, -[class^=" adminhtml-rma-"] .data-table tbody tr:nth-child(2n+1) td, -[class^=" adminhtml-rma-"] .data-table tbody tr:nth-child(2n+1) th, -[class^=" sales-transactions-"] .data-table tbody tr:nth-child(2n+1) th, -[class^=" sales-transactions-"] .data-table tbody tr:nth-child(2n+1) td, -[class^=" sales-"] .order-payment-method .data-table tbody tr:nth-child(2n+1) th, -[class^=" sales-"] .order-payment-method .data-table tbody tr:nth-child(2n+1) td, -[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr:nth-child(2n+1) th, -[class^=" sales-billing-agreement-"] .log-details .data-table tbody tr:nth-child(2n+1) td { - background-color: #fbfaf6; -} -/* - Content alignments in tables --------------------------------------- */ -/* left */ -.col-website, -.col-name, -.col-sku, -.col-color, -.col-size, -.col-product, -.col-comment, -.col-actions, -.col-status { - text-align: left; -} -/* center */ -.col-include, -.col-display, -.col-image, -.col-no-records, -.col-select, -.col-default, -.col-uqty { - text-align: center; -} -/* right */ -.col-qty, -.col-weight, -.col-price, -.col-price > input, -.col-id, -.col-total, -.col-average { - text-align: right; -} -/* - Attribute Information --------------------------------------- */ -.data-table .col-default { - white-space: nowrap; - text-align: center; - vertical-align: middle; -} -.data-table .col-delete { - text-align: center; - width: 32px; -} -.data-table .col-file { - white-space: nowrap; -} -.data-table .col-file input { - margin: 0 5px; - width: 40%; -} -.data-table .col-file input:first-child { - margin-left: 0; -} -/* - Website store views tree --------------------------------------- */ -.store-tree .website-name { - font-size: 14px; - font-weight: bold; -} -.store-tree .webiste-groups { - margin: 5px 0 20px 18px; -} -.store-tree .webiste-groups dt { - font-weight: bold; -} -.store-tree .webiste-groups dd { - margin: 5px 0 15px 15px; -} -.store-tree .webiste-groups dd > ul { - list-style: none; - margin: 0; - padding: 0; -} -.store-tree .webiste-groups dd > ul > li { - margin: 0 0 5px; -} -/* - Customer Reviews --------------------------------------- */ -.field-detailed_rating .control-value { - padding: 0; -} -.field-detailed_rating .nested { - padding: 0; -} -.field-detailed_rating .field-rating { - margin: 15px 0 0 0; -} -.field-detailed_rating .field-rating:first-child { - margin-top: 0; -} -.field-detailed_rating .field-rating .label { - width: 75px; -} -.field-detailed_rating .field-rating .control { - unicode-bidi: bidi-override; - direction: rtl; - width: 125px; -} -.field-detailed_rating input[type="radio"] { - display: none; -} -.field-detailed_rating .field-rating .control label { - color: #ccc; - cursor: pointer; - font-size: 18px; - float: right; - overflow: hidden; - white-space: nowrap; - width: 18px; - -webkit-transition: color 150ms linear; - -moz-transition: color 150ms linear; - -o-transition: color 150ms linear; - -ms-transition: color 150ms linear; - transition: color 150ms linear; -} -/* - Tree Store Scope --------------------------------------- */ -.tree-store-scope .buttons-set { - margin-bottom: 9px; -} -.tree-store-scope .buttons-set button { - margin-right: 4px; -} -.tree-store-scope .field { - margin: 0 0 5px; -} -.tree-store-scope [class^="field field-website_"] .label, -.tree-store-scope [class^="field field-group_"] .label, -.tree-store-scope [class^="field field-w_"] .label, -.tree-store-scope [class^="field field-sg_"] .label { - text-align: left; - font-size: 18px; - padding-right: 0; - width: auto; -} -.tree-store-scope [class^="field field-group_"] .label, -.tree-store-scope [class^="field field-sg_"] .label { - padding-left: 20px; -} -.tree-store-scope .field input[type="checkbox"] { - margin-right: 3px; - position: relative; - top: 2px; -} -.tree-store-scope .field .addafter { - display: inline-block; - padding-top: 6px; -} -.tree-store-scope .tooltip .help { - margin-top: 11px; -} -/* - Product Massaction page - TODO: css code below should be removed after element.html refactoring --------------------------------------- */ -.attributes-edit-form .attribute-change-checkbox { - white-space: nowrap; - display: block; -} -.attributes-edit-form .attribute-change-checkbox > label > input { - width: auto; -} -.attributes-edit-form .field:last-child, -.attributes-edit-form .field-name, -.attributes-edit-form .field.type-price, -.attributes-edit-form .field-price, -.attributes-edit-form .field-special_price, -.attributes-edit-form .field-meta_title, -.attributes-edit-form .field-visibility, -.attributes-edit-form .field-custom_design, -.attributes-edit-form .field-page_layout, -.attributes-edit-form .field-options_container, -.attributes-edit-form .field-country_of_manufacture, -.attributes-edit-form .field-msrp_display_actual_price_type, -.attributes-edit-form .field-tax_class_id, -.attributes-edit-form .field-is_returnable, -.attributes-edit-form .field-msrp, -.attributes-edit-form .field-gift_wrapping_price { - margin-bottom: 50px; -} -.attributes-edit-form .field .control { - position: relative; -} -.attributes-edit-form .field-name .attribute-change-checkbox, -.attributes-edit-form .field-meta_title .attribute-change-checkbox, -.attributes-edit-form .field-gift_wrapping_price .attribute-change-checkbox, -.attributes-edit-form .field .control select + .addafter { - position: absolute; - left: 0; - top: 35px; -} -.attributes-edit-form .field.type-price .attribute-change-checkbox, -.attributes-edit-form .field-price .attribute-change-checkbox, -.attributes-edit-form .field-special_price .attribute-change-checkbox, -.attributes-edit-form .field-msrp .attribute-change-checkbox { - position: absolute; - top: 35px; -} -.attributes-edit-form .field-special_from_date > .control .input-text, -.attributes-edit-form .field-special_to_date > .control .input-text, -.attributes-edit-form .field-news_from_date > .control .input-text, -.attributes-edit-form .field-news_to_date > .control .input-text, -.attributes-edit-form .field-custom_design_from > .control .input-text, -.attributes-edit-form .field-custom_design_to > .control .input-text { - border-width: 1px; - border-radius: 4px; - width: 130px; -} -.attributes-edit-form .field-special_from_date .attribute-change-checkbox, -.attributes-edit-form .field-special_to_date .attribute-change-checkbox, -.attributes-edit-form .field-news_from_date .attribute-change-checkbox, -.attributes-edit-form .field-news_to_date .attribute-change-checkbox, -.attributes-edit-form .field-custom_design_from .attribute-change-checkbox, -.attributes-edit-form .field-custom_design_to .attribute-change-checkbox { - margin-top: 5px; -} -.attributes-edit-form .field-weight .fields-group-2 .control { - width: 160px; -} -.attributes-edit-form .field-weight .fields-group-2 .control > input { - width: 130px; - float: left; -} -.attributes-edit-form .field-weight .fields-group-2 .control > input + .addafter { - position: absolute; - top: 35px; -} -.attributes-edit-form .field-weight .fields-group-2 .control .addafter strong { - line-height: 26px; -} -.attributes-edit-form .field .control select { - border-radius: 4px; -} -.attributes-edit-form .field-gift_message_available .addon > .select, -.attributes-edit-form .field-gift_wrapping_available .addon > .select { - margin-bottom: 25px; -} -.attributes-edit-form .field-gift_message_available .addon > input[type="checkbox"], -.attributes-edit-form .field-gift_wrapping_available .addon > input[type="checkbox"] { - width: auto; - margin-right: 5px; -} -/* - Widgets --------------------------------------- */ -.widget-layout-updates .fieldset-wrapper, -.widget-layout-updates .data-table { - margin: 0 0 18px; -} -.widget-layout-updates .fieldset-wrapper-title label { - padding: 10px 0 0; -} -.widget-layout-updates .fieldset-wrapper-title select { - margin: 3px 10px 5px; -} -.widget-layout-updates .fieldset-wrapper-title span, -.widget-layout-updates .fieldset-wrapper-title select { - vertical-align: middle; -} -.widget-layout-updates .data-table { - table-layout: fixed; -} -.widget-layout-updates .data-table, -.widget-layout-updates .data-table tr:nth-child(odd) td, -.widget-layout-updates .data-table tr:nth-child(odd):hover td { - background: none; - border: none; -} -.widget-layout-updates .data-table th, -.widget-layout-updates .data-table tbody td { - border: none; - padding: 5px 10px; - vertical-align: top; -} -.widget-layout-updates .data-table select { - margin: 0; - max-width: 99%; - overflow: hidden; -} -.widget-layout-updates .chooser_container { - padding: 0 10px; - margin-bottom: 18px; -} -.widget-layout-updates .chooser_container p { - margin: 0 0 18px; -} -.widget-layout-updates .chooser_container p img, -.widget-layout-updates .chooser_container p input { - vertical-align: middle; -} -/* - Preview window --------------------------------------- */ -.preview-window { - background: #fff; -} -.preview-window .toolbar { - background: #f5f2ed; - padding: 20px; -} -.preview-window .toolbar .switcher { - margin: 0; -} -.preview-window .toolbar .switcher span { - background: none; - width: auto; -} -/* - Global 'No Products found' block --------------------------------------- */ -.no-products-message { - background: #fbfaf6; - padding: 12px; - text-align: center; - font-size: 12px; - color: #666; - margin-bottom: 13px; -} -/* - WYSIWYG --------------------------------------- */ -.action-wysiwyg { - margin: 10px 0; -} -#catalog-wysiwyg-editor .buttons-set { - margin-bottom: 9px; -} -#catalog-wysiwyg-editor .buttons-set button { - margin-right: 4px; -} -/* - System Messages --------------------------------------- */ -.message-system { - min-width: 960px; - max-width: 1300px; - margin: 0 auto; - overflow: hidden; -} -.message-system-inner { - background: #f7f3eb; - border: 1px solid #c0bbaf; - border-top: 0; - border-radius: 0 0 5px 5px; - float: right; - overflow: hidden; -} -.message-system-unread .message-system-inner { - float: none; -} -.message-system-list { - margin: 0; - padding: 0; - list-style: none; - float: left; -} -.message-system .message-system-list { - width: 75%; -} -.message-system-list li { - padding: 5px 13px 7px 36px; - position: relative; -} -.message-system-short { - padding: 5px 13px 7px; - float: right; -} -.message-system-short span { - display: inline-block; - margin-left: 7px; - border-left: 1px #d1ccc3 solid; -} -.message-system-short span:first-child { - border: 0; - margin-left: 0; -} -.message-system-short a { - padding-left: 27px; - position: relative; - height: 16px; -} -.message-system .message-system-short a:before, -.message-system-list li:before { - font-family: 'MUI-Icons'; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - height: 16px; - width: 16px; - font-size: 16px; - line-height: 16px; - text-align: center; - position: absolute; - left: 7px; - top: 2px; -} -.message-system-list li:before { - top: 5px; - left: 13px; -} -.message-system .message-system-short .warning a:before, -.message-system-list li.warning:before { - content: "\e006"; - color: #f2a825; -} -.message-system .message-system-short .error a:before, -.message-system-list li.error:before { - content: "\e086"; - font-family: 'MUI-Icons'; - color: #c00815; -} -.ui-dialog .message-system-list { - margin-bottom: 25px; -} -/* - Add Attribute Popup --------------------------------------- */ -#create_new_attribute { - overflow: hidden; -} -#create_new_attribute > .loading-mask { - left: -25px; - top: -50px; -} -.attribute-popup { - background: none; -} -.attribute-popup #edit_form > .fieldset > .legend { - display: none; -} -.attribute-popup .wrapper-popup { - padding: 0; - height: 511px; - overflow-x: hidden; - overflow-y: auto; -} -.attribute-popup .fieldset, -.attribute-popup .fieldset-wrapper { - border: none; - border-radius: 0; - padding: 4px 0 20px; - margin: 0 23px 20px; -} -.attribute-popup .fieldset-wrapper { - border-top: none; -} -.attribute-popup .fieldset-wrapper .fieldset-wrapper-title { - border-bottom: none; -} -.attribute-popup .fieldset-wrapper .fieldset-wrapper-content > .fieldset { - margin-left: 0; - margin-right: 0; -} -.attribute-popup .fieldset > .field > input[type="checkbox"] { - margin-top: 7px; -} -.attribute-popup .fieldset .label { - width: 35%; -} -.attribute-popup .collapsable-wrapper, -#manage-titles-wrapper .fieldset-wrapper-title { - margin-bottom: 0; - padding-bottom: 0; -} -.attribute-popup .collapsable-wrapper .fieldset-wrapper-title > .title:before { - color: #797269; - font-size: 14px; - top: 9px; -} -.attribute-popup form .entry-edit:first-child .fieldset { - border-bottom: 1px solid #dfdcd7; -} -.attribute-popup .fieldset .legend { - border: none; -} -.attribute-popup .page-actions { - position: fixed; - top: auto !important; - left: 0; - right: 0; - bottom: 0; - background: #fff; - padding: 27px 50px 25px 23px; - border-top: 1px solid #dfdcd7; -} -.attribute-popup .page-actions [class^='action-'] { - margin-left: 18px; -} -.attribute-popup #base_fieldset { - padding-top: 20px; -} -.attribute-popup #base_fieldset > .legend { - display: none; -} -.attribute-popup .page-actions #reset, -.attribute-popup .page-actions #reset:hover, -.attribute-popup .page-actions #reset:active, -.attribute-popup .page-actions #reset:focus { - float: right; - vertical-align: middle; - margin: 5px 0 0 18px; -} -.attribute-popup .page-actions-placeholder { - display: none; -} -.attribute-popup .page-actions.fixed .page-actions-inner { - background: #fff; - padding: 0; - min-width: 100%; - max-width: 100%; - min-height: 100%; - margin: 0; -} -.attribute-popup .footer { - display: none; -} -#manage-options-panel > .data-table { - clear: both; -} -.CustomGridView .col-1-layout, -.sales-order-index .col-1-layout, -.adminhtml-rma-index .col-1-layout, -.adminhtml-catalog-event-index .col-1-layout, -.adminhtml-urlrewrite-index .col-1-layout, -.catalog-search-index .col-1-layout, -.review-product-index .col-1-layout, -.catalog-rule-promo-catalog-index .col-1-layout, -.sales-rule-promo-quote-index .col-1-layout, -.adminhtml-reminder-index .col-1-layout, -.newsletter-template-index .col-1-layout, -.adminhtml-system-email-template-index .col-1-layout, -.adminhtml-sitemap-index .col-1-layout, -.adminhtml-googleshopping-types-index .col-1-layout, -.customer-index-index .col-1-layout, -.adminhtml-cms-page-index .col-1-layout, -.cms-block-index .col-1-layout, -.adminhtml-banner-index .col-1-layout, -.adminhtml-widget-instance-index .col-1-layout, -.cms-page-index .col-1-layout, -.adminhtml-webapi-user-index .col-1-layout, -.adminhtml-webapi-role-index .col-1-layout, -.adminhtml-system-variable-index .col-1-layout, -.adminhtml-user-index .col-1-layout, -.adminhtml-user-role-index .col-1-layout, -.adminhtml-integration-index .col-1-layout, -.adminhtml-system-design-theme-index .col-1-layout, -.adminhtml-system-design-index .col-1-layout, -.adminhtml-customer-attribute-index .col-1-layout, -.adminhtml-customer-address-attribute-index .col-1-layout, -.rating-index-index .col-1-layout, -.tax-rule-index .col-1-layout, -.tax-rate-index .col-1-layout, -.adminhtml-rma-item-attribute-index .col-1-layout, -.adminhtml-reward-rate-index .col-1-layout, -.customer-group-index .col-1-layout, -.checkout-agreement-index .col-1-layout, -.catalog-product-attribute-index .col-1-layout, -.catalog-product-set-index .col-1-layout, -.catalog-product-index .col-1-layout, -.sales-invoice-index .col-1-layout, -.sales-shipment-index .col-1-layout, -.sales-creditmemo-index .col-1-layout, -.sales-billing-agreement-index .col-1-layout, -.sales-transactions-index .col-1-layout, -.sales-recurring-payment-index .col-1-layout, -.adminhtml-googleshopping-items-index .col-1-layout, -.customer-online-index .col-1-layout, -.newsletter-queue-index .col-1-layout, -.newsletter-subscriber-index .col-1-layout, -.adminhtml-report-shopcart-product .col-1-layout, -.adminhtml-report-shopcart-abandoned .adminhtml-report-product-downloads .col-1-layout, -.adminhtml-report-product-sold .col-1-layout, -.adminhtml-report-product-lowstock .col-1-layout, -.adminhtml-report-customer-accounts .col-1-layout, -.adminhtml-report-customer-totals .col-1-layout, -.adminhtml-report-customer-orders .col-1-layout, -.adminhtml-report-customer-wishlist-wishlist .col-1-layout, -.adminhtml-report-review-customer .col-1-layout, -.adminhtml-report-review-product .col-1-layout, -.adminhtml-report-search .col-1-layout, -.adminhtml-report-statistics-index .col-1-layout, -.newsletter-problem-index .col-1-layout, -.adminhtml-system-store-index .col-1-layout, -.sales-order-status-index .col-1-layout, -.adminhtml-system-currency-index .col-1-layout, -.adminhtml-system-currencysymbol-index .col-1-layout, -.adminhtml-scheduled-operation-index .col-1-layout, -.adminhtml-cache-index .col-1-layout, -.adminhtml-system-backup-index .col-1-layout, -.adminhtml-locks-index .col-1-layout, -.adminhtml-notification-index .col-1-layout, -.adminhtml-logging-archive .col-1-layout, -.adminhtml-logging-index .col-1-layout, -.adminhtml-process-list .col-1-layout, -.catalog-product-index .col-1-layout { - padding: 0; - background: transparent; - border: 0; - border-radius: 0; - max-width: 1300px; - min-width: 960px; -} -.CustomGridAction .grid-actions, -.sales-order-index .grid-actions, -.adminhtml-rma-index .grid-actions, -.adminhtml-catalog-event-index .grid-actions, -.adminhtml-urlrewrite-index .grid-actions, -.catalog-search-index .grid-actions, -.review-product-index .grid-actions, -.catalog-rule-promo-catalog-index .grid-actions, -.sales-rule-promo-quote-index .grid-actions, -.adminhtml-reminder-index .grid-actions, -.newsletter-template-index .grid-actions, -.adminhtml-system-email-template-index .grid-actions, -.adminhtml-sitemap-index .grid-actions, -.adminhtml-googleshopping-types-index .grid-actions, -.customer-index-index .grid-actions, -.adminhtml-cms-page-index .grid-actions, -.cms-block-index .grid-actions, -.adminhtml-banner-index .grid-actions, -.adminhtml-widget-instance-index .grid-actions, -.cms-page-index .grid-actions, -.adminhtml-webapi-user-index .grid-actions, -.adminhtml-webapi-role-index .grid-actions, -.adminhtml-system-variable-index .grid-actions, -.adminhtml-user-index .grid-actions, -.adminhtml-user-role-index .grid-actions, -.adminhtml-integration-index .grid-actions, -.adminhtml-system-design-theme-index .grid-actions, -.adminhtml-system-design-index .grid-actions, -.adminhtml-customer-attribute-index .grid-actions, -.adminhtml-customer-address-attribute-index .grid-actions, -.rating-index-index .grid-actions, -.tax-rule-index .grid-actions, -.tax-rate-index .grid-actions, -.adminhtml-rma-item-attribute-index .grid-actions, -.adminhtml-reward-rate-index .grid-actions, -.customer-group-index .grid-actions, -.checkout-agreement-index .grid-actions, -.catalog-product-attribute-index .grid-actions, -.catalog-product-set-index .grid-actions, -.catalog-product-index .grid-actions { - border-radius: 5px 5px 0 0; - margin-top: 20px; - padding: 9px 16px 9px 65px; -} -.CustomGridAction .page-actions.fixed, -.sales-order-index .page-actions.fixed, -.adminhtml-rma-index .page-actions.fixed, -.adminhtml-catalog-event-index .page-actions.fixed, -.adminhtml-urlrewrite-index .page-actions.fixed, -.catalog-search-index .page-actions.fixed, -.review-product-index .page-actions.fixed, -.catalog-rule-promo-catalog-index .page-actions.fixed, -.sales-rule-promo-quote-index .page-actions.fixed, -.adminhtml-reminder-index .page-actions.fixed, -.newsletter-template-index .page-actions.fixed, -.adminhtml-system-email-template-index .page-actions.fixed, -.adminhtml-sitemap-index .page-actions.fixed, -.adminhtml-googleshopping-types-index .page-actions.fixed, -.customer-index-index .page-actions.fixed, -.adminhtml-cms-page-index .page-actions.fixed, -.cms-block-index .page-actions.fixed, -.adminhtml-banner-index .page-actions.fixed, -.adminhtml-widget-instance-index .page-actions.fixed, -.cms-page-index .page-actions.fixed, -.adminhtml-webapi-user-index .page-actions.fixed, -.adminhtml-webapi-role-index .page-actions.fixed, -.adminhtml-system-variable-index .page-actions.fixed, -.adminhtml-user-index .page-actions.fixed, -.adminhtml-user-role-index .page-actions.fixed, -.adminhtml-integration-index .page-actions.fixed, -.adminhtml-system-design-theme-index .page-actions.fixed, -.adminhtml-system-design-index .page-actions.fixed, -.adminhtml-customer-attribute-index .page-actions.fixed, -.adminhtml-customer-address-attribute-index .page-actions.fixed, -.rating-index-index .page-actions.fixed, -.tax-rule-index .page-actions.fixed, -.tax-rate-index .page-actions.fixed, -.adminhtml-rma-item-attribute-index .page-actions.fixed, -.adminhtml-reward-rate-index .page-actions.fixed, -.customer-group-index .page-actions.fixed, -.checkout-agreement-index .page-actions.fixed, -.catalog-product-attribute-index .page-actions.fixed, -.catalog-product-set-index .page-actions.fixed, -.catalog-product-index .page-actions.fixed { - left: 0; - margin: 0; - padding: 0 21px; - position: fixed; -} -.CustomGridAction .page-actions, -.sales-order-index .page-actions, -.adminhtml-rma-index .page-actions, -.adminhtml-catalog-event-index .page-actions, -.adminhtml-urlrewrite-index .page-actions, -.catalog-search-index .page-actions, -.review-product-index .page-actions, -.catalog-rule-promo-catalog-index .page-actions, -.sales-rule-promo-quote-index .page-actions, -.adminhtml-reminder-index .page-actions, -.newsletter-template-index .page-actions, -.adminhtml-system-email-template-index .page-actions, -.adminhtml-sitemap-index .page-actions, -.adminhtml-googleshopping-types-index .page-actions, -.customer-index-index .page-actions, -.adminhtml-cms-page-index .page-actions, -.cms-block-index .page-actions, -.adminhtml-banner-index .page-actions, -.adminhtml-widget-instance-index .page-actions, -.cms-page-index .page-actions, -.adminhtml-webapi-user-index .page-actions, -.adminhtml-webapi-role-index .page-actions, -.adminhtml-system-variable-index .page-actions, -.adminhtml-user-index .page-actions, -.adminhtml-user-role-index .page-actions, -.adminhtml-integration-index .page-actions, -.adminhtml-system-design-theme-index .page-actions, -.adminhtml-system-design-index .page-actions, -.adminhtml-customer-attribute-index .page-actions, -.adminhtml-customer-address-attribute-index .page-actions, -.rating-index-index .page-actions, -.tax-rule-index .page-actions, -.tax-rate-index .page-actions, -.adminhtml-rma-item-attribute-index .page-actions, -.adminhtml-reward-rate-index .page-actions, -.customer-group-index .page-actions, -.checkout-agreement-index .page-actions, -.catalog-product-attribute-index .page-actions, -.catalog-product-set-index .page-actions, -.catalog-product-index .page-actions { - position: absolute; - z-index: 2; - margin-top: 10px; - margin-left: 15px; - padding: 0; -} -.adminhtml-googleshopping-items-index .grid-title, -.adminhtml-system-backup-index .page-actions, -.adminhtml-scheduled-operation-index .page-actions, -.adminhtml-system-currency-index .page-actions, -.adminhtml-system-currencysymbol-index .page-actions, -.adminhtml-cache-index .page-actions, -.adminhtml-system-store-index .page-actions, -.sales-order-status-index .page-actions { - border: 1px solid #c0bbaf; - border-bottom: 0; - background: #f6f3ec; - background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y2ZjNlYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZGVhZTEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); - background: -moz-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f6f3ec), color-stop(100%, #edeae1)); - background: -webkit-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -o-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: -ms-linear-gradient(top, #f6f3ec 0%, #edeae1 100%); - background: linear-gradient(to bottom, #f6f3ec 0%, #edeae1 100%); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f6f3ec', endColorstr='#edeae1', GradientType=0); - padding: 7px 8px 8px; - position: relative; - float: none; -} -.adminhtml-googleshopping-items-index .grid { - padding-bottom: 25px; -} -.adminhtml-googleshopping-items-index .grid-title .title { - font-size: 18px; -} -.adminhtml-googleshopping-items-index .page-actions { - float: right; -} -.adminhtml-system-backup-index .page-actions.fixed, -.adminhtml-scheduled-operation-index .page-actions.fixed, -.adminhtml-system-currency-index .page-actions.fixed, -.adminhtml-system-currencysymbol-index .page-actions.fixed, -.adminhtml-cache-index .page-actions.fixed, -.adminhtml-system-store-index .page-actions.fixed, -.sales-order-status-index .page-actions.fixed { - background-image: none; - padding: 0 21px; - position: fixed; -} -.catalog-product-index .grid-actions { - padding-left: 90px; -} -.catalog-rule-promo-catalog-index .grid-actions { - padding-left: 210px; -} -.catalog-rule-promo-catalog-index .page-actions .apply { - float: right; - margin: 0 0 0 10px; -} -.catalog-product-index .field-store-switcher { - padding: 0; -} -.sidebar-actions { - padding: 14px 0; -} -.sidebar-actions button { - margin: 0 0 5px; -} -.sales-order-create-index .grid table .action-configure { - float: right; -} -.adminhtml-system-currency-index .import-service { - float: left; -} -.adminhtml-system-currency-index .page-actions.fixed .import-service { - display: inline-block; - float: none; -} -.fpt-item-container select { - width: 100%; -} -.fpt-item-container select:first-child { - margin-bottom: 8px; -} -.clearfix:before, -.clearfix:after, -[class$="-layout"]:after, -.footer-content:before, -.footer-content:after, -.page-title-inner:before, -.page-title-inner:after, -.tabs-horiz:before, -.tabs-horiz:after, -.navigation > ul:before, -.navigation > ul:after, -.actions-split:before, -.actions-split:after, -.page-create-order:before, -.page-create-order:after, -.order-addresses:before, -.order-addresses:after, -.order-methods:before, -.order-methods:after, -.order-summary:before, -.order-summary:after, -.order-methods:before, -.order-methods:after, -.grid-actions:before, -.grid-actions:after, -.fieldset-wrapper-title:before, -.fieldset-wrapper-title:after { - content: ""; - display: table; -} -.clearfix:after, -[class$="-layout"]:after, -.footer-content:after, -.page-title-inner:after, -.tabs-horiz:after, -.navigation > ul:after, -.actions-split:after, -.page-create-order:after, -.order-addresses:after, -.order-methods:after, -.order-summary:after, -.order-methods:after, -.grid-actions:after, -.fieldset-wrapper-title:after { - clear: both; -} diff --git a/app/design/adminhtml/magento_backend/css/styles-ie8.css b/app/design/adminhtml/magento_backend/css/styles-ie8.css deleted file mode 100644 index 12df12f742abe93b23129e6f4e05299cddc0cfef..0000000000000000000000000000000000000000 --- a/app/design/adminhtml/magento_backend/css/styles-ie8.css +++ /dev/null @@ -1,300 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -.eq-ie8 .customer-current-activity .action-refresh, -.eq-ie8 .pager .action-next, -.eq-ie8 .pager .action-previous, -.eq-ie8 .pager .action-next:hover, -.eq-ie8 .pager .action-previous:hover, -.eq-ie8 .pager .action-next.disabled:focus, -.eq-ie8 .pager .action-previous.disabled:focus, -.eq-ie8 .pager .action-next.disabled:active, -.eq-ie8 .pager .action-previous.disabled:active, -.eq-ie8 .data-table .action-.delete, -.eq-ie8 .data-table .action-.delete:hover, -.eq-ie8 .data-table .action-.delete:active, -.eq-ie8 .data-table .action-.delete.active, -.eq-ie8 .data-table .action-delete, -.eq-ie8 .data-table .action-delete:hover, -.eq-ie8 .data-table .action-delete:active, -.eq-ie8 .data-table .action-delete.active, -.eq-ie8 .data-table .action-locked, -.eq-ie8 .data-table .action-locked:hover, -.eq-ie8 .data-table .action-locked:active, -.eq-ie8 .data-table .action-locked.active, -.eq-ie8 #product-variations-matrix .action-choose, -.eq-ie8 #product-variations-matrix .action-choose:hover, -.eq-ie8 #product-variations-matrix .action-choose:active, -.eq-ie8 #product-variations-matrix .action-choose.active, -.eq-ie8 .image-panel .action-close, -.eq-ie8 .eq-ie8 .image-panel .action-close:hover, -.eq-ie8 .image-panel .action-close:active, -.eq-ie8 .image-panel .action-close.active, -.eq-ie8 .image-panel-controls .action-remove, -.eq-ie8 .image-panel-controls .action-remove:hover, -.eq-ie8 .image-panel-controls .action-remove:active, -.eq-ie8 .image-panel-controls .action-remove.active, -.eq-ie8 .suggest-expandable .action-show-all, -.eq-ie8 .suggest-expandable .action-show-all:hover, -.eq-ie8 .suggest-expandable .action-show-all:active, -.eq-ie8 .suggest-expandable .action-show-all.active, -.eq-ie8 .vde-tools-header .action-close, -.eq-ie8 .vde-tools-header .action-close:hover, -.eq-ie8 .vde-tools-header .action-close:active, -.eq-ie8 .vde-tools-header .action-close.active, -.eq-ie8 .image .action-delete, -.eq-ie8 .image .action-delete:hover, -.eq-ie8 .image .action-delete:active, -.eq-ie8 .image .action-delete.active, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete:hover, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete:active, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete.active, -.eq-ie8 .address-list-item-actions .action-delete, -.eq-ie8 .address-list-item-actions .action-delete:hover, -.eq-ie8 .address-list-item-actions .action-delete:active, -.eq-ie8 .address-list-item-actions .action-delete.active, -.eq-ie8 .notification .action-close, -.eq-ie8 .notification .action-close:hover, -.eq-ie8 .notification .action-close:active, -.eq-ie8 .notification .action-close.active, -.eq-ie8 .page-login .action-forgotpassword, -.eq-ie8 .page-login .action-forgotpassword:hover, -.eq-ie8 .page-login .action-forgotpassword:active, -.eq-ie8 .page-login .action-forgotpassword.active, -.eq-ie8 .page-login .action-back, -.eq-ie8 .page-login .action-back:hover, -.eq-ie8 .page-login .action-back:active, -.eq-ie8 .page-login .action-back.active { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - filter: none; -} -.eq-ie8 .actions-image-uploader .action-upload { - filter: none; -} -.eq-ie8 select[disabled="disabled"][multiple="multiple"] option[selected="selected"] { - background-color: #ddd; -} -.eq-ie8 .fieldset { - border-width: 0 0 1px; -} -.eq-ie8 .fieldset .fieldset-wrapper .fieldset-wrapper-title, -.eq-ie8 .fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title { - background: #f4f2ef; -} -.eq-ie8 .fieldset-alt, -.eq-ie8 .fieldset-alt > .fieldset { - display: block; - width: 100%; -} -.eq-ie8 .fieldset-alt > .field { - display: inline-block; -} -.eq-ie8 .field.type-price .addon .addafter, -.eq-ie8 .field-price .addon .addafter, -.eq-ie8 .field-special_price .addon .addafter, -.eq-ie8 .field-msrp .addon .addafter { - border-width: 1px 1px 1px 0; -} -.eq-ie8 .field-apply_to .multiselect { - height: 120px; -} -.eq-ie8 .popup-loading { - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; -} -.eq-ie8 .loading-old, -.eq-ie8 .loading-mask { - background: #fff; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; -} -.eq-ie8 .navigation { - background: #726c62; -} -.eq-ie8 .navigation:before { - border-top: 1px solid #46433d; -} -.eq-ie8 .navigation .level-0.active > a { - background: #625d54; -} -.eq-ie8 .navigation .level-0.active > a, -.eq-ie8 .navigation .level-0:hover > a, -.eq-ie8 .navigation .level-0.hover > a { - border-top: 1px solid #46433d; - padding-top: 36px; -} -.eq-ie8 .navigation .level-0 > .submenu .column { - float: left; -} -.eq-ie8 .navigation .level-0.item-system > a, -.eq-ie8 .navigation .level-0.item-system:hover > a, -.eq-ie8 .navigation .level-0.item-system.hover > a, -.eq-ie8 .navigation .level-0.item-stores > a, -.eq-ie8 .navigation .level-0.item-stores:hover > a, -.eq-ie8 .navigation .level-0.item-stores.hover > a { - border-top: 0; - padding-top: 0; -} -.eq-ie8 .navigation .level-0.item-system > a:before, -.eq-ie8 .navigation .level-0.item-system > a:after, -.eq-ie8 .navigation .level-0.item-stores > a:before, -.eq-ie8 .navigation .level-0.item-stores > a:after { - display: none; -} -.eq-ie8 .page-login .field-username label, -.eq-ie8 .page-login .field-password label, -.eq-ie8 .page-login .field-confirmation label { - display: block; -} -.eq-ie8 .message-noscript, -.eq-ie8 .message-demo-mode { - border-bottom: 1px solid #46433d; -} -.eq-ie8 .store-switcher-alt .store-selected:after { - vertical-align: middle; -} -.eq-ie8 .store-switcher-website { - border-bottom: 0; -} -.eq-ie8 .store-switcher-store-view { - border-bottom: 0; - border-top: 1px solid #e5e5e5; -} -.eq-ie8 .switcher-label:after { - content: 'off'; - overflow: hidden; - white-space: nowrap; - text-indent: 100%; -} -.eq-ie8 .switcher.checked .switcher-label:after { - background-position: -34px 0; - content: 'on'; -} -.eq-ie8 .switcher.checked .switcher-label:before { - content: attr(data-text-on); -} -.eq-ie8 .grid table td.empty-text { - border-width: 0 1px 1px; -} -.eq-ie8 .grid table tr td.empty-text { - border-width: 0 1px 1px; -} -.eq-ie8 .grid .filter .date img { - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); -} -.eq-ie8 .massaction .entry-edit .field-row:first-child { - margin-right: 1px; -} -.eq-ie8 .massaction .entry-edit .field-row { - display: inline; -} -.eq-ie8 .data-table td, -.eq-ie8 .data-table tbody tr td { - border-width: 0 0 1px; -} -.eq-ie8 .data-table td > .field { - margin-bottom: 0; -} -.eq-ie8 .data-table tfoot tr td { - border: none; -} -.eq-ie8 .customer-information .data-table tbody tr td, -.eq-ie8 .customer-information .data-table tbody tr th, -.eq-ie8 .order-information .data-table tbody tr td, -.eq-ie8 .order-information .data-table tbody tr th, -.eq-ie8 .order-account-information .data-table tbody tr td, -.eq-ie8 .order-account-information .data-table tbody tr th, -.eq-ie8 [class^=" adminhtml-rma-"] .data-table tbody tr td, -.eq-ie8 [class^=" adminhtml-rma-"] .data-table tbody tr th, -.eq-ie8 [class^=" sales-transactions-"] .data-table tbody tr th, -.eq-ie8 [class^=" sales-transactions-"] .data-table tbody tr td, -.eq-ie8 [class^=" sales-"] .order-payment-method .data-table tbody tr th, -.eq-ie8 [class^=" sales-"] .order-payment-method .data-table tbody tr td, -.eq-ie8 [class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th, -.eq-ie8 [class^=" sales-billing-agreement-"] .log-details .data-table tbody tr td { - border-bottom: 1px solid #ededed; -} -.eq-ie8 .widget-layout-updates .data-table { - table-layout: auto; -} -.eq-ie8 .massaction { - border-bottom: 2px solid #504d46; -} -.eq-ie8 .header { - background: #f5f2ea; -} -.eq-ie8 .header-panel .dropdown-menu { - border: 1px solid #c3bcaf; -} -.eq-ie8 .header-panel .notifications-icon:before { - bottom: -6px; -} -.eq-ie8 .header-panel .notifications > .dropdown-menu > li:hover { - margin-top: 0; - padding-top: 13px; -} -.eq-ie8 .header-panel .dropdown-menu > li:hover:after { - display: block; -} -.eq-ie8 .header-panel .notifications > .dropdown-menu .action-close { - filter: none; -} -.eq-ie8 .header .header-panel .notifications .action-more { - filter: none; -} -.eq-ie8 .header .header-panel .notifications .action-more { - margin-bottom: -1px; -} -.eq-ie8 .autocomplete-results { - margin-top: -10px; -} -.eq-ie8 .search button[type="submit"]:before { - line-height: 1.3; -} -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back, -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back:hover, -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back:active, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back:hover, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back:active { - filter: none; - border: 0; -} -.eq-ie8 .sales-order-index .col-1-layout table.data { - table-layout: auto; - word-wrap: normal; -} -.eq-ie8 .accordion .config legend { - position: absolute; - left: -999em; - display: block; - width: 0; - height: 0; - padding: 0; - margin: 0; - overflow: hidden; -} diff --git a/app/design/adminhtml/magento_backend/images/icons-dashboard-switcher.png b/app/design/adminhtml/magento_backend/images/icons-dashboard-switcher.png deleted file mode 100644 index 97ac12ac8e6b32102ec2b2f11beb73820d649e49..0000000000000000000000000000000000000000 Binary files a/app/design/adminhtml/magento_backend/images/icons-dashboard-switcher.png and /dev/null differ diff --git a/app/design/adminhtml/magento_backend/less/styles/styles-ie8.less b/app/design/adminhtml/magento_backend/less/styles/styles-ie8.less deleted file mode 100644 index 22702520f0034eeeca7faeaa96650367a1ea084d..0000000000000000000000000000000000000000 --- a/app/design/adminhtml/magento_backend/less/styles/styles-ie8.less +++ /dev/null @@ -1,372 +0,0 @@ -/** -// * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -// Reset 'button view' for actions -.eq-ie8 .customer-current-activity .action-refresh, -.eq-ie8 .pager .action-next, -.eq-ie8 .pager .action-previous, -.eq-ie8 .pager .action-next:hover, -.eq-ie8 .pager .action-previous:hover, -.eq-ie8 .pager .action-next.disabled:focus, -.eq-ie8 .pager .action-previous.disabled:focus, -.eq-ie8 .pager .action-next.disabled:active, -.eq-ie8 .pager .action-previous.disabled:active, -.eq-ie8 .data-table .action-.delete, -.eq-ie8 .data-table .action-.delete:hover, -.eq-ie8 .data-table .action-.delete:active, -.eq-ie8 .data-table .action-.delete.active, -.eq-ie8 .data-table .action-delete, -.eq-ie8 .data-table .action-delete:hover, -.eq-ie8 .data-table .action-delete:active, -.eq-ie8 .data-table .action-delete.active, -.eq-ie8 .data-table .action-locked, -.eq-ie8 .data-table .action-locked:hover, -.eq-ie8 .data-table .action-locked:active, -.eq-ie8 .data-table .action-locked.active, -.eq-ie8 #product-variations-matrix .action-choose, -.eq-ie8 #product-variations-matrix .action-choose:hover, -.eq-ie8 #product-variations-matrix .action-choose:active, -.eq-ie8 #product-variations-matrix .action-choose.active, -.eq-ie8 .image-panel .action-close, -.eq-ie8 .eq-ie8 .image-panel .action-close:hover, -.eq-ie8 .image-panel .action-close:active, -.eq-ie8 .image-panel .action-close.active, -.eq-ie8 .image-panel-controls .action-remove, -.eq-ie8 .image-panel-controls .action-remove:hover, -.eq-ie8 .image-panel-controls .action-remove:active, -.eq-ie8 .image-panel-controls .action-remove.active, -.eq-ie8 .suggest-expandable .action-show-all, -.eq-ie8 .suggest-expandable .action-show-all:hover, -.eq-ie8 .suggest-expandable .action-show-all:active, -.eq-ie8 .suggest-expandable .action-show-all.active, -.eq-ie8 .vde-tools-header .action-close, -.eq-ie8 .vde-tools-header .action-close:hover, -.eq-ie8 .vde-tools-header .action-close:active, -.eq-ie8 .vde-tools-header .action-close.active, -.eq-ie8 .image .action-delete, -.eq-ie8 .image .action-delete:hover, -.eq-ie8 .image .action-delete:active, -.eq-ie8 .image .action-delete.active, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete:hover, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete:active, -.eq-ie8 .fieldset-wrapper-title .actions .action-delete.active, -.eq-ie8 .address-list-item-actions .action-delete, -.eq-ie8 .address-list-item-actions .action-delete:hover, -.eq-ie8 .address-list-item-actions .action-delete:active, -.eq-ie8 .address-list-item-actions .action-delete.active, -.eq-ie8 .notification .action-close, -.eq-ie8 .notification .action-close:hover, -.eq-ie8 .notification .action-close:active, -.eq-ie8 .notification .action-close.active, -.eq-ie8 .page-login .action-forgotpassword, -.eq-ie8 .page-login .action-forgotpassword:hover, -.eq-ie8 .page-login .action-forgotpassword:active, -.eq-ie8 .page-login .action-forgotpassword.active, -.eq-ie8 .page-login .action-back, -.eq-ie8 .page-login .action-back:hover, -.eq-ie8 .page-login .action-back:active, -.eq-ie8 .page-login .action-back.active { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - filter: none; -} - -// Variations Image Uploader - -.eq-ie8 .actions-image-uploader .action-upload { - filter: none; -} - -// Forms - -.eq-ie8 select[disabled="disabled"][multiple="multiple"] option[selected="selected"] { - background-color: #ddd; -} - -.eq-ie8 .fieldset { - border-width: 0 0 1px; -} - -.eq-ie8 .fieldset .fieldset-wrapper .fieldset-wrapper-title, -.eq-ie8 .fieldset-wrapper .fieldset-wrapper .fieldset-wrapper-title { - background: #f4f2ef; -} - -.eq-ie8 .fieldset-alt, -.eq-ie8 .fieldset-alt > .fieldset { - display: block; - width: 100%; -} - -.eq-ie8 .fieldset-alt > .field { - display: inline-block; -} - -.eq-ie8 .field.type-price .addon .addafter, -.eq-ie8 .field-price .addon .addafter, -.eq-ie8 .field-special_price .addon .addafter, -.eq-ie8 .field-msrp .addon .addafter { - border-width: 1px 1px 1px 0; -} - -.eq-ie8 .field-apply_to .multiselect { - height: 120px; -} - -// Popups - -.eq-ie8 .popup-loading { - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; -} - -.eq-ie8 .loading-old, -.eq-ie8 .loading-mask { - background: #fff; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; -} - -// Global Navigation -.eq-ie8 .navigation { - background: #726c62; -} - -.eq-ie8 .navigation:before { - border-top: 1px solid #46433d; -} - -.eq-ie8 .navigation .level-0.active > a { - background: #625d54; -} - -.eq-ie8 .navigation .level-0.active > a, -.eq-ie8 .navigation .level-0:hover > a, -.eq-ie8 .navigation .level-0.hover > a { - border-top: 1px solid #46433d; - padding-top: 36px; -} - -.eq-ie8 .navigation .level-0 > .submenu .column { - float: left; -} - -.eq-ie8 .navigation .level-0.item-system > a, -.eq-ie8 .navigation .level-0.item-system:hover > a, -.eq-ie8 .navigation .level-0.item-system.hover > a, -.eq-ie8 .navigation .level-0.item-stores > a, -.eq-ie8 .navigation .level-0.item-stores:hover > a, -.eq-ie8 .navigation .level-0.item-stores.hover > a { - border-top: 0; - padding-top: 0; -} - -.eq-ie8 .navigation .level-0.item-system > a:before, -.eq-ie8 .navigation .level-0.item-system > a:after, -.eq-ie8 .navigation .level-0.item-stores > a:before, -.eq-ie8 .navigation .level-0.item-stores > a:after { - display: none; -} - -.eq-ie8 .page-login .field-username label, -.eq-ie8 .page-login .field-password label, -.eq-ie8 .page-login .field-confirmation label { - display: block; -} - -.eq-ie8 .message-noscript, -.eq-ie8 .message-demo-mode { - border-bottom: 1px solid #46433d; -} - -// Switcher -.eq-ie8 .store-switcher-alt .store-selected:after { - vertical-align: middle; -} - -.eq-ie8 .store-switcher-website { - border-bottom: 0; -} - -.eq-ie8 .store-switcher-store-view { - border-bottom: 0; - border-top: 1px solid #e5e5e5; -} - -.eq-ie8 .switcher-label:after { - content: 'off'; - overflow: hidden; - white-space: nowrap; - text-indent: 100%; -} - -.eq-ie8 .switcher.checked .switcher-label:after { - background-position: -34px 0; - content: 'on'; -} - -.eq-ie8 .switcher.checked .switcher-label:before { - content: attr(data-text-on); -} - -// Table Grid - -.eq-ie8 .grid table td.empty-text { - border-width: 0 1px 1px; -} - -.eq-ie8 .grid table tr td.empty-text { - border-width: 0 1px 1px; -} - -.eq-ie8 .grid .filter .date img { - filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); -} - -.eq-ie8 .massaction .entry-edit .field-row:first-child { - margin-right: 1px; -} - -.eq-ie8 .massaction .entry-edit .field-row { - display: inline; -} - -// Data table - -.eq-ie8 .data-table td, -.eq-ie8 .data-table tbody tr td { - border-width: 0 0 1px; -} - -.eq-ie8 .data-table td > .field { - margin-bottom: 0; -} - -.eq-ie8 .data-table tfoot tr td { - border: none; -} - -// Data table - alternative view - -.eq-ie8 .customer-information .data-table tbody tr td, -.eq-ie8 .customer-information .data-table tbody tr th, -.eq-ie8 .order-information .data-table tbody tr td, -.eq-ie8 .order-information .data-table tbody tr th, -.eq-ie8 .order-account-information .data-table tbody tr td, -.eq-ie8 .order-account-information .data-table tbody tr th, -.eq-ie8 [class^=" adminhtml-rma-"] .data-table tbody tr td, -.eq-ie8 [class^=" adminhtml-rma-"] .data-table tbody tr th, -.eq-ie8 [class^=" sales-transactions-"] .data-table tbody tr th, -.eq-ie8 [class^=" sales-transactions-"] .data-table tbody tr td, -.eq-ie8 [class^=" sales-"] .order-payment-method .data-table tbody tr th, -.eq-ie8 [class^=" sales-"] .order-payment-method .data-table tbody tr td, -.eq-ie8 [class^=" sales-billing-agreement-"] .log-details .data-table tbody tr th, -.eq-ie8 [class^=" sales-billing-agreement-"] .log-details .data-table tbody tr td { - border-bottom: 1px solid #ededed; -} - -// Widgets -.eq-ie8 .widget-layout-updates .data-table { - table-layout: auto; -} - -// Grid - Mass Action - -.eq-ie8 .massaction { - border-bottom: 2px solid #504d46; -} - -// Header -.eq-ie8 .header { - background: #f5f2ea; -} - -.eq-ie8 .header-panel .dropdown-menu { - border: 1px solid #c3bcaf; -} - -.eq-ie8 .header-panel .notifications-icon:before { - bottom: -6px; -} - -.eq-ie8 .header-panel .notifications > .dropdown-menu > li:hover { - margin-top: 0; - padding-top: 13px; -} - -.eq-ie8 .header-panel .dropdown-menu > li:hover:after { - display: block; -} - -.eq-ie8 .header-panel .notifications > .dropdown-menu .action-close { - filter: none; -} - -.eq-ie8 .header .header-panel .notifications .action-more { - filter: none; -} - -.eq-ie8 .header .header-panel .notifications .action-more { - margin-bottom: -1px; -} - -.eq-ie8 .autocomplete-results { - margin-top: -10px; -} - -.eq-ie8 .search button[type="submit"]:before { - line-height: 1.3; -} - -// Product Creation - -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back, -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back:hover, -.eq-ie8 [class^=" catalog-product-"] .page-actions .action-back:active, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back:hover, -.eq-ie8 [class^=" newsletter-"] .page-actions .action-back:active { - filter: none; - border: 0; -} - -.eq-ie8 .sales-order-index .col-1-layout table.data { - table-layout: auto; - word-wrap: normal; -} - -// Accordion -.eq-ie8 .accordion .config legend { - position: absolute; - left: -999em; - display: block; - width: 0; - height: 0; - padding: 0; - margin: 0; - overflow: hidden; -} diff --git a/app/design/frontend/magento_blank/Magento_Bundle/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Bundle/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Bundle/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Bundle/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Catalog/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Catalog/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Catalog/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Catalog/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Catalog/css/source/widgets.less b/app/design/frontend/Magento/blank/Magento_Catalog/css/source/widgets.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Catalog/css/source/widgets.less rename to app/design/frontend/Magento/blank/Magento_Catalog/css/source/widgets.less diff --git a/app/design/frontend/magento_blank/Magento_Catalog/layout/catalog_product_view.xml b/app/design/frontend/Magento/blank/Magento_Catalog/layout/catalog_product_view.xml similarity index 91% rename from app/design/frontend/magento_blank/Magento_Catalog/layout/catalog_product_view.xml rename to app/design/frontend/Magento/blank/Magento_Catalog/layout/catalog_product_view.xml index 6aab1c931a79d3a8a9aba802cc06f206a20e702d..de403ef3008141ab7a325e6f9be1174c066e55a0 100644 --- a/app/design/frontend/magento_blank/Magento_Catalog/layout/catalog_product_view.xml +++ b/app/design/frontend/Magento/blank/Magento_Catalog/layout/catalog_product_view.xml @@ -24,6 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <move element="page.main.title" destination="product.info.main" before="-"/> </layout> diff --git a/app/design/frontend/magento_blank/Magento_CatalogSearch/css/source/module.less b/app/design/frontend/Magento/blank/Magento_CatalogSearch/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_CatalogSearch/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_CatalogSearch/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Checkout/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Checkout/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Checkout/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Checkout/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Checkout/layout/checkout_cart_index.xml b/app/design/frontend/Magento/blank/Magento_Checkout/layout/checkout_cart_index.xml similarity index 95% rename from app/design/frontend/magento_blank/Magento_Checkout/layout/checkout_cart_index.xml rename to app/design/frontend/Magento/blank/Magento_Checkout/layout/checkout_cart_index.xml index 0f0ce34ed82e3587a277f5889a0e5f840043cb5a..4cbae46355b06ee88a108a438be17f44047cd783 100644 --- a/app/design/frontend/magento_blank/Magento_Checkout/layout/checkout_cart_index.xml +++ b/app/design/frontend/Magento/blank/Magento_Checkout/layout/checkout_cart_index.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <update handle="page_one_column" /> <referenceContainer name="checkout.cart.items"> <container name="checkout.cart.container" label="invisible" htmlTag="div" htmlClass="cart container" before="-"> diff --git a/app/design/frontend/magento_blank/Magento_Cms/css/source/widgets.less b/app/design/frontend/Magento/blank/Magento_Cms/css/source/widgets.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Cms/css/source/widgets.less rename to app/design/frontend/Magento/blank/Magento_Cms/css/source/widgets.less diff --git a/app/design/frontend/magento_blank/Magento_Customer/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Customer/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Customer/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Customer/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Downloadable/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Downloadable/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Downloadable/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Downloadable/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Newsletter/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Newsletter/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Newsletter/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Newsletter/css/source/module.less diff --git a/app/design/frontend/magento_blank/MAgento_Paypal/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Paypal/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/MAgento_Paypal/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Paypal/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Reports/css/source/widgets.less b/app/design/frontend/Magento/blank/Magento_Reports/css/source/widgets.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Reports/css/source/widgets.less rename to app/design/frontend/Magento/blank/Magento_Reports/css/source/widgets.less diff --git a/app/design/frontend/magento_blank/Magento_Review/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Review/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Review/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Review/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Sales/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Sales/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Sales/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Sales/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Sales/css/source/widgets.less b/app/design/frontend/Magento/blank/Magento_Sales/css/source/widgets.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Sales/css/source/widgets.less rename to app/design/frontend/Magento/blank/Magento_Sales/css/source/widgets.less diff --git a/app/design/frontend/magento_blank/Magento_Sendfriend/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Sendfriend/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Sendfriend/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Sendfriend/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Theme/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Theme/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Theme/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Theme/css/source/module.less diff --git a/app/design/frontend/magento_blank/Magento_Theme/layout/default.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default.xml similarity index 92% rename from app/design/frontend/magento_blank/Magento_Theme/layout/default.xml rename to app/design/frontend/Magento/blank/Magento_Theme/layout/default.xml index 4d910008352a219c9aa2e52ee52ad80e96361695..e7f75fe1dac5dfd6e9ca8b3fefb8198f8039ce94 100644 --- a/app/design/frontend/magento_blank/Magento_Theme/layout/default.xml +++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceContainer name="header-container"> <container name="header.panel.wrapper" htmlClass="panel wrapper" htmlTag="div" before="-" /> </referenceContainer> diff --git a/app/design/frontend/magento_blank/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml similarity index 93% rename from app/design/frontend/magento_blank/Magento_Theme/layout/default_head_blocks.xml rename to app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml index 500ae91c6d32a12a62c82c2909c11a5b90ddca7a..5ba299de040ce9a665f7a03d0bd2668a3ee00896 100644 --- a/app/design/frontend/magento_blank/Magento_Theme/layout/default_head_blocks.xml +++ b/app/design/frontend/Magento/blank/Magento_Theme/layout/default_head_blocks.xml @@ -23,8 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="head"> <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-css"> <arguments> diff --git a/app/design/frontend/magento_blank/Magento_Wishlist/css/source/module.less b/app/design/frontend/Magento/blank/Magento_Wishlist/css/source/module.less similarity index 100% rename from app/design/frontend/magento_blank/Magento_Wishlist/css/source/module.less rename to app/design/frontend/Magento/blank/Magento_Wishlist/css/source/module.less diff --git a/app/design/frontend/magento_blank/css/print.less b/app/design/frontend/Magento/blank/css/print.less similarity index 98% rename from app/design/frontend/magento_blank/css/print.less rename to app/design/frontend/Magento/blank/css/print.less index 902dd8452a4c417c4a39550859849a43f4973d21..c6b6105e80b0f32b6605ecaeb654e39592c127dc 100644 --- a/app/design/frontend/magento_blank/css/print.less +++ b/app/design/frontend/Magento/blank/css/print.less @@ -22,4 +22,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/* magento_blank */ +/* Magento/blank */ diff --git a/app/design/frontend/magento_blank/css/source/abstract.less b/app/design/frontend/Magento/blank/css/source/abstract.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/abstract.less rename to app/design/frontend/Magento/blank/css/source/abstract.less diff --git a/app/design/frontend/magento_blank/css/source/actions-toolbar.less b/app/design/frontend/Magento/blank/css/source/actions-toolbar.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/actions-toolbar.less rename to app/design/frontend/Magento/blank/css/source/actions-toolbar.less diff --git a/app/design/frontend/magento_blank/css/source/breadcrumbs.less b/app/design/frontend/Magento/blank/css/source/breadcrumbs.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/breadcrumbs.less rename to app/design/frontend/Magento/blank/css/source/breadcrumbs.less diff --git a/app/design/frontend/magento_blank/css/source/buttons.less b/app/design/frontend/Magento/blank/css/source/buttons.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/buttons.less rename to app/design/frontend/Magento/blank/css/source/buttons.less diff --git a/app/design/frontend/magento_blank/css/source/dropdowns.less b/app/design/frontend/Magento/blank/css/source/dropdowns.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/dropdowns.less rename to app/design/frontend/Magento/blank/css/source/dropdowns.less diff --git a/app/design/frontend/magento_blank/css/source/forms.less b/app/design/frontend/Magento/blank/css/source/forms.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/forms.less rename to app/design/frontend/Magento/blank/css/source/forms.less diff --git a/app/design/frontend/magento_blank/css/source/icons.less b/app/design/frontend/Magento/blank/css/source/icons.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/icons.less rename to app/design/frontend/Magento/blank/css/source/icons.less diff --git a/app/design/frontend/magento_blank/css/source/layout.less b/app/design/frontend/Magento/blank/css/source/layout.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/layout.less rename to app/design/frontend/Magento/blank/css/source/layout.less diff --git a/app/design/frontend/magento_blank/css/source/loaders.less b/app/design/frontend/Magento/blank/css/source/loaders.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/loaders.less rename to app/design/frontend/Magento/blank/css/source/loaders.less diff --git a/app/design/frontend/magento_blank/css/source/messages.less b/app/design/frontend/Magento/blank/css/source/messages.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/messages.less rename to app/design/frontend/Magento/blank/css/source/messages.less diff --git a/app/design/frontend/magento_blank/css/source/navigation.less b/app/design/frontend/Magento/blank/css/source/navigation.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/navigation.less rename to app/design/frontend/Magento/blank/css/source/navigation.less diff --git a/app/design/frontend/magento_blank/css/source/pages.less b/app/design/frontend/Magento/blank/css/source/pages.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/pages.less rename to app/design/frontend/Magento/blank/css/source/pages.less diff --git a/app/design/frontend/magento_blank/css/source/popups.less b/app/design/frontend/Magento/blank/css/source/popups.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/popups.less rename to app/design/frontend/Magento/blank/css/source/popups.less diff --git a/app/design/frontend/magento_blank/css/source/rating.less b/app/design/frontend/Magento/blank/css/source/rating.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/rating.less rename to app/design/frontend/Magento/blank/css/source/rating.less diff --git a/app/design/frontend/magento_blank/css/source/sections.less b/app/design/frontend/Magento/blank/css/source/sections.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/sections.less rename to app/design/frontend/Magento/blank/css/source/sections.less diff --git a/app/design/frontend/magento_blank/css/source/tables.less b/app/design/frontend/Magento/blank/css/source/tables.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/tables.less rename to app/design/frontend/Magento/blank/css/source/tables.less diff --git a/app/design/frontend/magento_blank/css/source/theme.less b/app/design/frontend/Magento/blank/css/source/theme.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/theme.less rename to app/design/frontend/Magento/blank/css/source/theme.less diff --git a/app/design/frontend/magento_blank/css/source/tooltips.less b/app/design/frontend/Magento/blank/css/source/tooltips.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/tooltips.less rename to app/design/frontend/Magento/blank/css/source/tooltips.less diff --git a/app/design/frontend/magento_blank/css/source/typography.less b/app/design/frontend/Magento/blank/css/source/typography.less similarity index 100% rename from app/design/frontend/magento_blank/css/source/typography.less rename to app/design/frontend/Magento/blank/css/source/typography.less diff --git a/app/design/frontend/magento_blank/css/styles.less b/app/design/frontend/Magento/blank/css/styles.less similarity index 99% rename from app/design/frontend/magento_blank/css/styles.less rename to app/design/frontend/Magento/blank/css/styles.less index fd0fb2a8c5629533ef16dc7014e5acea20a4bb5b..9c979ca902e71b1af97437650086426770842e45 100644 --- a/app/design/frontend/magento_blank/css/styles.less +++ b/app/design/frontend/Magento/blank/css/styles.less @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/* magento_blank */ +/* Magento/blank */ .magento-reset(); // Reset default styles with magento_reset diff --git a/app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.eot b/app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.eot similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.eot rename to app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.eot diff --git a/app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.svg b/app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.svg similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.svg rename to app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.svg diff --git a/app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.ttf b/app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.ttf similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.ttf rename to app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.ttf diff --git a/app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.woff b/app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.woff similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/bold/opensans-700.woff rename to app/design/frontend/Magento/blank/fonts/opensans/bold/opensans-700.woff diff --git a/app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.eot b/app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.eot similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.eot rename to app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.eot diff --git a/app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.svg b/app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.svg similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.svg rename to app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.svg diff --git a/app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.ttf b/app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.ttf similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.ttf rename to app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.ttf diff --git a/app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.woff b/app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.woff similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/light/opensans-300.woff rename to app/design/frontend/Magento/blank/fonts/opensans/light/opensans-300.woff diff --git a/app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.eot b/app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.eot similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.eot rename to app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.eot diff --git a/app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.svg b/app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.svg similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.svg rename to app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.svg diff --git a/app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.ttf b/app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.ttf similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.ttf rename to app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.ttf diff --git a/app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.woff b/app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.woff similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/regular/opensans-400.woff rename to app/design/frontend/Magento/blank/fonts/opensans/regular/opensans-400.woff diff --git a/app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.eot b/app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.eot similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.eot rename to app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.eot diff --git a/app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.svg b/app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.svg similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.svg rename to app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.svg diff --git a/app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.ttf b/app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.ttf similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.ttf rename to app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.ttf diff --git a/app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.woff b/app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.woff similarity index 100% rename from app/design/frontend/magento_blank/fonts/opensans/semibold/opensans-600.woff rename to app/design/frontend/Magento/blank/fonts/opensans/semibold/opensans-600.woff diff --git a/app/design/frontend/magento_blank/images/logo.gif b/app/design/frontend/Magento/blank/images/logo.gif similarity index 100% rename from app/design/frontend/magento_blank/images/logo.gif rename to app/design/frontend/Magento/blank/images/logo.gif diff --git a/app/design/frontend/magento_blank/js/navigation-menu.js b/app/design/frontend/Magento/blank/js/navigation-menu.js similarity index 100% rename from app/design/frontend/magento_blank/js/navigation-menu.js rename to app/design/frontend/Magento/blank/js/navigation-menu.js diff --git a/app/design/frontend/magento_blank/js/responsive.js b/app/design/frontend/Magento/blank/js/responsive.js similarity index 100% rename from app/design/frontend/magento_blank/js/responsive.js rename to app/design/frontend/Magento/blank/js/responsive.js diff --git a/app/design/frontend/magento_blank/js/theme.js b/app/design/frontend/Magento/blank/js/theme.js similarity index 100% rename from app/design/frontend/magento_blank/js/theme.js rename to app/design/frontend/Magento/blank/js/theme.js diff --git a/app/design/frontend/magento_blank/media/preview.jpg b/app/design/frontend/Magento/blank/media/preview.jpg similarity index 100% rename from app/design/frontend/magento_blank/media/preview.jpg rename to app/design/frontend/Magento/blank/media/preview.jpg diff --git a/app/design/frontend/magento_blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml similarity index 93% rename from app/design/frontend/magento_blank/theme.xml rename to app/design/frontend/Magento/blank/theme.xml index 7a726a14ef17bd96602928cffa067eea6f92b457..fc51b32cca0f4211560ad872b6422d89f5cbb9ce 100644 --- a/app/design/frontend/magento_blank/theme.xml +++ b/app/design/frontend/Magento/blank/theme.xml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/theme.xsd"> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Magento Blank</title> <version>2.0.0.0</version> <media> diff --git a/app/design/frontend/magento_blank/view.xml b/app/design/frontend/Magento/blank/view.xml similarity index 99% rename from app/design/frontend/magento_blank/view.xml rename to app/design/frontend/Magento/blank/view.xml index 0a5df3b13499c7348d05d4f0ad3288c2c8474808..7b7373ac45e687a0719189baab6d4931a4287ca4 100644 --- a/app/design/frontend/magento_blank/view.xml +++ b/app/design/frontend/Magento/blank/view.xml @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/view.xsd"> +<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/view.xsd"> <vars module="Magento_Catalog"> <var name="product_small_image_sidebar_size">100</var> <!-- Override for small product image --> <var name="product_base_image_size">275</var> <!-- Override for base product image --> diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_category_view.xml b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml similarity index 93% rename from app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_category_view.xml rename to app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml index bd7034cce3f2f1487ba4757483b2327d5b2dc565..ed2bf54c46851858b5d188260d21cb99477e56ea 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_category_view.xml +++ b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="product_list"> <arguments> <!-- If position of argument is depend on image size changable in VDE: diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml similarity index 93% rename from app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml rename to app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml index 96e7dc7e6282eec1898a6530fc59b73a836ad8c1..964aa4638fab991310c852ebbfdda1f15170dff9 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml +++ b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <move element="product.info" destination="product.info.main" after="product.tierprices"/> <move element="page.main.title" destination="product.info.main" before="-"/> <move element="product.info.overview" destination="product.info.details" before="-" as="product_overview"/> diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/default.xml similarity index 92% rename from app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml rename to app/design/frontend/Magento/plushe/Magento_Catalog/layout/default.xml index 08edc52663f21869d9d87706d0508a40fcd19669..77689376e96a9b93ad39818efa5b0bd875c8baf2 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml +++ b/app/design/frontend/Magento/plushe/Magento_Catalog/layout/default.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="header.links"> <block class="Magento\Catalog\Block\Product\Compare\Link" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml"/> </referenceBlock> diff --git a/app/design/frontend/magento_plushe/Magento_Checkout/layout/checkout_cart_index.xml b/app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml similarity index 96% rename from app/design/frontend/magento_plushe/Magento_Checkout/layout/checkout_cart_index.xml rename to app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml index 41bb0b9497c0fc7851483aae62b3b970521e867c..c1be59f5e04518dd4c7f1ae801e8ee74628203af 100644 --- a/app/design/frontend/magento_plushe/Magento_Checkout/layout/checkout_cart_index.xml +++ b/app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <update handle="page_one_column" /> <referenceContainer name="checkout.cart.items"> <container name="checkout.cart.container" label="invisible" htmlTag="div" htmlClass="cart container" before="-"> diff --git a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml b/app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml similarity index 94% rename from app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml rename to app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml index 8990f982761e6b6722caf404a67ad0fc2fc0fdb0..a6c4e24a9a3f8f012d91798cd718eb2f23a0ce54 100644 --- a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml +++ b/app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="header.links"> <block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/> <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login"/> diff --git a/app/design/frontend/magento_plushe/Magento_DesignEditor/controls/image_sizing.xml b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml similarity index 99% rename from app/design/frontend/magento_plushe/Magento_DesignEditor/controls/image_sizing.xml rename to app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml index fa723fd83d8c69c458ea392402bc4061c583214f..ecb7b5efbfecebd7f0ffb8057eae2f464efc6657 100644 --- a/app/design/frontend/magento_plushe/Magento_DesignEditor/controls/image_sizing.xml +++ b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml @@ -26,7 +26,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<controls xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/DesignEditor/etc/image_sizing.xsd"> +<controls xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/DesignEditor/etc/image_sizing.xsd"> <control name="product_image_border" title="Product image white borders"> <type>white-border</type> <components> diff --git a/app/design/frontend/magento_plushe/Magento_DesignEditor/controls/quick_styles.xml b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml similarity index 99% rename from app/design/frontend/magento_plushe/Magento_DesignEditor/controls/quick_styles.xml rename to app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml index 4e5e64a3ff6ea15008f895be31c879ace8d19279..44b5f618b18d2411ffc79ce429b7e7cd436b8834 100644 --- a/app/design/frontend/magento_plushe/Magento_DesignEditor/controls/quick_styles.xml +++ b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml @@ -26,7 +26,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<controls xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/DesignEditor/etc/quick_styles.xsd"> +<controls xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/DesignEditor/etc/quick_styles.xsd"> <control name="store-name" title="Store Name" tab="header" column="left"> <type>logo</type> <components> diff --git a/app/design/frontend/magento_plushe/Magento_Reports/layout/catalog_product_view.xml b/app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml similarity index 95% rename from app/design/frontend/magento_plushe/Magento_Reports/layout/catalog_product_view.xml rename to app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml index 9d97ea635106e4af17159db33c52398b2973d47d..455dc6c5b614c03de350fcb35b97d775241ea59a 100644 --- a/app/design/frontend/magento_plushe/Magento_Reports/layout/catalog_product_view.xml +++ b/app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceContainer name="content"> <block class="Magento\Reports\Block\Product\Widget\Viewed\Item" name="product.widget.viewed.item" template="Magento_Reports::product/widget/viewed/item.phtml"> <arguments> diff --git a/app/design/frontend/magento_plushe/Magento_Review/layout/catalog_product_view.xml b/app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml similarity index 95% rename from app/design/frontend/magento_plushe/Magento_Review/layout/catalog_product_view.xml rename to app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml index 4ea69a0fe4fa0cb47d73b627571f4264379114ea..d49f0001bb6d8ad4fb45bad52cfdeccedaea716c 100644 --- a/app/design/frontend/magento_plushe/Magento_Review/layout/catalog_product_view.xml +++ b/app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="product.info.details"> <block class="Magento\Catalog\Block\Product\View\Additional" name="product.info.reviews.tab" as="product_reviews" group="detailed_info"> <arguments> diff --git a/app/design/frontend/magento_plushe/Magento_Review/layout/review_product_list.xml b/app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml similarity index 93% rename from app/design/frontend/magento_plushe/Magento_Review/layout/review_product_list.xml rename to app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml index e2e8c15e357886718cba8255f09de34225822d08..5148d484f3f99128621276d12d658fd30d42ed84 100644 --- a/app/design/frontend/magento_plushe/Magento_Review/layout/review_product_list.xml +++ b/app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="root"> <action method="setTemplate"> <argument name="template" xsi:type="string">blank.phtml</argument> diff --git a/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml similarity index 95% rename from app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml rename to app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml index 3fd2598b328a2482b776f7dcf7f04d81f73291cc..b29dc94589515764d92b838cdded03dc6c92e68f 100644 --- a/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml +++ b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="logo"> <arguments> <argument name="theme_name" xsi:type="string">plushe</argument> diff --git a/app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml similarity index 97% rename from app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml rename to app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml index b1b6788a938040569ff9d496e30fef0636b04dad..1765210c64335e363537f04d5ee0e939ce5fdcb0 100644 --- a/app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml +++ b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <referenceBlock name="head"> <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-css"> <arguments> diff --git a/app/design/frontend/magento_plushe/css/print.css b/app/design/frontend/Magento/plushe/css/print.css similarity index 100% rename from app/design/frontend/magento_plushe/css/print.css rename to app/design/frontend/Magento/plushe/css/print.css diff --git a/app/design/frontend/magento_plushe/css/source/clearless/all.less b/app/design/frontend/Magento/plushe/css/source/clearless/all.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/all.less rename to app/design/frontend/Magento/plushe/css/source/clearless/all.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/arrows.less b/app/design/frontend/Magento/plushe/css/source/clearless/arrows.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/arrows.less rename to app/design/frontend/Magento/plushe/css/source/clearless/arrows.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/grids.less b/app/design/frontend/Magento/plushe/css/source/clearless/grids.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/grids.less rename to app/design/frontend/Magento/plushe/css/source/clearless/grids.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/helpers.less b/app/design/frontend/Magento/plushe/css/source/clearless/helpers.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/helpers.less rename to app/design/frontend/Magento/plushe/css/source/clearless/helpers.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/icons.less b/app/design/frontend/Magento/plushe/css/source/clearless/icons.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/icons.less rename to app/design/frontend/Magento/plushe/css/source/clearless/icons.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/resets.less b/app/design/frontend/Magento/plushe/css/source/clearless/resets.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/resets.less rename to app/design/frontend/Magento/plushe/css/source/clearless/resets.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/settings.less b/app/design/frontend/Magento/plushe/css/source/clearless/settings.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/settings.less rename to app/design/frontend/Magento/plushe/css/source/clearless/settings.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/sprites.less b/app/design/frontend/Magento/plushe/css/source/clearless/sprites.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/sprites.less rename to app/design/frontend/Magento/plushe/css/source/clearless/sprites.less diff --git a/app/design/frontend/magento_plushe/css/source/clearless/typography.less b/app/design/frontend/Magento/plushe/css/source/clearless/typography.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/clearless/typography.less rename to app/design/frontend/Magento/plushe/css/source/clearless/typography.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/buttons.less b/app/design/frontend/Magento/plushe/css/source/lib/buttons.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/buttons.less rename to app/design/frontend/Magento/plushe/css/source/lib/buttons.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/forms.less b/app/design/frontend/Magento/plushe/css/source/lib/forms.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/forms.less rename to app/design/frontend/Magento/plushe/css/source/lib/forms.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/grids.less b/app/design/frontend/Magento/plushe/css/source/lib/grids.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/grids.less rename to app/design/frontend/Magento/plushe/css/source/lib/grids.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/icons.less b/app/design/frontend/Magento/plushe/css/source/lib/icons.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/icons.less rename to app/design/frontend/Magento/plushe/css/source/lib/icons.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/messages.less b/app/design/frontend/Magento/plushe/css/source/lib/messages.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/messages.less rename to app/design/frontend/Magento/plushe/css/source/lib/messages.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/navigation.less b/app/design/frontend/Magento/plushe/css/source/lib/navigation.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/navigation.less rename to app/design/frontend/Magento/plushe/css/source/lib/navigation.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/sections.less b/app/design/frontend/Magento/plushe/css/source/lib/sections.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/sections.less rename to app/design/frontend/Magento/plushe/css/source/lib/sections.less diff --git a/app/design/frontend/magento_plushe/css/source/lib/snippets.less b/app/design/frontend/Magento/plushe/css/source/lib/snippets.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/lib/snippets.less rename to app/design/frontend/Magento/plushe/css/source/lib/snippets.less diff --git a/app/design/frontend/magento_plushe/css/source/responsive/responsive.less b/app/design/frontend/Magento/plushe/css/source/responsive/responsive.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/responsive/responsive.less rename to app/design/frontend/Magento/plushe/css/source/responsive/responsive.less diff --git a/app/design/frontend/magento_plushe/css/source/styles/base.less b/app/design/frontend/Magento/plushe/css/source/styles/base.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/styles/base.less rename to app/design/frontend/Magento/plushe/css/source/styles/base.less diff --git a/app/design/frontend/magento_plushe/css/source/styles/magento.less b/app/design/frontend/Magento/plushe/css/source/styles/magento.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/styles/magento.less rename to app/design/frontend/Magento/plushe/css/source/styles/magento.less diff --git a/app/design/frontend/magento_plushe/css/source/vars.less b/app/design/frontend/Magento/plushe/css/source/vars.less similarity index 100% rename from app/design/frontend/magento_plushe/css/source/vars.less rename to app/design/frontend/Magento/plushe/css/source/vars.less diff --git a/app/design/frontend/magento_plushe/css/styles.less b/app/design/frontend/Magento/plushe/css/styles.less similarity index 100% rename from app/design/frontend/magento_plushe/css/styles.less rename to app/design/frontend/Magento/plushe/css/styles.less diff --git a/app/design/frontend/magento_plushe/fonts/.htaccess b/app/design/frontend/Magento/plushe/fonts/.htaccess similarity index 100% rename from app/design/frontend/magento_plushe/fonts/.htaccess rename to app/design/frontend/Magento/plushe/fonts/.htaccess diff --git a/app/design/frontend/magento_plushe/fonts/icons/icons.dev.svg b/app/design/frontend/Magento/plushe/fonts/icons/icons.dev.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/icons/icons.dev.svg rename to app/design/frontend/Magento/plushe/fonts/icons/icons.dev.svg diff --git a/app/design/frontend/magento_plushe/fonts/icons/icons.eot b/app/design/frontend/Magento/plushe/fonts/icons/icons.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/icons/icons.eot rename to app/design/frontend/Magento/plushe/fonts/icons/icons.eot diff --git a/app/design/frontend/magento_plushe/fonts/icons/icons.svg b/app/design/frontend/Magento/plushe/fonts/icons/icons.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/icons/icons.svg rename to app/design/frontend/Magento/plushe/fonts/icons/icons.svg diff --git a/app/design/frontend/magento_plushe/fonts/icons/icons.ttf b/app/design/frontend/Magento/plushe/fonts/icons/icons.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/icons/icons.ttf rename to app/design/frontend/Magento/plushe/fonts/icons/icons.ttf diff --git a/app/design/frontend/magento_plushe/fonts/icons/icons.woff b/app/design/frontend/Magento/plushe/fonts/icons/icons.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/icons/icons.woff rename to app/design/frontend/Magento/plushe/fonts/icons/icons.woff diff --git a/app/design/frontend/magento_plushe/fonts/marvel/OFL.txt b/app/design/frontend/Magento/plushe/fonts/marvel/OFL.txt similarity index 100% rename from app/design/frontend/magento_plushe/fonts/marvel/OFL.txt rename to app/design/frontend/Magento/plushe/fonts/marvel/OFL.txt diff --git a/app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.eot rename to app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.eot diff --git a/app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.svg rename to app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.svg diff --git a/app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.ttf rename to app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.ttf diff --git a/app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/marvel/marvel-400-normal-webfont.woff rename to app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.woff diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf diff --git a/app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff similarity index 100% rename from app/design/frontend/magento_plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff rename to app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff diff --git a/app/design/frontend/magento_plushe/i18n/en_US.csv b/app/design/frontend/Magento/plushe/i18n/en_US.csv similarity index 100% rename from app/design/frontend/magento_plushe/i18n/en_US.csv rename to app/design/frontend/Magento/plushe/i18n/en_US.csv diff --git a/app/design/frontend/magento_plushe/images/banner1.jpg b/app/design/frontend/Magento/plushe/images/banner1.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/banner1.jpg rename to app/design/frontend/Magento/plushe/images/banner1.jpg diff --git a/app/design/frontend/magento_plushe/images/banner2.jpg b/app/design/frontend/Magento/plushe/images/banner2.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/banner2.jpg rename to app/design/frontend/Magento/plushe/images/banner2.jpg diff --git a/app/design/frontend/magento_plushe/images/banner3.jpg b/app/design/frontend/Magento/plushe/images/banner3.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/banner3.jpg rename to app/design/frontend/Magento/plushe/images/banner3.jpg diff --git a/app/design/frontend/magento_plushe/images/banner4.jpg b/app/design/frontend/Magento/plushe/images/banner4.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/banner4.jpg rename to app/design/frontend/Magento/plushe/images/banner4.jpg diff --git a/app/design/frontend/magento_plushe/images/blog_bg.png b/app/design/frontend/Magento/plushe/images/blog_bg.png similarity index 100% rename from app/design/frontend/magento_plushe/images/blog_bg.png rename to app/design/frontend/Magento/plushe/images/blog_bg.png diff --git a/app/design/frontend/magento_plushe/images/express-checkout-retina.png b/app/design/frontend/Magento/plushe/images/express-checkout-retina.png similarity index 100% rename from app/design/frontend/magento_plushe/images/express-checkout-retina.png rename to app/design/frontend/Magento/plushe/images/express-checkout-retina.png diff --git a/app/design/frontend/magento_plushe/images/header-bg.jpg b/app/design/frontend/Magento/plushe/images/header-bg.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/header-bg.jpg rename to app/design/frontend/Magento/plushe/images/header-bg.jpg diff --git a/app/design/frontend/magento_plushe/images/info_photo.jpg b/app/design/frontend/Magento/plushe/images/info_photo.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/info_photo.jpg rename to app/design/frontend/Magento/plushe/images/info_photo.jpg diff --git a/app/design/frontend/magento_plushe/images/loader.gif b/app/design/frontend/Magento/plushe/images/loader.gif similarity index 100% rename from app/design/frontend/magento_plushe/images/loader.gif rename to app/design/frontend/Magento/plushe/images/loader.gif diff --git a/app/design/frontend/magento_plushe/images/logo.gif b/app/design/frontend/Magento/plushe/images/logo.gif similarity index 100% rename from app/design/frontend/magento_plushe/images/logo.gif rename to app/design/frontend/Magento/plushe/images/logo.gif diff --git a/app/design/frontend/magento_plushe/images/logo_notext.gif b/app/design/frontend/Magento/plushe/images/logo_notext.gif similarity index 100% rename from app/design/frontend/magento_plushe/images/logo_notext.gif rename to app/design/frontend/Magento/plushe/images/logo_notext.gif diff --git a/app/design/frontend/magento_plushe/images/main_image1.jpg b/app/design/frontend/Magento/plushe/images/main_image1.jpg similarity index 100% rename from app/design/frontend/magento_plushe/images/main_image1.jpg rename to app/design/frontend/Magento/plushe/images/main_image1.jpg diff --git a/app/design/frontend/magento_plushe/images/social-links.png b/app/design/frontend/Magento/plushe/images/social-links.png similarity index 100% rename from app/design/frontend/magento_plushe/images/social-links.png rename to app/design/frontend/Magento/plushe/images/social-links.png diff --git a/app/design/frontend/magento_plushe/images/texture.png b/app/design/frontend/Magento/plushe/images/texture.png similarity index 100% rename from app/design/frontend/magento_plushe/images/texture.png rename to app/design/frontend/Magento/plushe/images/texture.png diff --git a/app/design/frontend/magento_plushe/js/jquery.dropdowns.js b/app/design/frontend/Magento/plushe/js/jquery.dropdowns.js similarity index 100% rename from app/design/frontend/magento_plushe/js/jquery.dropdowns.js rename to app/design/frontend/Magento/plushe/js/jquery.dropdowns.js diff --git a/app/design/frontend/magento_plushe/js/navigation-menu.js b/app/design/frontend/Magento/plushe/js/navigation-menu.js similarity index 100% rename from app/design/frontend/magento_plushe/js/navigation-menu.js rename to app/design/frontend/Magento/plushe/js/navigation-menu.js diff --git a/app/design/frontend/magento_plushe/js/responsive.js b/app/design/frontend/Magento/plushe/js/responsive.js similarity index 100% rename from app/design/frontend/magento_plushe/js/responsive.js rename to app/design/frontend/Magento/plushe/js/responsive.js diff --git a/app/design/frontend/magento_plushe/js/sticky.js b/app/design/frontend/Magento/plushe/js/sticky.js similarity index 100% rename from app/design/frontend/magento_plushe/js/sticky.js rename to app/design/frontend/Magento/plushe/js/sticky.js diff --git a/app/design/frontend/magento_plushe/js/tabs.js b/app/design/frontend/Magento/plushe/js/tabs.js similarity index 100% rename from app/design/frontend/magento_plushe/js/tabs.js rename to app/design/frontend/Magento/plushe/js/tabs.js diff --git a/app/design/frontend/magento_plushe/js/theme.js b/app/design/frontend/Magento/plushe/js/theme.js similarity index 100% rename from app/design/frontend/magento_plushe/js/theme.js rename to app/design/frontend/Magento/plushe/js/theme.js diff --git a/app/design/frontend/magento_plushe/mage/gallery.css b/app/design/frontend/Magento/plushe/mage/gallery.css similarity index 100% rename from app/design/frontend/magento_plushe/mage/gallery.css rename to app/design/frontend/Magento/plushe/mage/gallery.css diff --git a/app/design/frontend/magento_plushe/media/preview.jpg b/app/design/frontend/Magento/plushe/media/preview.jpg similarity index 100% rename from app/design/frontend/magento_plushe/media/preview.jpg rename to app/design/frontend/Magento/plushe/media/preview.jpg diff --git a/app/design/frontend/magento_plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml similarity index 93% rename from app/design/frontend/magento_plushe/theme.xml rename to app/design/frontend/Magento/plushe/theme.xml index 7ae50a2d5acff997d4d0b410baeed5de25d2500c..f10dd34cd82a6eb7502362235adcce29711e1698 100644 --- a/app/design/frontend/magento_plushe/theme.xml +++ b/app/design/frontend/Magento/plushe/theme.xml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/theme.xsd"> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Magento Plushe</title> <version>1.0.0.0</version> <media> diff --git a/app/design/frontend/magento_plushe/view.xml b/app/design/frontend/Magento/plushe/view.xml similarity index 99% rename from app/design/frontend/magento_plushe/view.xml rename to app/design/frontend/Magento/plushe/view.xml index ce69a8f02f7a87edeb521de948c35275f38e76bd..fefbd3b423331bcc5c14af5923dad04463d2773c 100644 --- a/app/design/frontend/magento_plushe/view.xml +++ b/app/design/frontend/Magento/plushe/view.xml @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/view.xsd"> +<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/view.xsd"> <vars module="Magento_Catalog"> <var name="product_small_image_sidebar_size">100</var> <!-- Override for small product image --> <var name="product_base_image_size">275</var> <!-- Override for base product image --> diff --git a/app/design/install/magento_basic/css/boxes.css b/app/design/install/Magento/basic/css/boxes.css similarity index 100% rename from app/design/install/magento_basic/css/boxes.css rename to app/design/install/Magento/basic/css/boxes.css diff --git a/app/design/install/magento_basic/css/clears.css b/app/design/install/Magento/basic/css/clears.css similarity index 100% rename from app/design/install/magento_basic/css/clears.css rename to app/design/install/Magento/basic/css/clears.css diff --git a/app/design/install/magento_basic/css/ie7minus.css b/app/design/install/Magento/basic/css/ie7minus.css similarity index 100% rename from app/design/install/magento_basic/css/ie7minus.css rename to app/design/install/Magento/basic/css/ie7minus.css diff --git a/app/design/install/magento_basic/css/iestyles.css b/app/design/install/Magento/basic/css/iestyles.css similarity index 100% rename from app/design/install/magento_basic/css/iestyles.css rename to app/design/install/Magento/basic/css/iestyles.css diff --git a/app/design/install/magento_basic/css/reset.css b/app/design/install/Magento/basic/css/reset.css similarity index 100% rename from app/design/install/magento_basic/css/reset.css rename to app/design/install/Magento/basic/css/reset.css diff --git a/app/design/install/magento_basic/images/error_msg_icon.gif b/app/design/install/Magento/basic/images/error_msg_icon.gif similarity index 100% rename from app/design/install/magento_basic/images/error_msg_icon.gif rename to app/design/install/Magento/basic/images/error_msg_icon.gif diff --git a/app/design/install/magento_basic/images/footer_bg.gif b/app/design/install/Magento/basic/images/footer_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_bg.gif rename to app/design/install/Magento/basic/images/footer_bg.gif diff --git a/app/design/install/magento_basic/images/footer_container_bg.gif b/app/design/install/Magento/basic/images/footer_container_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_container_bg.gif rename to app/design/install/Magento/basic/images/footer_container_bg.gif diff --git a/app/design/install/magento_basic/images/footer_info_separator.gif b/app/design/install/Magento/basic/images/footer_info_separator.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_info_separator.gif rename to app/design/install/Magento/basic/images/footer_info_separator.gif diff --git a/app/design/install/magento_basic/images/footer_informational_bg.gif b/app/design/install/Magento/basic/images/footer_informational_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_informational_bg.gif rename to app/design/install/Magento/basic/images/footer_informational_bg.gif diff --git a/app/design/install/magento_basic/images/footer_left.gif b/app/design/install/Magento/basic/images/footer_left.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_left.gif rename to app/design/install/Magento/basic/images/footer_left.gif diff --git a/app/design/install/magento_basic/images/footer_legality_bg.gif b/app/design/install/Magento/basic/images/footer_legality_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_legality_bg.gif rename to app/design/install/Magento/basic/images/footer_legality_bg.gif diff --git a/app/design/install/magento_basic/images/footer_right.gif b/app/design/install/Magento/basic/images/footer_right.gif similarity index 100% rename from app/design/install/magento_basic/images/footer_right.gif rename to app/design/install/Magento/basic/images/footer_right.gif diff --git a/app/design/install/magento_basic/images/header_bg.gif b/app/design/install/Magento/basic/images/header_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/header_bg.gif rename to app/design/install/Magento/basic/images/header_bg.gif diff --git a/app/design/install/magento_basic/images/header_nav_bg.gif b/app/design/install/Magento/basic/images/header_nav_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/header_nav_bg.gif rename to app/design/install/Magento/basic/images/header_nav_bg.gif diff --git a/app/design/install/magento_basic/images/header_top_bg.jpg b/app/design/install/Magento/basic/images/header_top_bg.jpg similarity index 100% rename from app/design/install/magento_basic/images/header_top_bg.jpg rename to app/design/install/Magento/basic/images/header_top_bg.jpg diff --git a/app/design/install/magento_basic/images/header_top_container_bg.jpg b/app/design/install/Magento/basic/images/header_top_container_bg.jpg similarity index 100% rename from app/design/install/magento_basic/images/header_top_container_bg.jpg rename to app/design/install/Magento/basic/images/header_top_container_bg.jpg diff --git a/app/design/install/magento_basic/images/i_notice.gif b/app/design/install/Magento/basic/images/i_notice.gif similarity index 100% rename from app/design/install/magento_basic/images/i_notice.gif rename to app/design/install/Magento/basic/images/i_notice.gif diff --git a/app/design/install/magento_basic/images/main_bg.gif b/app/design/install/Magento/basic/images/main_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/main_bg.gif rename to app/design/install/Magento/basic/images/main_bg.gif diff --git a/app/design/install/magento_basic/images/main_container_bg.gif b/app/design/install/Magento/basic/images/main_container_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/main_container_bg.gif rename to app/design/install/Magento/basic/images/main_container_bg.gif diff --git a/app/design/install/magento_basic/images/note_msg_icon.gif b/app/design/install/Magento/basic/images/note_msg_icon.gif similarity index 100% rename from app/design/install/magento_basic/images/note_msg_icon.gif rename to app/design/install/Magento/basic/images/note_msg_icon.gif diff --git a/app/design/install/magento_basic/images/success_msg_icon.gif b/app/design/install/Magento/basic/images/success_msg_icon.gif similarity index 100% rename from app/design/install/magento_basic/images/success_msg_icon.gif rename to app/design/install/Magento/basic/images/success_msg_icon.gif diff --git a/app/design/install/magento_basic/images/validation_advice_bg.gif b/app/design/install/Magento/basic/images/validation_advice_bg.gif similarity index 100% rename from app/design/install/magento_basic/images/validation_advice_bg.gif rename to app/design/install/Magento/basic/images/validation_advice_bg.gif diff --git a/app/design/install/magento_basic/theme.xml b/app/design/install/Magento/basic/theme.xml similarity index 93% rename from app/design/install/magento_basic/theme.xml rename to app/design/install/Magento/basic/theme.xml index 82e9c2aacb0f3a824658e8baddaafda3ae2e2538..3d1e419bf49f7cd9c70366c7b02db741bf6e98dc 100644 --- a/app/design/install/magento_basic/theme.xml +++ b/app/design/install/Magento/basic/theme.xml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../lib/Magento/Config/etc/theme.xsd"> +<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Magento Basic</title> <version>2.0.0.0</version> </theme> diff --git a/app/etc/di.xml b/app/etc/di.xml index 305434cb7eae95639f5469e7bfe7726e70d8f7b0..95f0abbfbe81caeb59ddc56e4ba799adac32504a 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -25,7 +25,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\App\RequestInterface" type="Magento\App\Request\Http" /> - <preference for="Magento\App\Request\PathInfoProcessorInterface" type="Magento\Core\App\Request\PathInfoProcessor" /> + <preference for="Magento\App\Request\PathInfoProcessorInterface" type="Magento\Store\App\Request\PathInfoProcessor" /> <preference for="Magento\App\ResponseInterface" type="Magento\App\Response\Http" /> <preference for="Magento\App\RouterListInterface" type="Magento\App\RouterList" /> <preference for="Magento\App\FrontControllerInterface" type="Magento\App\FrontController" /> @@ -33,10 +33,10 @@ <preference for="Magento\App\CacheInterface" type="Magento\App\Cache\Proxy" /> <preference for="Magento\App\Cache\StateInterface" type="Magento\App\Cache\State" /> <preference for="Magento\App\Cache\TypeListInterface" type="Magento\App\Cache\TypeList" /> - <preference for="Magento\Core\Model\Store\ConfigInterface" type="Magento\Core\Model\Store\Config" /> - <preference for="Magento\Core\Model\StoreManagerInterface" type="Magento\Core\Model\StoreManager" /> + <preference for="Magento\Store\Model\StoreManagerInterface" type="Magento\Store\Model\StoreManager" /> <preference for="Magento\View\DesignInterface" type="Magento\Core\Model\View\Design\Proxy" /> <preference for="Magento\View\Design\ThemeInterface" type="Magento\Core\Model\Theme" /> + <preference for="Magento\View\Design\Theme\ResolverInterface" type="Magento\Core\Model\Theme\Resolver" /> <preference for="Magento\View\ConfigInterface" type="Magento\View\Config" /> <preference for="Magento\Locale\ListsInterface" type="Magento\Locale\Lists" /> <type name="Magento\Locale\Lists"> @@ -48,7 +48,7 @@ <preference for="Magento\UrlInterface" type="Magento\Url" /> <preference for="Magento\Data\Collection\Db\FetchStrategyInterface" type="Magento\Data\Collection\Db\FetchStrategy\Query" /> <preference for="Magento\Config\ScopeInterface" type="Magento\Config\Scope" /> - <preference for="Magento\Config\FileResolverInterface" type="Magento\Core\Model\Config\FileResolver" /> + <preference for="Magento\Config\FileResolverInterface" type="Magento\App\Config\FileResolver" /> <preference for="Magento\Config\CacheInterface" type="Magento\App\Cache\Type\Config" /> <preference for="Magento\Config\ValidationStateInterface" type="Magento\App\Arguments\ValidationState" /> <preference for="Magento\Module\ModuleListInterface" type="Magento\Module\ModuleList" /> @@ -56,7 +56,7 @@ <preference for="Magento\Event\InvokerInterface" type="Magento\Event\Invoker\InvokerDefault" /> <preference for="Magento\Interception\PluginList" type="Magento\Interception\PluginList\PluginList" /> <preference for="Magento\Event\ManagerInterface" type="Magento\Event\Manager\Proxy" /> - <preference for="Magento\View\LayoutInterface" type="Magento\Core\Model\Layout" /> + <preference for="Magento\View\LayoutInterface" type="Magento\View\Layout" /> <preference for="Magento\View\Layout\ProcessorInterface" type="Magento\Core\Model\Layout\Merge" /> <preference for="Magento\View\Url\ConfigInterface" type="Magento\Core\Model\View\Url\Config" /> <preference for="Magento\App\Route\ConfigInterface" type="Magento\App\Route\Config" /> @@ -69,15 +69,15 @@ <preference for="Magento\Json\EncoderInterface" type="Magento\Json\Encoder" /> <preference for="Magento\Json\DecoderInterface" type="Magento\Json\Decoder" /> <preference for="Magento\Message\ManagerInterface" type="Magento\Message\Manager" /> - <preference for="Magento\App\Config\ValueInterface" type="Magento\Core\Model\Config\Value" /> + <preference for="Magento\App\Config\ValueInterface" type="Magento\App\Config\Value" /> <preference for="Magento\Module\DependencyManagerInterface" type="Magento\Module\DependencyManager" /> <preference for="Magento\Interception\Chain" type="Magento\Interception\Chain\Chain" /> - <preference for="Magento\Module\Output\ConfigInterface" type="Magento\Core\Model\Module\Output\Config" /> + <preference for="Magento\Module\Output\ConfigInterface" type="Magento\Module\Output\Config" /> <preference for="Magento\View\Design\Theme\CustomizationInterface" type="Magento\View\Design\Theme\Customization" /> <preference for="Magento\Image\Adapter\ConfigInterface" type="Magento\Image\Adapter\Config" /> <preference for="Magento\View\Design\Theme\Image\PathInterface" type="Magento\Core\Model\Theme\Image\Path" /> - <preference for="Magento\Session\Config\ConfigInterface" type="Magento\Core\Model\Session\Config" /> - <preference for="Magento\Session\SidResolverInterface" type="Magento\Core\Model\Session\SidResolver\Proxy" /> + <preference for="Magento\Session\Config\ConfigInterface" type="Magento\Session\Config" /> + <preference for="Magento\Session\SidResolverInterface" type="Magento\Session\SidResolver\Proxy" /> <preference for="Magento\TranslateInterface" type="Magento\Translate" /> <preference for="Magento\Config\ScopeListInterface" type="interceptionConfigScope" /> <preference for="Magento\View\Design\Theme\Label\ListInterface" type="Magento\Core\Model\Resource\Theme\Collection" /> @@ -92,6 +92,7 @@ <argument name="actionValidator" xsi:type="object">Magento\Model\ActionValidator\RemoveAction\Proxy</argument> </arguments> </type> + <type name="Magento\Service\V1\Data\FilterBuilder" shared="false" /> <type name="Magento\Message\Manager"> <arguments> <argument name="session" xsi:type="object">Magento\Message\Session\Proxy</argument> @@ -100,14 +101,14 @@ <type name="Magento\View\BlockPool" shared="false" /> <type name="Magento\App\Request\Http"> <arguments> - <argument name="pathInfoProcessor" xsi:type="object">Magento\Core\App\Request\PathInfoProcessor\Proxy</argument> + <argument name="pathInfoProcessor" xsi:type="object">Magento\Store\App\Request\PathInfoProcessor\Proxy</argument> </arguments> </type> <preference for="Magento\Error\HandlerInterface" type="Magento\App\Error\Handler" /> <preference for="Magento\Session\SaveHandlerInterface" type="Magento\Session\SaveHandler" /> <type name="Magento\Session\SaveHandler"> <arguments> - <argument name="saveMethod" xsi:type="init_parameter">Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD</argument> + <argument name="saveMethod" xsi:type="init_parameter">Magento\Session\Config::PARAM_SESSION_SAVE_METHOD</argument> </arguments> </type> <type name="Magento\Session\SaveHandlerFactory"> @@ -167,10 +168,10 @@ <argument name="banAll" xsi:type="init_parameter">Magento\App\Cache\State::PARAM_BAN_CACHE</argument> </arguments> </type> - <type name="Magento\Core\Model\StoreManager"> + <type name="Magento\Store\Model\StoreManager"> <arguments> - <argument name="scopeCode" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_CODE</argument> - <argument name="scopeType" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_TYPE</argument> + <argument name="scopeCode" xsi:type="init_parameter">Magento\Store\Model\StoreManager::PARAM_RUN_CODE</argument> + <argument name="scopeType" xsi:type="init_parameter">Magento\Store\Model\StoreManager::PARAM_RUN_TYPE</argument> </arguments> </type> <type name="Magento\Translate"> @@ -189,7 +190,7 @@ <type name="Magento\Data\Structure" shared="false" /> <type name="Magento\Core\Model\View\Design"> <arguments> - <argument name="storeManager" xsi:type="object">Magento\Core\Model\StoreManager\Proxy</argument> + <argument name="storeManager" xsi:type="object">Magento\Store\Model\StoreManager\Proxy</argument> </arguments> </type> <type name="Magento\Acl" shared="false" /> @@ -243,7 +244,7 @@ </type> <type name="Magento\App\Resource\Config\Reader"> <arguments> - <argument name="fileResolver" xsi:type="object">Magento\Core\Model\Config\FileResolver\Proxy</argument> + <argument name="fileResolver" xsi:type="object">Magento\App\Config\FileResolver\Proxy</argument> </arguments> </type> <type name="Magento\Config\Scope"> @@ -254,7 +255,7 @@ </type> <type name="Magento\Url"> <arguments> - <argument name="session" xsi:type="object">Magento\Core\Model\Session\Proxy</argument> + <argument name="session" xsi:type="object">Magento\Session\Generic\Proxy</argument> </arguments> </type> <type name="Magento\View\Url"> @@ -330,9 +331,10 @@ <argument name="paramInterpreter" xsi:type="object">Magento\Data\Argument\Interpreter\String</argument> </arguments> </type> - <type name="Magento\Core\Model\Layout"> + <type name="Magento\View\Layout"> <arguments> <argument name="argumentInterpreter" xsi:type="object">layoutArgumentInterpreter</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> </arguments> </type> <type name="Magento\Mview\View"> diff --git a/dev/shell/indexer.php b/dev/shell/indexer.php index 5de788f9c0cc16e174d84da4e6230f417951d059..77ca46bfc710be78cdb3abc942d3a90998d25e09 100644 --- a/dev/shell/indexer.php +++ b/dev/shell/indexer.php @@ -25,7 +25,7 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; -use Magento\Core\Model\StoreManager; +use Magento\Store\Model\StoreManager; $params = array( StoreManager::PARAM_RUN_CODE => 'admin', diff --git a/dev/shell/install.php b/dev/shell/install.php index 513ae7bf97d12bab71fe3199fdb58df967713081..7a9b8c8894e78f9e4e00e68ac1fd80b73932cf1a 100644 --- a/dev/shell/install.php +++ b/dev/shell/install.php @@ -94,5 +94,5 @@ INSTALLSCHEME; define('BARE_BOOTSTRAP', 1); require_once __DIR__ . '/../../app/bootstrap.php'; -$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $_SERVER); $entryPoint->run('Magento\Install\App\Console', array('arguments' => $args)); diff --git a/dev/shell/log.php b/dev/shell/log.php index 87a85315b0f36501f35f33fc391b01a59ddf1e26..bf74a70daa4dd8f30da743fda42c0ec70feb2400 100644 --- a/dev/shell/log.php +++ b/dev/shell/log.php @@ -25,7 +25,7 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; -use Magento\Core\Model\StoreManager; +use Magento\Store\Model\StoreManager; $params = array( StoreManager::PARAM_RUN_CODE => 'admin', diff --git a/dev/shell/newindexer.php b/dev/shell/newindexer.php index d6ecda69728081b34a4eaedb3b12f1cbd0b8fb30..d4d7ce6562954db7d4465926829096d601d7018b 100644 --- a/dev/shell/newindexer.php +++ b/dev/shell/newindexer.php @@ -25,7 +25,7 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; -use Magento\Core\Model\StoreManager; +use Magento\Store\Model\StoreManager; $params = array( StoreManager::PARAM_RUN_CODE => 'admin', diff --git a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php index 125fc43dafcaf6a0342bb34a64e203597d4762c9..94335c31172f8510ec1b37008ea47641ae3e1196 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Annotation/ConfigFixture.php @@ -57,17 +57,21 @@ class ConfigFixture * Retrieve configuration node value * * @param string $configPath - * @param string|bool|null $storeCode + * @param string|bool|null $scopeCode * @return string */ - protected function _getConfigValue($configPath, $storeCode = false) + protected function _getConfigValue($configPath, $scopeCode = null) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $result = null; - if ($storeCode !== false) { - /** @var \Magento\Core\Model\Store\Config $storeConfig */ - $storeConfig = $objectManager->get('Magento\Core\Model\Store\Config'); - $result = $storeConfig->getConfig($configPath, $storeCode); + if ($scopeCode !== false) { + /** @var \Magento\App\Config\ScopeConfigInterface $scopeConfig */ + $scopeConfig = $objectManager->get('Magento\App\Config\ScopeConfigInterface'); + $result = $scopeConfig->getValue( + $configPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $scopeCode + ); } return $result; } @@ -81,20 +85,26 @@ class ConfigFixture */ protected function _setConfigValue($configPath, $value, $storeCode = false) { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); if ($storeCode === false) { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); if (strpos($configPath, 'default/') === 0) { $configPath = substr($configPath, 8); - $objectManager->get('Magento\App\ConfigInterface')->setValue($configPath, $value); + $objectManager->get( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( + $configPath, + $value, + \Magento\App\ScopeInterface::SCOPE_DEFAULT + ); } } else { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore( - $storeCode - )->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( $configPath, - $value + $value, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $storeCode ); } } @@ -113,12 +123,10 @@ class ConfigFixture foreach ($annotations['method']['magentoConfigFixture'] as $configPathAndValue) { if (preg_match('/^.+?(?=_store\s)/', $configPathAndValue, $matches)) { /* Store-scoped config value */ - $storeCode = $matches[0] != 'current' ? $matches[0] : ''; + $storeCode = $matches[0] != 'current' ? $matches[0] : null; list(, $configPath, $requiredValue) = preg_split('/\s+/', $configPathAndValue, 3); - $originalValue = $this->_getConfigValue($configPath, $storeCode); $this->_storeConfigValues[$storeCode][$configPath] = $originalValue; - $this->_setConfigValue($configPath, $requiredValue, $storeCode); } else { /* Global config value */ @@ -146,6 +154,9 @@ class ConfigFixture /* Restore store-scoped values */ foreach ($this->_storeConfigValues as $storeCode => $originalData) { foreach ($originalData as $configPath => $originalValue) { + if (empty($storeCode)) { + $storeCode = null; + } $this->_setConfigValue($configPath, $originalValue, $storeCode); } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Eav.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Eav.php index 330d0d1f76c1e2ac22a00d6e27e18d139bb7561b..0ab3c7d9f6d37413606c1839f1123debe6b8fc64 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Eav.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Eav.php @@ -36,7 +36,7 @@ class Eav public static function setIncrementIdPrefix($entityType, $prefix) { $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite(); $storeId = $website->getDefaultStore()->getId(); $entityTypeModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/framework/Magento/TestFramework/Listener/ExtededTestdox.php b/dev/tests/integration/framework/Magento/TestFramework/Listener/ExtededTestdox.php new file mode 100644 index 0000000000000000000000000000000000000000..31e1ded422a9ae604e678d5e090954f4ac1d1e56 --- /dev/null +++ b/dev/tests/integration/framework/Magento/TestFramework/Listener/ExtededTestdox.php @@ -0,0 +1,307 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\TestFramework\Listener; + +class ExtededTestdox extends \PHPUnit_Util_Printer implements \PHPUnit_Framework_TestListener +{ + /** + * @var \PHPUnit_Util_TestDox_NamePrettifier + */ + protected $prettifier; + + /** + * @var string + */ + protected $testClass = ''; + + /** + * @var integer + */ + protected $testStatus = false; + + /** + * @var array + */ + protected $tests = array(); + + /** + * @var integer + */ + protected $successful = 0; + + /** + * @var integer + */ + protected $failed = 0; + + /** + * @var integer + */ + protected $skipped = 0; + + /** + * @var integer + */ + protected $incomplete = 0; + + /** + * @var string + */ + protected $testTypeOfInterest = 'PHPUnit_Framework_TestCase'; + + /** + * @var string + */ + protected $currentTestClassPrettified; + + /** + * @var string + */ + protected $currentTestMethodPrettified; + + /** + * Constructor. + * + * @param resource $out + */ + public function __construct($out = null) + { + parent::__construct($out); + + $this->prettifier = new \PHPUnit_Util_TestDox_NamePrettifier(); + $this->startRun(); + } + + /** + * Flush buffer and close output. + * + */ + public function flush() + { + $this->doEndClass(); + $this->endRun(); + + parent::flush(); + } + + /** + * An error occurred. + * + * @param PHPUnit_Framework_Test $test + * @param Exception $e + * @param float $time + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + if ($test instanceof $this->testTypeOfInterest) { + $this->testStatus = \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR; + $this->failed++; + } + } + + /** + * A failure occurred. + * + * @param PHPUnit_Framework_Test $test + * @param PHPUnit_Framework_AssertionFailedError $e + * @param float $time + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addFailure(\PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) + { + if ($test instanceof $this->testTypeOfInterest) { + $this->testStatus = \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE; + $this->failed++; + } + } + + /** + * Incomplete test. + * + * @param PHPUnit_Framework_Test $test + * @param Exception $e + * @param float $time + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + if ($test instanceof $this->testTypeOfInterest) { + $this->testStatus = \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE; + $this->incomplete++; + } + } + + /** + * Skipped test. + * + * @param PHPUnit_Framework_Test $test + * @param Exception $e + * @param float $time + * @since Method available since Release 3.0.0 + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + if ($test instanceof $this->testTypeOfInterest) { + $this->testStatus = \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED; + $this->skipped++; + } + } + + /** + * A testsuite started. + * + * @param PHPUnit_Framework_TestSuite $suite + * @since Method available since Release 2.2.0 + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) + { + } + + /** + * A testsuite ended. + * + * @param PHPUnit_Framework_TestSuite $suite + * @since Method available since Release 2.2.0 + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) + { + } + + /** + * A test started. + * + * @param PHPUnit_Framework_Test $test + */ + public function startTest(\PHPUnit_Framework_Test $test) + { + if ($test instanceof $this->testTypeOfInterest) { + $class = get_class($test); + + if ($this->testClass != $class) { + if ($this->testClass != '') { + $this->doEndClass(); + } + + $this->currentTestClassPrettified = $this->prettifier->prettifyTestClass($class); + $this->startClass($class); + + $this->testClass = $class; + $this->tests = array(); + } + $this->write('.'); + $this->currentTestMethodPrettified = $this->prettifier->prettifyTestMethod($test->getName(false)); + + $this->testStatus = \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED; + } + } + + /** + * A test ended. + * + * @param PHPUnit_Framework_Test $test + * @param float $time + */ + public function endTest(\PHPUnit_Framework_Test $test, $time) + { + if ($test instanceof $this->testTypeOfInterest) { + if (!isset($this->tests[$this->currentTestMethodPrettified])) { + $this->tests[$this->currentTestMethodPrettified] = array('success' => 0, 'failure' => 0, 'time' => 0); + } + + if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_PASSED) { + $this->tests[$this->currentTestMethodPrettified]['success']++; + } + if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) { + $this->tests[$this->currentTestMethodPrettified]['failure']++; + } + if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) { + $this->tests[$this->currentTestMethodPrettified]['failure']++; + } + $this->tests[$this->currentTestMethodPrettified]['time'] += $time; + $this->currentTestClassPrettified = null; + $this->currentTestMethodPrettified = null; + } + } + + /** + * Handler for 'start run' event. + * + */ + protected function startRun() + { + } + + /** + * Handler for 'end run' event. + * + */ + protected function endRun() + { + } + + /** + * Handler for 'start class' event. + * + * @param string $name + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function startClass($name) + { + $this->write($this->currentTestClassPrettified . ' '); + } + + /** + * Handler for 'end class' event. + * + * @param string $name + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + protected function endClass($name) + { + $this->write("\n"); + } + + /** + * @since Method available since Release 2.3.0 + */ + protected function doEndClass() + { + foreach ($this->tests as $name => $data) { + $check = $data['failure'] == 0 ? ' [x] ' : ' [ ] '; + $this->write( + "\n" . $check . $name . ($data['failure'] + $data['success'] == + 0 ? ' (skipped)' : '') . ($data['time'] > 1 ? ' - ' . number_format( + $data['time'], + 2 + ) . "s" : '') + ); + } + + $this->endClass($this->testClass); + } +} diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php index 844d9f5e4922bb78219ff451f02f56902f6793b6..d7f11e1f93267ef773843c327be41024ab560095 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManager.php @@ -32,7 +32,7 @@ class ObjectManager extends \Magento\App\ObjectManager * * @var array */ - protected $_classesToDestruct = array('Magento\Core\Model\Layout', 'Magento\Registry'); + protected $_classesToDestruct = array('Magento\View\Layout', 'Magento\Registry'); /** * @var array @@ -44,7 +44,7 @@ class ObjectManager extends \Magento\App\ObjectManager 'Magento\ObjectManager\Config', 'Magento\Interception\Definition', 'Magento\ObjectManager\Definition', - 'Magento\Core\Model\Session\Config', + 'Magento\Session\Config', 'Magento\ObjectManager\Config\Mapper\Dom' ); @@ -61,7 +61,7 @@ class ObjectManager extends \Magento\App\ObjectManager } } - \Magento\Core\Model\Config\Base::destroy(); + \Magento\App\Config\Base::destroy(); $sharedInstances = array('Magento\ObjectManager' => $this, 'Magento\App\ObjectManager' => $this); foreach ($this->persistedInstances as $persistedClass) { if (isset($this->_sharedInstances[$persistedClass])) { diff --git a/dev/tests/integration/framework/Magento/TestFramework/View/Layout.php b/dev/tests/integration/framework/Magento/TestFramework/View/Layout.php index f492ff866238c611d59293a70d3befda516f0863..06e05b986228b75c9b2bf7f0e52c33f84bbedf33 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/View/Layout.php +++ b/dev/tests/integration/framework/Magento/TestFramework/View/Layout.php @@ -24,7 +24,7 @@ namespace Magento\TestFramework\View; -class Layout extends \Magento\Core\Model\Layout +class Layout extends \Magento\View\Layout { /** * @var bool diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index fa1d8e26b7d7e98b30e0d73043d627f567d09d54..5d74d2685af73d0acc85dbb12cfafc5d1664bb1f 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -59,7 +59,7 @@ $bootstrap = new \Magento\TestFramework\Bootstrap( new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\DocBlock("{$testsBaseDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Profiler\Driver\Standard()), - new \Magento\Shell(new \Magento\OSInfo()), + new \Magento\Shell(new \Magento\Shell\CommandRenderer()), $testsTmpDir ); $bootstrap->runBootstrap(); diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 2477b7ef3c420ad808ed19fafb778153cbf4a2db..5a86dc97dace22309ac0f49edf7bba0fb3f11bde 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -52,7 +52,7 @@ </filter> <!-- PHP INI settings and constants definition --> <php> - <includePath>.</includePath> + <includePath>.;testsuite</includePath> <ini name="date.timezone" value="America/Los_Angeles"/> <ini name="xdebug.max_nesting_level" value="200"/> <ini name="memory_limit" value="4096M"/> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Config/BaseTest.php b/dev/tests/integration/testsuite/Magento/App/Config/BaseTest.php similarity index 84% rename from dev/tests/integration/testsuite/Magento/Core/Model/Config/BaseTest.php rename to dev/tests/integration/testsuite/Magento/App/Config/BaseTest.php index 2e71b23da0c536c4ff79f5f39ae1dfa04da385c6..4d0552bf25d1c24682a7b41d774ff50ad50d74fe 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Config/BaseTest.php +++ b/dev/tests/integration/testsuite/Magento/App/Config/BaseTest.php @@ -18,13 +18,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class BaseTest extends \PHPUnit_Framework_TestCase { @@ -35,10 +33,10 @@ class BaseTest extends \PHPUnit_Framework_TestCase <root><key>value</key></root> XML; $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Config\Base', + 'Magento\App\Config\Base', array('sourceData' => $xml) ); - $this->assertInstanceOf('Magento\Core\Model\Config\Element', $config->getNode('key')); + $this->assertInstanceOf('Magento\App\Config\Element', $config->getNode('key')); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/App/Config/DataTest.php similarity index 94% rename from dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php rename to dev/tests/integration/testsuite/Magento/App/Config/DataTest.php index 0e1ad4f572dfd0be97f3e8372c9ece221628d9d4..508180f768b82b17a93122f2fdae9c765b97e6db 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/App/Config/DataTest.php @@ -18,13 +18,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class DataTest extends \PHPUnit_Framework_TestCase { @@ -33,14 +31,14 @@ class DataTest extends \PHPUnit_Framework_TestCase const SAMPLE_VALUE = 'http://example.com/'; /** - * @var \Magento\Core\Model\Config\Value + * @var \Magento\App\Config\Value */ protected $_model; public static function setUpBeforeClass() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\Config\Storage\Db' + 'Magento\App\Config\Storage\WriterInterface' )->save( self::SAMPLE_CONFIG_PATH, self::SAMPLE_VALUE @@ -51,7 +49,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\Config\Storage\Db' + 'Magento\App\Config\Storage\WriterInterface' )->delete( self::SAMPLE_CONFIG_PATH ); @@ -71,7 +69,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Config\Value' + 'Magento\App\Config\Value' ); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Config/ElementTest.php b/dev/tests/integration/testsuite/Magento/App/Config/ElementTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/Config/ElementTest.php rename to dev/tests/integration/testsuite/Magento/App/Config/ElementTest.php index 6f9b702adcb3121bdb9b9905c5a00803e4f6b8db..ec3b3f520e932217a8201d39e3fe7ebc22602fa0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Config/ElementTest.php +++ b/dev/tests/integration/testsuite/Magento/App/Config/ElementTest.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class ElementTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Element + * @var \Magento\App\Config\Element */ protected $_model; @@ -62,7 +60,7 @@ XML; * @TODO: Need to use ObjectManager instead 'new'. * On this moment we have next bug MAGETWO-4274 which blocker for this key. */ - $this->_model = new \Magento\Core\Model\Config\Element($xml); + $this->_model = new \Magento\App\Config\Element($xml); } public function testIs() diff --git a/dev/tests/integration/testsuite/Magento/App/FrontController/Plugin/InstallTest.php b/dev/tests/integration/testsuite/Magento/App/FrontController/Plugin/InstallTest.php index e76f7be0deaef132db2ad7b50ccc870e80cd42bd..fedfcf357ca61dc3b6b203acf110dd5423dc4b64 100644 --- a/dev/tests/integration/testsuite/Magento/App/FrontController/Plugin/InstallTest.php +++ b/dev/tests/integration/testsuite/Magento/App/FrontController/Plugin/InstallTest.php @@ -31,7 +31,7 @@ class InstallTest extends \Magento\TestFramework\TestCase\AbstractController protected $_objectManager; /** - * @var \Magento\Core\Model\Resource\Setup + * @var \Magento\Module\Setup */ protected $_model; @@ -39,7 +39,7 @@ class InstallTest extends \Magento\TestFramework\TestCase\AbstractController { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Setup', + 'Magento\Module\Setup', array('resourceName' => 'default_setup', 'moduleName' => 'Magento_Core') ); } diff --git a/dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test.php b/dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test.php index adbd0f6b98a487d38253f1001a95d5eb99d65386..9ad27dba6d573800b2f4557cd5f55310201b8e57 100644 --- a/dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test.php +++ b/dev/tests/integration/testsuite/Magento/Authz/Service/AuthorizationV1Test.php @@ -170,7 +170,7 @@ class AuthorizationV1Test extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Service\Exception + * @expectedException \Magento\Webapi\ServiceException * @expectedMessage The role associated with the specified user cannot be found. */ public function testGetAllowedResourcesRoleNotFound() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php index 115167a683b6f77dc1738ab4b544f96bb3f47226..464019d038b4d674501f38dfb1d56d9133e1049a 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Account/Edit/FormTest.php @@ -45,7 +45,7 @@ class FormTest extends \PHPUnit_Framework_TestCase ); $session->setUser($user); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var \Magento\Backend\Block\System\Account\Edit\Form */ diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php index 80d5dd29b23784ea47d11eec4ca28e9639a9fe18..4bae3a11133bb30f1ca65eb47676116c96f5b315 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -72,7 +72,7 @@ class FormTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => 'adminhtml') ); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( @@ -263,7 +263,7 @@ class FormTest extends \PHPUnit_Framework_TestCase ->load(\Magento\Core\Model\App\Area::PART_CONFIG); $fileResolverMock = $this->getMockBuilder( - 'Magento\Core\Model\Config\FileResolver' + 'Magento\App\Config\FileResolver' )->disableOriginalConstructor()->getMock(); $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); /** @var $directory \Magento\Filesystem\Directory\Read */ diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php index 77bfadadae4ac08b1d447e781b4bc6bddc3dcd58..f20d36e9e3d7b3cc8056018847aa311d593c76bb 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Design/Edit/Tab/GeneralTest.php @@ -49,7 +49,7 @@ class GeneralTest extends \PHPUnit_Framework_TestCase 'design', $objectManager->create('Magento\Core\Model\Design') ); - $layout = $objectManager->create('Magento\Core\Model\Layout'); + $layout = $objectManager->create('Magento\View\Layout'); $block = $layout->addBlock('Magento\Backend\Block\System\Design\Edit\Tab\General'); $prepareFormMethod = new \ReflectionMethod( 'Magento\Backend\Block\System\Design\Edit\Tab\General', diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php index c3617fd14b10d347d404ca8ea3c31e6bdb2744a1..5363e455c75acf8bc2d8852841495ba021fe5203 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/DeleteTest.php @@ -33,7 +33,7 @@ class DeleteTest extends \PHPUnit_Framework_TestCase { public function testGetHeaderText() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\System\Store\Delete */ $block = $layout->createBlock('Magento\Backend\Block\System\Store\Delete', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php index ad993d73560f8d43520d0b606aa6ba101e5e906d..3e3b035f45e4c79c97360972fb6bbfdebdb6e4ae 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/GroupTest.php @@ -44,7 +44,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase $registryData = array( 'store_type' => 'group', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store\Group' + 'Magento\Store\Model\Store' ), 'store_action' => 'add' ); @@ -54,7 +54,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Registry')->register($key, $value); } - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Group'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php index d7cf683531a47fccb703fedf882fd66560925e60..3cb01a4671f204e85373ca38ad7300d33a59eaa0 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/StoreTest.php @@ -44,7 +44,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase $registryData = array( 'store_type' => 'store', 'store_data' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store' + 'Magento\Store\Model\Store' ), 'store_action' => 'add' ); @@ -54,7 +54,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Registry')->register($key, $value); } - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Store'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php index 1f08bc49045e0ac4ad194824795772abd028ac63..86e9c4988e9c8e87569867eb2ec8e6649eeeb463 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/Edit/Form/WebsiteTest.php @@ -45,14 +45,14 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $registryData = array( 'store_type' => 'website', - 'store_data' => $objectManager->create('Magento\Core\Model\Website'), + 'store_data' => $objectManager->create('Magento\Store\Model\Website'), 'store_action' => 'add' ); foreach ($registryData as $key => $value) { $objectManager->get('Magento\Registry')->register($key, $value); } - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $this->_block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit\Form\Website'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php index 9a5d71d4cbd5ebf9ba60888e0193fea520078c61..c147a3f9d228ecdb668a5f02a7c7fd8914aef2d7 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Store/EditTest.php @@ -65,7 +65,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { $this->_initStoreTypesInRegistry($registryData); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\System\Store\Edit */ $block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit', 'block'); @@ -81,15 +81,15 @@ class EditTest extends \PHPUnit_Framework_TestCase { return array( array( - array('store_type' => 'website', 'store_data' => 'Magento\Core\Model\Website'), + array('store_type' => 'website', 'store_data' => 'Magento\Store\Model\Website'), 'Magento\Backend\Block\System\Store\Edit\Form\Website' ), array( - array('store_type' => 'group', 'store_data' => 'Magento\Core\Model\Store\Group'), + array('store_type' => 'group', 'store_data' => 'Magento\Store\Model\Store'), 'Magento\Backend\Block\System\Store\Edit\Form\Group' ), array( - array('store_type' => 'store', 'store_data' => 'Magento\Core\Model\Store'), + array('store_type' => 'store', 'store_data' => 'Magento\Store\Model\Store'), 'Magento\Backend\Block\System\Store\Edit\Form\Store' ) ); @@ -105,7 +105,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { $this->_initStoreTypesInRegistry($registryData); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\System\Store\Edit */ $block = $layout->createBlock('Magento\Backend\Block\System\Store\Edit', 'block'); @@ -123,7 +123,7 @@ class EditTest extends \PHPUnit_Framework_TestCase array( array( 'store_type' => 'website', - 'store_data' => 'Magento\Core\Model\Website', + 'store_data' => 'Magento\Store\Model\Website', 'store_action' => 'add' ), 'New Web Site' @@ -131,33 +131,25 @@ class EditTest extends \PHPUnit_Framework_TestCase array( array( 'store_type' => 'website', - 'store_data' => 'Magento\Core\Model\Website', + 'store_data' => 'Magento\Store\Model\Website', 'store_action' => 'edit' ), 'Edit Web Site' ), array( - array( - 'store_type' => 'group', - 'store_data' => 'Magento\Core\Model\Store\Group', - 'store_action' => 'add' - ), + array('store_type' => 'group', 'store_data' => 'Magento\Store\Model\Store', 'store_action' => 'add'), 'New Store' ), array( - array( - 'store_type' => 'group', - 'store_data' => 'Magento\Core\Model\Store\Group', - 'store_action' => 'edit' - ), + array('store_type' => 'group', 'store_data' => 'Magento\Store\Model\Store', 'store_action' => 'edit'), 'Edit Store' ), array( - array('store_type' => 'store', 'store_data' => 'Magento\Core\Model\Store', 'store_action' => 'add'), + array('store_type' => 'store', 'store_data' => 'Magento\Store\Model\Store', 'store_action' => 'add'), 'New Store View' ), array( - array('store_type' => 'store', 'store_data' => 'Magento\Core\Model\Store', 'store_action' => 'edit'), + array('store_type' => 'store', 'store_data' => 'Magento\Store\Model\Store', 'store_action' => 'edit'), 'Edit Store View' ) ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/TemplateTest.php index fb181716c038982e83c5d78c5def1c360c6a8c19..1d404ea3b2382f428d2ca0d11b3f9b3f34de0588 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/TemplateTest.php @@ -57,25 +57,24 @@ class TemplateTest extends \PHPUnit_Framework_TestCase } /** + * @magentoAppArea adminhtml * @covers \Magento\Backend\Block\Template::isOutputEnabled + * @magentoConfigFixture current_store advanced/modules_disable_output/dummy 1 */ - public function testIsOutputEnabled() + public function testIsOutputEnabledTrue() { $this->_block->setData('module_name', 'dummy'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( - 'advanced/modules_disable_output/dummy', - 'true' - ); - $this->assertFalse($this->_block->isOutputEnabled()); + $this->assertFalse($this->_block->isOutputEnabled('dummy')); + } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( - 'advanced/modules_disable_output/dummy', - 'false' - ); + /** + * @magentoAppArea adminhtml + * @covers \Magento\Backend\Block\Template::isOutputEnabled + * @magentoConfigFixture current_store advanced/modules_disable_output/dummy 0 + */ + public function testIsOutputEnabledFalse() + { + $this->_block->setData('module_name', 'dummy'); $this->assertTrue($this->_block->isOutputEnabled('dummy')); } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php index 0be268e261718e2f55fa51502952fa32bf386387..6c98beeb056d5fd69be1c29cb58d0953c77ad3c9 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Category/EditTest.php @@ -44,7 +44,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php index 912ec0c256862227186c90777fd4c8e397311db4..8e3ed4898b0dad3a7813c227dd2e359ceaf0c171 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Edit/FormTest.php @@ -40,7 +40,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected function _getFormInstance($args = array()) { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Urlrewrite\Catalog\Edit\Form */ $block = $layout->createBlock( @@ -119,7 +119,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * @magentoAppIsolation enabled * @magentoDataFixture Magento/Core/_files/store.php * - * @expectedException \Magento\Core\Model\Store\Exception + * @expectedException \Magento\Store\Model\Exception * @expectedExceptionMessage We can't set up a URL rewrite because the product you chose is not associated with */ public function testGetEntityStoresProductStoresException() @@ -134,7 +134,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * @magentoAppIsolation enabled * @magentoDataFixture Magento/Core/_files/store.php * - * @expectedException \Magento\Core\Model\Store\Exception + * @expectedException \Magento\Store\Model\Exception * @expectedExceptionMessage We can't set up a URL rewrite because the product you chose is not associated with */ public function testGetEntityStoresProductCategoryStoresException() @@ -152,7 +152,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * @magentoAppIsolation enabled * @magentoDataFixture Magento/Core/_files/store.php * - * @expectedException \Magento\Core\Model\Store\Exception + * @expectedException \Magento\Store\Model\Exception * @expectedExceptionMessage We can't set up a URL rewrite because the category your chose is not associated with */ public function testGetEntityStoresCategoryStoresException() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php index f6e8b66c35153b312eda9d9333245df46a70e9da..8367913ba1a3bc5eb5c2814c89881d926964dad4 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Catalog/Product/EditTest.php @@ -44,7 +44,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php index 7684076a7185c0490e094d3e58939869092975f7..82ad4ce8b821215fba59aefbb2e14caa5229724f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/Edit/FormTest.php @@ -40,7 +40,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected function _getFormInstance($args = array()) { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Urlrewrite\Cms\Page\Edit\Form */ $block = $layout->createBlock( @@ -115,7 +115,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * @magentoAppIsolation enabled * @magentoDataFixture Magento/Core/_files/store.php * - * @expectedException \Magento\Core\Model\Store\Exception + * @expectedException \Magento\Store\Model\Exception * @expectedExceptionMessage Chosen cms page does not associated with any website. */ public function testGetEntityStoresProductStoresException() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php index ba701007826b44192b63f8a63f4f9ab774a5a621..23907fc7c574360d80bd0002583f8be43b6fa846 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Cms/Page/EditTest.php @@ -44,7 +44,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php index 94ffbb6d5a6ee841b00e5c1e4ea7f751ea41cb57..1e364e071af4053db44985807d9807c612912d45 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/Edit/FormTest.php @@ -40,7 +40,7 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected function _getFormInstance($args = array()) { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Urlrewrite\Edit\Form */ $block = $layout->createBlock('Magento\Backend\Block\Urlrewrite\Edit\Form', 'block', array('data' => $args)); @@ -123,7 +123,7 @@ class FormTest extends \PHPUnit_Framework_TestCase // Check that store value set correctly $defaultStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( true )->getId(); @@ -153,7 +153,7 @@ class FormTest extends \PHPUnit_Framework_TestCase // Check store elements has expected values $storesList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\System\Store' + 'Magento\Store\Model\System\Store' )->getStoreValuesForForm(); $this->assertInternalType('array', $storeElement->getValues()); $this->assertNotEmpty($storeElement->getValues()); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php index 0a583809942e3a2b1ae9431f1a25446109806fe2..c0aeaf2c1517552b0b59130ecebd127819d0d23f 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Urlrewrite/EditTest.php @@ -45,7 +45,7 @@ class EditTest extends \PHPUnit_Framework_TestCase /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php index d58f5f06d7c09363595f079bb6158475da84746b..d07491853daaff681fdd0d83594289551a52326c 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/ContainerTest.php @@ -51,7 +51,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase { $titles = array(1 => 'Title 1', 'Title 2', 'Title 3'); $block = $this->_buildBlock($titles); - $html = $block->getButtonsHtml(); + $html = $block->getButtonsHtml('header'); $this->assertContains('<button', $html); foreach ($titles as $title) { @@ -65,7 +65,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase $newTitles = array(1 => 'Button A', 'Button B', 'Button C'); $block = $this->_buildBlock($originalTitles); - $html = $block->getButtonsHtml(); + $html = $block->getButtonsHtml('header'); foreach ($newTitles as $newTitle) { $this->assertNotContains($newTitle, $html); } @@ -75,7 +75,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase foreach ($newTitles as $id => $newTitle) { $block->updateButton($id, 'title', $newTitle); } - $html = $block->getButtonsHtml(); + $html = $block->getButtonsHtml('header'); foreach ($newTitles as $newTitle) { $this->assertContains($newTitle, $html); } @@ -91,14 +91,15 @@ class ContainerTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Backend\Block\Widget\Container */ $block = $layout->createBlock('Magento\Backend\Block\Widget\Container', 'block'); foreach ($titles as $id => $title) { - $block->addButton($id, array('title' => $title)); + $block->addButton($id, array('title' => $title), 0, 0, 'header'); } + $block->setLayout($layout); return $block; } } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php index 963b7555b9d6b3e3b8f7cb2f9a656309a40a3be2..0870916d958cf023406f950d6f7bb9dc3fff0f64 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Form/ContainerTest.php @@ -34,7 +34,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase public function testGetFormHtml() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); // Create block with blocking _prepateLayout(), which is used by block to instantly add 'form' child /** @var $block \Magento\Backend\Block\Widget\Form\Container */ diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php index a424f117f837217c9f64dae6817a07a5cc0e12ab..b86193dd9127caf2660b6f62e1dcb4d903aa68a5 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/FormTest.php @@ -43,7 +43,7 @@ class FormTest extends \PHPUnit_Framework_TestCase )->setArea( \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE )->setDefaultDesignTheme(); - $layout = $objectManager->create('Magento\Core\Model\Layout'); + $layout = $objectManager->create('Magento\View\Layout'); $formBlock = $layout->addBlock('Magento\Backend\Block\Widget\Form'); $fieldSet = $objectManager->create('Magento\Data\Form\Element\Fieldset'); $arguments = array( diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php index 387d7a7844ff441cb7632167168b62c30338e4d7..c45d38f286c0a66573db8c1d38a2e6f77e47b177 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php @@ -57,7 +57,7 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->_layoutMock->expects( $this->any() )->method( diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php index 6dbababbda4f4c48bba91f0ef2d4a52bc147151e..edd8647d54d937ffae0d6d2850520e367b217981 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/ItemTest.php @@ -33,7 +33,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase { public function testGetAdditionalActionBlock() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Widget\Grid\Massaction\Item */ $block = $layout->createBlock('Magento\Backend\Block\Widget\Grid\Massaction\Item', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index d4126a6b6cb37a5ad6d0e24f29aa7733cdc97201..c9bef05ad7c686a63b1f14850b69bfaf1cad2729 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Backend\Block\Widget\Grid; -use Magento\Core\Model\StoreManager; +use Magento\Store\Model\StoreManager; /** * @magentoDataFixture Magento/Backend/Block/_files/backend_theme.php * diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php index a400041d0809e4ce44f8cf6e506838c6e7205ee8..981010ff896b6bce92cabd6d26ed8ba6ac7ecf6e 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -48,7 +48,7 @@ class GridTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->_columnSetMock = $this->_getColumnSetMock(); $returnValueMap = array( @@ -157,7 +157,7 @@ class GridTest extends \PHPUnit_Framework_TestCase public function testGetMassactionBlock() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Widget\Grid */ $block = $layout->createBlock('Magento\Backend\Block\Widget\Grid\Extended', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php index e63e60cb26180f2e2a5c7d74005aabf5d0b47f2c..ecf4b98ca790c4db9857ab970a920de2255826ed 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/TabsTest.php @@ -44,7 +44,7 @@ class TabsTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Registry')->register('current_widget_instance', $widgetInstance); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Backend\Block\Widget\Tabs */ $block = $layout->createBlock('Magento\Backend\Block\Widget\Tabs', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php index 50a3e20595cb1182ad6ad8698c54c6eb72b4134c..3bc3894e4342936a1b1175b149d54eadcc9baf40 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/WidgetTest.php @@ -39,7 +39,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase public function testGetButtonHtml() { $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $layout->getUpdate()->load(); @@ -61,7 +61,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase public function testGetButtonHtmlForTwoButtonsInOneBlock() { $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $layout->getUpdate()->load(); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index f130e87a05c02f2ff7c4b61e08923bc61ad72109..fb00153330d17de2386f7f52efc785e10d4d3cec 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -56,60 +56,53 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $secureSuffix = '{{secure_base_url}}test/'; return array( - // any fully qualified URLs regardless of path array('any/path', 'http://example.com/'), array('any/path', 'http://example.com/uri/'), - - // unsecure base URLs - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, $basePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecureSuffix), - - // secure base URLs - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $basePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $secureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $secureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $secureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $secureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $secureSuffix), - - // secure base URLs - in addition can use unsecure - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $unsecureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $unsecurePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $unsecureSuffix) + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $basePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $basePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $unsecureSuffix) ); } @@ -143,40 +136,32 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $secureWrongSuffix = '{{secure_base_url}}test'; return array( - // not a fully qualified URLs regardless path array('', 'not a valid URL'), array('', 'example.com'), array('', 'http://example.com'), array('', 'http://example.com/uri'), - - // unsecure base URLs - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, ''), // breaks cache - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, $baseSuffix), // creates redirect loops - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureSuffix), - array( - \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, - $unsecurePlaceholder - ), // creates endless recursion - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $baseSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecureWrongSuffix), - - // secure base URLs - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $baseSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $secureSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, $securePlaceholder), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, ''), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $baseSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $secureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $secureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $secureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $secureWrongSuffix), - array(\Magento\Core\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $secureWrongSuffix) + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $baseSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecurePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $baseSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LINK_URL, $unsecureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_MEDIA_URL, $unsecureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_STATIC_URL, $unsecureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_CACHE_URL, $unsecureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_LIB_URL, $unsecureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $baseSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $secureSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $securePlaceholder), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, ''), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $baseSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LINK_URL, $secureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_MEDIA_URL, $secureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_STATIC_URL, $secureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_CACHE_URL, $secureWrongSuffix), + array(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_LIB_URL, $secureWrongSuffix) ); } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php index df1eff680af346aa150f314f5593b4092c64f4e2..ae54dc49f58e4eaec4f9e7a69a43c90db64e69db 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php @@ -37,7 +37,7 @@ class GridTest extends \PHPUnit_Framework_TestCase ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); $block = $layout->createBlock( diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php index 328e6f80a3ac5f89df6f948aa3cd0d648671dfe4..0b7fe9e6d17cfdbd2c64240ad99469a6dc70b822 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/SearchTest.php @@ -35,7 +35,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase public function testToHtmlHasIndex() { /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\Layout'); $block = $layout->createBlock( 'Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option\Search', 'block2' diff --git a/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php index 040ca8c83a94001f5f557e7a35e127f0f843f4f0..644528b32e3dae36add306c745f0d8e012798d14 100644 --- a/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php @@ -67,7 +67,7 @@ class ObserverTest extends \Magento\TestFramework\TestCase\AbstractController public function testCaptchaIsRequiredAfterFailedLoginAttempts() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->setCurrentStore( 0 ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php index e4928173709e3d0434754270123c0b7f76a99cfd..1f0688324d2b617483ddc50fef1ea4bb68c712ee 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/Set/Toolbar/AddTest.php @@ -33,7 +33,7 @@ class AddTest extends \PHPUnit_Framework_TestCase { public function testToHtmlFormId() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $block = $layout->addBlock('Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Toolbar\Add', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php index 7350a30a9e6b58e975d837cb4b9b73ed61ca0c11..b58ba0dcf1f61b70e4c27fe60aa9d4678aaee992 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php @@ -33,9 +33,9 @@ class SelectTest extends \PHPUnit_Framework_TestCase { public function testToHtmlFormId() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type_Select */ + /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select */ $block = $layout->createBlock( 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select', 'select' diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php index 5c55c981e6fecfdbe807119668b76f4636713e2e..74003dfeaeafa3b8662544dbeb5553be5e303808 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/TabsTest.php @@ -47,7 +47,7 @@ class TabsTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Registry')->register('product', $product); $objectManager->get('Magento\App\State')->setAreaCode('nonexisting'); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $layout->addBlock('Magento\View\Element\Text', 'head'); /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php index 3b4164490d6fa3872c6ae23f892ea95caebb4921..87f5e4a2f9b18d27ad41b3ae8439b6c815ccb52e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/CategoryTest.php @@ -32,7 +32,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php index 90f921e1af698d3265624fea7ed4f8368570ea64..d3ccb999b361147d9aa4735396de2d8c8fd7b10e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php @@ -33,7 +33,7 @@ class ContentTest extends \PHPUnit_Framework_TestCase { public function testGetUploader() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content */ $block = $layout->createBlock('Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php index 329b1529bb16dfebf8e854dbe724d1c2f7c95acc..1786d6fb5433dd7f2d29278ac1f82973e4c68344 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php @@ -40,16 +40,19 @@ class NewTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Http\Context') - ->setValue( - \Magento\Customer\Helper\Data::CONTEXT_GROUP, - \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, - \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID - ); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Catalog\Block\Product\NewProduct'); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Http\Context' + )->setValue( + \Magento\Customer\Helper\Data::CONTEXT_GROUP, + \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, + \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID + ); + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\View\LayoutInterface' + )->createBlock( + 'Magento\Catalog\Block\Product\NewProduct' + ); } public function testGetCacheKeyInfo() @@ -65,7 +68,7 @@ class NewTest extends \PHPUnit_Framework_TestCase $this->assertSame(1, array_shift($keys)); $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), $info[1] ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php index 0da579f05f4aafa35b4f187a449d6d4e2796c49b..91297158f9333e4f44a7270f3966a03e807a1757 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php @@ -30,7 +30,7 @@ class ToolbarTest extends \PHPUnit_Framework_TestCase { public function testGetPagerHtml() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar */ $block = $layout->createBlock('Magento\Catalog\Block\Product\ProductList\Toolbar', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AdditionalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AdditionalTest.php index 87b32ce08d9b2ac895f118784eda377ba0adfd48..ee6917215e646f303d7a0212451841acc71c5535 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AdditionalTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/AdditionalTest.php @@ -30,7 +30,7 @@ class AdditionalTest extends \PHPUnit_Framework_TestCase { public function testGetChildHtmlList() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Catalog\Block\Product\View\Additional */ $block = $layout->createBlock('Magento\Catalog\Block\Product\View\Additional', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php index 31b2e6d0529228d4b28ded35aebd7e7da2fae12c..264a2c29c5983959f51647548ead86e277eb28da 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ViewTest.php @@ -55,7 +55,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testSetLayout() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $headBlock = $layout->createBlock('Magento\View\Element\Template', 'head'); $layout->addBlock($this->_block); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index 3d1317bbdfe9b4ce93a470f0d4d9ab1130c2cbd1..af6ad5ba3e26d2e6fee2ae7f69f35c97e71746b8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -42,8 +42,8 @@ class CategoryTest extends \Magento\Backend\Utility\Controller */ public function testSaveAction($inputData, $defaultAttributes, $attributesSaved = array()) { - /** @var $store \Magento\Core\Model\Store */ - $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store'); + /** @var $store \Magento\Store\Model\Store */ + $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); $store->load('fixturestore', 'code'); $storeId = $store->getId(); @@ -68,8 +68,8 @@ class CategoryTest extends \Magento\Backend\Utility\Controller foreach ($attributesSaved as $attribute => $value) { $actualValue = $category->getData($attribute); if ($value !== $actualValue) { - $errors[] = - "value for '{$attribute}' attribute must be '{$value}', but '{$actualValue}' is found instead"; + $errors[] = "value for '{$attribute}' attribute must be '{$value}'" + . ", but '{$actualValue}' is found instead"; } } @@ -236,7 +236,7 @@ class CategoryTest extends \Magento\Backend\Utility\Controller 'landing_page' => '1', 'is_anchor' => '1', 'custom_apply_to_products' => '0', - 'custom_design' => 'magento_blank', + 'custom_design' => 'Magento/blank', 'custom_design_from' => '', 'custom_design_to' => '', 'page_layout' => '', @@ -269,7 +269,7 @@ class CategoryTest extends \Magento\Backend\Utility\Controller 'default_sort_by' => null, 'display_mode' => 'PRODUCTS', 'meta_title' => 'Custom Title', - 'custom_design' => 'magento_blank', + 'custom_design' => 'Magento/blank', 'page_layout' => null, 'is_active' => '0', 'include_in_menu' => '0', diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 489ef47e82ff44c0f47b4f1ac805c9fc2151c7ef..05edd814f4426844ad1722abfd232ddb4e84c6ae 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -136,7 +136,7 @@ class AttributeTest extends \Magento\Backend\Utility\Controller 'used_in_product_listing' => '1', 'used_for_sort_by' => '0', 'apply_to' => array('simple'), - 'frontend_label' => array(\Magento\Core\Model\Store::DEFAULT_STORE_ID => 'string to translate') + 'frontend_label' => array(\Magento\Store\Model\Store::DEFAULT_STORE_ID => 'string to translate') ); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php index 673fe088a74bde856278c67e0b7b55bff897a969..df69c9f3c92f4d305c5b8d509c2e937551bd4eca 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/DataTest.php @@ -123,7 +123,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetPriceScopeDefault() { - // $this->assertEquals(\Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL, $this->_helper->getPriceScope()); + // $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL, $this->_helper->getPriceScope()); $this->assertNull($this->_helper->getPriceScope()); } @@ -132,7 +132,7 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetPriceScope() { - $this->assertEquals(\Magento\Core\Model\Store::PRICE_SCOPE_WEBSITE, $this->_helper->getPriceScope()); + $this->assertEquals(\Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE, $this->_helper->getPriceScope()); } public function testIsPriceGlobalDefault() @@ -176,7 +176,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->_helper->isUsingStaticUrlsAllowed()); $this->_helper->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ); $this->assertTrue($this->_helper->isUsingStaticUrlsAllowed()); @@ -197,7 +197,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_helper->isUrlDirectivesParsingAllowed()); $this->_helper->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ); $this->assertFalse($this->_helper->isUrlDirectivesParsingAllowed()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php index 2df7726323535ff089c7ff7a41d554c636c8faab..896d4938122dbcd1cb83930a8b8ccd7f24897fa9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php @@ -66,7 +66,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase // watermark fixture mkdir( $fixtureMediaDir . '/watermark/stores/' . $objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), 0777, true @@ -74,7 +74,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase copy( "{$fixtureDir}/watermark.jpg", $fixtureMediaDir . '/watermark/stores/' . $objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() . '/watermark.jpg' ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php index 2d548a38dffbc40095fa3a7a50eee7f71bb5269e..e2f6b2247ce377b2f190cf46ddc1f9194ac7134e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php @@ -158,7 +158,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->assertSame( $store, \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore() ); } @@ -167,7 +167,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $ids = $this->_model->getWebsiteStoreIds(); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(); $this->assertEquals(array($storeId => $storeId), $ids); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php index f3641044aa779d960f58cde9baddfdbdd3ec9008..80a357eab8ec6f8a45ed27ddd34e60832690060f 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Model\Category; -use Magento\Catalog\Model\Category\CategoryImageTest\StubZendLogWriterStreamTest as StubZendLogWriterStreamTest; +use Magento\Catalog\Model\Category\CategoryImageTest\StubZendLogWriterStreamTest; class CategoryImageTest extends \PHPUnit_Framework_TestCase { @@ -50,12 +50,12 @@ class CategoryImageTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_oldLogActive = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getConfig( 'dev/log/active' ); $this->_oldExceptionFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getConfig( 'dev/log/exception_file' ); @@ -64,19 +64,23 @@ class CategoryImageTest extends \PHPUnit_Framework_TestCase protected function tearDown() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'dev/log/active', - $this->_oldLogActive + $this->_oldLogActive, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + $this->_oldLogActive = null; \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'dev/log/exception_file', - $this->_oldExceptionFile + $this->_oldExceptionFile, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + $this->_oldExceptionFile = null; $this->_oldWriterModel = null; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php index faff238a0daf34fa4af4a232d99793e0f4ec405e..ba193db46568d5c0baece073a40ae07842a92655 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Category/CategoryImageTest/StubZendLogWriterStreamTest.php @@ -28,16 +28,19 @@ namespace Magento\Catalog\Model\Category\CategoryImageTest; \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( 'dev/log/active', - 1 + 1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( 'dev/log/exception_file', - 'save_category_without_image.log' + 'save_category_without_image.log', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); class StubZendLogWriterStreamTest extends \Zend_Log_Writer_Stream { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php index f63cf98ee4979488c0bc522eb36dbe295f181b6e..7abca867c7e8adba41696fa3a3380c98a919de70 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php @@ -41,7 +41,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase protected static $_objectManager; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; @@ -66,8 +66,8 @@ class CategoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - /** @var $storeManager \Magento\Core\Model\StoreManagerInterface */ - $storeManager = self::$_objectManager->get('Magento\Core\Model\StoreManagerInterface'); + /** @var $storeManager \Magento\Store\Model\StoreManagerInterface */ + $storeManager = self::$_objectManager->get('Magento\Store\Model\StoreManagerInterface'); $this->_store = $storeManager->getStore(); $this->_model = self::$_objectManager->create('Magento\Catalog\Model\Category'); } @@ -142,7 +142,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase /* id from fixture */ $this->assertContains( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), $this->_model->getStoreIds() ); @@ -152,7 +152,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), $this->_model->getStoreId() ); @@ -167,8 +167,8 @@ class CategoryTest extends \PHPUnit_Framework_TestCase */ public function testSetStoreIdWithNonNumericValue() { - /** @var $store \Magento\Core\Model\Store */ - $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store'); + /** @var $store \Magento\Store\Model\Store */ + $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); $store->load('fixturestore'); $this->assertNotEquals($this->_model->getStoreId(), $store->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php index 74ba0387a9e5afda0892c9955381a3144b6a0443..6cc3dcdb7af192cab9930aa7f3c0c1b101d2c1fb 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php @@ -126,10 +126,8 @@ class ProcessorTest extends \Magento\TestFramework\Indexer\TestCase */ public function testAddNewStoreGroup() { - /** @var \Magento\Core\Model\Store\Group $storeGroup */ - $storeGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store\Group' - ); + /** @var \Magento\Store\Model\Group $storeGroup */ + $storeGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Group'); $storeGroup->setData( array('website_id' => 1, 'name' => 'New Store Group', 'root_category_id' => 2, 'group_id' => null) ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php index a08681eed03b49b2c09b001b9ac51b5ce2a0204d..21694177f54e575ca9209ac4f6f4dc2981eea604 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php @@ -40,8 +40,9 @@ class CategoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); $this->_model->setCurrentCategory(4); } @@ -63,35 +64,33 @@ class CategoryTest extends \PHPUnit_Framework_TestCase public function testApply() { - $this->_model->getState() - ->addFilter( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Layer\Filter\Item', - array( - 'data' => array( - 'filter' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create( - 'Magento\Catalog\Model\Layer\Filter\Category', array('layer' => $this->_model) - ), - 'value' => 'expected-value-string', - ) + $this->_model->getState()->addFilter( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Filter\Item', + array( + 'data' => array( + 'filter' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Filter\Category', + array('layer' => $this->_model) + ), + 'value' => 'expected-value-string' ) ) ) - ->addFilter( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Layer\Filter\Item', - array( - 'data' => array( - 'filter' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create( - 'Magento\Catalog\Model\Layer\Filter\Decimal', array('layer' => $this->_model) - ), - 'value' => 1234, - ) + )->addFilter( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Filter\Item', + array( + 'data' => array( + 'filter' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Filter\Decimal', + array('layer' => $this->_model) + ), + 'value' => 1234 ) ) - ); + ) + ); $this->_model->apply(); $this->assertEquals( @@ -115,14 +114,16 @@ class CategoryTest extends \PHPUnit_Framework_TestCase /* Category object */ /** @var $model \Magento\Catalog\Model\Layer */ - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); + $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); $model->setCurrentCategory($existingCategory); $this->assertSame($existingCategory, $model->getCurrentCategory()); /* Category id */ - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); + $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); $model->setCurrentCategory(3); $actualCategory = $model->getCurrentCategory(); $this->assertInstanceOf('Magento\Catalog\Model\Category', $actualCategory); @@ -134,8 +135,9 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Registry')->register('current_category', $existingCategory); try { - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); + $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); $this->assertSame($existingCategory, $model->getCurrentCategory()); $objectManager->get('Magento\Registry')->unregister('current_category'); $this->assertSame($existingCategory, $model->getCurrentCategory()); @@ -146,18 +148,21 @@ class CategoryTest extends \PHPUnit_Framework_TestCase try { - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); + $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); $model->setCurrentCategory(new \Magento\Object()); $this->fail('Assign category of invalid class.'); } catch (\Magento\Model\Exception $e) { } try { - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Layer\Category'); - $model->setCurrentCategory(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Category')); + $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Catalog\Model\Layer\Category' + ); + $model->setCurrentCategory( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Category') + ); $this->fail('Assign category with invalid id.'); } catch (\Magento\Model\Exception $e) { } @@ -167,7 +172,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase { $this->assertSame( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore(), $this->_model->getCurrentStore() ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php index c5239e903c9882659e6849d6af834de3592d0b90..b56354972954798b5862b57f8d1a1ebe50098360 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/PriceTest.php @@ -100,7 +100,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase $product->getId(), $this->_model->getAttribute()->getId(), \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php index 274000f36d166643bf0b16b6d99add38617e1b4b..9837bf5fb8654336e330d43457bb4910e6c002f3 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php @@ -162,12 +162,12 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase public function testAfterSaveEmpty() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->setCurrentStore( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ) ); /** @var $product \Magento\Catalog\Model\Product */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php index 267e449430874ad3e6f287a78bd3a88b91ee86cf..4f63b151cdd2b7ba24e2e7e3de0e966f174be8da 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php @@ -52,7 +52,7 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), $this->_model->getStoreId() ); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php index c45183b620b25b0b44b4ce3301c10138f30aeb4e..2817953b53a861350661079734061495fac0780a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php @@ -136,7 +136,6 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase * @covers \Magento\Catalog\Model\Product::getSpecialToDate * @covers \Magento\Catalog\Model\Product::getRequestPath * @covers \Magento\Catalog\Model\Product::getGiftMessageAvailable - * @covers \Magento\Catalog\Model\Product::getRatingSummary * @dataProvider getObsoleteGettersDataProvider * @param string $key * @param string $method @@ -159,7 +158,6 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase array('special_to_date', 'getSpecialToDate'), array('request_path', 'getRequestPath'), array('gift_message_available', 'getGiftMessageAvailable'), - array('rating_summary', 'getRatingSummary') ); } @@ -260,21 +258,6 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase $this->assertRegExp('/^[0-9]+$/', $setId); } - public function testGetReservedAttributes() - { - $result = $this->_model->getReservedAttributes(); - $this->assertInternalType('array', $result); - $this->assertContains('position', $result); - $this->assertContains('reserved_attributes', $result); - $this->assertContains('is_virtual', $result); - // and 84 more... - - $this->assertNotContains('type_id', $result); - $this->assertNotContains('calculated_final_price', $result); - $this->assertNotContains('request_path', $result); - $this->assertNotContains('rating_summary', $result); - } - public function testGetPreconfiguredValues() { $this->assertInstanceOf('Magento\Object', $this->_model->getPreconfiguredValues()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index fb2e8b2c25ac8558c28f097fd28318cd5ec876ad..46bf76a925e3d3f86b6cb251298f4732a9f6a801 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -110,13 +110,21 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testCleanCache() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') - ->save('test', 'catalog_product_999', array('catalog_product_999')); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\CacheInterface' + )->save( + 'test', + 'catalog_product_999', + array('catalog_product_999') + ); // potential bug: it cleans by cache tags, generated from its ID, which doesn't make much sense $this->_model->setId(999)->cleanCache(); $this->assertFalse( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') - ->load('catalog_product_999') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\CacheInterface' + )->load( + 'catalog_product_999' + ) ); } @@ -182,7 +190,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED, $duplicate->getStatus() ); - $this->assertEquals(\Magento\Core\Model\Store::DEFAULT_STORE_ID, $duplicate->getStoreId()); + $this->assertEquals(\Magento\Store\Model\Store::DEFAULT_STORE_ID, $duplicate->getStoreId()); $this->_undo($duplicate); } catch (\Exception $e) { $this->_undo($duplicate); @@ -213,9 +221,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase protected function _undo($duplicate) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setId( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $duplicate->delete(); } @@ -325,27 +333,6 @@ class ProductTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('sku' => 'sku', 'name' => 'name'), $this->_model->getData()); } - /** - * @param bool $isUserDefined - * @param string $code - * @param bool $expectedResult - * @dataProvider isReservedAttributeDataProvider - */ - public function testIsReservedAttribute($isUserDefined, $code, $expectedResult) - { - $attribute = new \Magento\Object(array('is_user_defined' => $isUserDefined, 'attribute_code' => $code)); - $this->assertEquals($expectedResult, $this->_model->isReservedAttribute($attribute)); - } - - public function isReservedAttributeDataProvider() - { - return array( - array(true, 'position', true), - array(true, 'type_id', false), - array(false, 'no_difference', false) - ); - } - /** * @magentoAppArea adminhtml */ @@ -401,7 +388,6 @@ class ProductTest extends \PHPUnit_Framework_TestCase // impossible to test $_optionInstance $this->assertEquals(array(), $model->getOptions()); $this->assertFalse($model->canAffectOptions()); - // impossible to test $_errors } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php index fb9b322b2f90f529c06569c3178f590ebaa0b901..335a0e71455f4364902db898264665c31763fd2e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/categories.php @@ -99,7 +99,7 @@ $category->setId( )->setCustomUseParentSettings( 0 )->setCustomDesign( - 'magento_blank' + 'Magento/blank' )->save(); $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Category'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/products.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/products.php index 65bdcce0c7c89127dd9c17193c48b32b41a1290c..960d66dd68f41444f87b8a794ddbf5efa297dd23 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/products.php @@ -59,4 +59,4 @@ $customDesignProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager 'Magento\Catalog\Model\Product', array('data' => $product->getData()) ); -$customDesignProduct->setId(2)->setCustomDesign('magento_blank')->save(); +$customDesignProduct->setId(2)->setCustomDesign('Magento/blank')->save(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php index f8fb9bf73cbdcf72cd175c11ec1a154b87176f0d..9757dedd5611515814ad3ceaef8d13114842297b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php @@ -46,7 +46,7 @@ $productOne->setId( )->setAttributeSetId( 4 )->setWebsiteIds( - array($obectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId()) + array($obectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId()) )->setSku( 'simple_product_1' )->setName( @@ -87,7 +87,7 @@ $productTwo->setId( )->setAttributeSetId( 4 )->setWebsiteIds( - array($obectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getWebsiteId()) + array($obectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getWebsiteId()) )->setSku( 'simple_product_2' )->setName( diff --git a/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php new file mode 100644 index 0000000000000000000000000000000000000000..461d16126dafa56e1172fd1ba5796bd2052023a6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/CustomergroupTest.php @@ -0,0 +1,53 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\CatalogInventory\Block\Adminhtml\Form\Field; + +class CustomergroupTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @var \Magento\CatalogInventory\Block\Adminhtml\Form\Field\Customergroup + */ + protected $_block; + + protected function setUp() + { + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\CatalogInventory\Block\Adminhtml\Form\Field\Customergroup' + ); + } + + public function test_toHtml() + { + $this->_block->setClass('customer_group_select'); + $this->_block->setId('123'); + $this->_block->setTitle('Customer Group'); + $this->_block->setInputName('groups[item_options]'); + $expectedResult = '<select name="groups[item_options]" id="123" class="customer_group_select" ' + . 'title="Customer Group" ><option value="32000" >ALL GROUPS</option><option value="0" >NOT LOGGED IN' + . '</option><option value="1" >General</option><option value="2" >Wholesale</option><option value="3" >' + . 'Retailer</option></select>'; + $this->assertEquals($expectedResult, $this->_block->_toHtml()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php index 0f76afe4b3838df312233966a5ba8c2cf2690de0..c70947a84209a4878e9916001614d1666e7d2cb0 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/MainTest.php @@ -49,7 +49,7 @@ class MainTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Registry')->register('current_promo_catalog_rule', $rule); $block = $objectManager->create('Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main'); - $block->setLayout($objectManager->create('Magento\Core\Model\Layout')); + $block->setLayout($objectManager->create('Magento\View\Layout')); $prepareFormMethod = new \ReflectionMethod( 'Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab\Main', '_prepareForm' @@ -58,10 +58,11 @@ class MainTest extends \PHPUnit_Framework_TestCase $prepareFormMethod->invoke($block); $form = $block->getForm(); - foreach (array('from_date', 'to_date') as $id) { + foreach (array('customer_group_ids', 'from_date', 'to_date') as $id) { $element = $form->getElement($id); $this->assertNotNull($element); - $this->assertNotEmpty($element->getDateFormat()); + $actual = ($id == 'customer_group_ids') ? $element->getValues() : $element->getDateFormat(); + $this->assertNotEmpty($actual); } } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/ResultTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/ResultTest.php index d53a4b4ad478c4dc317f4652da9d79bc66e0a1aa..3e52a9f525ff956f88c161cab4e97122d200e584 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/ResultTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Block/ResultTest.php @@ -30,7 +30,7 @@ class ResultTest extends \PHPUnit_Framework_TestCase { public function testSetListOrders() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $layout->addBlock('Magento\View\Element\Text', 'head'); // The tested block is using head block diff --git a/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php index d355e8a5c17c5f0ef8b1074d90a04ba04dab91c2..5e4f6056537bc4771081085a21f6c43490e8d694 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogSearch/Helper/DataTest.php @@ -74,7 +74,7 @@ class DataTest extends \PHPUnit_Framework_TestCase array( $objectManager->get('Magento\App\Helper\Context'), $objectManager->get('Magento\Stdlib\String'), - $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), + $objectManager->get('Magento\App\Config\ScopeConfigInterface'), $objectManager->get('Magento\CatalogSearch\Model\QueryFactory'), $objectManager->get('Magento\Escaper'), $objectManager->get('Magento\Filter\FilterManager') diff --git a/dev/tests/integration/testsuite/Magento/Centinel/CreateOrderTest.php b/dev/tests/integration/testsuite/Magento/Centinel/CreateOrderTest.php index 6897599ccd0277f82bc8acee4cedc3e304a11ed8..20557fda7d21903982317146618215964225552b 100644 --- a/dev/tests/integration/testsuite/Magento/Centinel/CreateOrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Centinel/CreateOrderTest.php @@ -50,7 +50,7 @@ class CreateOrderTest extends \Magento\Backend\Utility\Controller ); $quote = $order->addProducts(array(1 => array('qty' => 1)))->getQuote(); $defaultStoreId = $this->_objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( 'default' )->getId(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/CartTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/CartTest.php index c06fd1ef59313daf4a99fac8632f741f51b52974..0f971a2b538d31aadbf6ba43674277840595f9ff 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/CartTest.php @@ -34,7 +34,7 @@ class CartTest extends \PHPUnit_Framework_TestCase { public function testGetMethods() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $child = $layout->createBlock( 'Magento\View\Element\Text' @@ -53,7 +53,7 @@ class CartTest extends \PHPUnit_Framework_TestCase public function testGetMethodsEmptyChild() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $childEmpty = $layout->createBlock('Magento\View\Element\Text'); /** @var $block \Magento\Checkout\Block\Cart */ @@ -64,7 +64,7 @@ class CartTest extends \PHPUnit_Framework_TestCase public function testGetMethodsNoChild() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Checkout\Block\Cart */ $block = $layout->createBlock('Magento\Checkout\Block\Cart'); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/discount_10percent.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/discount_10percent.php index 97d89d32ec47d2c3add82b52f217b264cf74e65e..c249f7796163e4f3c9d4dc0a09c36ef900c07717 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/discount_10percent.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/discount_10percent.php @@ -32,7 +32,7 @@ $data = array( 'is_active' => true, 'website_ids' => array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getWebsiteId() ), 'customer_group_ids' => array(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID), diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php index ab31955c328ebc0596bcfe5276903d00ac92411b..93b6985a8d35a7960f048e56350f0adeb6f1cb77 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php @@ -48,10 +48,10 @@ class RouterTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\StateInterface'), \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Cms\Model\PageFactory'), \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' ), \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' ) ); } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php index 8ed9f5e184c3b6481b724f00f03e95eacec319a4..a9c6fd95e90ec3618327ecc1dbf16fecd7ee14b4 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Helper/PageTest.php @@ -64,7 +64,7 @@ class PageTest extends \PHPUnit_Framework_TestCase $page->getId() ); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface'); - $this->assertEquals('magento_blank', $design->getDesignTheme()->getThemePath()); + $this->assertEquals('Magento/blank', $design->getDesignTheme()->getThemePath()); $this->assertTrue($result); } } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index a07d77ea11de395a3e1931a7075b03dbecd66e42..f80ee946af097f438a32edc454318985a4fa0124 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -64,7 +64,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface') - ->setDesignTheme('magento_backend'); + ->setDesignTheme('Magento/backend'); /** @var $model \Magento\Cms\Model\Wysiwyg\Images\Storage */ $model = $objectManager->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); $collection = $model->getFilesCollection(self::$_baseDir, 'media'); diff --git a/dev/tests/integration/testsuite/Magento/Cms/_files/block.php b/dev/tests/integration/testsuite/Magento/Cms/_files/block.php index 3a62f83280584d957c85be77ab07219992cd923e..e784d2315bfd843b23585a01d7519651df073a3a 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/_files/block.php +++ b/dev/tests/integration/testsuite/Magento/Cms/_files/block.php @@ -42,7 +42,7 @@ $block->setTitle( )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->save(); diff --git a/dev/tests/integration/testsuite/Magento/Cms/_files/pages.php b/dev/tests/integration/testsuite/Magento/Cms/_files/pages.php index 9c980779f2e4f6df8720fff411fe800e1a657ff1..6a310779daf93af3862547421c825b76be29f892 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/_files/pages.php +++ b/dev/tests/integration/testsuite/Magento/Cms/_files/pages.php @@ -55,5 +55,5 @@ $page->setTitle( )->setRootTemplate( 'one_column' )->setCustomTheme( - 'magento_blank' + 'Magento/blank' )->save(); diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php index e315508fb1dd46d42449006e2c4a04532dd6e2a2..bd655a197716a96444b738543a6c6098a706cdbf 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/SettingsTest.php @@ -62,7 +62,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Registry')->register('current_product', $product); $context = $objectManager->create('Magento\Backend\Block\Template\Context', array('urlBuilder' => $urlModel)); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); /** @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Settings */ $block = $layout->createBlock( diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php index 7113eec93547b1ce1d9e71e15066ca7d37c01812..917995050709cc5d13fc8bf17b26bf93ceafe71f 100644 --- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php +++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Block/Product/Configurable/AssociatedSelector/Backend/Grid/ColumnSetTest.php @@ -43,7 +43,7 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Registry')->register('current_product', $product); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block ColumnSet */ $block = $layout->createBlock( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php index a61d4d77ea450199c2317264d9f33e6baeecd9b0..cdd09c0cec4955ccf63d0b8756b734eeb0232db3 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php @@ -80,8 +80,8 @@ class AreaTest extends \PHPUnit_Framework_TestCase // @codingStandardsIgnoreStart /** - * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"magento_blank";}} - * @magentoConfigFixture current_store design/package/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"magento_blank";}} + * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"Magento/blank";}} + * @magentoConfigFixture current_store design/package/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"Magento/blank";}} * @magentoAppIsolation enabled */ // @codingStandardsIgnoreEnd @@ -94,13 +94,13 @@ class AreaTest extends \PHPUnit_Framework_TestCase $request->setServer(array('HTTP_USER_AGENT' => 'Mozilla Firefox')); $this->_model->detectDesign($request); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface'); - $this->assertEquals('magento_blank', $design->getDesignTheme()->getThemePath()); + $this->assertEquals('Magento/blank', $design->getDesignTheme()->getThemePath()); } // @codingStandardsIgnoreStart /** - * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"magento_blank";}} - * @magentoConfigFixture current_store design/package/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"magento_blank";}} + * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"Magento/blank";}} + * @magentoConfigFixture current_store design/package/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"Magento/blank";}} * @magentoDataFixture Magento/Core/_files/design_change.php * @magentoAppIsolation enabled */ @@ -109,14 +109,14 @@ class AreaTest extends \PHPUnit_Framework_TestCase { $this->_model->detectDesign(); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface'); - $this->assertEquals('magento_plushe', $design->getDesignTheme()->getThemePath()); + $this->assertEquals('Magento/plushe', $design->getDesignTheme()->getThemePath()); } // @codingStandardsIgnoreStart /** * Test that non-frontend areas are not affected neither by user-agent reg expressions, nor by the "design change" * - * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"magento_blank";}} + * @magentoConfigFixture current_store design/theme/ua_regexp a:1:{s:1:"_";a:2:{s:6:"regexp";s:10:"/firefox/i";s:5:"value";s:13:"Magento/blank";}} * magentoDataFixture Magento/Core/_files/design_change.php * @magentoAppIsolation enabled */ @@ -130,6 +130,6 @@ class AreaTest extends \PHPUnit_Framework_TestCase $request->setServer(array('HTTP_USER_AGENT' => 'Mozilla Firefox')); $model->detectDesign($request); $design = $objectManager->get('Magento\View\DesignInterface'); - $this->assertNotEquals('magento_blank', $design->getDesignTheme()->getThemePath()); + $this->assertNotEquals('Magento/blank', $design->getDesignTheme()->getThemePath()); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php index b00b4757e09b5c6e36ebdd3bac261965357ec9eb..1a838c2a2d2673ce63d2ee608705dd27559a7a27 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php @@ -50,8 +50,8 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase public function testSaveValueIsFormedNicely() { $value = array( - '1' => array('search' => '/Opera/', 'value' => 'magento_blank'), - '2' => array('search' => '/Firefox/', 'value' => 'magento_blank') + '1' => array('search' => '/Opera/', 'value' => 'Magento/blank'), + '2' => array('search' => '/Firefox/', 'value' => 'Magento/blank') ); $this->_model->setValue($value); @@ -72,9 +72,9 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase public function testSaveEmptyValueIsSkipped() { $value = array( - '1' => array('search' => '/Opera/', 'value' => 'magento_blank'), - '2' => array('search' => '', 'value' => 'magento_blank'), - '3' => array('search' => '/Firefox/', 'value' => 'magento_blank') + '1' => array('search' => '/Opera/', 'value' => 'Magento/blank'), + '2' => array('search' => '', 'value' => 'Magento/blank'), + '3' => array('search' => '/Firefox/', 'value' => 'Magento/blank') ); $this->_model->setValue($value); @@ -106,11 +106,11 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase public function saveExceptionDataProvider() { $result = array( - array(array('search' => 'Opera', 'value' => 'magento_blank'), '/Opera/i'), - array(array('search' => '/Opera/', 'value' => 'magento_blank'), '/Opera/'), - array(array('search' => '#iPad|iPhone#i', 'value' => 'magento_blank'), '#iPad|iPhone#i'), + array(array('search' => 'Opera', 'value' => 'Magento/blank'), '/Opera/i'), + array(array('search' => '/Opera/', 'value' => 'Magento/blank'), '/Opera/'), + array(array('search' => '#iPad|iPhone#i', 'value' => 'Magento/blank'), '#iPad|iPhone#i'), array( - array('search' => 'Mozilla (3.6+)/Firefox', 'value' => 'magento_blank'), + array('search' => 'Mozilla (3.6+)/Firefox', 'value' => 'Magento/blank'), '/Mozilla \\(3\\.6\\+\\)\\/Firefox/i' ) ); @@ -138,38 +138,38 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase $result = array( array( array( - '1' => array('search' => '/Opera/', 'value' => 'magento_blank'), - '2' => array('search' => '/invalid_regexp(/', 'value' => 'magento_blank') + '1' => array('search' => '/Opera/', 'value' => 'Magento/blank'), + '2' => array('search' => '/invalid_regexp(/', 'value' => 'Magento/blank') ) ), array( array( - '1' => array('search' => '/invalid_regexp', 'value' => 'magento_blank'), - '2' => array('search' => '/Opera/', 'value' => 'magento_blank') + '1' => array('search' => '/invalid_regexp', 'value' => 'Magento/blank'), + '2' => array('search' => '/Opera/', 'value' => 'Magento/blank') ) ), array( array( - '1' => array('search' => 'invalid_regexp/iU', 'value' => 'magento_blank'), - '2' => array('search' => '/Opera/', 'value' => 'magento_blank') + '1' => array('search' => 'invalid_regexp/iU', 'value' => 'Magento/blank'), + '2' => array('search' => '/Opera/', 'value' => 'Magento/blank') ) ), array( array( - '1' => array('search' => 'invalid_regexp#', 'value' => 'magento_blank'), - '2' => array('search' => '/Opera/', 'value' => 'magento_blank') + '1' => array('search' => 'invalid_regexp#', 'value' => 'Magento/blank'), + '2' => array('search' => '/Opera/', 'value' => 'Magento/blank') ) ), array( array( '1' => array('search' => '/Firefox/'), - '2' => array('search' => '/Opera/', 'value' => 'magento_blank') + '2' => array('search' => '/Opera/', 'value' => 'Magento/blank') ) ), array( array( - '1' => array('value' => 'magento_blank'), - '2' => array('search' => '/Opera/', 'value' => 'magento_blank') + '1' => array('value' => 'Magento/blank'), + '2' => array('search' => '/Opera/', 'value' => 'Magento/blank') ) ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php index b3a1fe9a28b7c9dc945ef227c70ef299f4d175a6..bdf6958c58eab4295909757be617c42caa4a6ad2 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php @@ -54,14 +54,14 @@ class DesignTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\DesignInterface'); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getAnyStoreView()->getId(); // fixture design_change $designChange = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Design' ); $designChange->loadChange($storeId)->changeDesign($design); - $this->assertEquals('magento_plushe', $design->getDesignTheme()->getThemePath()); + $this->assertEquals('Magento/plushe', $design->getDesignTheme()->getThemePath()); } public function testCRUD() @@ -69,8 +69,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase $this->_model->setData( array( 'store_id' => 1, - 'design' => 'magento_blank', - /* Note: in order to load a design change it should be active within the store's time zone */ + 'design' => 'Magento/blank', 'date_from' => date('Y-m-d', strtotime('-1 day')), 'date_to' => date('Y-m-d', strtotime('+1 day')) ) @@ -89,7 +88,6 @@ class DesignTest extends \PHPUnit_Framework_TestCase $model->save(); $this->fail('A validation failure is expected.'); } catch (\Magento\Model\Exception $e) { - // intentionally swallow exception } $this->_model->delete(); @@ -122,7 +120,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); $date = $dateTime->now(true); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getAnyStoreView()->getId(); // fixture design_change @@ -132,21 +130,27 @@ class DesignTest extends \PHPUnit_Framework_TestCase $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') - ->load($cacheId); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\CacheInterface' + )->load( + $cacheId + ); $cachedDesign = unserialize($cachedDesign); $this->assertInternalType('array', $cachedDesign); $this->assertArrayHasKey('design', $cachedDesign); $this->assertEquals($cachedDesign['design'], $design->getDesign()); - $design->setDesign('magento_blank')->save(); + $design->setDesign('Magento/blank')->save(); $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') - ->load($cacheId); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\CacheInterface' + )->load( + $cacheId + ); $cachedDesign = unserialize($cachedDesign); $this->assertTrue(is_array($cachedDesign)); @@ -170,14 +174,16 @@ class DesignTest extends \PHPUnit_Framework_TestCase if ($storeDate == $utcDate) { $expectedDesign = "{$storeCode}_today_design"; - } else if ($storeDatetime > $utcDatetime) { - $expectedDesign = "{$storeCode}_tomorrow_design"; } else { - $expectedDesign = "{$storeCode}_yesterday_design"; + if ($storeDatetime > $utcDatetime) { + $expectedDesign = "{$storeCode}_tomorrow_design"; + } else { + $expectedDesign = "{$storeCode}_yesterday_design"; + } } $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $storeCode ); @@ -219,26 +225,10 @@ class DesignTest extends \PHPUnit_Framework_TestCase * that the proper design change is chosen for the timezone with the date different from the UTC. */ return array( - 'default store - UTC+12:00' => array( - 'default', - 'Etc/GMT-12', // "GMT-12", not "GMT+12", see http://www.php.net/manual/en/timezones.others.php#64310 - '+12 hours', - ), - 'default store - UTC-12:00' => array( - 'default', - 'Etc/GMT+12', - '-12 hours', - ), - 'admin store - UTC+12:00' => array( - 'admin', - 'Etc/GMT-12', - '+12 hours', - ), - 'admin store - UTC-12:00' => array( - 'admin', - 'Etc/GMT+12', - '-12 hours', - ), + 'default store - UTC+12:00' => array('default', 'Etc/GMT-12', '+12 hours'), + 'default store - UTC-12:00' => array('default', 'Etc/GMT+12', '-12 hours'), + 'admin store - UTC+12:00' => array('admin', 'Etc/GMT-12', '+12 hours'), + 'admin store - UTC-12:00' => array('admin', 'Etc/GMT+12', '-12 hours') ); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php index 35a6958e1a353a4240ad879c74e7a602bc80ae25..5bff480cc707c260af007dc43bdb23bc1d6e1eab 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php @@ -45,7 +45,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase array('modulePrefix' => 'core') ); $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Store\Collection' + 'Magento\Store\Model\Resource\Store\Collection' ); $this->_select = $collection->getSelect(); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Layout/UpdateTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Layout/UpdateTest.php index b55351d4d8e3a42382c7ed921db16ba0d172a282..d7946ab5431549874930e3f31c412aaf90f4a1f6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Layout/UpdateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Layout/UpdateTest.php @@ -54,7 +54,7 @@ class UpdateTest extends \PHPUnit_Framework_TestCase 'test_handle', $theme, \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore() ); $this->assertEquals('not_temporary', $result); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php deleted file mode 100644 index e083c975bd72bc76f1571cdbf63bc847e58a40ca..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/AbstractSession/VarienTest.php +++ /dev/null @@ -1,85 +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 Magento - * @package Magento_Core - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Session\AbstractSession; - -/** - * Test class for \Magento\Session\SessionManagerInterface - */ -class VarienTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param string $saveMethod - * @param string $iniValue - * @dataProvider sessionSaveMethodDataProvider - */ - public function testSessionSaveMethod($saveMethod, $iniValue) - { - $this->markTestIncomplete('Bug MAGE-5487'); - // depending on configuration some values cannot be set as default save session handlers. - // in such cases warnings will be generated by php and test will fail - $origErrorRep = error_reporting(E_ALL ^ E_WARNING); - $origSessionHandler = ini_set('session.save_handler', $iniValue); - if ($iniValue && ini_get('session.save_handler') != $iniValue) { - ini_set('session.save_handler', $origSessionHandler); - error_reporting($origErrorRep); - $this->markTestSkipped("Can't set '{$iniValue}' as session save handler"); - } - ini_set('session.save_handler', $origSessionHandler); - /** @var $configModel \Magento\App\ConfigInterface */ - $configModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ConfigInterface'); - $configModel->setNode(\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD, $saveMethod); - /** - * @var \Magento\Session\SessionManagerInterface $model - */ - $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Session\SessionManagerInterface' - ); - //There is no any possibility to determine whether session already started or not in php before 5.4 - $model->setSkipEmptySessionCheck(true); - $model->start(); - if ($iniValue) { - $this->assertEquals(ini_get('session.save_handler'), $iniValue); - } - ini_set('session.save_handler', $origSessionHandler); - error_reporting($origErrorRep); - } - - /** - * @return array - */ - public function sessionSaveMethodDataProvider() - { - return array( - array('db', 'user'), - array('memcache', 'memcache'), - array('memcached', 'memcached'), - array('eaccelerator', 'eaccelerator'), - array('', ''), - array('dummy', '') - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/TemplateTest.php index 75ff138600123782786f4c95bc9d833d1c0fc323..60a76fa1a141ec41a09ac93c4f20e4c33437dd6b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/TemplateTest.php @@ -42,7 +42,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function setDesignConfigExceptionDataProvider() { $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(); return array(array(array()), array(array('area' => 'frontend')), array(array('store' => $storeId))); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php index d9ca1292b9ad7a957c7574c1ef27f3ff44b99ba0..1a2eeb8744ea49974f8fdaa9db0e45992c2410db 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -89,11 +89,13 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ protected function _emulateFixtureTheme($themePath = 'test_default') { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')), - ), - )); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( + array( + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')) + ) + ) + ); \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend'); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme($themePath); @@ -154,7 +156,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase public function testGetConfigurationDesignThemeStore() { $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(); $this->assertEquals('one', $this->_model->getConfigurationDesignTheme()); $this->assertEquals('one', $this->_model->getConfigurationDesignTheme(null, array('store' => $storeId))); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/design_change.php b/dev/tests/integration/testsuite/Magento/Core/_files/design_change.php index 3e6d1c77eb9b86f761e9bf93d2eead82a24be12b..7fa3b3129a772c084cb1e6df17d4488b8540f952 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/design_change.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/design_change.php @@ -26,11 +26,8 @@ */ $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getAnyStoreView()->getId(); /** @var $change \Magento\Core\Model\Design */ $change = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); -$change->setStoreId($storeId) - ->setDesign('magento_plushe') - ->setDateFrom('2001-01-01 01:01:01') - ->save(); // creating with predefined ID doesn't work for some reason +$change->setStoreId($storeId)->setDesign('Magento/plushe')->setDateFrom('2001-01-01 01:01:01')->save(); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/design_change_timezone.php b/dev/tests/integration/testsuite/Magento/Core/_files/design_change_timezone.php index 78cdea1aef05372378771df2b4713acc349b599a..117166733967c2f9e92dc2e56d998639ddab253a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/design_change_timezone.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/design_change_timezone.php @@ -35,7 +35,7 @@ $designChanges = array( ); foreach ($designChanges as $designChangeData) { $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $designChangeData['store'] )->getId(); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php b/dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php index ebc6d87c15ec57539e643977fb008ae30e888fdf..4a3c0e3491f35056b764fb8208dc139765d2bce2 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php @@ -22,32 +22,32 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\Website $website */ -$website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Website'); +/** @var \Magento\Store\Model\Website $website */ +$website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Website'); $website->setName('Second Website')->setCode('secondwebsite')->save(); $websiteId = $website->getId(); $groupId = $website->getDefaultGroupId(); -/** @var \Magento\Core\Model\Store $store */ -$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store'); +/** @var \Magento\Store\Model\Store $store */ +$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); $store->setCode('secondstore')->setName('Second Store')->setSortOrder(10)->setIsActive(1); $store->save(); -/** @var \Magento\Core\Model\Website $website */ -$website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Website'); +/** @var \Magento\Store\Model\Website $website */ +$website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Website'); $website->setName('Third Website')->setCode('thirdwebsite')->save(); $websiteId = $website->getId(); $groupId = $website->getDefaultGroupId(); -/** @var \Magento\Core\Model\Store $store */ -$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store'); +/** @var \Magento\Store\Model\Store $store */ +$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); $store->setCode('thirdstore')->setName('Third Store')->setSortOrder(10)->setIsActive(1); $store->save(); /* Refresh stores memory cache */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/store.php b/dev/tests/integration/testsuite/Magento/Core/_files/store.php index 5d486fa08553db510126524fb3325b4f26a56daa..ecc76fbc975f18f9541c880898f04fe75eb03f16 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/store.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/store.php @@ -25,15 +25,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store'); +$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store'); $websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite()->getId(); $groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite()->getDefaultGroupId(); $store->setCode( - 'fixturestore' // fixture_store conflicts with "current_store" notation + 'fixturestore' )->setWebsiteId( $websiteId )->setGroupId( @@ -49,5 +49,5 @@ $store->save(); /* Refresh stores memory cache */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php index 0906a67f324b64ab53b8b4cc09b70cc50acb9ee5..33e147350f982f153d2e83eae4340b924f771776 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Address/EditTest.php @@ -53,7 +53,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\App\State')->setAreaCode('frontend'); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = $objectManager->get('Magento\View\LayoutInterface'); $customerCurrentService = $objectManager->create( 'Magento\Customer\Service\V1\CustomerCurrentServiceInterface', diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php index 46b17341745e7b22fe07203538a35424f0d04292..4eff0847c5fa7b09b44cbc1e6376dbeac7f649fd 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartTest.php @@ -40,7 +40,7 @@ class CartTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Registry */ private $_coreRegistry; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ private $_storeManager; /** @var Cart */ @@ -53,7 +53,7 @@ class CartTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManager'); + $this->_storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManager'); $this->_context = $this->_objectManager->get( 'Magento\Backend\Block\Template\Context', array('storeManager' => $this->_storeManager) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartsTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartsTest.php index 3f6271ffe931d0d3a3dba38d5bcb012e0d5f3194..8cf36cb766f9dc8398f5571f1292d312498cd5af 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartsTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/CartsTest.php @@ -50,7 +50,7 @@ class CartsTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService = $this->_objectManager->get( 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' ); - $storeManager = $this->_objectManager->get('Magento\Core\Model\StoreManager'); + $storeManager = $this->_objectManager->get('Magento\Store\Model\StoreManager'); $this->_context = $this->_objectManager->get( 'Magento\Backend\Block\Template\Context', array('storeManager' => $storeManager) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php index e6072d3a74a13c057d1ea18cceadf865660f004f..32a6c3b78a43f509e12d6be0b94df7f575e0bc3a 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php @@ -34,7 +34,7 @@ use Magento\Customer\Service\V1\CustomerAccountServiceInterface; */ class AccordionTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\Layout */ + /** @var \Magento\View\Layout */ protected $layout; /** @var \Magento\Registry */ @@ -57,7 +57,7 @@ class AccordionTest extends \PHPUnit_Framework_TestCase ); $this->backendSession = $objectManager->get('Magento\Backend\Model\Session'); $this->layout = $objectManager->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php index 9f929dc460bf030cc3366543e5ca7a53703c0bcd..216bbc24b834b998bec2f6faf172e8545aa950bb 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/ViewTest.php @@ -51,7 +51,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase /** @var CustomerGroupServiceInterface */ private $_groupService; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ private $_storeManager; /** @var View */ @@ -61,7 +61,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_storeManager = $objectManager->get('Magento\Core\Model\StoreManager'); + $this->_storeManager = $objectManager->get('Magento\Store\Model\StoreManager'); $this->_context = $objectManager->get( 'Magento\Backend\Block\Template\Context', array('storeManager' => $this->_storeManager) @@ -159,8 +159,9 @@ class ViewTest extends \PHPUnit_Framework_TestCase $defaultTimeZonePath = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Stdlib\DateTime\TimezoneInterface' )->getDefaultTimezonePath(); - $timezone = $this->_context->getStoreConfig()->getConfig( + $timezone = $this->_context->getScopeConfig()->getValue( $defaultTimeZonePath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_loadCustomer()->getStoreId() ); $this->assertEquals($timezone, $this->_block->getStoreCreateDateTimezone()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php index d872ba4e5ada8814583582718d3fe509c27dadeb..b919b5c8f1256e2320e49f50fbe239f9088fe746 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/Edit/FormTest.php @@ -21,12 +21,13 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Customer\Block\Adminhtml\Group\Edit; use Magento\Backend\App\Area\FrontNameResolver; use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Service\V1\Data\CustomerGroup; -use Magento\Customer\Service\V1\Data\FilterBuilder; +use Magento\Service\V1\Data\FilterBuilder; use Magento\Customer\Service\V1\Data\SearchCriteriaBuilder; use Magento\TestFramework\Helper\Bootstrap; @@ -59,12 +60,10 @@ class FormTest extends \PHPUnit_Framework_TestCase { parent::setUp(); $this->layout = Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', - array('area' => FrontNameResolver::AREA_CODE) - ); - $this->customerGroupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' + 'Magento\View\Layout' ); + $this->customerGroupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry'); } @@ -81,10 +80,8 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testGetForm() { - $this->registry->register( - RegistryConstants::CURRENT_GROUP_ID, - $this->customerGroupService->getDefaultGroup(0)->getId() - ); + $this->registry + ->register(RegistryConstants::CURRENT_GROUP_ID, $this->customerGroupService->getDefaultGroup(0)->getId()); /** @var $block Form */ $block = $this->layout->createBlock('Magento\Customer\Block\Adminhtml\Group\Edit\Form', 'block'); @@ -109,9 +106,9 @@ class FormTest extends \PHPUnit_Framework_TestCase */ public function testGetFormExistInCustomGroup() { - $searchCriteria = (new SearchCriteriaBuilder())->addFilter( - (new FilterBuilder())->setField('code')->setValue('custom_group')->create() - )->create(); + $searchCriteria = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\Data\SearchCriteriaBuilder') + ->addFilter((new FilterBuilder())->setField('code')->setValue('custom_group')->create())->create(); /** @var CustomerGroup $customerGroup */ $customerGroup = $this->customerGroupService->searchGroups($searchCriteria)->getItems()[0]; $this->registry->register(RegistryConstants::CURRENT_GROUP_ID, $customerGroup->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php index 8bdc0a1cc9f827fc9b3b7da6d376d4c50334c687..3b2511b7ed35ccab61588766ee9ef2f38948ec30 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Group/EditTest.php @@ -21,12 +21,13 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Customer\Block\Adminhtml\Group; use Magento\Backend\App\Area\FrontNameResolver; use Magento\Customer\Controller\RegistryConstants; use Magento\Customer\Service\V1\Data\CustomerGroup; -use Magento\Customer\Service\V1\Data\FilterBuilder; +use Magento\Service\V1\Data\FilterBuilder; use Magento\Customer\Service\V1\Data\SearchCriteriaBuilder; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\AbstractController; @@ -60,12 +61,10 @@ class EditTest extends AbstractController { parent::setUp(); $this->layout = Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', - array('area' => FrontNameResolver::AREA_CODE) - ); - $this->customerGroupService = Bootstrap::getObjectManager()->create( - 'Magento\Customer\Service\V1\CustomerGroupService' + 'Magento\View\Layout' ); + $this->customerGroupService = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\CustomerGroupService'); $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry'); } @@ -98,9 +97,9 @@ class EditTest extends AbstractController */ public function testDeleteButtonExistInCustomGroup() { - $searchCriteria = (new SearchCriteriaBuilder())->addFilter( - (new FilterBuilder())->setField('code')->setValue('custom_group')->create() - )->create(); + $searchCriteria = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\Data\SearchCriteriaBuilder') + ->addFilter((new FilterBuilder())->setField('code')->setValue('custom_group')->create())->create(); /** @var CustomerGroup $customerGroup */ $customerGroup = $this->customerGroupService->searchGroups($searchCriteria)->getItems()[0]; $this->getRequest()->setParam('id', $customerGroup->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php index d798a535998c774cd4dd2f83faf2d5bc344c54df..4a4040f4b0b001bb0f87bf08cbb3399e01d63a13 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/OnlineTest.php @@ -38,7 +38,7 @@ class OnlineTest extends \PHPUnit_Framework_TestCase { /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) ); /** @var $block \Magento\Customer\Block\Adminhtml\Online */ diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php index e6b2fa1df335e59cfde84b7561b02eb13d3cd60d..ab276bdb7ef3d99f4bb6a9cb10c56a9a985ec261 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/GroupTest.php @@ -35,9 +35,7 @@ use Magento\Customer\Service\V1\CustomerGroupServiceInterface; class GroupTest extends \Magento\Backend\Utility\Controller { const TAX_CLASS_ID = 3; - const CUSTOMER_GROUP_CODE = 'New Customer Group'; - const BASE_CONTROLLER_URL = 'http://localhost/index.php/backend/customer/group/'; protected static $_customerGroupId; @@ -45,24 +43,26 @@ class GroupTest extends \Magento\Backend\Utility\Controller public static function setUpBeforeClass() { /** @var CustomerGroupServiceInterface $groupService */ - $groupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' - ); + $groupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); /** @var CustomerGroupBuilder $groupBuilder */ - $groupBuilder = Bootstrap::getObjectManager()->get('Magento\Customer\Service\V1\Data\CustomerGroupBuilder'); - $group = $groupBuilder->populateWithArray( - array('id' => null, 'code' => self::CUSTOMER_GROUP_CODE, 'tax_class_id' => self::TAX_CLASS_ID) - )->create(); - self::$_customerGroupId = $groupService->saveGroup($group); + $groupBuilder = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\Data\CustomerGroupBuilder'); + $group = $groupBuilder->populateWithArray([ + 'id' => null, + 'code' => self::CUSTOMER_GROUP_CODE, + 'tax_class_id' => self::TAX_CLASS_ID + ]) + ->create(); + self::$_customerGroupId = $groupService->saveGroup($group);; } public static function tearDownAfterClass() { /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ - $groupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' - ); + $groupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); $groupService->deleteGroup(self::$_customerGroupId); } @@ -91,7 +91,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller * Check that success message is set */ $this->assertSessionMessages( - $this->equalTo(array('The customer group has been deleted.')), + $this->equalTo(['The customer group has been deleted.']), MessageInterface::TYPE_SUCCESS ); $this->assertRedirect($this->stringStartsWith(self::BASE_CONTROLLER_URL . 'index')); @@ -106,7 +106,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller * Check that error message is set */ $this->assertSessionMessages( - $this->equalTo(array('The customer group no longer exists.')), + $this->equalTo(['The customer group no longer exists.']), MessageInterface::TYPE_ERROR ); $this->assertRedirect($this->stringStartsWith(self::BASE_CONTROLLER_URL)); @@ -127,25 +127,24 @@ class GroupTest extends \Magento\Backend\Utility\Controller $this->assertSessionMessages($this->logicalNot($this->isEmpty()), MessageInterface::TYPE_SUCCESS); $this->assertSessionMessages( - $this->equalTo(array('The customer group has been saved.')), + $this->equalTo(['The customer group has been saved.']), MessageInterface::TYPE_SUCCESS ); /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ - $groupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' - ); + $groupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); $customerGroupData = \Magento\Service\DataObjectConverter::toFlatArray( $groupService->getGroup(self::$_customerGroupId) ); ksort($customerGroupData); $this->assertEquals( - array( + [ 'code' => self::CUSTOMER_GROUP_CODE, 'id' => self::$_customerGroupId, 'tax_class_id' => self::TAX_CLASS_ID - ), + ], $customerGroupData ); } @@ -155,23 +154,23 @@ class GroupTest extends \Magento\Backend\Utility\Controller */ public function testSaveActionExistingGroupWithEmptyGroupCode() { + /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ + $groupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); + + $originalCode = $groupService->getGroup(self::$_customerGroupId)->getCode(); + $this->getRequest()->setParam('tax_class', self::TAX_CLASS_ID); $this->getRequest()->setParam('id', self::$_customerGroupId); $this->getRequest()->setParam('code', ''); $this->dispatch('backend/customer/group/save'); - $this->assertSessionMessages( - $this->equalTo(array('The customer group has been saved.')), - MessageInterface::TYPE_SUCCESS - ); - - /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ - $groupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' - ); + $this->assertSessionMessages($this->equalTo(["One or more input exceptions have occurred.\n" + . "{\n\tcode: INVALID_FIELD_VALUE\n\tcode: \n\tparams: []\n }\n"]), MessageInterface::TYPE_ERROR); + $this->assertSessionMessages($this->isEmpty(), MessageInterface::TYPE_SUCCESS); - $this->assertEmpty($groupService->getGroup(self::$_customerGroupId)->getCode()); + $this->assertEquals($originalCode, $groupService->getGroup(self::$_customerGroupId)->getCode()); } public function testSaveActionForwardNewCreateNewGroup() @@ -187,9 +186,8 @@ class GroupTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/customer/group/save'); /** @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface $groupService */ - $groupService = Bootstrap::getObjectManager()->get( - 'Magento\Customer\Service\V1\CustomerGroupServiceInterface' - ); + $groupService = Bootstrap::getObjectManager() + ->get('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); $customerGroupCode = $groupService->getGroup(self::$_customerGroupId)->getCode(); $responseBody = $this->getResponse()->getBody(); @@ -206,7 +204,7 @@ class GroupTest extends \Magento\Backend\Utility\Controller $this->assertSessionMessages($this->isEmpty(), MessageInterface::TYPE_SUCCESS); $this->assertSessionMessages($this->logicalNot($this->isEmpty()), MessageInterface::TYPE_ERROR); $this->assertSessionMessages( - $this->equalTo(array('No such entity with groupId = 10000')), + $this->equalTo(['No such entity with groupId = 10000']), MessageInterface::TYPE_ERROR ); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 40e9a576d4a8b6aff2e1c7977512d54b1aacc643..7c6ae72cd68099bf48fd9509eca0a66c30d76511 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -212,7 +212,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller ); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $objectManager->get("Magento\Newsletter\Model\SubscriberFactory")->create(); + $subscriber = $objectManager->get('Magento\Newsletter\Model\SubscriberFactory')->create(); $this->assertEmpty($subscriber->getId()); $subscriber->loadByCustomerId($customerId); $this->assertEmpty($subscriber->getId()); @@ -305,7 +305,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller $this->assertEquals('new firstname', $newAddress->getFirstname()); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $objectManager->get("Magento\Newsletter\Model\SubscriberFactory")->create(); + $subscriber = $objectManager->get('Magento\Newsletter\Model\SubscriberFactory')->create(); $this->assertEmpty($subscriber->getId()); $subscriber->loadByCustomerId($customerId); $this->assertNotEmpty($subscriber->getId()); @@ -324,7 +324,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller $objectManager = Bootstrap::getObjectManager(); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $objectManager->get("Magento\Newsletter\Model\SubscriberFactory")->create(); + $subscriber = $objectManager->get('Magento\Newsletter\Model\SubscriberFactory')->create(); $this->assertEmpty($subscriber->getId()); $subscriber->loadByCustomerId($customerId); $this->assertNotEmpty($subscriber->getId()); @@ -338,7 +338,7 @@ class IndexTest extends \Magento\Backend\Utility\Controller $this->dispatch('backend/customer/index/save'); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ - $subscriber = $objectManager->get("Magento\Newsletter\Model\SubscriberFactory")->create(); + $subscriber = $objectManager->get('Magento\Newsletter\Model\SubscriberFactory')->create(); $this->assertEmpty($subscriber->getId()); $subscriber->loadByCustomerId($customerId); $this->assertNotEmpty($subscriber->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Helper/DataTest.php deleted file mode 100644 index 17176d8368b3682807ad0aa9e00c490c8ffb9e60..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Customer/Helper/DataTest.php +++ /dev/null @@ -1,76 +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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Customer\Helper; - -use Magento\TestFramework\Helper\Bootstrap; - -class DataTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Customer\Helper\Data */ - protected $_dataHelper; - - /** @var \Magento\Customer\Model\Session */ - protected $_customerSession; - - protected function setUp() - { - $this->_dataHelper = Bootstrap::getObjectManager()->create('Magento\Customer\Helper\Data'); - $this->_customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session'); - $this->_customerSession->setCustomerId(1); - parent::setUp(); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testGetCustomerData() - { - $this->assertInstanceOf('\Magento\Customer\Service\V1\Data\Customer', $this->_dataHelper->getCustomerData()); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testCustomerHasNoAddresses() - { - $this->assertFalse($this->_dataHelper->customerHasAddresses()); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php - */ - public function testCustomerHasAddresses() - { - $this->assertTrue($this->_dataHelper->customerHasAddresses()); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testConfirmationNotRequired() - { - $this->assertFalse($this->_dataHelper->isConfirmationRequired()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php index af4cdd933c70400c5abb8d48d2a171a400ee1f6e..51028b0a10c5028c31653002041baf0fe1fa8cdd 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php @@ -49,8 +49,8 @@ class ShareTest extends \PHPUnit_Framework_TestCase /** @var Share $share */ $share = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Config\Share'); $expectedIds = array(1); - /** @var \Magento\Core\Model\Website $website */ - $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Website'); + /** @var \Magento\Store\Model\Website $website */ + $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Website'); $expectedIds[] = $website->load('secondwebsite')->getId(); $expectedIds[] = $website->load('thirdwebsite')->getId(); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index 3e34b3df8e61f190bcd664ff4263a973d6046918..9f0f439d26d2d2077fabf5cf5d99de09a54c47ce 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -1,10 +1,12 @@ <?php -namespace Magento\Customer\Service\V1; +namespace Magento\Customer\Service\V1; use Magento\Customer\Service\V1; use Magento\Exception\InputException; use Magento\Exception\NoSuchEntityException; use Magento\Exception\StateException; +use Magento\Service\V1\Data\FilterBuilder; +use Magento\TestFramework\Helper\Bootstrap; /** * Integration test for service layer \Magento\Customer\Service\V1\CustomerAccountService @@ -60,75 +62,50 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_customerAccountService = $this->_objectManager->create( - 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' - ); - $this->_customerAddressService = $this->_objectManager->create( - 'Magento\Customer\Service\V1\CustomerAddressServiceInterface' - ); + $this->_objectManager = Bootstrap::getObjectManager(); + $this->_customerAccountService = $this->_objectManager + ->create('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + $this->_customerAddressService = + $this->_objectManager->create('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); $this->_addressBuilder = $this->_objectManager->create('Magento\Customer\Service\V1\Data\AddressBuilder'); $this->_customerBuilder = $this->_objectManager->create('Magento\Customer\Service\V1\Data\CustomerBuilder'); - $this->_customerDetailsBuilder = $this->_objectManager->create( - 'Magento\Customer\Service\V1\Data\CustomerDetailsBuilder' - ); - - $this->_addressBuilder->setId( - 1 - )->setCountryId( - 'US' - )->setCustomerId( - 1 - )->setDefaultBilling( - true - )->setDefaultShipping( - true - )->setPostcode( - '75477' - )->setRegion( - (new V1\Data\RegionBuilder())->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create() - )->setStreet( - array('Green str, 67') - )->setTelephone( - '3468676' - )->setCity( - 'CityM' - )->setFirstname( - 'John' - )->setLastname( - 'Smith' - ); + $this->_customerDetailsBuilder = + $this->_objectManager->create('Magento\Customer\Service\V1\Data\CustomerDetailsBuilder'); + + $this->_addressBuilder->setId(1) + ->setCountryId('US') + ->setCustomerId(1) + ->setDefaultBilling(true) + ->setDefaultShipping(true) + ->setPostcode('75477') + ->setRegion( + (new V1\Data\RegionBuilder())->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create() + ) + ->setStreet(['Green str, 67']) + ->setTelephone('3468676') + ->setCity('CityM') + ->setFirstname('John') + ->setLastname('Smith'); $address = $this->_addressBuilder->create(); - $this->_addressBuilder->setId( - 2 - )->setCountryId( - 'US' - )->setCustomerId( - 1 - )->setDefaultBilling( - false - )->setDefaultShipping( - false - )->setPostcode( - '47676' - )->setRegion( - (new V1\Data\RegionBuilder())->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create() - )->setStreet( - array('Black str, 48') - )->setCity( - 'CityX' - )->setTelephone( - '3234676' - )->setFirstname( - 'John' - )->setLastname( - 'Smith' - ); + $this->_addressBuilder->setId(2) + ->setCountryId('US') + ->setCustomerId(1) + ->setDefaultBilling(false) + ->setDefaultShipping(false) + ->setPostcode('47676') + ->setRegion( + (new V1\Data\RegionBuilder())->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create() + ) + ->setStreet(['Black str, 48']) + ->setCity('CityX') + ->setTelephone('3234676') + ->setFirstname('John') + ->setLastname('Smith'); $address2 = $this->_addressBuilder->create(); - $this->_expectedAddresses = array($address, $address2); + $this->_expectedAddresses = [$address, $address2]; } /** @@ -165,6 +142,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->authenticate('non_existing_user', 'password', true); } + /** * @magentoAppArea frontend * @magentoDataFixture Magento/Customer/_files/customer.php @@ -231,9 +209,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->activateCustomer($customerModel->getId(), $key . $key); $this->fail('Expected exception was not thrown'); } catch (InputException $ie) { - $expectedParams = array( - array('code' => StateException::INPUT_MISMATCH, 'fieldName' => 'confirmation', 'value' => $key . $key) - ); + $expectedParams = [ + [ + 'code' => StateException::INPUT_MISMATCH, + 'fieldName' => 'confirmation', + 'value' => $key . $key, + ] + ]; $this->assertEquals($expectedParams, $ie->getParams()); } } @@ -251,7 +233,9 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->activateCustomer('1234' . $customerModel->getId(), $key); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('customerId' => '12341'); + $expectedParams = [ + 'customerId' => '12341', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -274,6 +258,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->activateCustomer($customerModel->getId(), $key); } + /** * @magentoDataFixture Magento/Customer/_files/customer.php */ @@ -308,13 +293,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->validateResetPasswordLinkToken(1, $invalidToken); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $expectedParams = array( - array( + $expectedParams = [ + [ 'value' => $invalidToken, 'fieldName' => 'resetPasswordLinkToken', - 'code' => InputException::INVALID_FIELD_VALUE - ) - ); + 'code' => InputException::INVALID_FIELD_VALUE, + ] + ]; $this->assertEquals($expectedParams, $ie->getParams()); } } @@ -331,7 +316,9 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->validateResetPasswordLinkToken(4200, $resetToken); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('customerId' => '4200'); + $expectedParams = [ + 'customerId' => '4200', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -346,13 +333,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->validateResetPasswordLinkToken(1, null); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $expectedParams = array( - array( + $expectedParams = [ + [ 'value' => null, 'fieldName' => 'resetPasswordLinkToken', - 'code' => InputException::INVALID_FIELD_VALUE - ) - ); + 'code' => InputException::INVALID_FIELD_VALUE, + ] + ]; $this->assertEquals($expectedParams, $ie->getParams()); } } @@ -377,14 +364,14 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $email = 'foo@example.com'; try { - $this->_customerAccountService->initiatePasswordReset( - $email, - 0, - CustomerAccountServiceInterface::EMAIL_RESET - ); + $this->_customerAccountService->initiatePasswordReset($email, 0, + CustomerAccountServiceInterface::EMAIL_RESET); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('email' => $email, 'websiteId' => 0); + $expectedParams = [ + 'email' => $email, + 'websiteId' => 0, + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -402,6 +389,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase //TODO assert } + + /** * @magentoDataFixture Magento/Customer/_files/customer.php * @@ -432,13 +421,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->resetPassword(1, $invalidToken, $password); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $expectedParams = array( - array( + $expectedParams = [ + [ 'value' => $invalidToken, 'fieldName' => 'resetPasswordLinkToken', - 'code' => InputException::INVALID_FIELD_VALUE - ) - ); + 'code' => InputException::INVALID_FIELD_VALUE, + ] + ]; $this->assertEquals($expectedParams, $ie->getParams()); } } @@ -455,7 +444,9 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->resetPassword(4200, $resetToken, $password); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('customerId' => '4200'); + $expectedParams = [ + 'customerId' => '4200', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -474,11 +465,16 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->resetPassword(0, $resetToken, $password); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $expectedParams = array( - array('value' => 0, 'fieldName' => 'customerId', 'code' => InputException::INVALID_FIELD_VALUE) - ); + $expectedParams = [ + [ + 'value' => 0, + 'fieldName' => 'customerId', + 'code' => InputException::INVALID_FIELD_VALUE, + ] + ]; $this->assertEquals($expectedParams, $ie->getParams()); } + } /** @@ -502,7 +498,10 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase try { $this->_customerAccountService->resendConfirmation('customer@needAconfirmation.com', 'notAWebsiteId'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('email' => 'customer@needAconfirmation.com', 'websiteId' => 'notAWebsiteId'); + $expectedParams = [ + 'email' => 'customer@needAconfirmation.com', + 'websiteId' => 'notAWebsiteId', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -516,7 +515,10 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->resendConfirmation('wrongemail@example.com', 1); $this->fail('Expected exception not thrown.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('email' => 'wrongemail@example.com', 'websiteId' => '1'); + $expectedParams = [ + 'email' => 'wrongemail@example.com', + 'websiteId' => '1', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); } } @@ -546,7 +548,10 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerDetails = $this->_customerAccountService->getCustomerDetails($customerId); $newCustomer = array_merge( $customerDetails->getCustomer()->__toArray(), - array('firstname' => $firstName, 'lastname' => $lastName) + [ + 'firstname' => $firstName, + 'lastname' => $lastName, + ] ); $this->_customerBuilder->populateWithArray($newCustomer); $this->_customerDetailsBuilder->setCustomer($this->_customerBuilder->create()); @@ -556,6 +561,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $newCustomerDetails->getCustomer()->getFirstname()); $this->assertEquals($lastName, $newCustomerDetails->getCustomer()->getLastname()); $this->assertEquals(2, count($newCustomerDetails->getAddresses())); + } /** @@ -571,14 +577,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerDetails = $this->_customerAccountService->getCustomerDetails($customerId); $addresses = $customerDetails->getAddresses(); $addressId = $addresses[0]->getId(); - $newAddress = array_merge($addresses[0]->__toArray(), array('city' => $city)); + $newAddress = array_merge($addresses[0]->__toArray(), ['city' => $city]); $this->_addressBuilder->populateWithArray($newAddress); - $this->_customerDetailsBuilder->setCustomer( - $customerDetails->getCustomer() - )->setAddresses( - array($this->_addressBuilder->create(), $addresses[1]) - ); + $this->_customerDetailsBuilder->setCustomer($customerDetails->getCustomer()) + ->setAddresses(array($this->_addressBuilder->create(), $addresses[1])); $this->_customerAccountService->updateCustomer($this->_customerDetailsBuilder->create()); $newCustomerDetails = $this->_customerAccountService->getCustomerDetails($customerId); @@ -603,11 +606,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $addresses = $customerDetails->getAddresses(); $addressIdToRetain = $addresses[1]->getId(); - $this->_customerDetailsBuilder->setCustomer( - $customerDetails->getCustomer() - )->setAddresses( - array($addresses[1]) - ); + $this->_customerDetailsBuilder->setCustomer($customerDetails->getCustomer()) + ->setAddresses([$addresses[1]]); $this->_customerAccountService->updateCustomer($this->_customerDetailsBuilder->create()); @@ -625,7 +625,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase { $customerId = 1; $customerDetails = $this->_customerAccountService->getCustomerDetails($customerId); - $this->_customerDetailsBuilder->setCustomer($customerDetails->getCustomer())->setAddresses(array()); + $this->_customerDetailsBuilder->setCustomer($customerDetails->getCustomer()) + ->setAddresses([]); $this->_customerAccountService->updateCustomer($this->_customerDetailsBuilder->create()); $newCustomerDetails = $this->_customerAccountService->getCustomerDetails($customerId); @@ -646,17 +647,14 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerBefore = $this->_customerAccountService->getCustomer($existingCustId); - $customerData = array_merge( - $customerBefore->__toArray(), - array( - 'id' => 1, - 'email' => $email, - 'firstname' => $firstName, - 'lastname' => $lastname, - 'created_in' => 'Admin', - 'password' => 'notsaved' - ) - ); + $customerData = array_merge($customerBefore->__toArray(), array( + 'id' => 1, + 'email' => $email, + 'firstname' => $firstName, + 'lastname' => $lastname, + 'created_in' => 'Admin', + 'password' => 'notsaved' + )); $this->_customerBuilder->populateWithArray($customerData); $modifiedCustomer = $this->_customerBuilder->create(); @@ -667,7 +665,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $customerAfter->getFirstname()); $this->assertEquals($lastname, $customerAfter->getLastname()); $this->assertEquals('Admin', $customerAfter->getCreatedIn()); - $this->_customerAccountService->authenticate($customerAfter->getEmail(), 'aPassword', true); + $this->_customerAccountService->authenticate( + $customerAfter->getEmail(), + 'aPassword', + true + ); $attributesBefore = \Magento\Service\DataObjectConverter::toFlatArray($customerBefore); $attributesAfter = \Magento\Service\DataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' @@ -675,7 +677,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase unset($attributesAfter['updated_at']); $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter); $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore); - $expectedInBefore = array('firstname', 'lastname', 'email'); + $expectedInBefore = array( + 'firstname', + 'lastname', + 'email', + ); foreach ($expectedInBefore as $key) { $this->assertContains($key, array_keys($inBeforeOnly)); } @@ -699,15 +705,14 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $lastName = 'Lastsave'; $customerBefore = $this->_customerAccountService->getCustomer($existingCustId); - $customerData = array_merge( - $customerBefore->__toArray(), - array( + $customerData = array_merge($customerBefore->__toArray(), + [ 'id' => 1, 'email' => $email, 'firstname' => $firstName, 'lastname' => $lastName, 'created_in' => 'Admin' - ) + ] ); $this->_customerBuilder->populateWithArray($customerData); $modifiedCustomer = $this->_customerBuilder->create(); @@ -719,7 +724,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $customerAfter->getFirstname()); $this->assertEquals($lastName, $customerAfter->getLastname()); $this->assertEquals('Admin', $customerAfter->getCreatedIn()); - $this->_customerAccountService->authenticate($customerAfter->getEmail(), 'password', true); + $this->_customerAccountService->authenticate( + $customerAfter->getEmail(), + 'password', + true + ); $attributesBefore = \Magento\Service\DataObjectConverter::toFlatArray($customerBefore); $attributesAfter = \Magento\Service\DataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' @@ -727,12 +736,21 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase unset($attributesAfter['updated_at']); $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter); $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore); - $expectedInBefore = array('firstname', 'lastname', 'email'); + $expectedInBefore = array( + 'firstname', + 'lastname', + 'email', + ); sort($expectedInBefore); $actualInBeforeOnly = array_keys($inBeforeOnly); sort($actualInBeforeOnly); $this->assertEquals($expectedInBefore, $actualInBeforeOnly); - $expectedInAfter = array('firstname', 'lastname', 'email', 'created_in'); + $expectedInAfter = array( + 'firstname', + 'lastname', + 'email', + 'created_in', + ); sort($expectedInAfter); $actualInAfterOnly = array_keys($inAfterOnly); sort($actualInAfterOnly); @@ -752,16 +770,15 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $lastName = 'Lastsave'; $customerBefore = $this->_customerAccountService->getCustomer($existingCustId); - $customerData = array_merge( - $customerBefore->__toArray(), - array( + $customerData = array_merge($customerBefore->__toArray(), + [ 'id' => 1, 'email' => $email, 'firstname' => $firstName, 'lastname' => $lastName, 'created_in' => 'Admin', 'password' => 'aPassword' - ) + ] ); $this->_customerBuilder->populateWithArray($customerData); $modifiedCustomer = $this->_customerBuilder->create(); @@ -773,7 +790,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $customerAfter->getFirstname()); $this->assertEquals($lastName, $customerAfter->getLastname()); $this->assertEquals('Admin', $customerAfter->getCreatedIn()); - $this->_customerAccountService->authenticate($customerAfter->getEmail(), 'password', true); + $this->_customerAccountService->authenticate( + $customerAfter->getEmail(), + 'password', + true + ); $attributesBefore = \Magento\Service\DataObjectConverter::toFlatArray($customerBefore); $attributesAfter = \Magento\Service\DataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' @@ -781,12 +802,21 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase unset($attributesAfter['updated_at']); $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter); $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore); - $expectedInBefore = array('firstname', 'lastname', 'email'); + $expectedInBefore = array( + 'firstname', + 'lastname', + 'email', + ); sort($expectedInBefore); $actualInBeforeOnly = array_keys($inBeforeOnly); sort($actualInBeforeOnly); $this->assertEquals($expectedInBefore, $actualInBeforeOnly); - $expectedInAfter = array('firstname', 'lastname', 'email', 'created_in'); + $expectedInAfter = array( + 'firstname', + 'lastname', + 'email', + 'created_in', + ); sort($expectedInAfter); $actualInAfterOnly = array_keys($inAfterOnly); sort($actualInAfterOnly); @@ -798,7 +828,10 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase */ public function testSaveCustomerException() { - $customerData = array('id' => 1, 'password' => 'aPassword'); + $customerData = [ + 'id' => 1, + 'password' => 'aPassword' + ]; $this->_customerBuilder->populateWithArray($customerData); $customerEntity = $this->_customerBuilder->create(); @@ -806,11 +839,23 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->saveCustomer($customerEntity); $this->fail('Expected exception not thrown'); } catch (InputException $ie) { - $expectedParams = array( - array('fieldName' => 'firstname', 'value' => '', 'code' => InputException::REQUIRED_FIELD), - array('fieldName' => 'lastname', 'value' => '', 'code' => InputException::REQUIRED_FIELD), - array('fieldName' => 'email', 'value' => '', 'code' => InputException::INVALID_FIELD_VALUE) - ); + $expectedParams = [ + [ + 'fieldName' => 'firstname', + 'value' => '', + 'code' => InputException::REQUIRED_FIELD, + ], + [ + 'fieldName' => 'lastname', + 'value' => '', + 'code' => InputException::REQUIRED_FIELD, + ], + [ + 'fieldName' => 'email', + 'value' => '', + 'code' => InputException::INVALID_FIELD_VALUE, + ], + ]; $this->assertEquals($expectedParams, $ie->getParams()); } } @@ -828,15 +873,14 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $email = 'savecustomer@example.com'; $firstName = 'Firstsave'; $lastName = 'Lastsave'; - $customerData = array_merge( - $existingCustomer->__toArray(), - array( + $customerData = array_merge($existingCustomer->__toArray(), + [ 'id' => $newCustId, 'email' => $email, 'firstname' => $firstName, 'lastname' => $lastName, 'created_in' => 'Admin' - ) + ] ); $this->_customerBuilder->populateWithArray($customerData); $customerEntity = $this->_customerBuilder->create(); @@ -848,7 +892,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $customerAfter->getFirstname()); $this->assertEquals($lastName, $customerAfter->getLastname()); $this->assertEquals('Admin', $customerAfter->getCreatedIn()); - $this->_customerAccountService->authenticate($customerAfter->getEmail(), 'aPassword', true); + $this->_customerAccountService->authenticate( + $customerAfter->getEmail(), + 'aPassword', + true + ); $attributesBefore = \Magento\Service\DataObjectConverter::toFlatArray($existingCustomer); $attributesAfter = \Magento\Service\DataObjectConverter::toFlatArray($customerAfter); // ignore 'updated_at' @@ -856,12 +904,23 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase unset($attributesAfter['updated_at']); $inBeforeOnly = array_diff_assoc($attributesBefore, $attributesAfter); $inAfterOnly = array_diff_assoc($attributesAfter, $attributesBefore); - $expectedInBefore = array('email', 'firstname', 'id', 'lastname'); + $expectedInBefore = array( + 'email', + 'firstname', + 'id', + 'lastname' + ); sort($expectedInBefore); $actualInBeforeOnly = array_keys($inBeforeOnly); sort($actualInBeforeOnly); $this->assertEquals($expectedInBefore, $actualInBeforeOnly); - $expectedInAfter = array('created_in', 'email', 'firstname', 'id', 'lastname'); + $expectedInAfter = array( + 'created_in', + 'email', + 'firstname', + 'id', + 'lastname', + ); sort($expectedInAfter); $actualInAfterOnly = array_keys($inAfterOnly); sort($actualInAfterOnly); @@ -881,61 +940,38 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $password = 'aPassword'; /** @var \Magento\Customer\Model\Customer $customerModel */ - $customerModel = $this->_objectManager->create('Magento\Customer\Model\CustomerFactory')->create(); - $customerModel->setEmail( - $email - )->setFirstname( - $firstname - )->setLastname( - $lastname - )->setGroupId( - $groupId - )->setPassword( - $password - ); + $customerModel = $this->_objectManager->create('Magento\Customer\Model\CustomerFactory') + ->create(); + $customerModel->setEmail($email) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setGroupId($groupId) + ->setPassword($password); $customerModel->save(); /** @var \Magento\Customer\Model\Customer $customerModel */ - $savedModel = $this->_objectManager->create( - 'Magento\Customer\Model\CustomerFactory' - )->create()->load( - $customerModel->getId() - ); + $savedModel = $this->_objectManager->create('Magento\Customer\Model\CustomerFactory') + ->create() + ->load($customerModel->getId()); $dataInModel = $savedModel->getData(); - $this->_customerBuilder->setEmail( - $email2 - )->setFirstname( - $firstname - )->setLastname( - $lastname - )->setGroupId( - $groupId - ); + $this->_customerBuilder->setEmail($email2) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setGroupId($groupId); $newCustomerEntity = $this->_customerBuilder->create(); $customerId = $this->_customerAccountService->saveCustomer($newCustomerEntity, $password); $this->assertNotNull($customerId); $savedCustomer = $this->_customerAccountService->getCustomer($customerId); $dataInService = \Magento\Service\DataObjectConverter::toFlatArray($savedCustomer); - $expectedDifferences = array( - 'created_at', - 'updated_at', - 'email', - 'is_active', - 'entity_id', - 'entity_type_id', - 'password_hash', - 'attribute_set_id', - 'disable_auto_group_change', - 'confirmation', - 'reward_update_notification', - 'reward_warning_notification' - ); + $expectedDifferences = ['created_at', 'updated_at', 'email', 'is_active', 'entity_id', 'entity_type_id', + 'password_hash', 'attribute_set_id', 'disable_auto_group_change', 'confirmation', + 'reward_update_notification', 'reward_warning_notification']; foreach ($dataInModel as $key => $value) { if (!in_array($key, $expectedDifferences)) { if (is_null($value)) { $this->assertArrayNotHasKey($key, $dataInService); } else { - $this->assertEquals($value, $dataInService[$key], 'Failed asserting value for ' . $key); + $this->assertEquals($value, $dataInService[$key], 'Failed asserting value for '. $key); } } } @@ -956,17 +992,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $lastname = 'McTest'; $groupId = 1; - $this->_customerBuilder->setStoreId( - $storeId - )->setEmail( - $email - )->setFirstname( - $firstname - )->setLastname( - $lastname - )->setGroupId( - $groupId - ); + $this->_customerBuilder->setStoreId($storeId) + ->setEmail($email) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setGroupId($groupId); $newCustomerEntity = $this->_customerBuilder->create(); $customerId = $this->_customerAccountService->saveCustomer($newCustomerEntity, 'aPassword'); $this->assertNotNull($customerId); @@ -991,9 +1021,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $existingCustId = 1; $existingCustomer = $this->_customerAccountService->getCustomer($existingCustId); - $customerData = array_merge( - $existingCustomer->__toArray(), - array('email' => $email, 'firstname' => $firstName, 'lastname' => $lastname, 'created_in' => 'Admin') + $customerData = array_merge($existingCustomer->__toArray(), + [ + 'email' => $email, + 'firstname' => $firstName, + 'lastname' => $lastname, + 'created_in' => 'Admin' + ] ); $this->_customerBuilder->populateWithArray($customerData); $customerEntity = $this->_customerBuilder->create(); @@ -1005,7 +1039,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($firstName, $customer->getFirstname()); $this->assertEquals($lastname, $customer->getLastname()); $this->assertEquals('Admin', $customer->getCreatedIn()); - $this->_customerAccountService->authenticate($customer->getEmail(), 'aPassword', true); + $this->_customerAccountService->authenticate( + $customer->getEmail(), + 'aPassword', + true + ); } /** @@ -1019,17 +1057,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $lastname = 'McTest'; $groupId = 1; - $this->_customerBuilder->setStoreId( - $storeId - )->setEmail( - $email - )->setFirstname( - $firstname - )->setLastname( - $lastname - )->setGroupId( - $groupId - ); + $this->_customerBuilder->setStoreId($storeId) + ->setEmail($email) + ->setFirstname($firstname) + ->setLastname($lastname) + ->setGroupId($groupId); $newCustomerEntity = $this->_customerBuilder->create(); $customerId = $this->_customerAccountService->saveCustomer($newCustomerEntity, 'aPassword'); @@ -1066,7 +1098,9 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAccountService->getCustomer(1); $this->fail('Did not throw expected exception.'); } catch (NoSuchEntityException $nsee) { - $expectedParams = array('customerId' => '1'); + $expectedParams = [ + 'customerId' => '1', + ]; $this->assertEquals($expectedParams, $nsee->getParams()); $this->assertEquals('No such entity with customerId = 1', $nsee->getMessage()); } @@ -1085,12 +1119,20 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase public function invalidCustomerIdsDataProvider() { - return array(array('ab'), array(' '), array(-1), array(0), array(' 1234'), array('-1'), array('0')); + return array( + array('ab'), + array(' '), + array(-1), + array(0), + array(' 1234'), + array('-1'), + array('0'), + ); } /** - * @param Data\Filter[] $filters - * @param Datao\Filter[] $orGroup + * @param \Magento\Service\V1\Data\Filter[] $filters + * @param \Magento\Service\V1\Data\Filter[] $orGroup * @param array $expectedResult array of expected results indexed by ID * * @dataProvider searchCustomersDataProvider @@ -1100,7 +1142,9 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase */ public function testSearchCustomers($filters, $orGroup, $expectedResult) { - $searchBuilder = new Data\SearchCriteriaBuilder(); + $searchBuilder = Bootstrap::getObjectManager()->create( + 'Magento\Customer\Service\V1\Data\SearchCriteriaBuilder' + ); foreach ($filters as $filter) { $searchBuilder->addFilter($filter); } @@ -1128,47 +1172,38 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase public function searchCustomersDataProvider() { - return array( - 'Customer with specific email' => array( - array( - (new Data\FilterBuilder())->setField('email')->setValue('customer@search.example.com')->create() - ), + return [ + 'Customer with specific email' => [ + [(new FilterBuilder())->setField('email')->setValue('customer@search.example.com')->create()], null, - array(1 => array('email' => 'customer@search.example.com', 'firstname' => 'Firstname')) - ), - 'Customer with specific first name' => array( - array((new Data\FilterBuilder())->setField('firstname')->setValue('Firstname2')->create()), + [1 => ['email' => 'customer@search.example.com', 'firstname' => 'Firstname']] + ], + 'Customer with specific first name' => [ + [(new FilterBuilder())->setField('firstname')->setValue('Firstname2')->create()], null, - array(2 => array('email' => 'customer2@search.example.com', 'firstname' => 'Firstname2')) - ), - 'Customers with either email' => array( - array(), - array( - (new Data\FilterBuilder())->setField('firstname')->setValue('Firstname')->create(), - (new Data\FilterBuilder())->setField('firstname')->setValue('Firstname2')->create() - ), - array( - 1 => array('email' => 'customer@search.example.com', 'firstname' => 'Firstname'), - 2 => array('email' => 'customer2@search.example.com', 'firstname' => 'Firstname2') - ) - ), - 'Customers created since' => array( - array( - (new Data\FilterBuilder())->setField( - 'created_at' - )->setValue( - '2011-02-28 15:52:26' - )->setConditionType( - 'gt' - )->create() - ), - array(), - array( - 1 => array('email' => 'customer@search.example.com', 'firstname' => 'Firstname'), - 3 => array('email' => 'customer3@search.example.com', 'firstname' => 'Firstname3') - ) - ) - ); + [2 => ['email' => 'customer2@search.example.com', 'firstname' => 'Firstname2']] + ], + 'Customers with either email' => [ + [], + [ + (new FilterBuilder())->setField('firstname')->setValue('Firstname')->create(), + (new FilterBuilder())->setField('firstname')->setValue('Firstname2')->create() + ], + [ + 1 => ['email' => 'customer@search.example.com', 'firstname' => 'Firstname'], + 2 => ['email' => 'customer2@search.example.com', 'firstname' => 'Firstname2'], + ] + ], + 'Customers created since' => [ + [(new FilterBuilder()) + ->setField('created_at')->setValue('2011-02-28 15:52:26')->setConditionType('gt')->create()], + [], + [ + 1 => ['email' => 'customer@search.example.com', 'firstname' => 'Firstname'], + 3 => ['email' => 'customer3@search.example.com', 'firstname' => 'Firstname3'], + ], + ], + ]; } /** @@ -1179,17 +1214,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase */ public function testSearchCustomersOrder() { - $searchBuilder = new Data\SearchCriteriaBuilder(); + $searchBuilder = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\Data\SearchCriteriaBuilder'); // Filter for 'firstname' like 'First' - $filterBuilder = new Data\FilterBuilder(); - $firstnameFilter = $filterBuilder->setField( - 'firstname' - )->setConditionType( - 'like' - )->setValue( - 'First%' - )->create(); + $filterBuilder = new FilterBuilder(); + $firstnameFilter = $filterBuilder-> + setField('firstname')->setConditionType('like')->setValue('First%')->create(); $searchBuilder->addFilter($firstnameFilter); // Search ascending order @@ -1283,7 +1314,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase protected function verifyDeletedAddress($addressId) { /** @var $addressFactory \Magento\Customer\Model\AddressFactory */ - $addressFactory = $this->_objectManager->create('Magento\Customer\Model\AddressFactory'); + $addressFactory = $this->_objectManager + ->create('Magento\Customer\Model\AddressFactory'); $addressModel = $addressFactory->create()->load($addressId); $addressData = $addressModel->getData(); $this->assertTrue(empty($addressData)); @@ -1312,6 +1344,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->_customerAccountService->isEmailAvailable('nonexistent@example.com', 1)); } + /** * Set Rp data to Customer in fixture * diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerGroupServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerGroupServiceTest.php index 42b0be3a50cbd6f18e2a29e58e3243293eb809b9..ce02c72fd0d329dddf55eed411da93950fdf0d1b 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerGroupServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerGroupServiceTest.php @@ -25,6 +25,10 @@ */ namespace Magento\Customer\Service\V1; +use Magento\Service\V1\Data\FilterBuilder; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Service\V1\Data\Filter; + class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase { /** @@ -73,20 +77,20 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase $groups = $this->_groupService->getGroups(); $this->assertEquals(4, count($groups)); $this->assertEquals( - array(0, 'NOT LOGGED IN', 3), - array($groups[0]->getId(), $groups[0]->getCode(), $groups[0]->getTaxClassId()) + [0, 'NOT LOGGED IN', 3], + [$groups[0]->getId(), $groups[0]->getCode(), $groups[0]->getTaxClassId()] ); $this->assertEquals( - array(1, 'General', 3), - array($groups[1]->getId(), $groups[1]->getCode(), $groups[1]->getTaxClassId()) + [1, 'General', 3], + [$groups[1]->getId(), $groups[1]->getCode(), $groups[1]->getTaxClassId()] ); $this->assertEquals( - array(2, 'Wholesale', 3), - array($groups[2]->getId(), $groups[2]->getCode(), $groups[2]->getTaxClassId()) + [2, 'Wholesale', 3], + [$groups[2]->getId(), $groups[2]->getCode(), $groups[2]->getTaxClassId()] ); $this->assertEquals( - array(3, 'Retailer', 3), - array($groups[3]->getId(), $groups[3]->getCode(), $groups[3]->getTaxClassId()) + [3, 'Retailer', 3], + [$groups[3]->getId(), $groups[3]->getCode(), $groups[3]->getTaxClassId()] ); } @@ -97,16 +101,16 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase $groups = $this->_groupService->getGroups(false); $this->assertEquals(3, count($groups)); $this->assertEquals( - array(1, 'General', 3), - array($groups[0]->getId(), $groups[0]->getCode(), $groups[0]->getTaxClassId()) + [1, 'General', 3], + [$groups[0]->getId(), $groups[0]->getCode(), $groups[0]->getTaxClassId()] ); $this->assertEquals( - array(2, 'Wholesale', 3), - array($groups[1]->getId(), $groups[1]->getCode(), $groups[1]->getTaxClassId()) + [2, 'Wholesale', 3], + [$groups[1]->getId(), $groups[1]->getCode(), $groups[1]->getTaxClassId()] ); $this->assertEquals( - array(3, 'Retailer', 3), - array($groups[2]->getId(), $groups[2]->getCode(), $groups[2]->getTaxClassId()) + [3, 'Retailer', 3], + [$groups[2]->getId(), $groups[2]->getCode(), $groups[2]->getTaxClassId()] ); } @@ -127,17 +131,16 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase */ public function getGroupsDataProvider() { - return array( - array(array('id' => 0, 'code' => 'NOT LOGGED IN', 'tax_class_id' => 3)), - array(array('id' => 1, 'code' => 'General', 'tax_class_id' => 3)), - array(array('id' => 2, 'code' => 'Wholesale', 'tax_class_id' => 3)), - array(array('id' => 3, 'code' => 'Retailer', 'tax_class_id' => 3)) - ); + return [ [['id' => 0, 'code' => 'NOT LOGGED IN', 'tax_class_id' => 3]], + [['id' => 1, 'code' => 'General', 'tax_class_id' => 3]], + [['id' => 2, 'code' => 'Wholesale', 'tax_class_id' => 3]], + [['id' => 3, 'code' => 'Retailer', 'tax_class_id' => 3]], + ]; } public function testCreateGroup() { - $group = (new Data\CustomerGroupBuilder())->setId(null)->setCode('Test Group')->setTaxClassId(4)->create(); + $group = (new Data\CustomerGroupBuilder())->setId(null)->setCode('Test Group')->setTaxClassId(3)->create(); $groupId = $this->_groupService->saveGroup($group); $this->assertNotNull($groupId); @@ -149,7 +152,7 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase public function testUpdateGroup() { - $group = (new Data\CustomerGroupBuilder())->setId(null)->setCode('New Group')->setTaxClassId(4)->create(); + $group = (new Data\CustomerGroupBuilder())->setId(null)->setCode('New Group')->setTaxClassId(3)->create(); $groupId = $this->_groupService->saveGroup($group); $this->assertNotNull($groupId); @@ -158,13 +161,8 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase $this->assertEquals($group->getCode(), $newGroup->getCode()); $this->assertEquals($group->getTaxClassId(), $newGroup->getTaxClassId()); - $updates = (new Data\CustomerGroupBuilder())->setId( - $groupId - )->setCode( - 'Updated Group' - )->setTaxClassId( - 2 - )->create(); + $updates = (new Data\CustomerGroupBuilder())->setId($groupId)->setCode('Updated Group')->setTaxClassId(3) + ->create(); $newId = $this->_groupService->saveGroup($updates); $this->assertEquals($newId, $groupId); $updatedGroup = $this->_groupService->getGroup($groupId); @@ -173,15 +171,16 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase } /** - * @param Data\Filter[] $filters - * @param Data\Filter[] $orGroup + * @param Filter[] $filters + * @param Filter[] $orGroup * @param array $expectedResult array of expected results indexed by ID * * @dataProvider searchGroupsDataProvider */ public function testSearchGroups($filters, $orGroup, $expectedResult) { - $searchBuilder = new Data\SearchCriteriaBuilder(); + $searchBuilder = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\Data\SearchCriteriaBuilder'); foreach ($filters as $filter) { $searchBuilder->addFilter($filter); } @@ -201,42 +200,40 @@ class CustomerGroupServiceTest extends \PHPUnit_Framework_TestCase public function searchGroupsDataProvider() { - return array( - 'eq' => array( - array((new Data\FilterBuilder())->setField('code')->setValue('General')->create()), + return [ + 'eq' => [ + [(new FilterBuilder())->setField('code')->setValue('General')->create()], null, - array(1 => array('code' => 'General', 'tax_class_id' => 3)) - ), - 'and' => array( - array( - (new Data\FilterBuilder())->setField('code')->setValue('General')->create(), - (new Data\FilterBuilder())->setField('tax_class_id')->setValue('3')->create(), - (new Data\FilterBuilder())->setField('id')->setValue('1')->create() - ), - array(), - array(1 => array('code' => 'General', 'tax_class_id' => 3)) - ), - 'or' => array( - array(), - array( - (new Data\FilterBuilder())->setField('code')->setValue('General')->create(), - (new Data\FilterBuilder())->setField('code')->setValue('Wholesale')->create() - ), - array( - 1 => array('code' => 'General', 'tax_class_id' => 3), - 2 => array('code' => 'Wholesale', 'tax_class_id' => 3) - ) - ), - 'like' => array( - array( - (new Data\FilterBuilder())->setField('code')->setValue('er')->setConditionType('like')->create() - ), - array(), - array( - 1 => array('code' => 'General', 'tax_class_id' => 3), - 3 => array('code' => 'Retailer', 'tax_class_id' => 3) - ) - ) - ); + [1 => ['code' => 'General', 'tax_class_id' => 3]] + ], + 'and' => [ + [ + (new FilterBuilder())->setField('code')->setValue('General')->create(), + (new FilterBuilder())->setField('tax_class_id')->setValue('3')->create(), + (new FilterBuilder())->setField('id')->setValue('1')->create(), + ], + [], + [1 => ['code' => 'General', 'tax_class_id' => 3]] + ], + 'or' => [ + [], + [ + (new FilterBuilder())->setField('code')->setValue('General')->create(), + (new FilterBuilder())->setField('code')->setValue('Wholesale')->create(), + ], + [ + 1 => ['code' => 'General', 'tax_class_id' => 3], + 2 => ['code' => 'Wholesale', 'tax_class_id' => 3] + ] + ], + 'like' => [ + [(new FilterBuilder())->setField('code')->setValue('er')->setConditionType('like')->create()], + [], + [ + 1 => ['code' => 'General', 'tax_class_id' => 3], + 3 => ['code' => 'Retailer', 'tax_class_id' => 3] + ] + ], + ]; } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php index 085756b56570f963b5a7574da47483854e335b2e..503e61b801dde3737d9291addfd4549bfdaff013 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php @@ -22,8 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); @@ -56,7 +57,7 @@ $quoteItem = $quote->setCustomerId( 1 )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test01' diff --git a/dev/tests/integration/testsuite/Magento/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/DB/Adapter/InterfaceTest.php index e7b7ab688c5e23dd2c6196aa18fc281e2085770d..25157f9ac0f92bb9659778428549c620f1af27a5 100644 --- a/dev/tests/integration/testsuite/Magento/DB/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/DB/Adapter/InterfaceTest.php @@ -55,9 +55,9 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Setup', + 'Magento\Module\Setup', array( - 'resourceName' => \Magento\Core\Model\Resource\Setup::DEFAULT_SETUP_CONNECTION, + 'resourceName' => 'core_setup', 'moduleName' => 'Magento_Core' ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php b/dev/tests/integration/testsuite/Magento/DB/TransactionTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php rename to dev/tests/integration/testsuite/Magento/DB/TransactionTest.php index 5d8ba652c0efd373b8dcd3af3c433922d4502482..cd0cbdb8144d70b751217298c4dc774a0eb3736a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php +++ b/dev/tests/integration/testsuite/Magento/DB/TransactionTest.php @@ -19,12 +19,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\DB; class TransactionTest extends \PHPUnit_Framework_TestCase { @@ -35,8 +34,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\DB\Transaction'); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\DB\Transaction'); } /** @@ -44,13 +42,12 @@ class TransactionTest extends \PHPUnit_Framework_TestCase */ public function testSaveDelete() { - $first = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store\Group'); + $first = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Group'); $first->setData( array('website_id' => 1, 'name' => 'test 1', 'root_category_id' => 1, 'default_store_id' => 1) ); - $second = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store\Group' - ); + + $second = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Group'); $second->setData( array('website_id' => 1, 'name' => 'test 2', 'root_category_id' => 1, 'default_store_id' => 1) ); @@ -64,7 +61,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase $this->_model->delete(); - $test = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Store\Group'); + $test = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Group'); $test->load($first->getId()); $this->assertEmpty($test->getId()); } diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php index d22c4e4ea93919622388b881651fa265d78f6186..e68347494e1c3407aa534730110521371ab9e19b 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php @@ -49,7 +49,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' )->setDesignTheme( - 'magento_blank' + 'Magento/blank' ); } diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php b/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php index b458c7f40d40d03c81ffe84326a53cdd216b9c2a..79fb89147b36792b997b49765d468f9b903c7c3f 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/_files/design_editor_active.php @@ -43,7 +43,7 @@ $theme->setData( 'theme_code' => 'blank', 'area' => 'frontend', 'parent_id' => null, - 'theme_path' => 'magento_blank', + 'theme_path' => 'Magento/blank', 'theme_version' => '2.0.0.0', 'theme_title' => 'Default', 'preview_image' => 'media/preview_image.jpg', diff --git a/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php b/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php index ce5550ca09533a66088a76538475174dff740049..4b41657dab21fceab2699535284695bae6824457 100644 --- a/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php +++ b/dev/tests/integration/testsuite/Magento/Dhl/Block/Adminhtml/UnitofmeasureTest.php @@ -33,7 +33,7 @@ class UnitofmeasureTest extends \PHPUnit_Framework_TestCase */ public function testToHtml() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Dhl\Block\Adminhtml\Unitofmeasure */ $block = $layout->createBlock('Magento\Dhl\Block\Adminhtml\Unitofmeasure'); diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php index d96d1e8a380f4eda5674eceac76695dfd966d8e2..1678a3eb9797dcfa61576cb290f84f5ee88fcfaf 100644 --- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable/LinksTest.php @@ -49,7 +49,7 @@ class LinksTest extends \PHPUnit_Framework_TestCase public static function performUploadButtonTest(\Magento\View\Element\AbstractBlock $block) { /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\Layout'); $layout->addBlock($block, 'links'); $expected = uniqid(); $text = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php index e09e7ed7c91061dc09045e8bd77da1287bdfbe92..871c12b51cde5a2b3dc36da53e9f663ecb6f3a79 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php @@ -62,7 +62,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Eav\Model\Entity\Attribute\Config') ) )->setLayout( - $objectManager->create('Magento\Core\Model\Layout') + $objectManager->create('Magento\View\Layout') ); $method = new \ReflectionMethod( diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index 780676ae0d78dbc3bbbf41ef6d3b0b6957cbe79a..eb98cdb54a9cdc5cfe2d92144462266824b581e9 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -48,11 +48,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase public function testViewDirective() { $url = $this->_model->viewDirective( - array( - '{{view url="Magento_Theme::favicon.ico"}}', - 'view', - ' url="Magento_Theme::favicon.ico"', // note leading space - ) + array('{{view url="Magento_Theme::favicon.ico"}}', 'view', ' url="Magento_Theme::favicon.ico"') ); $this->assertStringEndsWith('favicon.ico', $url); } @@ -67,11 +63,9 @@ class FilterTest extends \PHPUnit_Framework_TestCase ); $this->assertStringMatchesFormat('http://example.com/%sarbitrary_url/', $url); - $url = $this->_model->storeDirective(array( - '{{store url="translation/ajax/index"}}', - 'store', - ' url="translation/ajax/index"', - )); + $url = $this->_model->storeDirective( + array('{{store url="translation/ajax/index"}}', 'store', ' url="translation/ajax/index"') + ); $this->assertStringMatchesFormat('http://example.com/%stranslation/ajax/index/', $url); } @@ -133,22 +127,16 @@ class FilterTest extends \PHPUnit_Framework_TestCase $collection = $objectManager->create('Magento\Core\Model\Resource\Theme\Collection'); $themeId = $collection->getThemeByFullPath('frontend/test_default')->getId(); $objectManager->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( \Magento\View\DesignInterface::XML_PATH_THEME_ID, - $themeId + $themeId, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - - /** @var $layout \Magento\View\LayoutInterface */ - $layout = $objectManager->create('Magento\Core\Model\Layout'); - $objectManager->addSharedInstance($layout, 'Magento\Core\Model\Layout'); - $this->assertEquals($area, $layout->getArea()); - $this->assertEquals( - $area, - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface')->getArea() - ); + $layout = $objectManager->create('Magento\View\Layout'); + $objectManager->addSharedInstance($layout, 'Magento\View\Layout'); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('test_default'); $actualOutput = $this->_model->layoutDirective( diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 9b4000f1eccd5d8775a94c5a6fc038446b04a3c8..37641617f6b675280898b02b0edda8f3bfcc161b 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -56,12 +56,11 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\View\DesignInterface'), $objectManager->get('Magento\Registry'), $objectManager->get('Magento\Core\Model\App\Emulation'), - $objectManager->get('Magento\Core\Model\StoreManager'), + $objectManager->get('Magento\Store\Model\StoreManager'), $objectManager->create('Magento\App\Filesystem'), $objectManager->create('Magento\View\Url'), $objectManager->create('Magento\View\FileSystem'), - $objectManager->create('Magento\Core\Model\Store\Config'), - $objectManager->create('Magento\App\ConfigInterface'), + $objectManager->create('Magento\App\Config\ScopeConfigInterface'), $objectManager->get('Magento\Email\Model\Template\FilterFactory'), $objectManager->get('Magento\Email\Model\Template\Config') ) @@ -87,7 +86,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->assertSame($filter, $this->_model->getTemplateFilter()); $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(), $filter->getStoreId() ); @@ -115,17 +114,20 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplate() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + \Magento\Core\Model\App\Area::AREA_FRONTEND + )->load(); $this->_setNotDefaultThemeForFixtureStore(); - $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; + $expectedViewUrl = 'static/frontend/Magento/plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); $this->assertStringEndsNotWith($expectedViewUrl, $this->_model->getProcessedTemplate()); $this->_model->setDesignConfig( array( 'area' => 'frontend', 'store' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( 'fixturestore' )->getId() @@ -135,7 +137,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase } /** - * Set 'magento_plushe' for the 'fixturestore' store. + * Set 'Magento/plushe' for the 'fixturestore' store. * Application isolation is required, if a test uses this method. */ protected function _setNotDefaultThemeForFixtureStore() @@ -143,14 +145,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\View\Design\ThemeInterface' ); - $theme->load('magento_plushe', 'theme_path'); + $theme->load('Magento/plushe', 'theme_path'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore( - 'fixturestore' - )->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( \Magento\View\DesignInterface::XML_PATH_THEME_ID, - $theme->getId() + $theme->getId(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 'fixturestore' ); } @@ -160,11 +162,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateDesignChange() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + \Magento\Core\Model\App\Area::AREA_FRONTEND + )->load(); $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); $this->assertStringEndsWith( - 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico', + 'static/frontend/Magento/plushe/en_US/Magento_Theme/favicon.ico', $this->_model->getProcessedTemplate() ); } @@ -175,17 +180,20 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateSubject() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + \Magento\Core\Model\App\Area::AREA_FRONTEND + )->load(); $this->_setNotDefaultThemeForFixtureStore(); - $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; + $expectedViewUrl = 'static/frontend/Magento/plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}'); $this->assertStringEndsNotWith($expectedViewUrl, $this->_model->getProcessedTemplateSubject(array())); $this->_model->setDesignConfig( array( 'area' => 'frontend', 'store' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( 'fixturestore' )->getId() @@ -199,10 +207,13 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetDefaultEmailLogo() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + \Magento\Core\Model\App\Area::AREA_FRONTEND + )->load(); $this->assertStringEndsWith( - 'static/frontend/magento_blank/en_US/Magento_Email/logo_email.gif', + 'static/frontend/Magento/blank/en_US/Magento_Email/logo_email.gif', $this->_model->getDefaultEmailLogo() ); } diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/AbstractStubEntity.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/AbstractStubEntity.php index 487fac29a2e9651b903ca7608de909fa24abfc86..189c6168a9ab00f7a4fb140401abbb82f08432f7 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/AbstractStubEntity.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/AbstractStubEntity.php @@ -33,13 +33,13 @@ namespace Magento\ImportExport\Model\Export; abstract class AbstractStubEntity extends \Magento\ImportExport\Model\Export\AbstractEntity { public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, array $data = array() ) { - parent::__construct($coreStoreConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); + parent::__construct($scopeConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); $this->_disabledAttrs = array('default_billing', 'default_shipping'); } } diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php index a1589d684133e5f1ad0a332663fbd24989bf1f06..f758f720aaacef2346edb978a1b81758295f3a43 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php @@ -81,8 +81,8 @@ class AbstractEavTest extends \PHPUnit_Framework_TestCase $this->returnValue($customerAttributes) ); $this->_model->__construct( - $objectManager->get('Magento\Core\Model\Store\Config'), - $objectManager->get('Magento\Core\Model\StoreManager'), + $objectManager->get('Magento\App\Config\ScopeConfigInterface'), + $objectManager->get('Magento\Store\Model\StoreManager'), $objectManager->get('Magento\ImportExport\Model\Export\Factory'), $objectManager->get('Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory'), $objectManager->get('Magento\Stdlib\DateTime\TimezoneInterface'), diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php index eb46a7e108a65481704a17434f4f2d7026636340..9804d8c45d669d0f675913d42bd814d494c2a508 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php @@ -25,7 +25,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\ImportExport\Model\Export\Entity\Eav\Customer; - +use \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address as ImportAddress; +use \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address; /** * Test for customer address export model * @@ -34,7 +35,7 @@ namespace Magento\ImportExport\Model\Export\Entity\Eav\Customer; class AddressTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address + * @var Address */ protected $_model; @@ -53,11 +54,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase ); $websites = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsites( true ); - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ foreach ($websites as $website) { $this->_websites[$website->getId()] = $website->getCode(); } @@ -68,9 +69,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ public function testExport() { - $websiteCode = \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address::COLUMN_WEBSITE; - $emailCode = \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address::COLUMN_EMAIL; - $entityIdCode = \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address::COLUMN_ADDRESS_ID; + $websiteCode = Address::COLUMN_WEBSITE; + $emailCode = Address::COLUMN_EMAIL; + $entityIdCode = Address::COLUMN_ADDRESS_ID; $expectedAttributes = array(); /** @var $collection \Magento\Customer\Model\Resource\Address\Attribute\Collection */ @@ -83,8 +84,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase } // Get customer default addresses column name to customer attribute mapping array. - $defaultAddressMap = - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::getDefaultAddressAttributeMapping(); + $defaultAddressMap = ImportAddress::getDefaultAddressAttributeMapping(); $this->_model->setWriter( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( @@ -163,7 +163,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase */ public function testExportWithFilter($genderFilterValue) { - $entityIdCode = \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address::COLUMN_ADDRESS_ID; + $entityIdCode = Address::COLUMN_ADDRESS_ID; $this->_model->setWriter( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php index f56487b40978b148d60ae4e8ee7ebbc555e3890f..27e0cbe76c4f74ba6da68492f07132779623e256 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php @@ -203,7 +203,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase 'email' => 'example.com', 'created_at' => array($createdAtDate, ''), 'store_id' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) ); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php index 016c68038e18e79a7ad04dffd65d9487b2f61330..c9649f0a47ada458e4e4006448f92969d73332c5 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php @@ -46,8 +46,8 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase $this->_model = $this->getMockForAbstractClass( 'Magento\ImportExport\Model\Export\AbstractEntity', array( - $objectManager->get('Magento\Core\Model\Store\Config'), - $objectManager->get('Magento\Core\Model\StoreManager'), + $objectManager->get('Magento\App\Config\ScopeConfigInterface'), + $objectManager->get('Magento\Store\Model\StoreManager'), $objectManager->get('Magento\ImportExport\Model\Export\Factory'), $objectManager->get('Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory') ) @@ -123,17 +123,17 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Stub abstract class which provide to change protected property "$_disabledAttrs" and test methods depended on it */ -abstract class Stub_Magento_ImportExport_Model_Export_AbstractEntity extends -\Magento\ImportExport\Model\Export\AbstractEntity +abstract class Stub_Magento_ImportExport_Model_Export_AbstractEntity + extends \Magento\ImportExport\Model\Export\AbstractEntity { public function __construct( - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\ImportExport\Model\Export\Factory $collectionFactory, \Magento\ImportExport\Model\Resource\CollectionByPagesIteratorFactory $resourceColFactory, array $data = array() ) { - parent::__construct($coreStoreConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); + parent::__construct($scopeConfig, $storeManager, $collectionFactory, $resourceColFactory, $data); $this->_disabledAttrs = array('default_billing', 'default_shipping'); } } diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index d14f88ceb80b226bd45e830dcc8ef7687e0298d9..461ab899c07b25f5b9975d9907bdd8a2c055f345 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -53,7 +53,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase array( $objectManager->get('Magento\Core\Helper\Data'), $objectManager->get('Magento\Stdlib\String'), - $objectManager->get('Magento\Core\Model\Store\Config'), + $objectManager->get('Magento\App\Config\ScopeConfigInterface'), $objectManager->get('Magento\ImportExport\Model\ImportFactory'), $objectManager->get('Magento\ImportExport\Model\Resource\Helper'), $objectManager->get('Magento\App\Resource') diff --git a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php index a87ecdb99537eb94592b8f2acc926290505ae2ce..a8901ffc57a29a75ade6e6e345cde731540d8186 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Block/AdminTest.php @@ -42,7 +42,7 @@ class AdminTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('install'); /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\Layout'); /** @var $block \Magento\Install\Block\Admin */ $block = $layout->createBlock('Magento\Install\Block\Admin'); $output = $block->toHtml(); diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php index f29c5b1ecaaf4ac63a224f4a6fadd33319591ed0..2978ffa7a498e3acfa12abf906c06bf1e4933faf 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php @@ -98,9 +98,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/Magento/Test/etc'); - /** @var \Magento\Core\Model\Config\FileResolver $fileResolver */ + /** @var \Magento\App\Config\FileResolver $fileResolver */ $fileResolver = $this->_objectManager->create( - 'Magento\Core\Model\Config\FileResolver', + 'Magento\App\Config\FileResolver', array('moduleReader' => $moduleReader) ); diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php index 0520950c13f0f62abcf5aaa8f088f10c4a2d341c..b4f2213adc424b501e2d2155187ab18901c61798 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php @@ -83,7 +83,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Install\Model\Installer'), $objectManager->get('Magento\App\RequestInterface'), $filesystem, - $objectManager->get('Magento\Core\Model\StoreManager'), + $objectManager->get('Magento\Store\Model\StoreManager'), $objectManager->get('Magento\Message\Manager') ); $objectManager->addSharedInstance($installerConfig, 'Magento\Install\Model\Installer\Config'); diff --git a/dev/tests/integration/testsuite/Magento/Log/Model/VisitorTest.php b/dev/tests/integration/testsuite/Magento/Log/Model/VisitorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..32a078a66c8e7e81162822ddc536a657cf83537c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Log/Model/VisitorTest.php @@ -0,0 +1,103 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Log\Model; + +use Magento\TestFramework\Helper\Bootstrap; + +class VisitorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoAppArea frontend + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testBindCustomerLogin() + { + /** @var \Magento\Log\Model\Visitor $visitor */ + $visitor = Bootstrap::getObjectManager()->get('Magento\Log\Model\Visitor'); + $visitor->unsCustomerId(); + $visitor->unsDoCustomerLogin(); + + $customer = $this->_loginCustomer('customer@example.com', 'password'); + + // Visitor has not customer ID yet + $this->assertTrue($visitor->getDoCustomerLogin()); + $this->assertEquals($customer->getId(), $visitor->getCustomerId()); + + // Visitor already has customer ID + $visitor->unsDoCustomerLogin(); + $this->_loginCustomer('customer@example.com', 'password'); + $this->assertNull($visitor->getDoCustomerLogin()); + } + + /** + * @magentoAppArea frontend + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testBindCustomerLogout() + { + /** @var \Magento\Log\Model\Visitor $visitor */ + $visitor = Bootstrap::getObjectManager()->get('Magento\Log\Model\Visitor'); + + $this->_loginCustomer('customer@example.com', 'password'); + $visitor->setCustomerId(1); + $visitor->unsDoCustomerLogout(); + $this->_logoutCustomer(1); + + // Visitor has customer ID => check that do_customer_logout flag is set + $this->assertTrue($visitor->getDoCustomerLogout()); + + $this->_loginCustomer('customer@example.com', 'password'); + $visitor->unsCustomerId(); + $visitor->unsDoCustomerLogout(); + $this->_logoutCustomer(1); + + // Visitor has no customer ID => check that do_customer_logout flag not changed + $this->assertNull($visitor->getDoCustomerLogout()); + } + + /** + * Authenticate customer and return its DTO + * @param string $username + * @param string $password + * @return \Magento\Customer\Service\V1\Data\Customer + */ + protected function _loginCustomer($username, $password) + { + /** @var \Magento\Customer\Service\V1\CustomerAccountService $service */ + $service = Bootstrap::getObjectManager()->create('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + return $service->authenticate($username, $password); + } + + /** + * Log out customer + * @param int $customerId + */ + public function _logoutCustomer($customerId) + { + /** @var \Magento\Customer\Model\Session $customerSession */ + $customerSession = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session'); + $customerSession->setCustomerId($customerId); + $customerSession->logout(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php index 0a517449e971c7b8bc05ff7ee1127487c7035370..794441a2c00b97ef01223d7b48b490284b00c178 100644 --- a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php +++ b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php @@ -40,7 +40,9 @@ class MemoryUsageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_helper = new \Magento\TestFramework\Helper\Memory(new \Magento\Shell(new \Magento\OSInfo())); + $this->_helper = new \Magento\TestFramework\Helper\Memory( + new \Magento\Shell(new \Magento\Shell\CommandRenderer()) + ); } /** diff --git a/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php index 6023ae8e2481459daba43767539c509609682514..0c1dc4f3053b820f689d9c2df51315f3a328827d 100644 --- a/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php @@ -53,7 +53,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $setMainTableMethod = new \ReflectionMethod($this->_model, '_setMainTable'); $setMainTableMethod->setAccessible(true); - $tableName = $this->_model->getTable('core_website'); + $tableName = $this->_model->getTable('store_website'); $idFieldName = 'website_id'; $setMainTableMethod->invoke($this->_model, $tableName); @@ -66,7 +66,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testGetTableName() { - $tableNameOrig = 'core_website'; + $tableNameOrig ='store_website'; $tableSuffix = 'suffix'; $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\App\Resource', @@ -78,6 +78,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase ); $tableName = $model->getTable(array($tableNameOrig, $tableSuffix)); - $this->assertEquals('prefix_core_website_suffix', $tableName); + $this->assertEquals('prefix_store_website_suffix', $tableName); } } diff --git a/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php index 370453181c85710df23b54abd1b7e81d9aa59d28..d6657fcc93b3fe1411bb6882578b8fddff11ef1e 100644 --- a/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php @@ -32,10 +32,15 @@ class AbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\Resource'); - $resource = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', - array($resourceModel), '', true, true, true, array('getMainTable', 'getIdFieldName') + $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); + $resource = $this->getMockForAbstractClass( + 'Magento\Model\Resource\Db\AbstractDb', + array($resourceModel), + '', + true, + true, + true, + array('getMainTable', 'getIdFieldName') ); $resource->expects( @@ -43,7 +48,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase )->method( 'getMainTable' )->will( - $this->returnValue($resource->getTable('core_website')) + $this->returnValue($resource->getTable('store_website')) ); $resource->expects($this->any())->method('getIdFieldName')->will($this->returnValue('website_id')); @@ -53,10 +58,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Event\ManagerInterface' ); - $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\EntityFactory'); - $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Logger'); + $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Core\Model\EntityFactory' + ); + $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Logger'); $this->_model = $this->getMockForAbstractClass( 'Magento\Model\Resource\Db\Collection\AbstractCollection', diff --git a/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php index de6e27ee3303dce8c6fdb67cd78fcd55320cd494..04b0228d6ad574825c70b1ac9ae6f0d740b36a32 100644 --- a/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php @@ -42,8 +42,18 @@ class IteratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Model\Resource\Iterator'); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Model\Resource\Iterator' + ); + } + + public function testWalk() + { + $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Store\Model\Resource\Store\Collection' + ); + $this->_model->walk($collection->getSelect(), array(array($this, 'walkCallback'))); + $this->assertGreaterThan(0, $this->_callbackCounter); } /** diff --git a/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php index 4fd86172af5ed1ed797c00f3cb70e636d89a5b2f..0f4dfd8ef6ac77b1685abc0f75cf34fcba4fb27e 100644 --- a/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php @@ -41,7 +41,7 @@ class ResourceTest extends \PHPUnit_Framework_TestCase { $tablePrefix = 'prefix_'; $tableSuffix = 'suffix'; - $tableNameOrig = 'core_website'; + $tableNameOrig = 'store_website'; $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\App\Resource', diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php b/dev/tests/integration/testsuite/Magento/Module/SetupTest.php similarity index 81% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php rename to dev/tests/integration/testsuite/Magento/Module/SetupTest.php index 8213200322a25e8851e5fefcde04264cc50b14b3..99bdbb8c096ffe80d8290fc17db1285d3d320232 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/SetupTest.php +++ b/dev/tests/integration/testsuite/Magento/Module/SetupTest.php @@ -19,24 +19,24 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Module; class SetupTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Setup + * @var \Magento\Module\Setup */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Setup', + 'Magento\Module\Setup', array('resourceName' => 'default_setup', 'moduleName' => 'Magento_Core') ); } @@ -92,26 +92,6 @@ class SetupTest extends \PHPUnit_Framework_TestCase $this->_model->updateTableRow('core_resource', 'code', 'adminnotification_setup', 'version', $original); } - public function testSetDeleteConfigData() - { - $select = $this->_model->getConnection()->select()->from( - $this->_model->getTable('core_config_data'), - 'value' - )->where( - 'path=?', - 'my/test/path' - ); - - $this->_model->setConfigData('my/test/path', 'test_value'); - $this->assertEquals('test_value', $this->_model->getConnection()->fetchOne($select)); - - $this->_model->deleteConfigData('my/test/path', 'test'); - $this->assertNotEmpty($this->_model->getConnection()->fetchRow($select)); - - $this->_model->deleteConfigData('my/test/path'); - $this->assertEmpty($this->_model->getConnection()->fetchRow($select)); - } - /** * @expectedException \Zend_Db_Statement_Exception */ @@ -130,7 +110,7 @@ class SetupTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Setup::updateTableRow + * @covers \Magento\Module\Setup::updateTableRow * @expectedException \Zend_Db_Statement_Exception */ public function testUpdateTableRowNameConversion() @@ -141,7 +121,7 @@ class SetupTest extends \PHPUnit_Framework_TestCase public function testTableExists() { - $this->assertTrue($this->_model->tableExists('core_website')); + $this->assertTrue($this->_model->tableExists('store_website')); $this->assertFalse($this->_model->tableExists('core/website')); } } diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..eb9d253cd60decaf65a44314317a79d58bdb3e20 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/AddressesTest.php @@ -0,0 +1,88 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Multishipping\Block\Checkout; + +use Magento\TestFramework\Helper\Bootstrap; + +/** + * @magentoAppArea frontend + */ +class AddressesTest extends \PHPUnit_Framework_TestCase +{ + const FIXTURE_CUSTOMER_ID = 1; + + /** + * @var \Magento\Multishipping\Block\Checkout\Addresses + */ + protected $_addresses; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = Bootstrap::getObjectManager(); + $customerService = $this->_objectManager->create('Magento\Customer\Service\V1\CustomerAccountService'); + $customerData = $customerService->getCustomer(self::FIXTURE_CUSTOMER_ID); + + /** @var \Magento\Customer\Model\Session $customerSession */ + $customerSession = $this->_objectManager->get('Magento\Customer\Model\Session'); + $customerSession->setCustomerData($customerData); + + /** @var \Magento\Sales\Model\Resource\Quote\Collection $quoteCollection */ + $quoteCollection = $this->_objectManager->get('Magento\Sales\Model\Resource\Quote\Collection'); + /** @var $quote \Magento\Sales\Model\Quote */ + $quote = $quoteCollection->getLastItem(); + + /** @var $checkoutSession \Magento\Checkout\Model\Session */ + $checkoutSession = $this->_objectManager->get('Magento\Checkout\Model\Session'); + $checkoutSession->setQuoteId($quote->getId()); + $checkoutSession->setLoadInactive(true); + + $this->_addresses = $this->_objectManager->create( + 'Magento\Multishipping\Block\Checkout\Addresses' + ); + + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Checkout/_files/quote_with_product_and_payment.php + */ + public function testGetAddressOptions() + { + $expectedResult = [ + [ + 'value' => '1', + 'label' => 'John Smith, Green str, 67, CityM, Alabama 75477, United States' + ] + ]; + + $addressAsHtml = $this->_addresses->getAddressOptions(); + $this->assertEquals($expectedResult, $addressAsHtml); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php index 1b3fb6742e4c5dcb752c2daa59fa859fa7c7c476..46ce4d8318595e4a14a048b3c5ca55b781ed9bc7 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Adminhtml/SubscriberTest.php @@ -33,7 +33,7 @@ class SubscriberTest extends \PHPUnit_Framework_TestCase { public function testGetShowQueueAdd() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Newsletter\Block\Adminhtml\Subscriber */ $block = $layout->createBlock('Magento\Newsletter\Block\Adminhtml\Subscriber', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php index 142dd56174668d79dc14a2bb5be5400e3f703df5..e4c324e60ceb878e24694e983e61b51dd32a9a84 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php @@ -34,7 +34,7 @@ class ManageTest extends \Magento\TestFramework\TestCase\AbstractController */ protected $customerSession; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $coreSession; @@ -44,7 +44,7 @@ class ManageTest extends \Magento\TestFramework\TestCase\AbstractController $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->customerSession = $objectManager->get('Magento\Customer\Model\Session'); $this->customerSession->setCustomerId(1); - $this->coreSession = $objectManager->get('Magento\Core\Model\Session'); + $this->coreSession = $objectManager->get('Magento\Session\Generic'); $this->coreSession->setData('_form_key', 'formKey'); } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php index 10990192d8bb8d5ab463fd9c797347bd263ef387..e63c380322d0dd120bc1dafad7421b4414378c2e 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php @@ -45,8 +45,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase /** * This test expects next themes for areas: - * current_store design/theme/full_name magento_blank - * fixturestore_store design/theme/full_name magento_plushe + * current_store design/theme/full_name Magento/blank + * fixturestore_store design/theme/full_name Magento/plushe * * @magentoAppIsolation enabled * @magentoAppArea adminhtml @@ -57,7 +57,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); if ($store != 'default') { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\MutableScopeConfigInterface' )->setValue( \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, $design, @@ -83,15 +83,15 @@ class TemplateTest extends \PHPUnit_Framework_TestCase public function getProcessedTemplateFrontendDataProvider() { return array( - 'frontend' => array('default', 'magento_blank'), - 'frontend store' => array('fixturestore', 'magento_plushe') + 'frontend' => array('default', 'Magento/blank'), + 'frontend store' => array('fixturestore', 'Magento/plushe') ); } /** * This test expects next themes for areas: - * install/design/theme/full_name magento_basic - * adminhtml/design/theme/full_name magento_backend + * install/design/theme/full_name Magento/basic + * adminhtml/design/theme/full_name Magento/backend * * @magentoAppIsolation enabled * @dataProvider getProcessedTemplateAreaDataProvider @@ -120,7 +120,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ); return array( 'install' => array('install', $design->getConfigurationDesignTheme('install')), - 'backend' => array('adminhtml', 'magento_backend') + 'backend' => array('adminhtml', 'Magento/backend') ); } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/queue.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/queue.php index 81b9ddb7627d041ab1767adc620e03463ce2dd76..3d5083c4768f6c5a21d1fcfb358913f86d8b0e02 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/_files/queue.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/queue.php @@ -35,8 +35,8 @@ $template = $objectManager->create('Magento\Newsletter\Model\Template'); $template->load('fixture_tpl', 'template_code'); $templateId = $template->getId(); -$currentStore = $objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId(); -$otherStore = $objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore('fixturestore')->getId(); +$currentStore = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId(); +$otherStore = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore('fixturestore')->getId(); /** @var $queue \Magento\Newsletter\Model\Queue */ $queue = $objectManager->create('Magento\Newsletter\Model\Queue'); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php index c6185c303d57fdce0aa8fd33c015197cf8109eb9..fdda3664e469756c5269c5b4f69006fbefdc481d 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php @@ -28,10 +28,14 @@ require __DIR__ . '/../../../Magento/Core/_files/store.php'; require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; -$currentStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId(); -$otherStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\StoreManagerInterface')->getStore('fixturestore')->getId(); +$currentStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Store\Model\StoreManagerInterface' +)->getStore()->getId(); +$otherStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Store\Model\StoreManagerInterface' +)->getStore( + 'fixturestore' +)->getId(); /** @var \Magento\Newsletter\Model\Subscriber $subscriber */ $subscriber = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php index 8385414f4903d62b2d1301d256a3ccd251100ddd..604be42a3a499eef3c3d19365e0646b635e47efd 100644 --- a/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php @@ -78,9 +78,9 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ); $moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/Magento/Test/etc'); - /** @var \Magento\Core\Model\Config\FileResolver $fileResolver */ + /** @var \Magento\App\Config\FileResolver $fileResolver */ $fileResolver = $objectManager->create( - 'Magento\Core\Model\Config\FileResolver', + 'Magento\App\Config\FileResolver', array('moduleReader' => $moduleReader) ); diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml index ca91008373c7e8a9c21b43b15ac07c40458f00e2..cdfd6eb3c7166cccc7ac784e8c79f6bc6ae0ca27 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_merged.xml @@ -61,7 +61,7 @@ <argument name="cacheIdPrefix" xsi:type="string"><![CDATA[collection_]]></argument> <argument name="cacheLifetime" xsi:type="string">86400</argument> <argument name="cacheTags" xsi:type="array"> - <item name="const" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</item> + <item name="const" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</item> <item name="boolFalse" xsi:type="boolean">true</item> <item name="boolTrue" xsi:type="number">10</item> <item name="boolOne" xsi:type="string">1</item> @@ -70,7 +70,7 @@ <item name="nullValue" xsi:type="null"/> <item name="stringPattern" xsi:type="string">Az-Value</item> </argument> - <argument name="constParam" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</argument> + <argument name="constParam" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</argument> <argument name="boolFalseParam" xsi:type="number">100</argument> <argument name="boolTrueParam" xsi:type="boolean">true</argument> <argument name="boolOneParam" xsi:type="boolean">true</argument> diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml index 8b2921c111813e07d16b748a0dd7f210ab47b599..4752a3580c9c68938f7d02f422dab945c6216065 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_one.xml @@ -56,7 +56,7 @@ <argument name="cacheIdPrefix" xsi:type="string"><![CDATA[collection_]]></argument> <argument name="cacheLifetime" xsi:type="string">86400</argument> <argument name="cacheTags" xsi:type="array"> - <item name="const" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</item> + <item name="const" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</item> <item name="boolFalse" xsi:type="boolean">false</item> <item name="boolTrue" xsi:type="boolean">true</item> <item name="boolOne" xsi:type="boolean">true</item> @@ -65,7 +65,7 @@ <item name="nullValue" xsi:type="null"/> <item name="stringPattern" xsi:type="string">az-value</item> </argument> - <argument name="constParam" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</argument> + <argument name="constParam" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</argument> <argument name="boolFalseParam" xsi:type="boolean">false</argument> <argument name="boolTrueParam" xsi:type="boolean">true</argument> <argument name="boolOneParam" xsi:type="boolean">true</argument> diff --git a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml index 50a269fb55b7298bbbf5398ece459b2cef5780ff..acf8151baedd15a19a68aa3b22d0b77637293216 100644 --- a/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml +++ b/dev/tests/integration/testsuite/Magento/ObjectManager/_files/config_two.xml @@ -48,14 +48,14 @@ <type name="Magento\Data\Collection\Db\FetchStrategy\Cache"> <arguments> <argument name="cacheTags" xsi:type="array"> - <item name="const" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</item> + <item name="const" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</item> <item name="boolFalse" xsi:type="boolean">true</item> <item name="boolTrue" xsi:type="number">10</item> <item name="boolOne" xsi:type="string">1</item> <item name="boolZero" xsi:type="boolean">false</item> <item name="stringPattern" xsi:type="string">Az-Value</item> </argument> - <argument name="constParam" xsi:type="const">Magento\Core\Model\Website::CACHE_TAG</argument> + <argument name="constParam" xsi:type="const">Magento\Store\Model\Website::CACHE_TAG</argument> <argument name="boolFalseParam" xsi:type="number">100</argument> <argument name="nullValueParam" xsi:type="boolean">true</argument> </arguments> diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php index 6c9d5bc0304b3470b9e5c2545dcccf8fed8807ed..3b553eddd8f03e3d651a5c499b535c152d12ecd7 100644 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php +++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php @@ -34,14 +34,14 @@ class TtlTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; protected function setUp() { $this->_config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\App\ConfigInterface'); + ->create('Magento\App\Config\ScopeConfigInterface'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\PageCache\Model\System\Config\Backend\Ttl'); } diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php index 20af93b990588593594f4c1f498e25515e167aaa..f111559995fed80bed1538ae1e85cdfdf6da3074 100644 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php +++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/VarnishTest.php @@ -34,14 +34,14 @@ class VarnishTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\MutableScopeConfigInterface */ protected $_config; protected function setUp() { $this->_config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\MutableScopeConfigInterface' ); $data = array( 'access_list' => 'localhost', diff --git a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php index 442b2faf2f11167cad73665aafa8e58f6b29f2f5..e4eb782a4a4cb26fe7d90d2243a3e4f87e2cd03c 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Block/InfoTest.php @@ -35,7 +35,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase */ public function testGetChildPdfAsArray() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $block = $layout->createBlock('Magento\Payment\Block\Info', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Payment/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Payment/Model/ObserverTest.php index 42d65fb38870dd164db9d1207d3858c83ba7f9c9..c6b7538c02224ad3c888de7641b79da25f1552bb 100644 --- a/dev/tests/integration/testsuite/Magento/Payment/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Payment/Model/ObserverTest.php @@ -77,23 +77,32 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Sales\Model\Order\Status $status */ $status = $this->_objectManager->get('Magento\Sales\Model\Order\Status')->load($statusCode); - /** @var $storeConfig \Magento\Core\Model\Store\Config */ - $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config'); - $defaultStatus = (string)$storeConfig->getConfig('payment/checkmo/order_status'); + /** @var $scopeConfig \Magento\App\Config\ScopeConfigInterface */ + $scopeConfig = $this->_objectManager->get('Magento\App\Config\ScopeConfigInterface'); + $defaultStatus = (string)$scopeConfig->getValue( + 'payment/checkmo/order_status', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); /** @var \Magento\Core\Model\Resource\Config $config */ $config = $this->_objectManager->get('Magento\Core\Model\Resource\Config'); - $config->saveConfig('payment/checkmo/order_status', $statusCode, 'default', 0); + $config->saveConfig('payment/checkmo/order_status', $statusCode, \Magento\App\ScopeInterface::SCOPE_DEFAULT, 0); $this->_resetConfig(); - $newStatus = $storeConfig->getConfig('payment/checkmo/order_status'); + $newStatus = (string)$scopeConfig->getValue( + 'payment/checkmo/order_status', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $status->unassignState(\Magento\Sales\Model\Order::STATE_NEW); $this->_resetConfig(); - $unassignedStatus = $storeConfig->getConfig('payment/checkmo/order_status'); + $unassignedStatus = $scopeConfig->getValue( + 'payment/checkmo/order_status', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->assertEquals('pending', $defaultStatus); $this->assertEquals($statusCode, $newStatus); @@ -119,9 +128,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_resetConfig(); - /** @var \Magento\Core\Model\Store\Config $storeConfig */ - $storeConfig = $this->_objectManager->get('Magento\Core\Model\Store\Config'); - $unassignedStatus = $storeConfig->getConfig('payment/checkmo/order_status'); + /** @var $scopeConfig \Magento\App\Config\ScopeConfigInterface */ + $scopeConfig = $this->_objectManager->get('Magento\App\Config\ScopeConfigInterface'); + $unassignedStatus = (string)$scopeConfig->getValue( + 'payment/checkmo/order_status', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->assertEquals('pending', $unassignedStatus); } @@ -142,7 +154,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ protected function _resetConfig() { - $this->_objectManager->get('Magento\App\ReinitableConfigInterface')->reinit(); - $this->_objectManager->create('Magento\Core\Model\StoreManagerInterface')->reinitStores(); + $this->_objectManager->get('Magento\App\Config\ReinitableConfigInterface')->reinit(); + $this->_objectManager->create('Magento\Store\Model\StoreManagerInterface')->reinitStores(); } } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php new file mode 100644 index 0000000000000000000000000000000000000000..38b8e7c382dca28c76d73887e1fe468904d2b6fb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php @@ -0,0 +1,140 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Paypal\Controller\Billing; + +/** + * Test class for \Magento\Paypal\Controller\Billing\Agreement + */ +class AgreementTest extends \Magento\TestFramework\TestCase\AbstractController +{ + /** + * Test billing agreement record creation in Magento DB. + * + * All mocking effort is aimed to disable remote call for billing agreement creation in the external system. + * Request parameters and current customer are emulated as well. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDbIsolation enabled + */ + public function testReturnWizardAction() + { + $paymentMethod = "paypal_express"; + $token = "token_value"; + $referenceId = "Reference-id-1"; + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /** Mock Request */ + $requestMock = $this->getMockForAbstractClass('Magento\App\RequestInterface', [], '', false); + $requestMock + ->expects($this->any()) + ->method('getParam') + ->will( + $this->returnValueMap( + [ + ['payment_method', null, $paymentMethod], + ['token', null, $token] + ] + ) + ); + + /** + * Disable billing agreement placement using calls to remote system + * in \Magento\Paypal\Model\Billing\Agreement::place() + */ + $objectManagerMock = $this->getMockForAbstractClass('Magento\ObjectManager', [], '', false); + $paymentMethodMock = $this->getMock( + 'Magento\Paypal\Model\Express', + ['getTitle', 'setStore', 'placeBillingAgreement'], + [], + '', + false + ); + $paymentMethodMock->expects($this->any())->method('placeBillingAgreement')->will($this->returnSelf()); + $paymentMethodMock->expects($this->any())->method('getTitle')->will($this->returnValue($paymentMethod)); + + $paymentHelperMock = $this->getMock('Magento\Payment\Helper\Data', ['getMethodInstance'], [], '', false); + $paymentHelperMock + ->expects($this->any()) + ->method('getMethodInstance') + ->will($this->returnValue($paymentMethodMock)); + $billingAgreement = $objectManager->create( + 'Magento\Paypal\Model\Billing\Agreement', + ['paymentData' => $paymentHelperMock] + ); + /** Reference ID is normally set by placeBillingAgreement() and is an agreement ID in the external system. */ + $billingAgreement->setBillingAgreementId($referenceId); + $objectManagerMock + ->expects($this->once()) + ->method('create') + ->with('Magento\Paypal\Model\Billing\Agreement', []) + ->will($this->returnValue($billingAgreement)); + $storeManager = $objectManager->get('Magento\Store\Model\StoreManager'); + $customerSession = $objectManager->get('Magento\Customer\Model\Session'); + $objectManagerMock + ->expects($this->any()) + ->method('get') + ->will( + $this->returnValueMap( + [ + ['Magento\Store\Model\StoreManager', $storeManager], + ['Magento\Customer\Model\Session', $customerSession] + ] + ) + ); + $contextMock = $objectManager->create( + 'Magento\App\Action\Context', + [ + 'objectManager' => $objectManagerMock, + 'request' => $requestMock + ] + ); + /** @var \Magento\Paypal\Controller\Billing\Agreement $billingAgreementController */ + $billingAgreementController = $objectManager->create( + 'Magento\Paypal\Controller\Billing\Agreement', + ['context' => $contextMock] + ); + + /** Initialize current customer */ + /** @var \Magento\Customer\Model\Session $customerSession */ + $customerSession = $objectManager->get('Magento\Customer\Model\Session'); + $fixtureCustomerId = 1; + $customerSession->setCustomerId($fixtureCustomerId); + + /** Execute SUT */ + $billingAgreementController->returnWizardAction(); + + /** Ensure that billing agreement record was created in the DB */ + /** @var \Magento\Paypal\Model\Resource\Billing\Agreement\Collection $billingAgreementCollection */ + $billingAgreementCollection = $objectManager->create( + 'Magento\Paypal\Model\Resource\Billing\Agreement\Collection' + ); + /** @var \Magento\Paypal\Model\Billing\Agreement $createdBillingAgreement */ + $createdBillingAgreement = $billingAgreementCollection->getLastItem(); + $this->assertEquals($fixtureCustomerId, $createdBillingAgreement->getCustomerId(), "Customer ID is invalid."); + $this->assertEquals($referenceId, $createdBillingAgreement->getReferenceId(), "Reference ID is invalid."); + $this->assertEquals($paymentMethod, $createdBillingAgreement->getMethodCode(), "Method code is invalid."); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php index c600a52f689686aecd0cea6ce3bc809dbbda62eb..354bb26a6f49f92b31fcb48fc717af3d0740a438 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/ExpressTest.php @@ -78,4 +78,65 @@ class ExpressTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertEquals($session->getQuote()->getGrandTotal(), $quote->getGrandTotal()); $this->assertEquals($session->getQuote()->getItemsCount(), $quote->getItemsCount()); } + + /** + * Test ensures only that customer data was copied to quote correctly. + * + * Note that test does not verify communication during remote calls to PayPal. + * + * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php + */ + public function testStartActionCustomerToQuote() + { + $fixtureCustomerId = 1; + $fixtureCustomerEmail = 'customer@example.com'; + $fixtureCustomerFirstname = 'Firstname'; + $fixtureQuoteReserveId = 'test01'; + + /** Preconditions */ + /** @var \Magento\Customer\Model\Session $customerSession */ + $customerSession = $this->_objectManager->get('Magento\Customer\Model\Session'); + /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerService */ + $customerService = $this->_objectManager->get('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + $customerData = $customerService->getCustomer($fixtureCustomerId); + $customerSession->setCustomerDataObject($customerData); + + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = $this->_objectManager->create('Magento\Sales\Model\Quote'); + $quote->load($fixtureQuoteReserveId, 'reserved_order_id'); + + /** @var \Magento\Checkout\Model\Session $checkoutSession */ + $checkoutSession = $this->_objectManager->get('Magento\Checkout\Model\Session'); + $checkoutSession->setQuoteId($quote->getId()); + + /** Preconditions check */ + $this->assertNotEquals( + $fixtureCustomerEmail, + $quote->getCustomerEmail(), + "Precondition failed: customer email in quote is invalid." + ); + $this->assertNotEquals( + $fixtureCustomerFirstname, + $quote->getCustomerFirstname(), + "Precondition failed: customer first name in quote is invalid." + ); + + /** Execute SUT */ + $this->dispatch('paypal/express/start'); + + /** Check if customer data was copied to quote correctly */ + /** @var \Magento\Sales\Model\Quote $updatedQuote */ + $updatedQuote = $this->_objectManager->create('Magento\Sales\Model\Quote'); + $updatedQuote->load($fixtureQuoteReserveId, 'reserved_order_id'); + $this->assertEquals( + $fixtureCustomerEmail, + $updatedQuote->getCustomerEmail(), + "Customer email in quote is invalid." + ); + $this->assertEquals( + $fixtureCustomerFirstname, + $updatedQuote->getCustomerFirstname(), + "Customer first name in quote is invalid." + ); + } } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php new file mode 100644 index 0000000000000000000000000000000000000000..778c608fd1d51715d68d9e5d24dfc1a5102222e6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php @@ -0,0 +1,208 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Paypal\Model\Express; + +use Magento\Customer\Model\Customer; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Checkout\Model\Type\Onepage; +use Magento\Sales\Model\Quote; + +class CheckoutTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\ObjectManager */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = Bootstrap::getObjectManager(); + } + + /** + * Verify that an order placed with an existing customer can re-use the customer addresses. + * + * @magentoDataFixture Magento/Paypal/_files/quote_payment_express_with_customer.php + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + */ + public function testPrepareCustomerQuote() + { + /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService */ + $addressService = $this->_objectManager->get('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); + /** @var Quote $quote */ + $quote = $this->_getFixtureQuote(); + $quote->setCheckoutMethod(Onepage::METHOD_CUSTOMER); // to dive into _prepareCustomerQuote() on switch + $quote->getShippingAddress()->setSameAsBilling(0); + $customer = $this->_objectManager->create('Magento\Customer\Model\Customer')->load(1); + $customer->setDefaultBilling(false) + ->setDefaultShipping(false) + ->save(); + + /** @var \Magento\Customer\Model\Session $customerSession */ + $customerSession = $this->_objectManager->get('Magento\Customer\Model\Session'); + $customerSession->loginById(1); + $checkout = $this->_getCheckout($quote); + $checkout->place('token'); + + $this->assertEquals(1, $quote->getCustomerId()); + $addressService->getAddresses($quote->getCustomerId()); + $this->assertEquals(2, count($addressService->getAddresses($quote->getCustomerId()))); + + $this->assertEquals(1, $quote->getBillingAddress()->getCustomerAddressId()); + $this->assertEquals(2, $quote->getShippingAddress()->getCustomerAddressId()); + + $order = $checkout->getOrder(); + $this->assertEquals(1, $order->getBillingAddress()->getCustomerAddressId()); + $this->assertEquals(2, $order->getShippingAddress()->getCustomerAddressId()); + } + + /** + * Verify that an order placed with a new customer will create the customer. + * + * @magentoDataFixture Magento/Paypal/_files/quote_payment_express.php + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + */ + public function testPrepareNewCustomerQuote() + { + /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerService */ + $customerService = $this->_objectManager->get('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + + /** @var Quote $quote */ + $quote = $this->_getFixtureQuote(); + + $quote->setCheckoutMethod(Onepage::METHOD_REGISTER); // to dive into _prepareNewCustomerQuote() on switch + $quote->setCustomerEmail('user@example.com'); + $quote->setCustomerFirstname('Firstname'); + $quote->setCustomerLastname('Lastname'); + $quote->setCustomerIsGuest(false); + $checkout = $this->_getCheckout($quote); + $checkout->place('token'); + $customer = $customerService->getCustomer($quote->getCustomerId()); + $customerDetails = $customerService->getCustomerDetails($customer->getId()); + $this->assertEquals('user@example.com', $customer->getEmail()); + $this->assertEquals('11111111', $customerDetails->getAddresses()[0]->getTelephone()); + } + + /** + * Verify that an order placed with a new unconfirmed customer alerts the user that they must confirm the account. + * + * @magentoDataFixture Magento/Paypal/_files/quote_payment_express.php + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + * @magentoConfigFixture current_store customer/create_account/confirm true + */ + public function testPrepareNewCustomerQuoteConfirmationRequired() + { + /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerService */ + $customerService = $this->_objectManager->get('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + + /** @var Quote $quote */ + $quote = $this->_getFixtureQuote(); + + $quote->setCheckoutMethod(Onepage::METHOD_REGISTER); // to dive into _prepareNewCustomerQuote() on switch + $quote->setCustomerEmail('user@example.com'); + $quote->setCustomerFirstname('Firstname'); + $quote->setCustomerLastname('Lastname'); + $quote->setCustomerIsGuest(false); + + $checkout = $this->_getCheckout($quote); + $checkout->place('token'); + $customer = $customerService->getCustomer($quote->getCustomerId()); + $customerDetails = $customerService->getCustomerDetails($customer->getId()); + $this->assertEquals('user@example.com', $customer->getEmail()); + $this->assertEquals('11111111', $customerDetails->getAddresses()[0]->getTelephone()); + + /** @var \Magento\Message\ManagerInterface $messageManager */ + $messageManager = $this->_objectManager->get('\Magento\Message\ManagerInterface'); + $confirmationText = sprintf( + 'customer/account/confirmation/email/%s/key/', + $customerDetails->getCustomer()->getEmail() + ); + /** @var \Magento\Message\MessageInterface $message */ + $message = $messageManager->getMessages()->getLastAddedMessage(); + $this->assertInstanceOf('\Magento\Message\MessageInterface', $message); + $this->assertTrue( + strpos($message->getText(), $confirmationText) !== false + ); + + } + + /** + * Verify that after placing the order, addresses are associated with the order and the quote is a guest quote. + * + * @magentoDataFixture Magento/Paypal/_files/quote_payment_express.php + * @magentoAppIsolation enabled + * @magentoDbIsolation enabled + */ + public function testPlaceGuestQuote() + { + /** @var Quote $quote */ + $quote = $this->_getFixtureQuote(); + $quote->setCheckoutMethod(Onepage::METHOD_GUEST); // to dive into _prepareGuestQuote() on switch + $quote->getShippingAddress()->setSameAsBilling(0); + + $checkout = $this->_getCheckout($quote); + $checkout->place('token'); + + $this->assertNull($quote->getCustomerId()); + $this->assertTrue($quote->getCustomerIsGuest()); + $this->assertEquals(\Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, $quote->getCustomerGroupId()); + + $this->assertNotEmpty($quote->getBillingAddress()); + $this->assertNotEmpty($quote->getShippingAddress()); + + $order = $checkout->getOrder(); + $this->assertNotEmpty($order->getBillingAddress()); + $this->assertNotEmpty($order->getShippingAddress()); + } + + /** + * @param Quote $quote + * @return Checkout + */ + protected function _getCheckout(Quote $quote) + { + return $this->_objectManager->create( + 'Magento\Paypal\Model\Express\Checkout', + [ + 'params' => [ + 'config' => $this->getMock('Magento\Paypal\Model\Config', [], [], '', false), + 'quote' => $quote, + ] + ] + ); + } + + /** + * @return Quote + */ + protected function _getFixtureQuote() + { + /** @var \Magento\Sales\Model\Resource\Quote\Collection $quoteCollection */ + $quoteCollection = $this->_objectManager->create('Magento\Sales\Model\Resource\Quote\Collection'); + + return $quoteCollection->getLastItem(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php index 6b93f2ee2e1e9b884f80276b62e7ce83c1799a2f..6b7d8a4e22b3b8a2312fd8a798cc04007bfac636 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php @@ -38,12 +38,12 @@ class VoidTest extends \PHPUnit_Framework_TestCase $eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $moduleList = $objectManager->get('Magento\Module\ModuleListInterface'); $paymentData = $objectManager->get('Magento\Payment\Helper\Data'); - $coreStoreConfig = $objectManager->get('Magento\Core\Model\Store\Config'); + $scopeConfig = $objectManager->get('Magento\App\Config\ScopeConfigInterface'); $logger = $objectManager->get('Magento\Logger'); $logAdapterFactory = $objectManager->get('Magento\Logger\AdapterFactory'); $localeDate = $objectManager->get('Magento\Stdlib\DateTime\TimezoneInterface'); $centinelService = $objectManager->get('Magento\Centinel\Model\Service'); - $storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface'); + $storeManager = $objectManager->get('Magento\Store\Model\StoreManagerInterface'); $configFactory = $objectManager->get('Magento\Paypal\Model\ConfigFactory'); $mathRandom = $objectManager->get('Magento\Math\Random'); @@ -59,7 +59,7 @@ class VoidTest extends \PHPUnit_Framework_TestCase array( $eventManager, $paymentData, - $coreStoreConfig, + $scopeConfig, $logAdapterFactory, $logger, $moduleList, diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php index c5c02f63ee6cd798647e601d1d2e460ece8f3e02..8e6a005bed8af8c5e6bc7585ee1e32dc98d3380c 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php @@ -22,52 +22,49 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() - ->setConfig('carriers/flatrate/active', 1); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() - ->setConfig('payment/paypal_express/active', 1); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( + 'carriers/flatrate/active', + 1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE +); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( + 'payment/paypal_express/active', + 1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE +); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); -$product->setTypeId( - 'simple' -)->setId( - 1 -)->setAttributeSetId( - 4 -)->setName( - 'Simple Product' -)->setSku( - 'simple' -)->setPrice( - 10 -)->setStockData( - array('use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 100) -)->setVisibility( - \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH -)->setStatus( - \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED -)->save(); +$product->setTypeId('simple') + ->setId(1) + ->setAttributeSetId(4) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setStockData(array( + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 100, +)) + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->save(); $product->load(1); -$addressData = array( - 'region' => 'CA', - 'postcode' => '11111', - 'lastname' => 'lastname', - 'firstname' => 'firstname', - 'street' => 'street', - 'city' => 'Los Angeles', - 'email' => 'admin@example.com', - 'telephone' => '11111111', - 'country_id' => 'US' -); - $billingData = array( - 'address_id' => '', 'firstname' => 'testname', 'lastname' => 'lastname', 'company' => '', 'email' => 'test@com.com', - 'street' => array(0 => 'test1', 1 => ''), + 'street' => + array( + 0 => 'test1', + 1 => '', + ), 'city' => 'Test', 'region_id' => '1', 'region' => '', @@ -77,13 +74,11 @@ $billingData = array( 'fax' => '', 'confirm_password' => '', 'save_in_address_book' => '1', - 'use_for_shipping' => '1' + 'use_for_shipping' => '1', ); -$billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Sales\Model\Quote\Address', - array('data' => $billingData) -); +$billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Quote\Address', array('data' => $billingData)); $billingAddress->setAddressType('billing'); $shippingAddress = clone $billingAddress; @@ -97,7 +92,7 @@ $quote->setCustomerIsGuest( true )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test02' @@ -115,12 +110,10 @@ $quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS); $quote->collectTotals()->save(); /** @var $service \Magento\Sales\Model\Service\Quote */ -$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Sales\Model\Service\Quote', - array('quote' => $quote) -); +$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Service\Quote', array('quote' => $quote)); $service->setOrderData(array('increment_id' => '100000002')); -$service->submitAll(); +$service->submitAllWithDataObject(); $order = $service->getOrder(); $order->save(); diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express_with_customer.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express_with_customer.php new file mode 100644 index 0000000000000000000000000000000000000000..a84874f70c273bc0a56878331d6c53b2ab37703c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express_with_customer.php @@ -0,0 +1,107 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +require __DIR__ . '/../../Customer/_files/customer.php'; +require __DIR__ . '/../../Customer/_files/customer_two_addresses.php'; + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); + +\Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\Config\MutableScopeConfigInterface') + ->setValue('carriers/flatrate/active', 1, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\Config\MutableScopeConfigInterface') + ->setValue('payment/paypal_express/active', 1, \Magento\Store\Model\ScopeInterface::SCOPE_STORE); + +/** @var $product \Magento\Catalog\Model\Product */ +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); +$product->setTypeId('simple') + ->setId(1) + ->setAttributeSetId(4) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setStockData(array( + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 100, +)) + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->save(); +$product->load(1); + +$addressConverter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Address\Converter'); + +$customerBillingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Address'); +$customerBillingAddress->load(1); +$billingAddressDataObject = $addressConverter->createAddressFromModel($customerBillingAddress, false, false); +$billingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Quote\Address'); +$billingAddress->importCustomerAddressData($billingAddressDataObject); +$billingAddress->setAddressType('billing'); + +$customerShippingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Address'); +$customerShippingAddress->load(2); +$shippingAddressDataObject = $addressConverter->createAddressFromModel($customerShippingAddress, false, false); +$shippingAddress = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Quote\Address'); +$shippingAddress->importCustomerAddressData($shippingAddressDataObject); +$shippingAddress->setAddressType('shipping'); + +$shippingAddress->setShippingMethod('flatrate_flatrate'); +$shippingAddress->setCollectShippingRates(true); + +/** @var $quote \Magento\Sales\Model\Quote */ +$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Quote'); +$quote->setCustomerIsGuest(false) + ->setCustomerId($customer->getId()) + ->setCustomer($customer) + ->setStoreId( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface') + ->getStore()->getId() + ) + ->setReservedOrderId('test02') + ->setBillingAddress($billingAddress) + ->setShippingAddress($shippingAddress) + ->addProduct($product, 10); +$quote->getShippingAddress()->setShippingMethod('flatrate_flatrate'); +$quote->getShippingAddress()->setCollectShippingRates(true); +$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS); +$quote->collectTotals()->save(); + +/** @var $service \Magento\Sales\Model\Service\Quote */ +$service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Service\Quote', array('quote' => $quote)); +$service->setOrderData(array('increment_id' => '100000002')); +$service->submitAllWithDataObject(); + +$order = $service->getOrder(); + +$order->save(); \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php index 54aba2fe7eed9cdee1e7bb643189a4234a830f1b..65c39dbda3ae0ac1095597768916f4c72b41592d 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php @@ -23,8 +23,13 @@ */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() - ->setConfig('carriers/flatrate/active', 1); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( + 'carriers/flatrate/active', + 1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE +); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( @@ -96,7 +101,7 @@ $quote->setCustomerIsGuest( true )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test02' @@ -123,7 +128,7 @@ $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( array('quote' => $quote) ); $service->setOrderData(array('increment_id' => '100000001')); -$service->submitAll(); +$service->submitAllWithDataObject(); $order = $service->getOrder(); $order->setPayment($payment); diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php index e255ed2b24e4ea35aa64c39057e8afdba1ffb13b..d6905eaf202b4086266453b34e81013a9b838099 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php @@ -22,8 +22,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() - ->setConfig('carriers/flatrate/active', 1); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' +)->setValue( + 'carriers/flatrate/active', + 1, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE +); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( @@ -95,7 +100,7 @@ $quote->setCustomerIsGuest( true )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test01' @@ -119,7 +124,7 @@ $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( array('quote' => $quote) ); $service->setOrderData(array('increment_id' => '100000002')); -$service->submitAll(); +$service->submitAllWithDataObject(); $order = $service->getOrder(); $order->save(); diff --git a/dev/tests/integration/testsuite/Magento/RecurringPayment/Block/Catalog/Product/View/PaymentTest.php b/dev/tests/integration/testsuite/Magento/RecurringPayment/Block/Catalog/Product/View/PaymentTest.php index 49eb5f6748e2062302a9999acc7d1bbc43029702..7c423dfe1591660679fd4a7868575c8c372fd18e 100644 --- a/dev/tests/integration/testsuite/Magento/RecurringPayment/Block/Catalog/Product/View/PaymentTest.php +++ b/dev/tests/integration/testsuite/Magento/RecurringPayment/Block/Catalog/Product/View/PaymentTest.php @@ -44,7 +44,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $product->setRecurringPayment(array('start_date_is_editable' => true)); $objectManager->get('Magento\Registry')->register('current_product', $product); $block = $objectManager->create('Magento\RecurringPayment\Block\Catalog\Product\View\Payment'); - $block->setLayout($objectManager->create('Magento\Core\Model\Layout')); + $block->setLayout($objectManager->create('Magento\View\Layout')); $html = $block->getDateHtml(); $this->assertNotEmpty($html); diff --git a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php index 27f59912296a327774180e25ef931481061da86a..5f0a90959511b8484f3a82f948688edc71c56a80 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Reports/Block/Adminhtml/Filter/FormTest.php @@ -42,7 +42,7 @@ class FormTest extends \PHPUnit_Framework_TestCase )->setArea( \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE )->setDefaultDesignTheme(); - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); + $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\Layout'); $block = $layout->addBlock('Magento\Reports\Block\Adminhtml\Filter\Form'); $prepareFormMethod = new \ReflectionMethod('Magento\Reports\Block\Adminhtml\Filter\Form', '_prepareForm'); $prepareFormMethod->setAccessible(true); diff --git a/dev/tests/integration/testsuite/Magento/Rating/Block/Adminhtml/Edit/Tab/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php similarity index 87% rename from dev/tests/integration/testsuite/Magento/Rating/Block/Adminhtml/Edit/Tab/FormTest.php rename to dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php index 41926e88e3b06f58916e649fab30f6fe43b7f665..cedc9f4ebe143e3988af72a411f1332de97ded8c 100644 --- a/dev/tests/integration/testsuite/Magento/Rating/Block/Adminhtml/Edit/Tab/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/Tab/FormTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Rating\Block\Adminhtml\Edit\Tab; +namespace Magento\Review\Block\Adminhtml\Edit\Tab; /** * @magentoAppArea adminhtml @@ -31,11 +31,11 @@ class FormTest extends \PHPUnit_Framework_TestCase public function testConstruct() { $this->assertInstanceOf( - 'Magento\Rating\Block\Adminhtml\Edit\Tab\Form', + 'Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form', \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\LayoutInterface' )->createBlock( - 'Magento\Rating\Block\Adminhtml\Edit\Tab\Form' + 'Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form' ) ); } diff --git a/dev/tests/integration/testsuite/Magento/Review/Controller/ProductTest.php b/dev/tests/integration/testsuite/Magento/Review/Controller/ProductTest.php index fd8f56b326f9f3f82757a0700388596d385506b2..76ce2df35365aebb83a785b0c830079327d0f58b 100644 --- a/dev/tests/integration/testsuite/Magento/Review/Controller/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Review/Controller/ProductTest.php @@ -45,6 +45,6 @@ class ProductTest extends \Magento\TestFramework\TestCase\AbstractController */ public function listActionDesignDataProvider() { - return array('custom product design' => array(2, 'magento_blank')); + return array('custom product design' => array(2, 'Magento/blank')); } } diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php index 1535b4f74d33c5422df7d0a27606ca2a9d4d59f7..c8c25dd24496bf84c84e7b5c467ecf7bd3df274b 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php @@ -44,11 +44,11 @@ $review ->setEntityPkValue($product->getId()) ->setStatusId(\Magento\Review\Model\Review::STATUS_PENDING) ->setStoreId( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface') ->getStore()->getId() ) ->setStores([ - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface') ->getStore()->getId() ]) ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php index 1006096d348db312b6f6c4982059bf1bf7843d59..a645875e5c0ddc380aff15e21420f8bc462ba4af 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php @@ -34,17 +34,17 @@ $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( $review->setEntityId( $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE) )->setEntityPkValue( - 1 // the last product from the fixture file included above + 1 )->setStatusId( \Magento\Review\Model\Review::STATUS_PENDING )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->save(); @@ -56,17 +56,17 @@ $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( $review->setEntityId( $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE) )->setEntityPkValue( - 1 // the last product from the fixture file included above + 1 )->setStatusId( \Magento\Review\Model\Review::STATUS_APPROVED )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->save(); @@ -78,17 +78,17 @@ $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( $review->setEntityId( $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE) )->setEntityPkValue( - 1 // the last product from the fixture file included above + 1 )->setStatusId( \Magento\Review\Model\Review::STATUS_APPROVED )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->save(); diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/review_xss.php b/dev/tests/integration/testsuite/Magento/Review/_files/review_xss.php index d68c6377d54beb51bf303a158397f4fe1a554c56..4dce3cfd10201b86d37963dfd4ed013f4962e065 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/review_xss.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/review_xss.php @@ -31,17 +31,17 @@ $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('M $review->setEntityId( $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE) )->setEntityPkValue( - 1 // the last product from the fixture file included above + 1 )->setStatusId( \Magento\Review\Model\Review::STATUS_PENDING )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->setNickname( diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/reviews.php b/dev/tests/integration/testsuite/Magento/Review/_files/reviews.php index a8be3d802630d1c1cd9101d312576dc64532189a..745de75e908abfe21a9f6a5c72c1065ca094ed9a 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/reviews.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/reviews.php @@ -34,17 +34,17 @@ $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( $review->setEntityId( $review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE) )->setEntityPkValue( - $product->getId() // the last product from the fixture file included above + $product->getId() )->setStatusId( \Magento\Review\Model\Review::STATUS_PENDING )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setStores( array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() ) )->save(); diff --git a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php index 847c96368a982de1119f415423b199e1bc47dab3..2c94556916031ecfea6fcd8c91e17e5d3b9127a6 100644 --- a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php +++ b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php @@ -122,8 +122,10 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController // assert that among 2 products in fixture, there is only one with 50 qty $body = $this->getResponse()->getBody(); - $this->assertNotContains('<![CDATA[Simple Product]]>', $body); // this one was supposed to have qty 100 ( > 75) - $this->assertContains('<![CDATA[Simple Product2]]>', $body); // 50 < 75 + $this->assertNotContains('<![CDATA[Simple Product]]>', $body); + // this one was supposed to have qty 100 ( > 75) + $this->assertContains('<![CDATA[Simple Product2]]>', $body); + // 50 < 75 // this one was supposed to have qty 140 ( > 75) $this->assertNotContains('<![CDATA[Simple Product 3]]>', $body); } @@ -149,7 +151,7 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController $this->getRequest()->setParam( 'cid', \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getRootCategoryId() ); $this->dispatch('rss/catalog/category'); @@ -164,15 +166,20 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController */ protected function _loginAdmin() { - \Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') - ->setDefaultDesignTheme(); - $this->getRequest()->setServer(array( - 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, - 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD - )); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Model\UrlInterface') - ->turnOffSecretKey(); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\View\DesignInterface' + )->setDefaultDesignTheme(); + $this->getRequest()->setServer( + array( + 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, + 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD + ) + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Backend\Model\UrlInterface' + )->turnOffSecretKey(); } } diff --git a/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php index c9e3accf6acbe2a0859f430d560863dc4ab2954d..b836460fe97e6b1488bf94216c25629bda29ae00 100644 --- a/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Rule/Model/Condition/AbstractTest.php @@ -34,7 +34,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { public function testGetValueElement() { - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $context = $objectManager->create('Magento\Rule\Model\Condition\Context', array('layout' => $layoutMock)); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php index 36b4b138da0c13af7cf6cb8e8b48980929aecb43..940a6a56e318ee3914b9caf0408ec08e9ff90be2 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php @@ -33,7 +33,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { public function testGetItemExtraInfoHtml() { - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); /** @var $block \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ $block = $layout->createBlock('Magento\Sales\Block\Adminhtml\Items\AbstractItems', 'block'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php index 908ea87a9b4aa5140f6376c26c5c92f2c3ebe72c..f18d69e10bc9abd9f7d126405274d2c920981303 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php @@ -30,7 +30,6 @@ */ namespace Magento\Sales\Block\Adminhtml\Order\Create\Form; -use Magento\Customer\Service\V1\Data\Eav\AttributeMetadata; use Magento\Customer\Service\V1\Data\Eav\AttributeMetadataBuilder; use Magento\Customer\Service\V1\Data\Eav\OptionBuilder; use Magento\Customer\Service\V1\Data\Eav\ValidationRuleBuilder; @@ -59,7 +58,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractForm', $arguments ); - $block->setLayout($objectManager->create('Magento\Core\Model\Layout')); + $block->setLayout($objectManager->create('Magento\View\Layout')); $method = new \ReflectionMethod( 'Magento\Sales\Block\Adminhtml\Order\Create\Form\AbstractForm', diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php index 3f0ceb62d30d966590e46579a9b4267f85913c90..0657a7d7769036c0dfc5abde65fd773896abf11a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/FormTest.php @@ -58,7 +58,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $sessionMock->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); $storeMock = $this->getMockBuilder( - '\Magento\Core\Model\Store' + '\Magento\Store\Model\Store' )->disableOriginalConstructor()->setMethods( array('getCurrentCurrencyCode') )->getMock(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php index b5f49bf787d08d5478eab904908b9f958a967ea3..f52a758c9b178707207ee329446e8f71a58c35f6 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/TotalsTest.php @@ -32,8 +32,9 @@ class TotalsTest extends \PHPUnit_Framework_TestCase { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); + /** @var \Magento\Sales\Block\Order\Totals $block */ $block = $layout->createBlock('Magento\Sales\Block\Order\Totals', 'block'); $block->setOrder( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order') diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php index f227dd4c770c09cef996a22f0fb6f7280721ebb1..0132193e22204b086fbb7fd5d824cd84d4f3b57a 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Quote/AddressTest.php @@ -81,7 +81,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase if ($unsetId) { $address->setId(null); } - $address->setSameAsBilling(0)->setCustomerAddress($this->_customer->getDefaultBillingAddress())->save(); + /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService */ + $addressService = Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); + $customerAddressData = $addressService->getDefaultBillingAddress($this->_customer->getId()); + $address->setSameAsBilling(0)->setCustomerAddressData($customerAddressData)->save(); $this->assertEquals(0, $this->_quote->getBillingAddress()->getSameAsBilling()); } @@ -115,7 +119,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase if ($unsetId) { $shippingAddress->setId(null); } - $shippingAddress->setSameAsBilling(0)->setCustomerAddress(null)->save(); + $shippingAddress->setSameAsBilling(0) + ->setCustomerAddressData(null) + ->save(); $this->assertEquals((int)$unsetId, $this->_quote->getShippingAddress()->getSameAsBilling()); } @@ -178,11 +184,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase if ($unsetId) { $shippingAddress->setId(null); } - $shippingAddress->setSameAsBilling( - 0 - )->setCustomerAddress( - $this->_customer->getDefaultBillingAddress() - )->save(); + $shippingAddress->setSameAsBilling(0) + ->setCustomerAddressData($this->_customer->getDefaultBillingAddress()) + ->save(); } public function unsetAddressIdDataProvider() @@ -274,10 +278,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase "Precondition failed: Customer address ID was not set." ); - /** @var \Magento\Customer\Model\Address $customerAddress */ - $customerAddress = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Address'); - $customerAddress->setId($customerAddressId); - $this->_address->setCustomerAddress($customerAddress); + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder */ + $addressBuilder = Bootstrap::getObjectManager()->create('Magento\Customer\Service\V1\Data\AddressBuilder'); + $customerAddressData = $addressBuilder->setId($customerAddressId)->create(); + $this->_address->setCustomerAddressData($customerAddressData); $this->_address->save(); $this->assertEquals($customerId, $this->_address->getCustomerId()); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order.php index eeb63a7736a6aaf3cc013384d4007c430fd8cfeb..e19cf27effee77059be936fe659f0513ffbcbc99 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order.php @@ -63,7 +63,7 @@ $order->setIncrementId( )->setShippingAddress( $shippingAddress )->setStoreId( - $objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId() + $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId() )->addItem( $orderItem )->setPayment( diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php index 1e3a8ccf75d96c43dcbb83fe1ba7fe8584b60a8c..1da3629059fb232d3befaf8669906961f8d275b1 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php @@ -66,7 +66,7 @@ $order->setIncrementId( )->setShippingAddress( $shippingAddress )->setStoreId( - $objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore('fixturestore')->getId() + $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore('fixturestore')->getId() )->addItem( $orderItem )->setPayment( diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index cdfa0326eb98178116ea88312cf6edffa5960850..ac5329a07fd0a4c4540b3510afd91d4a022415c9 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -25,8 +25,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); @@ -69,7 +70,7 @@ $quote->setCustomerIsGuest( true )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test01' @@ -133,10 +134,13 @@ foreach ($creditmemo->getAllItems() as $creditmemoItem) { $creditmemo->register(); $creditmemo->save(); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\DB\Transaction') - ->addObject($creditmemo) - ->addObject($creditmemo->getOrder()); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\DB\Transaction' +)->addObject( + $creditmemo +)->addObject( + $creditmemo->getOrder() +); if ($creditmemo->getInvoice()) { $transactionSave->addObject($creditmemo->getInvoice()); } diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_payflowpro.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_payflowpro.php index 3a65668ceb556c5599a04013a50258dd29487c97..44266da0026a7d198c98ab0d5b0df4b27233890b 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_payflowpro.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_payflowpro.php @@ -54,7 +54,7 @@ $order->setIncrementId( $shippingAddress )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setPayment( $payment diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php index 51e48d41f0bea7f98ccc38100622f3809e620c08..fcfd454233ada6c33d57464c2c49cf08fe00de17 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php @@ -25,8 +25,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +); $addressData = include __DIR__ . '/address_data.php'; @@ -57,7 +58,7 @@ $order->setIncrementId( $shippingAddress )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setPayment( $payment diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php index da673e38d43a02d9af3cca5dde51a27b0ca2fe16..99a27d1d5978c7548a9cfbdcec94ddd509823312 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php @@ -70,7 +70,7 @@ $quote->setCustomerIsGuest( true )->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( 'test01' diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php index d39588212227bf2bc5ef49ebdede78c2011c27a1..d8068b05b6908b340eeebdee1c9b64828e223690 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/MainTest.php @@ -51,7 +51,7 @@ class MainTest extends \PHPUnit_Framework_TestCase $objectManager->create('Magento\SalesRule\Model\Rule') ); - $layout = $objectManager->create('Magento\Core\Model\Layout'); + $layout = $objectManager->create('Magento\View\Layout'); $block = $layout->addBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main'); $prepareFormMethod = new \ReflectionMethod( 'Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Main', @@ -66,5 +66,13 @@ class MainTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($element); $this->assertNotEmpty($element->getDateFormat()); } + + // assert Customer Groups field + $customerGroupsField = $form->getElement('customer_group_ids'); + $customerGroupService = $objectManager->create('Magento\Customer\Service\V1\CustomerGroupServiceInterface'); + $objectConverter = $objectManager->get('Magento\Convert\Object'); + $groups = $customerGroupService->getGroups(); + $expected = $objectConverter->toOptionArray($groups, 'id', 'code'); + $this->assertEquals($expected, $customerGroupsField->getValues()); } } diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off.php index c92f2fb336d84235bb56e3202a2c25679534b853..a9882a11ebf44632dbe6624869e81b075e8861a3 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_40_percent_off.php @@ -43,7 +43,7 @@ $salesRule->setData( 'stop_rules_processing' => 1, 'website_ids' => array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite()->getId() ) ) diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off.php index 865f88b6d03a9d7115d62d381434eb75b8498b42..24e22a1175a6d466335fa56304fef20f93347f3e 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_50_percent_off.php @@ -43,7 +43,7 @@ $salesRule->setData( 'stop_rules_processing' => 1, 'website_ids' => array( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite()->getId() ) ) diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Session/ConfigTest.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php rename to dev/tests/integration/testsuite/Magento/Session/ConfigTest.php index dbd206d4dafac9ad57a80c7c20b0e0527b0bba30..7308fe14c969354cf6f46fa7f66c73d20ec281ca 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Session/ConfigTest.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; +namespace Magento\Session; class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Session\Config + * @var \Magento\Session\Config */ protected $_model; @@ -52,14 +50,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $sessionManager->destroy(); } $this->_model = $this->_objectManager->create( - 'Magento\Core\Model\Session\Config', + 'Magento\Session\Config', array('saveMethod' => 'files', 'cacheLimiter' => $this->_cacheLimiter) ); } protected function tearDown() { - $this->_objectManager->removeSharedInstance('Magento\Core\Model\Session\Config'); + $this->_objectManager->removeSharedInstance('Magento\Session\Config'); } /** @@ -76,7 +74,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_model->getSavePath() ); $this->assertEquals( - \Magento\Core\Model\Session\Config::COOKIE_LIFETIME_DEFAULT, + \Magento\Session\Config::COOKIE_LIFETIME_DEFAULT, $this->_model->getCookieLifetime() ); $this->assertEquals($this->_cacheLimiter, $this->_model->getCacheLimiter()); diff --git a/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php b/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php index c77c45e802145fbff8ca4e496b5c65dd0eb088de..16c38151c8bfc3762eab34987d67a3a87fae85e0 100644 --- a/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php +++ b/dev/tests/integration/testsuite/Magento/Session/SessionManagerTest.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -49,7 +47,7 @@ class SessionManagerTest extends \PHPUnit_Framework_TestCase $this->_model = $objectManager->create( 'Magento\Session\SessionManager', array( - $objectManager->get('Magento\App\RequestInterface'), + $objectManager->get('Magento\App\Request\Http'), $this->_sidResolver, $objectManager->get('Magento\Session\Config\ConfigInterface'), $objectManager->get('Magento\Session\SaveHandlerInterface'), diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php b/dev/tests/integration/testsuite/Magento/Session/SidResolverTest.php similarity index 83% rename from dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php rename to dev/tests/integration/testsuite/Magento/Session/SidResolverTest.php index e9475400a1abfaf7a95fdb6ae63127580a8bc106..eafa759cebb35704e6d83da293c1c21c1e7867da 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/SidResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Session/SidResolverTest.php @@ -18,35 +18,33 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; +namespace Magento\Session; class SidResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Session\SidResolver + * @var \Magento\Session\SidResolver */ protected $model; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $session; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store */ protected $store; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\ConfigInterface + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ - protected $coreStoreConfig; + protected $scopeConfig; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\UrlInterface @@ -67,13 +65,13 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Core\Model\Session _model */ - $this->session = $objectManager->get('Magento\Core\Model\Session'); + /** @var \Magento\Session\Generic _model */ + $this->session = $objectManager->get('Magento\Session\Generic'); - $this->coreStoreConfig = $this->getMockBuilder( - 'Magento\Core\Model\Store\ConfigInterface' + $this->scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->setMethods( - array('getConfig') + array('getValue') )->disableOriginalConstructor()->getMockForAbstractClass(); $this->urlBuilder = $this->getMockBuilder( @@ -83,9 +81,9 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase )->disableOriginalConstructor()->getMockForAbstractClass(); $this->model = $objectManager->create( - 'Magento\Core\Model\Session\SidResolver', + 'Magento\Session\SidResolver', array( - 'coreStoreConfig' => $this->coreStoreConfig, + 'scopeConfig' => $this->scopeConfig, 'urlBuilder' => $this->urlBuilder, 'sidNameMap' => array($this->customSessionName => $this->customSessionQueryParam) ) @@ -108,12 +106,13 @@ class SidResolverTest extends \PHPUnit_Framework_TestCase */ public function testGetSid($sid, $useFrontedSid, $isOwnOriginUrl, $testSid) { - $this->coreStoreConfig->expects( + $this->scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( - SidResolver::XML_PATH_USE_FRONTEND_SID + \Magento\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue($useFrontedSid) ); diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php index f7d75cdee56beb397af4664dfb7c3da47a0a6097..a673085e3ae56b66dd44b2f66550f857351ae36d 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php @@ -45,8 +45,11 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetMaximumLinesNumber() { - $this->assertEquals(50000, $this->_helper->getMaximumLinesNumber(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(10, $this->_helper->getMaximumLinesNumber(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals( + 50000, + $this->_helper->getMaximumLinesNumber(\Magento\Store\Model\Store::DEFAULT_STORE_ID) + ); + $this->assertEquals(10, $this->_helper->getMaximumLinesNumber(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -54,8 +57,11 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetMaximumFileSize() { - $this->assertEquals(10485760, $this->_helper->getMaximumFileSize(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(1024, $this->_helper->getMaximumFileSize(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals( + 10485760, + $this->_helper->getMaximumFileSize(\Magento\Store\Model\Store::DEFAULT_STORE_ID) + ); + $this->assertEquals(1024, $this->_helper->getMaximumFileSize(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -65,11 +71,11 @@ class DataTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( 'daily', - $this->_helper->getCategoryChangefreq(\Magento\Core\Model\Store::DEFAULT_STORE_ID) + $this->_helper->getCategoryChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID) ); $this->assertEquals( 'montly', - $this->_helper->getCategoryChangefreq(\Magento\Core\Model\Store::DISTRO_STORE_ID) + $this->_helper->getCategoryChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID) ); } @@ -80,11 +86,11 @@ class DataTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( 'daily', - $this->_helper->getProductChangefreq(\Magento\Core\Model\Store::DEFAULT_STORE_ID) + $this->_helper->getProductChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID) ); $this->assertEquals( 'montly', - $this->_helper->getProductChangefreq(\Magento\Core\Model\Store::DISTRO_STORE_ID) + $this->_helper->getProductChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID) ); } @@ -93,8 +99,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetPageChangefreq() { - $this->assertEquals('daily', $this->_helper->getPageChangefreq(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals('montly', $this->_helper->getPageChangefreq(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals('daily', $this->_helper->getPageChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); + $this->assertEquals('montly', $this->_helper->getPageChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -102,8 +108,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetCategoryPriority() { - $this->assertEquals(0.5, $this->_helper->getCategoryPriority(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getCategoryPriority(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals(0.5, $this->_helper->getCategoryPriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->_helper->getCategoryPriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -111,8 +117,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetProductPriority() { - $this->assertEquals(1, $this->_helper->getProductPriority(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getProductPriority(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals(1, $this->_helper->getProductPriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->_helper->getProductPriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -120,8 +126,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetPagePriority() { - $this->assertEquals(0.25, $this->_helper->getPagePriority(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getPagePriority(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals(0.25, $this->_helper->getPagePriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->_helper->getPagePriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -129,8 +135,11 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetEnableSubmissionRobots() { - $this->assertEquals(0, $this->_helper->getEnableSubmissionRobots(\Magento\Core\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(1, $this->_helper->getEnableSubmissionRobots(\Magento\Core\Model\Store::DISTRO_STORE_ID)); + $this->assertEquals( + 0, + $this->_helper->getEnableSubmissionRobots(\Magento\Store\Model\Store::DEFAULT_STORE_ID) + ); + $this->assertEquals(1, $this->_helper->getEnableSubmissionRobots(\Magento\Store\Model\Store::DISTRO_STORE_ID)); } /** @@ -140,11 +149,11 @@ class DataTest extends \PHPUnit_Framework_TestCase { $this->assertEquals( 'all', - $this->_helper->getProductImageIncludePolicy(\Magento\Core\Model\Store::DEFAULT_STORE_ID) + $this->_helper->getProductImageIncludePolicy(\Magento\Store\Model\Store::DEFAULT_STORE_ID) ); $this->assertEquals( 'base', - $this->_helper->getProductImageIncludePolicy(\Magento\Core\Model\Store::DISTRO_STORE_ID) + $this->_helper->getProductImageIncludePolicy(\Magento\Store\Model\Store::DISTRO_STORE_ID) ); } } diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/Resource/Catalog/ProductTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/Resource/Catalog/ProductTest.php index 90087969189f8f1b9f9764db69e2544932aaddce..9f85c865105dc9740cac06cc09684b1035382dd2 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/Model/Resource/Catalog/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/Resource/Catalog/ProductTest.php @@ -46,7 +46,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Sitemap\Model\Resource\Catalog\Product' ); - $products = $model->getCollection(\Magento\Core\Model\Store::DISTRO_STORE_ID); + $products = $model->getCollection(\Magento\Store\Model\Store::DISTRO_STORE_ID); $this->_checkProductCollection($products, 3, array(1, 4, 5)); @@ -73,7 +73,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Sitemap\Model\Resource\Catalog\Product' ); - $products = $model->getCollection(\Magento\Core\Model\Store::DISTRO_STORE_ID); + $products = $model->getCollection(\Magento\Store\Model\Store::DISTRO_STORE_ID); $this->_checkProductCollection($products, 3, array(1, 4, 5)); @@ -141,7 +141,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Sitemap\Model\Resource\Catalog\Product' ); - $products = $model->getCollection(\Magento\Core\Model\Store::DISTRO_STORE_ID); + $products = $model->getCollection(\Magento\Store\Model\Store::DISTRO_STORE_ID); $this->_checkProductCollection($products, 3, array(1, 4, 5)); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php similarity index 82% rename from dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php index a359e0642353ca95def5ec26d5d0a7f051066388..e6ed4ae093e32e27e4ceb88b9280cd9c3ac3f5c6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Store/GroupTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/GroupTest.php @@ -18,32 +18,29 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store; +namespace Magento\Store\Model; use Magento\TestFramework\Helper\Bootstrap; class GroupTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Store\Group + * @var \Magento\Store\Model\Store */ protected $_model; protected function setUp() { - $this->_model = Bootstrap::getObjectManager()->create('Magento\Core\Model\Store\Group'); + $this->_model = Bootstrap::getObjectManager()->create('Magento\Store\Model\Group'); } public function testSetGetWebsite() { $this->assertFalse($this->_model->getWebsite()); - $website = Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getWebsite(); + $website = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface')->getWebsite(); $this->_model->setWebsite($website); $actualResult = $this->_model->getWebsite(); $this->assertSame($website, $actualResult); @@ -55,7 +52,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase public function testGetWebsiteDefault() { $this->assertFalse($this->_model->getWebsite()); - $website = Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getWebsite(); + $website = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface')->getWebsite(); $this->_model->setWebsite($website); // Empty string should get treated like no parameter $actualResult = $this->_model->getWebsite(''); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/Store/CollectionTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/Resource/Store/CollectionTest.php index cad51a5602ba00e1b3aebf902e331928824c1de5..e1137adbd7e6006c2315cc8eef7208e28383ab79 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/Store/CollectionTest.php @@ -18,25 +18,22 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Store; +namespace Magento\Store\Model\Resource\Store; class CollectionTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Store\Collection + * @var \Magento\Store\Model\Resource\Store\Collection */ protected $_collection; protected function setUp() { $this->_collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Store\Collection' + 'Magento\Store\Model\Resource\Store\Collection' ); } @@ -60,10 +57,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Store\Collection::addGroupFilter - * @covers \Magento\Core\Model\Resource\Store\Collection::addIdFilter - * @covers \Magento\Core\Model\Resource\Store\Collection::addWebsiteFilter - * @covers \Magento\Core\Model\Resource\Store\Collection::addCategoryFilter + * @covers \Magento\Store\Model\Resource\Store\Collection::addGroupFilter + * @covers \Magento\Store\Model\Resource\Store\Collection::addIdFilter + * @covers \Magento\Store\Model\Resource\Store\Collection::addWebsiteFilter + * @covers \Magento\Store\Model\Resource\Store\Collection::addCategoryFilter */ public function testAddFilters() { @@ -146,7 +143,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase */ public function testGetAllIds() { - $this->assertContains(\Magento\Core\Model\Store::DISTRO_STORE_ID, $this->_collection->getAllIds()); + $this->assertContains(\Magento\Store\Model\Store::DISTRO_STORE_ID, $this->_collection->getAllIds()); } /** @@ -162,7 +159,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase */ public function testJoin() { - $this->_collection->join(array('w' => 'core_website'), 'main_table.website_id=w.website_id'); - $this->assertContains('core_website', (string)$this->_collection->getSelect()); + $this->_collection->join(array('w' => 'store_website'), 'main_table.website_id=w.website_id'); + $this->assertContains('store_website', (string)$this->_collection->getSelect()); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/StoreTest.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/StoreTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/Resource/StoreTest.php index 98b3101e09379ffcbb6b28efc91f1091d5c8b332..371f12e025e6d42454382eb2b7efc55d4346aaa0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/StoreTest.php @@ -21,15 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Store\Model\Resource; class StoreTest extends \PHPUnit_Framework_TestCase { public function testCountAll() { - /** @var $model \Magento\Core\Model\Resource\Store */ + /** @var $model \Magento\Store\Model\Resource\Store */ $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Store' + 'Magento\Store\Model\Resource\Store' ); $this->assertEquals(1, $model->countAll()); $this->assertEquals(1, $model->countAll(false)); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/WebsiteTest.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/WebsiteTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/Resource/WebsiteTest.php index ed658e14c4e1c63c1c779d7f2af8f41de87b1337..9f9e066dff4f3b8991144fa61281e9db2659bd65 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/WebsiteTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/Resource/WebsiteTest.php @@ -21,15 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Store\Model\Resource; class WebsiteTest extends \PHPUnit_Framework_TestCase { public function testCountAll() { - /** @var $model \Magento\Core\Model\Resource\Website */ + /** @var $model \Magento\Store\Model\Resource\Website */ $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Website' + 'Magento\Store\Model\Resource\Website' ); $this->assertEquals(1, $model->countAll()); $this->assertEquals(1, $model->countAll(false)); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php similarity index 85% rename from dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php index 66c121d3f4f411f1af6667641d745da606b3ece0..328d7b2f35971196e332068510a2a495c95cb66d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php @@ -18,13 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; class StoreTest extends \PHPUnit_Framework_TestCase { @@ -34,7 +31,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase protected $_modelParams; /** - * @var \Magento\Core\Model\Store|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -44,7 +41,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store + * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\Store */ protected function _getStoreModel() { @@ -52,23 +49,21 @@ class StoreTest extends \PHPUnit_Framework_TestCase $this->_modelParams = array( 'context' => $objectManager->get('Magento\Model\Context'), 'registry' => $objectManager->get('Magento\Registry'), + 'resource' => $objectManager->get('Magento\Store\Model\Resource\Store'), 'coreFileStorageDatabase' => $objectManager->get('Magento\Core\Helper\File\Storage\Database'), 'configCacheType' => $objectManager->get('Magento\App\Cache\Type\Config'), 'url' => $objectManager->get('Magento\Url'), 'request' => $objectManager->get('Magento\App\RequestInterface'), 'configDataResource' => $objectManager->get('Magento\Core\Model\Resource\Config\Data'), 'filesystem' => $objectManager->get('Magento\App\Filesystem'), - 'coreStoreConfig' => $objectManager->get('Magento\Core\Model\Store\Config'), - 'coreConfig' => $objectManager->get('Magento\App\ReinitableConfigInterface'), - 'resource' => $objectManager->get('Magento\Core\Model\Resource\Store'), - 'storeManager' => $objectManager->get('Magento\Core\Model\StoreManager'), + 'config' => $objectManager->get('Magento\App\Config\ReinitableConfigInterface'), + 'storeManager' => $objectManager->get('Magento\Store\Model\StoreManager'), 'sidResolver' => $objectManager->get('Magento\Session\SidResolverInterface'), 'cookie' => $objectManager->get('Magento\Stdlib\Cookie'), - 'httpContext' => $objectManager->get('Magento\App\Http\Context'), - 'config' => $objectManager->get('Magento\App\ConfigInterface') + 'httpContext' => $objectManager->get('Magento\App\Http\Context') ); - return $this->getMock('Magento\Core\Model\Store', array('getUrl'), $this->_modelParams); + return $this->getMock('Magento\Store\Model\Store', array('getUrl'), $this->_modelParams); } protected function tearDown() @@ -93,26 +88,11 @@ class StoreTest extends \PHPUnit_Framework_TestCase return array(array(1, 1), array('default', 1), array('nostore', null)); } - public function testSetGetConfig() - { - /* config operations require store to be loaded */ - $this->_model->load('default'); - $value = $this->_model->getConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, 'test'); - $this->assertEquals('test', $this->_model->getConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL)); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, $value); - - /* Call set before get */ - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES, 1); - $this->assertEquals(1, $this->_model->getConfig(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES)); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES, 0); - } - public function testSetGetWebsite() { $this->assertFalse($this->_model->getWebsite()); $website = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getWebsite(); $this->_model->setWebsite($website); $actualResult = $this->_model->getWebsite(); @@ -123,7 +103,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($this->_model->getGroup()); $storeGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->getGroup(); $this->_model->setGroup($storeGroup); $actualResult = $this->_model->getGroup(); @@ -144,8 +124,20 @@ class StoreTest extends \PHPUnit_Framework_TestCase { /* config operations require store to be loaded */ $this->_model->load('default'); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES, $useRewrites); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, $useStoreCode); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( + \Magento\Store\Model\Store::XML_PATH_USE_REWRITES, + $useRewrites, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( + \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, + $useStoreCode, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $actual = $this->_model->getBaseUrl($type); $this->assertEquals($expected, $actual); @@ -231,8 +223,20 @@ class StoreTest extends \PHPUnit_Framework_TestCase { /* config operations require store to be loaded */ $this->_model->load('default'); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_USE_REWRITES, false); - $this->_model->setConfig(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL, $useStoreCode); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( + \Magento\Store\Model\Store::XML_PATH_USE_REWRITES, + false, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( + \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, + $useStoreCode, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); // emulate custom entry point $_SERVER['SCRIPT_FILENAME'] = 'custom_entry.php'; @@ -270,7 +274,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase } /** - * @todo refactor \Magento\Core\Model\Store::getPriceFilter, it can return two different types + * @todo refactor \Magento\Store\Model\Store::getPriceFilter, it can return two different types */ public function testGetPriceFilter() { @@ -360,6 +364,8 @@ class StoreTest extends \PHPUnit_Framework_TestCase */ public function testIsUseStoreInUrl($isInstalled, $storeInUrl, $disableStoreInUrl, $expectedResult) { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $configMock = $this->getMock('Magento\App\Config\ReinitableConfigInterface'); $appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false, false); $appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue($isInstalled)); @@ -369,17 +375,17 @@ class StoreTest extends \PHPUnit_Framework_TestCase array('appState' => $appStateMock) ); - $model = $this->getMock('Magento\Core\Model\Store', array('getConfig'), $params); - - $model->expects( + $configMock->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( - $this->stringContains(\Magento\Core\Model\Store::XML_PATH_STORE_IN_URL) + $this->stringContains(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL) )->will( $this->returnValue($storeInUrl) ); + $params['config'] = $configMock; + $model = $objectManager->create('Magento\Store\Model\Store', $params); $model->setDisableStoreInUrl($disableStoreInUrl); $this->assertEquals($expectedResult, $model->isUseStoreInUrl()); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/WebsiteTest.php b/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/WebsiteTest.php rename to dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php index efb130d02b5452287a29b4c1a9de1cfe0489cfa3..acf60aa93d1b6641f0905c0a3c0662284bb3d343 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/WebsiteTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/WebsiteTest.php @@ -18,25 +18,22 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; class WebsiteTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Website + * @var \Magento\Store\Model\Website */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Website' + 'Magento\Store\Model\Website' ); $this->_model->load(1); } @@ -56,15 +53,15 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Website::setGroups - * @covers \Magento\Core\Model\Website::setStores - * @covers \Magento\Core\Model\Website::getStores + * @covers \Magento\Store\Model\Website::setGroups + * @covers \Magento\Store\Model\Website::setStores + * @covers \Magento\Store\Model\Website::getStores */ public function testSetGroupsAndStores() { /* Groups */ $expectedGroup = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store\Group' + 'Magento\Store\Model\Group' ); $expectedGroup->setId(123); $this->_model->setDefaultGroupId($expectedGroup->getId()); @@ -75,7 +72,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase /* Stores */ $expectedStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Store' + 'Magento\Store\Model\Store' ); $expectedStore->setId(456); $expectedGroup->setDefaultStoreId($expectedStore->getId()); @@ -89,7 +86,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase { $groups = $this->_model->getGroups(); $this->assertEquals(array(1), array_keys($groups)); - $this->assertInstanceOf('Magento\Core\Model\Store\Group', $groups[1]); + $this->assertInstanceOf('Magento\Store\Model\Group', $groups[1]); $this->assertEquals(1, $groups[1]->getId()); } @@ -106,7 +103,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase public function testGetDefaultGroup() { $defaultGroup = $this->_model->getDefaultGroup(); - $this->assertInstanceOf('Magento\Core\Model\Store\Group', $defaultGroup); + $this->assertInstanceOf('Magento\Store\Model\Group', $defaultGroup); $this->assertEquals(1, $defaultGroup->getId()); $this->_model->setDefaultGroupId(null); @@ -117,7 +114,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase { $stores = $this->_model->getStores(); $this->assertEquals(array(1), array_keys($stores)); - $this->assertInstanceOf('Magento\Core\Model\Store', $stores[1]); + $this->assertInstanceOf('Magento\Store\Model\Store', $stores[1]); $this->assertEquals(1, $stores[1]->getId()); } @@ -166,7 +163,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase public function testGetDefaultStore() { $defaultStore = $this->_model->getDefaultStore(); - $this->assertInstanceOf('Magento\Core\Model\Store', $defaultStore); + $this->assertInstanceOf('Magento\Store\Model\Store', $defaultStore); $this->assertEquals(1, $defaultStore->getId()); } diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php index fa9b2a2413ecddd6a7a3032a4630a4e763c82e62..cf3c30c6bc4c5a63e686c740300c404875974d71 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php @@ -23,7 +23,6 @@ */ namespace Magento\Tax\Model\TaxClass\Type; -use Magento\Customer\Service\V1\Data\CustomerGroup; use Magento\Customer\Service\V1\Data\CustomerGroupBuilder; class CustomerTest extends \PHPUnit_Framework_TestCase @@ -33,8 +32,6 @@ class CustomerTest extends \PHPUnit_Framework_TestCase */ protected $_objectManager; - const TAX_CLASS_ID = 4; - const GROUP_CODE = 'Test Group'; /** @@ -44,26 +41,32 @@ class CustomerTest extends \PHPUnit_Framework_TestCase { /** @var $objectManager \Magento\TestFramework\ObjectManager */ $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + + /* Create a tax class */ + $model = $this->_objectManager->create('Magento\Tax\Model\ClassModel'); + $model->setClassName("Test Group Tax Class") + ->setClassType(\Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER) + ->isObjectNew(true); + $model->save(); + $taxClassId = $model->getId(); + + $model->setId($taxClassId); /** @var $customerGroupService \Magento\Customer\Service\V1\CustomerGroupServiceInterface */ $customerGroupService = $this->_objectManager->create('\Magento\Customer\Service\V1\CustomerGroupService'); - $group = (new CustomerGroupBuilder())->setId( - null - )->setCode( - self::GROUP_CODE - )->setTaxClassId( - self::TAX_CLASS_ID - )->create(); + $group = (new CustomerGroupBuilder())->setId(null)->setCode(self::GROUP_CODE)->setTaxClassId($taxClassId) + ->create(); $customerGroupService->saveGroup($group); /** @var $model \Magento\Tax\Model\TaxClass\Type\Customer */ $model = $this->_objectManager->create('Magento\Tax\Model\TaxClass\Type\Customer'); - $model->setId(self::TAX_CLASS_ID); - /** @var $collection \Magento\Model\Resource\Db\Collection\AbstractCollection */ + $model->setId($taxClassId); + /** @var $collection \Magento\Core\Model\Resource\Db\Collection\AbstractCollection */ $collection = $model->getAssignedToObjects(); - $this->assertEquals(self::TAX_CLASS_ID, $collection->getFirstItem()->getData('tax_class_id')); + $this->assertEquals($taxClassId, $collection->getFirstItem()->getData('tax_class_id')); $this->assertEquals(self::GROUP_CODE, $collection->getFirstItem()->getData('customer_group_code')); $dataObjectArray = $model->getAssignedDataObjects(); - $this->assertEquals(self::TAX_CLASS_ID, $dataObjectArray[0]->getTaxClassId()); + $this->assertEquals($taxClassId, $dataObjectArray[0]->getTaxClassId()); $this->assertEquals(self::GROUP_CODE, $dataObjectArray[0]->getCode()); } } + diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php index cd29868f220420c751554c8cdca77b3e6ee8b46c..5d8418a6592d8872f45ac80834953501ff340ace 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Payment/MethodsTest.php @@ -46,16 +46,31 @@ class MethodsTest extends \PHPUnit_Framework_TestCase 'Magento\View\Element\BlockFactory' ); $storeId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId(); /** @var $model \Magento\Payment\Model\MethodInterface */ if (empty($methodClass)) { /** * Note that $code is not whatever the payment method getCode() returns */ - $this->fail("Model of '{$code}' payment method is not found."); // prevent fatal error + $this->fail("Model of '{$code}' payment method is not found."); } $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($methodClass); + if ($code == \Magento\Payment\Model\Method\Substitution::CODE) { + $paymentInfo = $this->getMockBuilder( + 'Magento\Payment\Model\Info' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $paymentInfo->expects( + $this->any() + )->method( + 'getAdditionalInformation' + )->will( + $this->returnValue('Additional data mock') + ); + $model->setInfoInstance($paymentInfo); + } $this->assertNotEmpty($model->getTitle()); foreach (array($model->getFormBlockType(), $model->getInfoBlockType()) as $blockClass) { $message = "Block class: {$blockClass}"; @@ -66,20 +81,20 @@ class MethodsTest extends \PHPUnit_Framework_TestCase if ($model->canUseInternal()) { try { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setId( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $block->setArea('adminhtml'); $this->assertFileExists($block->getTemplateFile(), $message); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setId( $storeId ); } catch (\Exception $e) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setId( $storeId ); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php index 6a86defe013cb4d83261aee65c4d5db20ea28844..e3de637967cf08de10ad5a188bf62ec16090609c 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php @@ -38,19 +38,17 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt { $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); $invoker( - /** - * @param string $module - * @param string $class - * @param string $area - */ function ($module, $class, $area) { $this->assertNotEmpty($module); $this->assertTrue(class_exists($class), "Block class: {$class}"); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Config\ScopeInterface') - ->setCurrentScope($area); - $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\Http\Context'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Config\ScopeInterface' + )->setCurrentScope( + $area + ); + $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Http\Context' + ); $context->setValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH, false, false); $context->setValue( \Magento\Customer\Helper\Data::CONTEXT_GROUP, @@ -73,9 +71,9 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt { $blockClass = ''; try { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setWebsiteId( 0 ); @@ -143,11 +141,14 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt ) { $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) - ->load(\Magento\Core\Model\App\Area::PART_CONFIG); - $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] - = array($module, $blockClass, $area); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE + )->load( + \Magento\Core\Model\App\Area::PART_CONFIG + ); + $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] = array($module, $blockClass, $area); return $templateBlocks; } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php index 7094313503b71b15d1be46c1469cb5270be3e475..f988569aaa52b04532245de055d700e7fcc1b492 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php @@ -35,12 +35,6 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit { $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); $invoker( - /** - * @param string $module - * @param string $template - * @param string $class - * @param string $area - */ function ($module, $template, $class, $area) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' @@ -72,9 +66,9 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit { $blockClass = ''; try { - /** @var $website \Magento\Core\Model\Website */ + /** @var $website \Magento\Store\Model\Website */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->setWebsiteId( 0 ); @@ -106,16 +100,26 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') - ->getArea($area) - ->load(\Magento\Core\Model\App\Area::PART_CONFIG); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Config\ScopeInterface') - ->setCurrentScope($area); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State') - ->setAreaCode($area); - $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\App\Http\Context'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\AreaList' + )->getArea( + $area + )->load( + \Magento\Core\Model\App\Area::PART_CONFIG + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Config\ScopeInterface' + )->setCurrentScope( + $area + ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\State' + )->setAreaCode( + $area + ); + $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\App\Http\Context' + ); $context->setValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH, false, false); $context->setValue( \Magento\Customer\Helper\Data::CONTEXT_GROUP, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php index 58f8d697d415ce52df182a5125e7d9c4ad69b6b6..9489462dacbfb4d6b72219db1f2ef7ced789d45f 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php @@ -337,33 +337,4 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity } return $result; } - - /** - * @param string $file - * @dataProvider staticLibsDataProvider - */ - public function testStaticLibs($file) - { - $this->markTestIncomplete('Should be fixed when static when we have static folder jslib implemented'); - $this->assertFileExists( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\App\Filesystem' - )->getPath( - 'jslib' - ) . '/' . $file - ); - } - - /** - * @return array - */ - public function staticLibsDataProvider() - { - return array( - array('media/editor.swf'), - array('media/flex.swf'), // looks like this one is not used anywhere - array('media/uploader.swf'), - array('media/uploaderSingle.swf') - ); - } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php index 5b41f8ff3c1b68008b6faa59ace9700718750728..3c75b7a97ebe0265204adec0743d1b842daaf272 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php @@ -73,7 +73,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase public function themeConfigFileExistsDataProvider() { $result = array(); - $files = glob($this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*', GLOB_ONLYDIR); + $files = glob($this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*/*', GLOB_ONLYDIR); foreach ($files as $themeDir) { $result[$themeDir] = array($themeDir); } @@ -112,7 +112,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase public function themeConfigFileDataProvider() { $result = array(); - $files = glob($this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*/theme.xml'); + $files = glob($this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*/*/theme.xml'); foreach ($files as $file) { $result[$file] = array($file); } @@ -129,6 +129,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase protected function _validateConfigFile($file, $schemaFile) { $domConfig = new \Magento\Config\Dom(file_get_contents($file)); + $errors = array(); $result = $domConfig->validate($schemaFile, $errors); $message = "Invalid XML-file: {$file}\n"; foreach ($errors as $error) { diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php index cbe1222280984006a2e6343dafa349302e653043..023f65f0660a5ff06e59852e3ad60f5855ab375b 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/FooterTest.php @@ -46,7 +46,7 @@ class FooterTest extends \PHPUnit_Framework_TestCase $context = $objectManager->get('Magento\App\Http\Context'); $context->setValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH, false, false); $block = $objectManager->get('Magento\View\LayoutInterface')->createBlock('Magento\Theme\Block\Html\Footer'); - $storeId = $objectManager->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId(); + $storeId = $objectManager->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId(); $this->assertEquals( array('PAGE_FOOTER', $storeId, 0, $this->_theme->getId(), null), $block->getCacheKeyInfo() diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/HeadTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/HeadTest.php index d9c0e012bb56551974fd6b52996d01073f59f744..d4982cecf2cc9d058fb026589fd8714cc379f4ed 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Block/Html/HeadTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Block/Html/HeadTest.php @@ -39,7 +39,7 @@ class HeadTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' )->setDesignTheme( - 'magento_blank' + 'Magento/blank' ); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\LayoutInterface' @@ -102,14 +102,14 @@ class HeadTest extends \PHPUnit_Framework_TestCase '<script type="text/javascript" src="http://localhost/pub/lib/varien/js.js"></script>' . "\n" . '<script type="text/javascript" ' . - 'src="http://localhost/pub/static/frontend/magento_blank/en_US/Magento_Bundle/bundle.js">' . + 'src="http://localhost/pub/static/frontend/Magento/blank/en_US/Magento_Bundle/bundle.js">' . '</script>' . "\n" . '<link rel="stylesheet" type="text/css" media="all"' . ' href="http://localhost/pub/lib/tiny_mce/themes/advanced/skins/default/ui.css" />' . "\n" . '<link rel="stylesheet" type="text/css" media="print" ' . - 'href="http://localhost/pub/static/frontend/magento_blank/en_US/css/styles.css" />' . + 'href="http://localhost/pub/static/frontend/Magento/blank/en_US/css/styles.css" />' . "\n" . '<link rel="next" href="http://localhost/index.php/category.html" />' . "\n" . @@ -201,7 +201,7 @@ class HeadTest extends \PHPUnit_Framework_TestCase ' href="http://localhost/index.php/core/index/notfound" />' . "\n" . '<link rel="stylesheet" type="text/css" media="print"' . - ' href="http://localhost/pub/static/frontend/magento_blank/en_US/css/styles.css" />' . + ' href="http://localhost/pub/static/frontend/Magento/blank/en_US/css/styles.css" />' . "\n", $this->_block->getCssJsHtml() ); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Block/HtmlTest.php b/dev/tests/integration/testsuite/Magento/Theme/Block/HtmlTest.php index c4e723fe2edcb8609c604775d1bbc9858d7b27a6..a45b1b81aa062a476d6d6fad360d37a147e6b892 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Block/HtmlTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Block/HtmlTest.php @@ -34,10 +34,10 @@ class HtmlTest extends \PHPUnit_Framework_TestCase */ public function testGetPrintLogoUrl($configData, $returnValue) { - $storeConfig = $this->getMockBuilder( - 'Magento\Core\Model\Store\Config' + $scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); - $storeConfig->expects($this->any())->method('getConfig')->will($this->returnValueMap($configData)); + $scopeConfig->expects($this->atLeastOnce())->method('getValue')->will($this->returnValueMap($configData)); $securityInfoMock = $this->getMock('Magento\Url\SecurityInfoInterface'); $codeData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); @@ -49,10 +49,12 @@ class HtmlTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\App\Request\Http', array(), array(), '', false), $securityInfoMock, $this->getMock('Magento\Url\ScopeResolverInterface', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Session', array(), array(), '', false), + $this->getMock('Magento\Session\Generic', array(), array(), '', false), $this->getMock('Magento\Session\SidResolverInterface', array(), array(), '', false), $this->getMock('Magento\Url\RouteParamsResolverFactory', array(), array(), '', false), $this->getMock('Magento\Url\QueryParamsResolver', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface', array(), array(), '', false), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, array() ) ); @@ -66,10 +68,10 @@ class HtmlTest extends \PHPUnit_Framework_TestCase $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\View\Element\Template\Context', - array('storeConfig' => $storeConfig, 'urlBuilder' => $urlBuilder) + array('scopeConfig' => $scopeConfig, 'urlBuilder' => $urlBuilder) ); $storeManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' ); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Theme\Block\Html', @@ -83,15 +85,34 @@ class HtmlTest extends \PHPUnit_Framework_TestCase { return array( 'sales_identity_logo_html' => array( - array(array('sales/identity/logo_html', null, 'image.gif')), + array( + array( + 'sales/identity/logo_html', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + 'image.gif' + ) + ), 'http://localhost/pub/media/sales/store/logo_html/image.gif' ), 'sales_identity_logo' => array( - array(array('sales/identity/logo', null, 'image.gif')), + array( + array('sales/identity/logo', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, 'image.gif') + ), 'http://localhost/pub/media/sales/store/logo/image.gif' ), - 'sales_identity_logoTif' => array(array(array('sales/identity/logo', null, 'image.tif')), ''), - 'sales_identity_logoTiff' => array(array(array('sales/identity/logo', null, 'image.tiff')), ''), + 'sales_identity_logoTif' => array( + array( + array('sales/identity/logo', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, 'image.tif') + ), + '' + ), + 'sales_identity_logoTiff' => array( + array( + array('sales/identity/logo', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null, 'image.tiff') + ), + '' + ), 'no_logo' => array(array(), '') ); } diff --git a/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php index e55ec160ace2c2cf4bd352cecdd97b3854937268..2a832187acb2270d332a6c98c4854b198b1402b0 100644 --- a/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Tools/View/GeneratorTest.php @@ -45,7 +45,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->tmpDir = BP . '/var/static'; - $this->shell = new \Magento\Shell(new \Magento\OSInfo()); + $this->shell = new \Magento\Shell(new \Magento\Shell\CommandRenderer()); $this->filesystem = new \Magento\Filesystem\Driver\File(); if (!$this->filesystem->isExists($this->tmpDir)) { $this->filesystem->createDirectory($this->tmpDir, 0777); diff --git a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php index 5b542f6c50714b673727501f3396779de48f8030..531db272ec14d780a179e27700c3adbcf2aceaa2 100644 --- a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php @@ -46,7 +46,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' )->setDesignTheme( - 'magento_blank' + 'Magento/blank' ); } @@ -60,19 +60,19 @@ class InlineTest extends \PHPUnit_Framework_TestCase ); /* Called getConfig as workaround for setConfig bug */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $this->_storeId )->getConfig( 'dev/translate_inline/active' ); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore( - $this->_storeId - )->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'dev/translate_inline/active', - true + true, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId ); } @@ -83,7 +83,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->assertTrue( $this->_model->isAllowed( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $this->_storeId ) @@ -95,7 +95,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->assertFalse( $this->_model->isAllowed( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $this->_storeId ) diff --git a/dev/tests/integration/testsuite/Magento/TranslateTest.php b/dev/tests/integration/testsuite/Magento/TranslateTest.php index 0ad27a46c0c86f7203ddd35d70e6edf2b7001ba0..654b174a27d77e0eb6e7d28a7a3c2003aff9359c 100644 --- a/dev/tests/integration/testsuite/Magento/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/TranslateTest.php @@ -81,10 +81,9 @@ class TranslateTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Model\View\Design', array('getDesignTheme'), array( - $objectManager->get('Magento\Core\Model\StoreManagerInterface'), + $objectManager->get('Magento\Store\Model\StoreManagerInterface'), $objectManager->get('Magento\View\Design\Theme\FlyweightFactory'), - $objectManager->get('Magento\App\ConfigInterface'), - $objectManager->get('Magento\Core\Model\Store\Config'), + $objectManager->get('Magento\App\Config\ScopeConfigInterface'), $objectManager->get('Magento\Core\Model\ThemeFactory'), $objectManager->get('Magento\Locale\ResolverInterface'), $objectManager->get('Magento\App\State'), diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php index 5211f3c32c7d3832339d5f9093dc338cc8a52477..0620b378050636c4175e9ce738202b61635fedd3 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php @@ -21,7 +21,6 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - namespace Magento\Translation\Model; class InlineParserTest extends \PHPUnit_Framework_TestCase @@ -39,34 +38,33 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' )->setDesignTheme( - 'magento_blank' + 'Magento/blank' ); } protected function setUp() { /** @var $inline \Magento\Translate\Inline */ - $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Translate\Inline'); + $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate\Inline'); $this->_inlineParser = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Translation\Model\Inline\Parser', + 'Magento\Translation\Model\Inline\Parser', array('translateInline' => $inline) ); /* Called getConfig as workaround for setConfig bug */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore( $this->_storeId )->getConfig( 'dev/translate_inline/active' ); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore( - $this->_storeId - )->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'dev/translate_inline/active', - true + true, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->_storeId ); } diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php index 46bdfd1aa778a71462c072f707d4488463b90728..89dc94777f06422ea8b1d72e517eebdd9efcd239 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlRewriteTest.php @@ -42,7 +42,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase { $this->_model->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getId() )->setRequestPath( 'fancy/url.html' @@ -60,7 +60,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase ); $read->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getId() )->loadByRequestPath( 'fancy/url.html' @@ -82,7 +82,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase { $this->_model->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getId() )->setRequestPath( 'product1.html' @@ -102,7 +102,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase ); $read->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getId() )->loadByIdPath( 'product/1' @@ -171,7 +171,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase { $request = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\RequestInterface'); $_GET['___from_store'] = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getCode(); $this->assertFalse($this->_model->rewrite($request)); } @@ -186,7 +186,7 @@ class UrlRewriteTest extends \PHPUnit_Framework_TestCase { $this->_model->setStoreId( \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getDefaultStoreView()->getId() )->setRequestPath( 'fancy/url.html' diff --git a/dev/tests/integration/testsuite/Magento/UrlTest.php b/dev/tests/integration/testsuite/Magento/UrlTest.php index ea0b91fd9b61ef019ae3bb5c5e676f40f4832396..3a0266b041c32417333b927563f9a6bd66d4039b 100644 --- a/dev/tests/integration/testsuite/Magento/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlTest.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -415,7 +413,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase public function testSessionUrlVar() { $sessionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\Session' + 'Magento\Session\Generic' )->getSessionId(); $sessionUrl = $this->_model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>'); $this->assertEquals('<a href="http://example.com/?SID=' . $sessionId . '">www.example.com</a>', $sessionUrl); diff --git a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php index 6abb3a0926d013024de70b6dea9a12709e1dc947..d726d1e54ac5164384844a3ad39bbb50ae1080e6 100644 --- a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php @@ -82,7 +82,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase $cssUrl = $this->_block->getViewFileUrl( 'css/wrong.css', - array('area' => 'frontend', 'theme' => 'magento_plushe', 'locale' => 'en_US') + array('area' => 'frontend', 'theme' => 'Magento/plushe', 'locale' => 'en_US') ); $this->assertStringMatchesFormat('%s/css/wrong.css', $cssUrl); } @@ -265,7 +265,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_block->getChildBlock($childAlias)); // With layout - /** @var $layout \Magento\Core\Model\Layout */ + /** @var $layout \Magento\View\Layout */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); $child = $layout->createBlock('Magento\View\Element\Text', $childName); $layout->addBlock($this->_block, $parentName); @@ -456,7 +456,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled * @covers \Magento\View\Element\AbstractBlock::getGroupChildNames - * @covers \Magento\Core\Model\Layout::addToParentGroup + * @covers \Magento\View\Layout::addToParentGroup */ public function testAddToParentGroup() { diff --git a/dev/tests/integration/testsuite/Magento/View/Element/TemplateTest.php b/dev/tests/integration/testsuite/Magento/View/Element/TemplateTest.php index 0713cd75fdcb18626eb544765efcc55a673053f0..331b7682e4d0a3e35cef1b348148732ddf4bc807 100644 --- a/dev/tests/integration/testsuite/Magento/View/Element/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Element/TemplateTest.php @@ -36,7 +36,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $params = array('layout' => $objectManager->create('Magento\Core\Model\Layout', array())); + $params = array('layout' => $objectManager->create('Magento\View\Layout', array())); $context = $objectManager->create('Magento\View\Element\Template\Context', $params); $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\LayoutInterface' diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php b/dev/tests/integration/testsuite/Magento/View/LayoutArgumentObjectUpdater.php similarity index 97% rename from dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php rename to dev/tests/integration/testsuite/Magento/View/LayoutArgumentObjectUpdater.php index d37ce5e33c046c03ae5e6b05b7f38fd34412a1d6..d5fbaa506fe9c105d0e370a5c283268526498516 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentObjectUpdater.php +++ b/dev/tests/integration/testsuite/Magento/View/LayoutArgumentObjectUpdater.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; /** * Dummy layout argument updater model diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentSimpleUpdater.php b/dev/tests/integration/testsuite/Magento/View/LayoutArgumentSimpleUpdater.php similarity index 97% rename from dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentSimpleUpdater.php rename to dev/tests/integration/testsuite/Magento/View/LayoutArgumentSimpleUpdater.php index 11e410b83da55a81a139f7c03d1454735067b301..634fc80332d5330a2a4a6247210ae038affdc007 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutArgumentSimpleUpdater.php +++ b/dev/tests/integration/testsuite/Magento/View/LayoutArgumentSimpleUpdater.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; /** * Dummy layout argument updater model diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutDirectivesTest.php b/dev/tests/integration/testsuite/Magento/View/LayoutDirectivesTest.php similarity index 99% rename from dev/tests/integration/testsuite/Magento/Core/Model/LayoutDirectivesTest.php rename to dev/tests/integration/testsuite/Magento/View/LayoutDirectivesTest.php index b177c9508a0208c33f146ace31d9860b423fded8..be13f6f370ffd1ae1ee4572f365cb4737249836e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutDirectivesTest.php +++ b/dev/tests/integration/testsuite/Magento/View/LayoutDirectivesTest.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; class LayoutDirectivesTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/integration/testsuite/Magento/View/LayoutTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php rename to dev/tests/integration/testsuite/Magento/View/LayoutTest.php index e92faeecdb10c75fa474fdcfffffe6756ae5913b..fc37bcb867c4254a4f3cb96f10b7aebaa7d9f01e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/View/LayoutTest.php @@ -28,49 +28,22 @@ /** * Layout integration tests * - * Note that some methods are not covered here, see the \Magento\Core\Model\LayoutDirectivesTest + * Note that some methods are not covered here, see the \Magento\View\LayoutDirectivesTest * * @see \Magento\Core\Model\LayoutDirectivesTest */ -namespace Magento\Core\Model; +namespace Magento\View; class LayoutTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Layout + * @var \Magento\View\Layout */ protected $_layout; protected function setUp() { - $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Layout'); - } - - /** - * @param array $inputArguments - * @param string $expectedArea - * @dataProvider constructorDataProvider - */ - public function testConstructor(array $inputArguments, $expectedArea) - { - if (isset($inputArguments['area'])) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\App\State' - )->setAreaCode( - $inputArguments['area'] - ); - } - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); - $this->assertEquals($expectedArea, $layout->getArea()); - } - - public function constructorDataProvider() - { - return array( - 'default area' => array(array(), null), - 'frontend area' => array(array('area' => 'frontend'), 'frontend'), - 'backend area' => array(array('area' => 'adminhtml'), 'adminhtml') - ); + $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\Layout'); } public function testConstructorStructure() @@ -79,7 +52,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $structure->createElement('test.container', array()); /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('structure' => $structure) ); $this->assertTrue($layout->hasElement('test.container')); @@ -104,10 +77,10 @@ class LayoutTest extends \PHPUnit_Framework_TestCase public function testGenerateXml() { - $layoutUtility = new \Magento\Core\Utility\Layout($this); + $layoutUtility = new Utility\Layout($this); /** @var $layout \Magento\View\LayoutInterface */ $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getUpdate'), $layoutUtility->getLayoutDependencies() ); @@ -133,7 +106,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase /** * A smoke test for generating elements * - * See sophisticated tests at \Magento\Core\Model\LayoutDirectivesTest + * See sophisticated tests at \Magento\View\LayoutDirectivesTest * @see \Magento\Core\Model\LayoutDirectivesTest * @magentoAppIsolation enabled */ @@ -332,7 +305,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\Core\Model\Layout + * @return \Magento\View\Layout */ public function testSetChild() { @@ -449,7 +422,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($this->_layout->getBlock('test')); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->createBlock( 'Magento\View\Element\Text' ); @@ -477,9 +450,9 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout::addOutputElement - * @covers \Magento\Core\Model\Layout::getOutput - * @covers \Magento\Core\Model\Layout::removeOutputElement + * @covers \Magento\View\Layout::addOutputElement + * @covers \Magento\View\Layout::getOutput + * @covers \Magento\View\Layout::removeOutputElement */ public function testGetOutput() { diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php index ff17317d32de07a04e19785451aedbfd1fa4381a..8fd28e5497ac4ff3f1bc0272f42e40edb72aaed2 100644 --- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php @@ -391,13 +391,13 @@ class PublicationTest extends \PHPUnit_Framework_TestCase 'product/product.css', array( 'area' => 'adminhtml', - 'theme' => 'magento_backend', + 'theme' => 'Magento/backend', 'locale' => 'en_US', 'module' => 'Magento_ModuleA' ), - 'adminhtml/magento_backend/en_US/Magento_ModuleA/product/product.css', + 'adminhtml/Magento/backend/en_US/Magento_ModuleA/product/product.css', array('url(../../Magento_ModuleB/images/gallery-image-base-label.png)'), - array('adminhtml/magento_backend/en_US/Magento_ModuleB/images/gallery-image-base-label.png') + array('adminhtml/Magento/backend/en_US/Magento_ModuleB/images/gallery-image-base-label.png') ), 'adminhtml' => array( 'Magento_ModuleC::styles.css', diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/View/Utility/Layout.php similarity index 85% rename from dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php rename to dev/tests/integration/testsuite/Magento/View/Utility/Layout.php index 2cb81f593ed9f58bd5c601cf337ad767592b35db..6c9eff254363418055d8a324f62c59c0807e8629 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/View/Utility/Layout.php @@ -28,7 +28,7 @@ /** * Core layout utility */ -namespace Magento\Core\Utility; +namespace Magento\View\Utility; class Layout { @@ -46,7 +46,7 @@ class Layout * Retrieve new layout update model instance with XML data from a fixture file * * @param string|array $layoutUpdatesFile - * @return \Magento\Core\Model\Layout\Merge + * @return \Magento\View\Layout\ProcessorInterface */ public function getLayoutUpdateFromFixture($layoutUpdatesFile) { @@ -55,7 +55,7 @@ class Layout $fileFactory = $objectManager->get('Magento\View\Layout\File\Factory'); $files = array(); foreach ((array)$layoutUpdatesFile as $filename) { - $files[] = $fileFactory->create($filename, 'Magento_Core'); + $files[] = $fileFactory->create($filename, 'Magento_View'); } $fileSource = $this->_testCase->getMockForAbstractClass('Magento\View\Layout\File\SourceInterface'); $fileSource->expects( @@ -77,11 +77,11 @@ class Layout * * @param string|array $layoutUpdatesFile * @param array $args - * @return \Magento\Core\Model\Layout|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\View\Layout|\PHPUnit_Framework_MockObject_MockObject */ public function getLayoutFromFixture($layoutUpdatesFile, array $args = array()) { - $layout = $this->_testCase->getMock('Magento\Core\Model\Layout', array('getUpdate'), $args); + $layout = $this->_testCase->getMock('Magento\View\Layout', array('getUpdate'), $args); $layoutUpdate = $this->getLayoutUpdateFromFixture($layoutUpdatesFile); $layoutUpdate->asSimplexml(); $layout->expects( @@ -104,20 +104,19 @@ class Layout $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); return array( 'processorFactory' => $objectManager->get('Magento\View\Layout\ProcessorFactory'), - 'themeFactory' => $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), 'logger' => $objectManager->get('Magento\Logger'), 'eventManager' => $objectManager->get('Magento\Event\ManagerInterface'), - 'coreData' => $objectManager->get('Magento\Core\Helper\Data'), - 'design' => $objectManager->get('Magento\View\DesignInterface'), 'blockFactory' => $objectManager->create('Magento\View\Element\BlockFactory', array()), 'structure' => $objectManager->create('Magento\Data\Structure', array()), 'argumentParser' => $objectManager->get('Magento\View\Layout\Argument\Parser'), 'argumentInterpreter' => $objectManager->get('layoutArgumentInterpreter'), - 'scheduledStructure' => $objectManager->create('Magento\Core\Model\Layout\ScheduledStructure', array()), - 'coreStoreConfig' => $objectManager->create('Magento\Core\Model\Store\Config'), + 'scheduledStructure' => $objectManager->create('Magento\View\Layout\ScheduledStructure', array()), + 'scopeConfig' => $objectManager->create('Magento\App\Config\ScopeConfigInterface'), 'appState' => $objectManager->get('Magento\App\State'), 'messageManager' => $objectManager->get('Magento\Message\ManagerInterface'), - 'objectManager' => $objectManager + 'themeResolver' => $objectManager->get('Magento\View\Design\Theme\ResolverInterface'), + 'scopeResolver' => $objectManager->get('Magento\App\ScopeResolverInterface'), + 'scopeType' => \Magento\Store\Model\ScopeInterface::SCOPE_STORE, ); } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php b/dev/tests/integration/testsuite/Magento/View/Utility/LayoutTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php rename to dev/tests/integration/testsuite/Magento/View/Utility/LayoutTest.php index 009f336ca58217783f195a767854ca69090bc376..dfdc3e5c2eff1600aface02ab75fbfbe9f05b173 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Utility/LayoutTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Utility; +namespace Magento\View\Utility; class LayoutTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Utility\Layout + * @var \Magento\View\Utility\Layout */ protected $_utility; @@ -39,15 +39,14 @@ class LayoutTest extends \PHPUnit_Framework_TestCase ) ) ); - $this->_utility = new \Magento\Core\Utility\Layout($this); + $this->_utility = new \Magento\View\Utility\Layout($this); } /** * Assert that the actual layout update instance represents the expected layout update file * - * @param \Magento\Core\Model\Layout\Merge $actualUpdate * @param string $expectedUpdateFile - * @param \Magento\Core\Model\Layout\Merge $actualUpdate + * @param \Magento\View\Layout\ProcessorInterface $actualUpdate */ protected function _assertLayoutUpdate($expectedUpdateFile, $actualUpdate) { @@ -59,9 +58,10 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @dataProvider getLayoutFromFixtureDataProvider * @param string|array $inputFiles * @param string $expectedFile + * + * @dataProvider getLayoutFromFixtureDataProvider */ public function testGetLayoutUpdateFromFixture($inputFiles, $expectedFile) { @@ -70,9 +70,10 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @dataProvider getLayoutFromFixtureDataProvider * @param string|array $inputFiles * @param string $expectedFile + * + * @dataProvider getLayoutFromFixtureDataProvider */ public function testGetLayoutFromFixture($inputFiles, $expectedFile) { diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_one.xml b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_one.xml similarity index 87% rename from dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_one.xml rename to dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_one.xml index 365a7a54304e9bfb4a66db2c95ea248ada298bbd..2a9d8e8f90f156d89348d4b67afc2d5881b9ea51 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_one.xml +++ b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_one.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="some_text_block"> <action method="setText"> <text>Some Default Text</text> diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_three.xml b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_three.xml similarity index 84% rename from dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_three.xml rename to dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_three.xml index e21390524b926d4df86ac7c045137324d3ddb567..53d018c3c2d0ad516f0c045feb1a66c44947a47d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_three.xml +++ b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_three.xml @@ -23,6 +23,6 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout label="Handle Three"> +<layout label="Handle Three" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <update handle="handle_one"/> </layout> diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_two.xml b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_two.xml similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_two.xml rename to dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_two.xml index 2b99aa714f375eaf9c5ffaa7a8f232f6e3933170..fa4414e9b76f655e53022e88c6c67b05e5b9b5dd 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout/handle_two.xml +++ b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout/handle_two.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout label="Handle Two"> +<layout label="Handle Two" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <update handle="handle_one"/> <referenceBlock name="some_text_block"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout_merged/multiple_handles.xml b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout_merged/multiple_handles.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout_merged/multiple_handles.xml rename to dev/tests/integration/testsuite/Magento/View/Utility/_files/layout_merged/multiple_handles.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout_merged/single_handle.xml b/dev/tests/integration/testsuite/Magento/View/Utility/_files/layout_merged/single_handle.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Utility/_files/layout_merged/single_handle.xml rename to dev/tests/integration/testsuite/Magento/View/Utility/_files/layout_merged/single_handle.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/cacheable.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout/cacheable.xml similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/cacheable.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout/cacheable.xml index 0680fc8f3dcafa57f433a279444fe146c18b82ad..3dcab7b9358f1b78ffaf19fb8db51db4e76f96ae 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/cacheable.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout/cacheable.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="cachable_container1-1" label="test1" htmlTag="div" htmlId="cachable_container11" htmlClass="class11"> <block class="Magento\View\Element\Text" name="block-1-in-cacheable-container1"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/container_attributes.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout/container_attributes.xml similarity index 93% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/container_attributes.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout/container_attributes.xml index dce1d4fff8373c01753650ce82c95f671f1ac436..c986d0dc4c866d1590cbf68f0f73a9aa4380970f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/container_attributes.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout/container_attributes.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="container1" label="test1" htmlTag="div" htmlId="container1-1" htmlClass="class11"> <block class="Magento\View\Element\Text" name="block11"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/non_cacheable.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout/non_cacheable.xml similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/non_cacheable.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout/non_cacheable.xml index 0bac7ca5161d6a353abc7945d28ab87b87c4c202..439a49d720137e37b3d57694cec016e8fe9df06e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout/non_cacheable.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout/non_cacheable.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="non_cachable_container1-1" label="test1" htmlTag="div" htmlId="non_cachable_container11" htmlClass="class11"> <block class="Magento\View\Element\Text" name="block-1-in-non-cacheable-container1" cacheable="false"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/action_for_anonymous_parent_block.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/action_for_anonymous_parent_block.xml similarity index 90% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/action_for_anonymous_parent_block.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/action_for_anonymous_parent_block.xml index 21b182a5616a9fc345512f02e7a88bc4b0e6ca3d..b1e967b7317a62b362aa6bdb411bcd1ff2af3468 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/action_for_anonymous_parent_block.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/action_for_anonymous_parent_block.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block name="test.block.insert" class="Magento\View\Element\Text"/> <block class="Magento\View\Element\Template"> <action method="insert"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments.xml similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments.xml index 50861bb779cb1d0313e6f3306e1c5f2e129559d8..64a8e70b7b2c22b55676ac8719122423d3515c28 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block_with_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="string">1</argument> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_complex_values.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_complex_values.xml similarity index 94% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_complex_values.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_complex_values.xml index c4abfa3cd7cf8e86424807d066917fc1531eb61e..524b391345e2a74aaed366bea51abd387910199b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_complex_values.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_complex_values.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block_with_args_complex_values"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="array"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type.xml index 3aad1f1ae7df7f24b2fb418c605f2e5e743452f4..37fdd438771297f11b7cd61b09b6c9bf92bd40d4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block_with_object_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object">Magento\Data\Collection\Db</argument> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type_updaters.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type_updaters.xml similarity index 79% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type_updaters.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type_updaters.xml index 2a32dbdb5c74e48c3f0435617d08a071a39f1345..ed751b05a8873f1e842a7ad0ffa76b49df4facad 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_object_type_updaters.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_object_type_updaters.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block_with_object_updater_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object">Magento\Core\Model\DataSource</argument> @@ -33,21 +33,21 @@ <referenceBlock name="block_with_object_updater_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object"> - <updater>Magento\Core\Model\LayoutArgumentObjectUpdater</updater> - <updater>Magento\Core\Model\LayoutArgumentObjectUpdater</updater> + <updater>Magento\View\LayoutArgumentObjectUpdater</updater> + <updater>Magento\View\LayoutArgumentObjectUpdater</updater> </argument> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="two" xsi:type="number"> - <updater>Magento\Core\Model\LayoutArgumentSimpleUpdater</updater> + <updater>Magento\View\LayoutArgumentSimpleUpdater</updater> </argument> </arguments> </referenceBlock> <referenceBlock name="block_with_object_updater_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object"> - <updater>Magento\Core\Model\LayoutArgumentObjectUpdater</updater> + <updater>Magento\View\LayoutArgumentObjectUpdater</updater> </argument> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="two" xsi:type="number"> - <updater>Magento\Core\Model\LayoutArgumentSimpleUpdater</updater> + <updater>Magento\View\LayoutArgumentSimpleUpdater</updater> </argument> </arguments> </referenceBlock> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_url_type.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_url_type.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_url_type.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_url_type.xml index cf58cd50b80e89631d3fd044b6a3d0271eef3cd6..a387800bb7236110f8fac82f2e519c46cfd932e1 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/arguments_url_type.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/arguments_url_type.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block_with_url_args"> <arguments> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="url" path="customer/account/login"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block.xml similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block.xml index 09c863667629cea65546dc151f078b1ab0e2e157..036bced37612f33888f7e65bf49a4f52832e3f6b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block name="block1" class="Magento\View\Element\Text"> <action method="getChildBlock"> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="value" xsi:type="string">block2</argument> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block_exception.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block_exception.xml similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block_exception.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block_exception.xml index f1d20b00c0117662916415d26b2337bc3cdb36d3..8c1d2428b3d92fbeccc067b5184154cc4a88769a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/get_block_exception.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/get_block_exception.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block name="block1" class="Magento\View\Element\Text"> <container name="container" label="Container"/> <action method="getChildBlock"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/group.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/group.xml similarity index 94% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/group.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/group.xml index 6cf9f42668a4ca909ce76189901d3a49c5a8c56a..7667e2b2548ac33f4931f54a37c27b5a9c8033f3 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/group.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/group.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block1"> <block class="Magento\View\Element\Text" name="block2" group="group1"> <arguments> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/ifconfig.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/ifconfig.xml similarity index 93% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/ifconfig.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/ifconfig.xml index 5505f2801039359a67d740621d73b7d3944d414e..9015b2b2984c6b91140b3d5d564a97624747565b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/ifconfig.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/ifconfig.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block class="Magento\View\Element\Text" name="block1" ifconfig="not_exists"> <block class="Magento\View\Element\Text" name="block2"/> </block> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_alias_broken.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_alias_broken.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_alias_broken.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_alias_broken.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_broken.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_broken.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_broken.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_broken.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_new_alias.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_new_alias.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_new_alias.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_new_alias.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_the_same_alias.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_the_same_alias.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/move_the_same_alias.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/move_the_same_alias.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/remove.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/remove.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/remove.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/remove.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/remove_broken.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/remove_broken.xml similarity index 90% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/remove_broken.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/remove_broken.xml index 858d9d43d7507664e7fdf626f8f40c20fbca4c6e..89b796a183f6bce2dd2fd134ca236c2b13a3c092 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/remove_broken.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/remove_broken.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <block name="test.broken.block" type="Magento\View\Element\Text"/> <remove name="test.broken.block"/> <block class="Magento\View\Element\Template" name="bug.without.name.action.is.ignored"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/render.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/render.xml similarity index 93% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/render.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/render.xml index 641b7ce8f7ac6a4c963724f1a281e7890eb7ba72..7d92dd36b73ad6400fcae2b94199c1d24227b7bf 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/render.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/render.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <!-- Despite reference element is not declared yet, it will "save this action for later" --> <referenceBlock name="block1"> <action method="addText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_after.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_after.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_after.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_after.xml index 7d7f2b01806cf41a77e7c639db959c812a3b1337..06b48f96eee09a79672ae1e074f6215ffec40334 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_after.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_after.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="root" label="Root"> <block class="Magento\View\Element\Text" name="element1" after="element3"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_previous.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_previous.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_previous.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_previous.xml index 089ba2eff8400c3384278df74f1d9a711cd5ba0d..7c3d6aa4ec3626f88d51ae161a5621975a862a2d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_after_previous.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_after_previous.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="root" label="Root"> <block class="Magento\View\Element\Text" name="element1" after="element2"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_after.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_after.xml similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_after.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_after.xml index 8ff7b56abfdf8e6eaa4922e2a94e5e89a9eebb42..fb5d19b6da33f9b015c52efe59976fa58938f48c 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_after.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_after.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="root" label="Root"> <block class="Magento\View\Element\Text" name="element1" before="element2"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_before.xml b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_before.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_before.xml rename to dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_before.xml index 62f24e4e86ea0b13084163d98d0e1e2173b849c7..2f764691cd08994bed26c859fcc208d51c6de6df 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/layout_directives_test/sort_before_before.xml +++ b/dev/tests/integration/testsuite/Magento/View/_files/layout_directives_test/sort_before_before.xml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<layout> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/layout_single.xsd"> <container name="root" label="Root"> <block class="Magento\View\Element\Text" name="element1" before="element3"> <action method="setText"> diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php index 6a01e64f164a79dd89a0f6448b8e9a1554a42597..e7c663c01026f0e77c36e834c29068206da66616 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php @@ -43,10 +43,10 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\DomDocument\Factory */ protected $_domDocumentFactory; - /** @var \Magento\Core\Model\Store */ + /** @var \Magento\Store\Model\Store */ protected $_storeMock; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManagerMock; /** @var \Magento\Webapi\Model\Soap\Server\Factory */ @@ -55,12 +55,17 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor */ protected $_typeProcessor; + /** @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ + protected $_configMock; + protected function setUp() { $this->_storeManagerMock = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' + )->disableOriginalConstructor()->getMock(); + $this->_storeMock = $this->getMockBuilder( + 'Magento\Store\Model\Store' )->disableOriginalConstructor()->getMock(); - $this->_storeMock = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); $this->_areaListMock = $this->getMock('Magento\App\AreaList', array(), array(), '', false); $this->_configScopeMock = $this->getMock('Magento\Config\ScopeInterface'); @@ -87,6 +92,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase '', false ); + $this->_configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); parent::setUp(); } @@ -98,7 +104,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase public function testConstructEnableWsdlCache() { /** Mock getConfig method to return true. */ - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(true)); + $this->_configMock->expects($this->once())->method('isSetFlag')->will($this->returnValue(true)); /** Create SOAP server object. */ $server = new \Magento\Webapi\Model\Soap\Server( $this->_areaListMock, @@ -107,7 +113,8 @@ class ServerTest extends \PHPUnit_Framework_TestCase $this->_domDocumentFactory, $this->_storeManagerMock, $this->_soapServerFactory, - $this->_typeProcessor + $this->_typeProcessor, + $this->_configMock ); /** Assert that SOAP WSDL caching option was enabled after SOAP server initialization. */ $this->assertTrue((bool)ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not enabled.'); @@ -120,7 +127,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase public function testConstructDisableWsdlCache() { /** Mock getConfig method to return false. */ - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(false)); + $this->_configMock->expects($this->once())->method('isSetFlag')->will($this->returnValue(false)); /** Create SOAP server object. */ $server = new \Magento\Webapi\Model\Soap\Server( $this->_areaListMock, @@ -129,7 +136,8 @@ class ServerTest extends \PHPUnit_Framework_TestCase $this->_domDocumentFactory, $this->_storeManagerMock, $this->_soapServerFactory, - $this->_typeProcessor + $this->_typeProcessor, + $this->_configMock ); /** Assert that SOAP WSDL caching option was disabled after SOAP server initialization. */ $this->assertFalse((bool)ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not disabled.'); diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php index 648d7c5128755f4eba288d655d610b2d0ae16ebd..f91303bf64b59f151c681a9b75476498d555f4ac 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Model/ObserverTest.php @@ -60,10 +60,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase foreach (array(\Magento\Weee\Model\Tax::DISPLAY_INCL, \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR) as $mode) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'tax/weee/display', - $mode + $mode, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $eventObserver = $this->_createEventObserverForUpdateConfigurableProductOptions(); $this->_model->updateProductOptions($eventObserver); @@ -78,10 +79,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL ) as $mode) { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' - )->getStore()->setConfig( + 'Magento\App\Config\MutableScopeConfigInterface' + )->setValue( 'tax/weee/display', - $mode + $mode, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); $eventObserver = $this->_createEventObserverForUpdateConfigurableProductOptions(); $this->_model->updateProductOptions($eventObserver); diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3438034a2a4acce7ad24c3960705834a188d93ad --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php @@ -0,0 +1,98 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Weee\Model; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Customer\Service\V1\Data\CustomerBuilder; +use Magento\Customer\Service\V1\Data\Customer; + +/** + * @magentoDataFixture Magento/Customer/_files/customer_sample.php + * @magentoDataFixture Magento/Catalog/_files/products.php + */ +class TaxTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Weee\Model\Tax + */ + protected $_model; + + protected function setUp() + { + $helper = $this->getMock('Magento\Weee\Helper\Data', [], [], '', false); + $helper->expects($this->any())->method('isEnabled')->will($this->returnValue(true)); + $attribute = $this->getMock('Magento\Eav\Model\Entity\Attribute', [], [], '', false); + $attribute->expects($this->any())->method('getAttributeCodesByFrontendType')->will( + $this->returnValue(['price']) + ); + $attributeFactory = $this->getMock('Magento\Eav\Model\Entity\AttributeFactory', [], [], '', false); + $attributeFactory->expects($this->any())->method('create')->will($this->returnValue($attribute)); + $this->_model = Bootstrap::getObjectManager()->create( + 'Magento\Weee\Model\Tax', ['weeeData' => $helper, 'attributeFactory' => $attributeFactory] + ); + } + + public function testGetProductWeeeAttributes() + { + $customerAccountService = Bootstrap::getObjectManager()->create( + 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' + ); + $customerMetadataService = Bootstrap::getObjectManager()->create( + 'Magento\Customer\Service\V1\CustomerMetadataService' + ); + $customerBuilder = new CustomerBuilder($customerMetadataService); + $expected = \Magento\Service\DataObjectConverter::toFlatArray($customerAccountService->getCustomer(1)); + $customerBuilder->populateWithArray($expected); + $customerDataSet = $customerBuilder->create(); + $fixtureGroupCode = 'custom_group'; + $fixtureTaxClassId = 3; + /** @var \Magento\Customer\Model\Group $group */ + $group = Bootstrap::getObjectManager()->create('Magento\Customer\Model\Group'); + $fixtureGroupId = $group->load($fixtureGroupCode, 'customer_group_code')->getId(); + /** @var \Magento\Sales\Model\Quote $quote */ + $quote = Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote'); + $quote->setCustomerGroupId($fixtureGroupId); + $quote->setCustomerTaxClassId($fixtureTaxClassId); + $quote->setCustomerData($customerDataSet); + $shipping = new \Magento\Object([ + 'quote' => $quote + ]); + $product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); + $product->load(1); + $weeeTax = Bootstrap::getObjectManager()->create('Magento\Weee\Model\Tax'); + $weeeTaxData = array( + 'website_id' => '1', + 'entity_id' => '1', + 'country' => 'US', + 'value' => '12.4', + 'state' => '0', + 'attribute_id' => '75', + 'entity_type_id' => '0' + ); + $weeeTax->setData($weeeTaxData); + $weeeTax->save(); + $amount = $this->_model->getProductWeeeAttributes($product, $shipping); + $this->assertEquals('12.4000', $amount[0]->getAmount()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php index 2962d282393439589089cab0b18f0a0126f3fd98..56c62d3af436655deeb5c8c7f4ceaf1a286302cc 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php @@ -42,7 +42,7 @@ class DesignAbstractionTest extends \PHPUnit_Framework_TestCase parent::setUp(); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $layoutUtility = new \Magento\Core\Utility\Layout($this); + $layoutUtility = new \Magento\View\Utility\Layout($this); $appState = $objectManager->get('Magento\App\State'); $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $processorMock = $this->getMock( diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php index 2fa7d21a8b9cfe20c720cc52df27198616a8de47..fd6251dcadcb2d4df093def6e3d4235ee815c312 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/MainTest.php @@ -36,6 +36,7 @@ class MainTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Registry')->register('current_widget_instance', new \Magento\Object()); + /** @var \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main $block */ $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\LayoutInterface' )->createBlock( @@ -51,7 +52,7 @@ class MainTest extends \PHPUnit_Framework_TestCase public function testTypeElement() { $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->createBlock( 'Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main' ); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php index b562b2bd2dade95a8575835ba313c9d164c63987..1f76c616caca93fb38fa58edaf20744cca1ce24f 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/ConfigTest.php @@ -53,7 +53,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\View\DesignInterface' )->setDesignTheme( - 'magento_backend' + 'Magento/backend' ); $config = new \Magento\Object(); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php index b8b7a2f13f17cfcdd3736d8c326742f4c6f3e583..9ea4400b6e128d64ff5db14fb67bb7d7747565f5 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Widget/InstanceTest.php @@ -65,7 +65,7 @@ class InstanceTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete( 'Functionality is failed because widget' . - ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' . + ' "app/design/frontend/Magento/iphone_html5/etc/widget.xml" replaces' . ' "new_products" widget in Catalog module' ); $config = $this->_model->setType('Magento\Catalog\Block\Product\Widget\NewWidget')->getWidgetConfigAsArray(); @@ -100,7 +100,7 @@ class InstanceTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete( 'Functionality is failed because widget' . - ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' . + ' "app/design/frontend/Magento/iphone_html5/etc/widget.xml" replaces' . ' "new_products" widget in Catalog module' ); $this->_model->setType('Magento\Catalog\Block\Product\Widget\NewWidget'); @@ -136,7 +136,7 @@ class InstanceTest extends \PHPUnit_Framework_TestCase $params = array('display_mode' => 'fixed', 'types' => array('type_1', 'type_2')); $model->setData('widget_parameters', $params); $this->assertEquals('', $model->generateLayoutUpdateXml('content')); - $model->setId('test_id')->setPackageTheme('magento_plushe'); + $model->setId('test_id')->setPackageTheme('Magento/plushe'); $result = $model->generateLayoutUpdateXml('content'); $this->assertContains('<referenceContainer name="content">', $result); $this->assertContains('<block class="' . $model->getType() . '"', $result); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index 03e3128ec5e54b7da101f3f219839711a73b8e98..4947fe7cbacdb04d3fe5ba1dedd6c6c4d1624114 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -65,14 +65,14 @@ class WidgetTest extends \PHPUnit_Framework_TestCase { $this->markTestIncomplete( 'Functionality is failed because widget' . - ' "app/design/frontend/magento_iphone_html5/etc/widget.xml" replaces' . + ' "app/design/frontend/Magento/iphone_html5/etc/widget.xml" replaces' . ' "new_products" widget in Catalog module' ); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); - $expectedFilePath = "/adminhtml/magento_backend/en_US/{$expectedFile}"; + $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('Magento/backend'); + $expectedFilePath = "/adminhtml/Magento/backend/en_US/{$expectedFile}"; $expectedPubFile = $objectManager->get( 'Magento\App\Filesystem' )->getPath( @@ -125,7 +125,7 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $expectedFile = dirname( __DIR__ - ) . '/_files/design/adminhtml/magento_backend/Magento_Catalog/images/product_widget_new.gif'; + ) . '/_files/design/adminhtml/Magento/backend/Magento_Catalog/images/product_widget_new.gif'; $this->assertFileEquals($expectedFile, $actualFile); } } diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php new file mode 100644 index 0000000000000000000000000000000000000000..55e7089b9ef456149e078738597554083beda92c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Share/WishlistTest.php @@ -0,0 +1,62 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Wishlist\Block\Share; + +class WishlistTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Wishlist\Block\Share\Wishlist + */ + protected $_block; + + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + public function setUp() + { + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_customerSession = $this->_objectManager->get('Magento\Customer\Model\Session'); + $this->_block = $this->_objectManager->create('Magento\Wishlist\Block\Share\Wishlist'); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist.php + */ + public function testGetWishlistCustomer() + { + $this->_customerSession->loginById(1); + $this->assertEquals($this->_customerSession->getCustomerDataObject(), $this->_block->getWishlistCustomer()); + + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php index f433406b6a038dace197090bcc65c5e91f72f8d7..cf2e1347f16b7e904a4b9131dd1d29719cc2814a 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php @@ -38,6 +38,11 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController */ protected $_messages; + /** + * @var \Magento\Customer\Helper\View + */ + protected $_customerViewHelper; + protected function setUp() { parent::setUp(); @@ -52,6 +57,8 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController $customer = $service->authenticate('customer@example.com', 'password'); $this->_customerSession->setCustomerDataAsLoggedIn($customer); + $this->_customerViewHelper = $this->_objectManager->create('Magento\Customer\Helper\View'); + $this->_messages = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Message\ManagerInterface' ); @@ -124,4 +131,93 @@ class IndexTest extends \Magento\TestFramework\TestCase\AbstractController \Magento\Message\MessageInterface::TYPE_ERROR ); } + + /** + * @magentoDataFixture Magento/Wishlist/_files/wishlist.php + */ + public function testSendAction() + { + $this->_objectManager->configure( + [ + 'Magento\Wishlist\Controller\Index' => [ + 'arguments' => [ + 'transportBuilder' => [ + 'instance' => 'Magento\Wishlist\Controller\MockedTransportBuilder' + ] + ] + ], + 'preferences' => [ + 'Magento\Mail\TransportInterface' => 'Magento\Wishlist\Controller\MockedMailTransport' + ] + ] + ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + + $request = [ + 'form_key' => $this->_objectManager->get('Magento\Data\Form\FormKey')->getFormKey(), + 'emails' => 'test@tosend.com', + 'message' => 'message', + 'rss_url' => null // no rss + ]; + + $this->getRequest()->setPost($request); + + $this->_objectManager->get('Magento\Registry')->register( + 'wishlist', + $this->_objectManager->get('Magento\Wishlist\Model\Wishlist')->loadByCustomerId(1) + ); + $this->dispatch('wishlist/index/send'); + + /** @var \Magento\Wishlist\Controller\MockedTransportBuilder $transportBuilder */ + $transportBuilder = $this->_objectManager->get('Magento\Wishlist\Controller\MockedTransportBuilder'); + + $this->assertStringMatchesFormat( + '%AThank you, %A' + . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . '%A', + $transportBuilder->getSentMessage()->getBodyHtml()->getContent() + ); + } +} + +class MockedTransportBuilder extends \Magento\Mail\Template\TransportBuilder +{ + /** + * @var \Magento\Mail\Message + */ + protected $_sentMessage; + + /** + * Reset object state + * + * @return $this + */ + protected function reset() + { + $this->_sentMessage = $this->message; + parent::reset(); + } + + /** + * Returns message object with prepared data + * + * @return \Magento\Mail\Message|null + */ + public function getSentMessage() + { + return $this->_sentMessage; + } } + +class MockedMailTransport implements \Magento\Mail\TransportInterface +{ + /** + * Mock of send a mail using transport + * + * @return void + */ + public function sendMessage() + { + return; + } +} \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php index 231b6e505dfd521ac0810b44a4b31650989734d5..10cfd770856f9e433e3fa51a6eb84c35e26d6410 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php @@ -31,7 +31,7 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController /** * @var Data */ - private $wishlistHelper; + private $_wishlistHelper; /** * @var \Magento\ObjectManager @@ -39,12 +39,18 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController private $objectManager; /** - * Get requrer instance + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * Get required instance */ protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->wishlistHelper = $this->objectManager->get('Magento\Wishlist\Helper\Data'); + $this->_wishlistHelper = $this->objectManager->get('Magento\Wishlist\Helper\Data'); + $this->_customerSession = $this->objectManager->get('Magento\Customer\Model\Session'); } /** @@ -53,13 +59,16 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController protected function tearDown() { $this->_wishlistHelper = null; + if ($this->_customerSession->isLoggedIn()) { + $this->_customerSession->logout(); + } } public function testGetAddParams() { $product = $this->objectManager->get('Magento\Catalog\Model\Product'); $product->setId(11); - $json = $this->wishlistHelper->getAddParams($product); + $json = $this->_wishlistHelper->getAddParams($product); $params = (array)json_decode($json); $data = (array)$params['data']; $this->assertEquals('11', $data['product']); @@ -69,7 +78,7 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController public function testGetMoveFromCartParams() { - $json = $this->wishlistHelper->getMoveFromCartParams(11); + $json = $this->_wishlistHelper->getMoveFromCartParams(11); $params = (array)json_decode($json); $data = (array)$params['data']; $this->assertEquals('11', $data['item']); @@ -82,7 +91,7 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController $product = $this->objectManager->get('Magento\Catalog\Model\Product'); $product->setId(11); $product->setWishlistItemId(15); - $json = $this->wishlistHelper->getUpdateParams($product); + $json = $this->_wishlistHelper->getUpdateParams($product); $params = (array)json_decode($json); $data = (array)$params['data']; $this->assertEquals('11', $data['product']); @@ -90,4 +99,30 @@ class DataTest extends \Magento\TestFramework\TestCase\AbstractController $this->assertArrayHasKey('uenc', $data); $this->assertStringEndsWith('wishlist/index/updateItemOptions/', $params['action']); } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testWishlistCustomer() + { + /** @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService */ + $customerAccountService = $this->objectManager->create( + 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' + ); + $customer = $customerAccountService->getCustomer(1); + + $this->_wishlistHelper->setCustomer($customer); + $this->assertSame($customer, $this->_wishlistHelper->getCustomer()); + + $this->_wishlistHelper = null; + /** @var \Magento\Wishlist\Helper\Data wishlistHelper */ + $this->_wishlistHelper = $this->objectManager->get('Magento\Wishlist\Helper\Data'); + + $this->_customerSession->loginById(1); + $this->assertEquals($customer, $this->_wishlistHelper->getCustomer()); + + /** @var \Magento\Customer\Helper\View $customerViewHelper */ + $customerViewHelper = $this->objectManager->create('Magento\Customer\Helper\View'); + $this->assertEquals($customerViewHelper->getCustomerName($customer), $this->_wishlistHelper->getCustomerName()); + } } diff --git a/dev/tests/js/framework/qunit/qunit-1.14.0.css b/dev/tests/js/framework/qunit/qunit-1.14.0.css new file mode 100644 index 0000000000000000000000000000000000000000..93026e3ba3f6d00b2b0f416c2f4c7272f1954029 --- /dev/null +++ b/dev/tests/js/framework/qunit/qunit-1.14.0.css @@ -0,0 +1,237 @@ +/*! + * QUnit 1.14.0 + * http://qunitjs.com/ + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-01-31T16:40Z + */ + +/** Font Family and Sizes */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { + font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; +} + +#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } +#qunit-tests { font-size: smaller; } + + +/** Resets */ + +#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { + margin: 0; + padding: 0; +} + + +/** Header */ + +#qunit-header { + padding: 0.5em 0 0.5em 1em; + + color: #8699A4; + background-color: #0D3349; + + font-size: 1.5em; + line-height: 1em; + font-weight: 400; + + border-radius: 5px 5px 0 0; +} + +#qunit-header a { + text-decoration: none; + color: #C2CCD1; +} + +#qunit-header a:hover, +#qunit-header a:focus { + color: #FFF; +} + +#qunit-testrunner-toolbar label { + display: inline-block; + padding: 0 0.5em 0 0.1em; +} + +#qunit-banner { + height: 5px; +} + +#qunit-testrunner-toolbar { + padding: 0.5em 0 0.5em 2em; + color: #5E740B; + background-color: #EEE; + overflow: hidden; +} + +#qunit-userAgent { + padding: 0.5em 0 0.5em 2.5em; + background-color: #2B81AF; + color: #FFF; + text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; +} + +#qunit-modulefilter-container { + float: right; +} + +/** Tests: Pass/Fail */ + +#qunit-tests { + list-style-position: inside; +} + +#qunit-tests li { + padding: 0.4em 0.5em 0.4em 2.5em; + border-bottom: 1px solid #FFF; + list-style-position: inside; +} + +#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { + display: none; +} + +#qunit-tests li strong { + cursor: pointer; +} + +#qunit-tests li a { + padding: 0.5em; + color: #C2CCD1; + text-decoration: none; +} +#qunit-tests li a:hover, +#qunit-tests li a:focus { + color: #000; +} + +#qunit-tests li .runtime { + float: right; + font-size: smaller; +} + +.qunit-assert-list { + margin-top: 0.5em; + padding: 0.5em; + + background-color: #FFF; + + border-radius: 5px; +} + +.qunit-collapsed { + display: none; +} + +#qunit-tests table { + border-collapse: collapse; + margin-top: 0.2em; +} + +#qunit-tests th { + text-align: right; + vertical-align: top; + padding: 0 0.5em 0 0; +} + +#qunit-tests td { + vertical-align: top; +} + +#qunit-tests pre { + margin: 0; + white-space: pre-wrap; + word-wrap: break-word; +} + +#qunit-tests del { + background-color: #E0F2BE; + color: #374E0C; + text-decoration: none; +} + +#qunit-tests ins { + background-color: #FFCACA; + color: #500; + text-decoration: none; +} + +/*** Test Counts */ + +#qunit-tests b.counts { color: #000; } +#qunit-tests b.passed { color: #5E740B; } +#qunit-tests b.failed { color: #710909; } + +#qunit-tests li li { + padding: 5px; + background-color: #FFF; + border-bottom: none; + list-style-position: inside; +} + +/*** Passing Styles */ + +#qunit-tests li li.pass { + color: #3C510C; + background-color: #FFF; + border-left: 10px solid #C6E746; +} + +#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } +#qunit-tests .pass .test-name { color: #366097; } + +#qunit-tests .pass .test-actual, +#qunit-tests .pass .test-expected { color: #999; } + +#qunit-banner.qunit-pass { background-color: #C6E746; } + +/*** Failing Styles */ + +#qunit-tests li li.fail { + color: #710909; + background-color: #FFF; + border-left: 10px solid #EE5757; + white-space: pre; +} + +#qunit-tests > li:last-child { + border-radius: 0 0 5px 5px; +} + +#qunit-tests .fail { color: #000; background-color: #EE5757; } +#qunit-tests .fail .test-name, +#qunit-tests .fail .module-name { color: #000; } + +#qunit-tests .fail .test-actual { color: #EE5757; } +#qunit-tests .fail .test-expected { color: #008000; } + +#qunit-banner.qunit-fail { background-color: #EE5757; } + + +/** Result */ + +#qunit-testresult { + padding: 0.5em 0.5em 0.5em 2.5em; + + color: #2B81AF; + background-color: #D2E0E6; + + border-bottom: 1px solid #FFF; +} +#qunit-testresult .module-name { + font-weight: 700; +} + +/** Fixture */ + +#qunit-fixture { + position: absolute; + top: -10000px; + left: -10000px; + width: 1000px; + height: 1000px; +} diff --git a/dev/tests/js/framework/qunit/qunit-1.14.0.js b/dev/tests/js/framework/qunit/qunit-1.14.0.js new file mode 100644 index 0000000000000000000000000000000000000000..0e279fde17024c0a14bf2e7abd8de90c29746f1f --- /dev/null +++ b/dev/tests/js/framework/qunit/qunit-1.14.0.js @@ -0,0 +1,2288 @@ +/*! + * QUnit 1.14.0 + * http://qunitjs.com/ + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-01-31T16:40Z + */ + +(function( window ) { + +var QUnit, + assert, + config, + onErrorFnPrev, + testId = 0, + fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + // Keep a local reference to Date (GH-283) + Date = window.Date, + setTimeout = window.setTimeout, + clearTimeout = window.clearTimeout, + defined = { + document: typeof window.document !== "undefined", + setTimeout: typeof window.setTimeout !== "undefined", + sessionStorage: (function() { + var x = "qunit-test-string"; + try { + sessionStorage.setItem( x, x ); + sessionStorage.removeItem( x ); + return true; + } catch( e ) { + return false; + } + }()) + }, + /** + * Provides a normalized error string, correcting an issue + * with IE 7 (and prior) where Error.prototype.toString is + * not properly implemented + * + * Based on http://es5.github.com/#x15.11.4.4 + * + * @param {String|Error} error + * @return {String} error message + */ + errorString = function( error ) { + var name, message, + errorString = error.toString(); + if ( errorString.substring( 0, 7 ) === "[object" ) { + name = error.name ? error.name.toString() : "Error"; + message = error.message ? error.message.toString() : ""; + if ( name && message ) { + return name + ": " + message; + } else if ( name ) { + return name; + } else if ( message ) { + return message; + } else { + return "Error"; + } + } else { + return errorString; + } + }, + /** + * Makes a clone of an object using only Array or Object as base, + * and copies over the own enumerable properties. + * + * @param {Object} obj + * @return {Object} New object with only the own properties (recursively). + */ + objectValues = function( obj ) { + // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. + /*jshint newcap: false */ + var key, val, + vals = QUnit.is( "array", obj ) ? [] : {}; + for ( key in obj ) { + if ( hasOwn.call( obj, key ) ) { + val = obj[key]; + vals[key] = val === Object(val) ? objectValues(val) : val; + } + } + return vals; + }; + + +// Root QUnit object. +// `QUnit` initialized at top of scope +QUnit = { + + // call on start of module test to prepend name to all tests + module: function( name, testEnvironment ) { + config.currentModule = name; + config.currentModuleTestEnvironment = testEnvironment; + config.modules[name] = true; + }, + + asyncTest: function( testName, expected, callback ) { + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + QUnit.test( testName, expected, callback, true ); + }, + + test: function( testName, expected, callback, async ) { + var test, + nameHtml = "<span class='test-name'>" + escapeText( testName ) + "</span>"; + + if ( arguments.length === 2 ) { + callback = expected; + expected = null; + } + + if ( config.currentModule ) { + nameHtml = "<span class='module-name'>" + escapeText( config.currentModule ) + "</span>: " + nameHtml; + } + + test = new Test({ + nameHtml: nameHtml, + testName: testName, + expected: expected, + async: async, + callback: callback, + module: config.currentModule, + moduleTestEnvironment: config.currentModuleTestEnvironment, + stack: sourceFromStacktrace( 2 ) + }); + + if ( !validTest( test ) ) { + return; + } + + test.queue(); + }, + + // Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through. + expect: function( asserts ) { + if (arguments.length === 1) { + config.current.expected = asserts; + } else { + return config.current.expected; + } + }, + + start: function( count ) { + // QUnit hasn't been initialized yet. + // Note: RequireJS (et al) may delay onLoad + if ( config.semaphore === undefined ) { + QUnit.begin(function() { + // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first + setTimeout(function() { + QUnit.start( count ); + }); + }); + return; + } + + config.semaphore -= count || 1; + // don't start until equal number of stop-calls + if ( config.semaphore > 0 ) { + return; + } + // ignore if start is called more often then stop + if ( config.semaphore < 0 ) { + config.semaphore = 0; + QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); + return; + } + // A slight delay, to avoid any current callbacks + if ( defined.setTimeout ) { + setTimeout(function() { + if ( config.semaphore > 0 ) { + return; + } + if ( config.timeout ) { + clearTimeout( config.timeout ); + } + + config.blocking = false; + process( true ); + }, 13); + } else { + config.blocking = false; + process( true ); + } + }, + + stop: function( count ) { + config.semaphore += count || 1; + config.blocking = true; + + if ( config.testTimeout && defined.setTimeout ) { + clearTimeout( config.timeout ); + config.timeout = setTimeout(function() { + QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; + QUnit.start(); + }, config.testTimeout ); + } + } +}; + +// We use the prototype to distinguish between properties that should +// be exposed as globals (and in exports) and those that shouldn't +(function() { + function F() {} + F.prototype = QUnit; + QUnit = new F(); + // Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +}()); + +/** + * Config object: Maintain internal state + * Later exposed as QUnit.config + * `config` initialized at top of scope + */ +config = { + // The queue of tests to run + queue: [], + + // block until document ready + blocking: true, + + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + + // by default, run previously failed tests first + // very useful in combination with "Hide passed tests" checked + reorder: true, + + // by default, modify document.title when suite is done + altertitle: true, + + // by default, scroll to top of the page when suite is done + scrolltop: true, + + // when enabled, all tests must call expect() + requireExpects: false, + + // add checkboxes that are persisted in the query-string + // when enabled, the id is set to `true` as a `QUnit.config` property + urlConfig: [ + { + id: "noglobals", + label: "Check for Globals", + tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." + }, + { + id: "notrycatch", + label: "No try-catch", + tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." + } + ], + + // Set of all modules. + modules: {}, + + // logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] +}; + +// Initialize more QUnit.config and QUnit.urlParams +(function() { + var i, current, + location = window.location || { search: "", protocol: "file:" }, + params = location.search.slice( 1 ).split( "&" ), + length = params.length, + urlParams = {}; + + if ( params[ 0 ] ) { + for ( i = 0; i < length; i++ ) { + current = params[ i ].split( "=" ); + current[ 0 ] = decodeURIComponent( current[ 0 ] ); + + // allow just a key to turn on a flag, e.g., test.html?noglobals + current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; + if ( urlParams[ current[ 0 ] ] ) { + urlParams[ current[ 0 ] ] = [].concat( urlParams[ current[ 0 ] ], current[ 1 ] ); + } else { + urlParams[ current[ 0 ] ] = current[ 1 ]; + } + } + } + + QUnit.urlParams = urlParams; + + // String search anywhere in moduleName+testName + config.filter = urlParams.filter; + + // Exact match of the module name + config.module = urlParams.module; + + config.testNumber = []; + if ( urlParams.testNumber ) { + + // Ensure that urlParams.testNumber is an array + urlParams.testNumber = [].concat( urlParams.testNumber ); + for ( i = 0; i < urlParams.testNumber.length; i++ ) { + current = urlParams.testNumber[ i ]; + config.testNumber.push( parseInt( current, 10 ) ); + } + } + + // Figure out if we're running the tests from a server or not + QUnit.isLocal = location.protocol === "file:"; +}()); + +extend( QUnit, { + + config: config, + + // Initialize the configuration options + init: function() { + extend( config, { + stats: { all: 0, bad: 0 }, + moduleStats: { all: 0, bad: 0 }, + started: +new Date(), + updateRate: 1000, + blocking: false, + autostart: true, + autorun: false, + filter: "", + queue: [], + semaphore: 1 + }); + + var tests, banner, result, + qunit = id( "qunit" ); + + if ( qunit ) { + qunit.innerHTML = + "<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" + + "<h2 id='qunit-banner'></h2>" + + "<div id='qunit-testrunner-toolbar'></div>" + + "<h2 id='qunit-userAgent'></h2>" + + "<ol id='qunit-tests'></ol>"; + } + + tests = id( "qunit-tests" ); + banner = id( "qunit-banner" ); + result = id( "qunit-testresult" ); + + if ( tests ) { + tests.innerHTML = ""; + } + + if ( banner ) { + banner.className = ""; + } + + if ( result ) { + result.parentNode.removeChild( result ); + } + + if ( tests ) { + result = document.createElement( "p" ); + result.id = "qunit-testresult"; + result.className = "result"; + tests.parentNode.insertBefore( result, tests ); + result.innerHTML = "Running...<br/> "; + } + }, + + // Resets the test setup. Useful for tests that modify the DOM. + /* + DEPRECATED: Use multiple tests instead of resetting inside a test. + Use testStart or testDone for custom cleanup. + This method will throw an error in 2.0, and will be removed in 2.1 + */ + reset: function() { + var fixture = id( "qunit-fixture" ); + if ( fixture ) { + fixture.innerHTML = config.fixture; + } + }, + + // Safe object type checking + is: function( type, obj ) { + return QUnit.objectType( obj ) === type; + }, + + objectType: function( obj ) { + if ( typeof obj === "undefined" ) { + return "undefined"; + } + + // Consider: typeof null === object + if ( obj === null ) { + return "null"; + } + + var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), + type = match && match[1] || ""; + + switch ( type ) { + case "Number": + if ( isNaN(obj) ) { + return "nan"; + } + return "number"; + case "String": + case "Boolean": + case "Array": + case "Date": + case "RegExp": + case "Function": + return type.toLowerCase(); + } + if ( typeof obj === "object" ) { + return "object"; + } + return undefined; + }, + + push: function( result, actual, expected, message ) { + if ( !config.current ) { + throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); + } + + var output, source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: message, + actual: actual, + expected: expected + }; + + message = escapeText( message ) || ( result ? "okay" : "failed" ); + message = "<span class='test-message'>" + message + "</span>"; + output = message; + + if ( !result ) { + expected = escapeText( QUnit.jsDump.parse(expected) ); + actual = escapeText( QUnit.jsDump.parse(actual) ); + output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>"; + + if ( actual !== expected ) { + output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>"; + output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>"; + } + + source = sourceFromStacktrace(); + + if ( source ) { + details.source = source; + output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>"; + } + + output += "</table>"; + } + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: !!result, + message: output + }); + }, + + pushFailure: function( message, source, actual ) { + if ( !config.current ) { + throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + + var output, + details = { + module: config.current.module, + name: config.current.testName, + result: false, + message: message + }; + + message = escapeText( message ) || "error"; + message = "<span class='test-message'>" + message + "</span>"; + output = message; + + output += "<table>"; + + if ( actual ) { + output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText( actual ) + "</pre></td></tr>"; + } + + if ( source ) { + details.source = source; + output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>"; + } + + output += "</table>"; + + runLoggingCallbacks( "log", QUnit, details ); + + config.current.assertions.push({ + result: false, + message: output + }); + }, + + url: function( params ) { + params = extend( extend( {}, QUnit.urlParams ), params ); + var key, + querystring = "?"; + + for ( key in params ) { + if ( hasOwn.call( params, key ) ) { + querystring += encodeURIComponent( key ) + "=" + + encodeURIComponent( params[ key ] ) + "&"; + } + } + return window.location.protocol + "//" + window.location.host + + window.location.pathname + querystring.slice( 0, -1 ); + }, + + extend: extend, + id: id, + addEvent: addEvent, + addClass: addClass, + hasClass: hasClass, + removeClass: removeClass + // load, equiv, jsDump, diff: Attached later +}); + +/** + * @deprecated: Created for backwards compatibility with test runner that set the hook function + * into QUnit.{hook}, instead of invoking it and passing the hook function. + * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. + * Doing this allows us to tell if the following methods have been overwritten on the actual + * QUnit object. + */ +extend( QUnit.constructor.prototype, { + + // Logging callbacks; all receive a single argument with the listed properties + // run test/logs.html for any related changes + begin: registerLoggingCallback( "begin" ), + + // done: { failed, passed, total, runtime } + done: registerLoggingCallback( "done" ), + + // log: { result, actual, expected, message } + log: registerLoggingCallback( "log" ), + + // testStart: { name } + testStart: registerLoggingCallback( "testStart" ), + + // testDone: { name, failed, passed, total, runtime } + testDone: registerLoggingCallback( "testDone" ), + + // moduleStart: { name } + moduleStart: registerLoggingCallback( "moduleStart" ), + + // moduleDone: { name, failed, passed, total } + moduleDone: registerLoggingCallback( "moduleDone" ) +}); + +if ( !defined.document || document.readyState === "complete" ) { + config.autorun = true; +} + +QUnit.load = function() { + runLoggingCallbacks( "begin", QUnit, {} ); + + // Initialize the config, saving the execution queue + var banner, filter, i, j, label, len, main, ol, toolbar, val, selection, + urlConfigContainer, moduleFilter, userAgent, + numModules = 0, + moduleNames = [], + moduleFilterHtml = "", + urlConfigHtml = "", + oldconfig = extend( {}, config ); + + QUnit.init(); + extend(config, oldconfig); + + config.blocking = false; + + len = config.urlConfig.length; + + for ( i = 0; i < len; i++ ) { + val = config.urlConfig[i]; + if ( typeof val === "string" ) { + val = { + id: val, + label: val + }; + } + config[ val.id ] = QUnit.urlParams[ val.id ]; + if ( !val.value || typeof val.value === "string" ) { + urlConfigHtml += "<input id='qunit-urlconfig-" + escapeText( val.id ) + + "' name='" + escapeText( val.id ) + + "' type='checkbox'" + + ( val.value ? " value='" + escapeText( val.value ) + "'" : "" ) + + ( config[ val.id ] ? " checked='checked'" : "" ) + + " title='" + escapeText( val.tooltip ) + + "'><label for='qunit-urlconfig-" + escapeText( val.id ) + + "' title='" + escapeText( val.tooltip ) + "'>" + val.label + "</label>"; + } else { + urlConfigHtml += "<label for='qunit-urlconfig-" + escapeText( val.id ) + + "' title='" + escapeText( val.tooltip ) + + "'>" + val.label + + ": </label><select id='qunit-urlconfig-" + escapeText( val.id ) + + "' name='" + escapeText( val.id ) + + "' title='" + escapeText( val.tooltip ) + + "'><option></option>"; + selection = false; + if ( QUnit.is( "array", val.value ) ) { + for ( j = 0; j < val.value.length; j++ ) { + urlConfigHtml += "<option value='" + escapeText( val.value[j] ) + "'" + + ( config[ val.id ] === val.value[j] ? + (selection = true) && " selected='selected'" : + "" ) + + ">" + escapeText( val.value[j] ) + "</option>"; + } + } else { + for ( j in val.value ) { + if ( hasOwn.call( val.value, j ) ) { + urlConfigHtml += "<option value='" + escapeText( j ) + "'" + + ( config[ val.id ] === j ? + (selection = true) && " selected='selected'" : + "" ) + + ">" + escapeText( val.value[j] ) + "</option>"; + } + } + } + if ( config[ val.id ] && !selection ) { + urlConfigHtml += "<option value='" + escapeText( config[ val.id ] ) + + "' selected='selected' disabled='disabled'>" + + escapeText( config[ val.id ] ) + + "</option>"; + } + urlConfigHtml += "</select>"; + } + } + for ( i in config.modules ) { + if ( config.modules.hasOwnProperty( i ) ) { + moduleNames.push(i); + } + } + numModules = moduleNames.length; + moduleNames.sort( function( a, b ) { + return a.localeCompare( b ); + }); + moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " + + ( config.module === undefined ? "selected='selected'" : "" ) + + ">< All Modules ></option>"; + + + for ( i = 0; i < numModules; i++) { + moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(moduleNames[i]) ) + "' " + + ( config.module === moduleNames[i] ? "selected='selected'" : "" ) + + ">" + escapeText(moduleNames[i]) + "</option>"; + } + moduleFilterHtml += "</select>"; + + // `userAgent` initialized at top of scope + userAgent = id( "qunit-userAgent" ); + if ( userAgent ) { + userAgent.innerHTML = navigator.userAgent; + } + + // `banner` initialized at top of scope + banner = id( "qunit-header" ); + if ( banner ) { + banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> "; + } + + // `toolbar` initialized at top of scope + toolbar = id( "qunit-testrunner-toolbar" ); + if ( toolbar ) { + // `filter` initialized at top of scope + filter = document.createElement( "input" ); + filter.type = "checkbox"; + filter.id = "qunit-filter-pass"; + + addEvent( filter, "click", function() { + var tmp, + ol = id( "qunit-tests" ); + + if ( filter.checked ) { + ol.className = ol.className + " hidepass"; + } else { + tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; + ol.className = tmp.replace( / hidepass /, " " ); + } + if ( defined.sessionStorage ) { + if (filter.checked) { + sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); + } else { + sessionStorage.removeItem( "qunit-filter-passed-tests" ); + } + } + }); + + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { + filter.checked = true; + // `ol` initialized at top of scope + ol = id( "qunit-tests" ); + ol.className = ol.className + " hidepass"; + } + toolbar.appendChild( filter ); + + // `label` initialized at top of scope + label = document.createElement( "label" ); + label.setAttribute( "for", "qunit-filter-pass" ); + label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." ); + label.innerHTML = "Hide passed tests"; + toolbar.appendChild( label ); + + urlConfigContainer = document.createElement("span"); + urlConfigContainer.innerHTML = urlConfigHtml; + // For oldIE support: + // * Add handlers to the individual elements instead of the container + // * Use "click" instead of "change" for checkboxes + // * Fallback from event.target to event.srcElement + addEvents( urlConfigContainer.getElementsByTagName("input"), "click", function( event ) { + var params = {}, + target = event.target || event.srcElement; + params[ target.name ] = target.checked ? + target.defaultValue || true : + undefined; + window.location = QUnit.url( params ); + }); + addEvents( urlConfigContainer.getElementsByTagName("select"), "change", function( event ) { + var params = {}, + target = event.target || event.srcElement; + params[ target.name ] = target.options[ target.selectedIndex ].value || undefined; + window.location = QUnit.url( params ); + }); + toolbar.appendChild( urlConfigContainer ); + + if (numModules > 1) { + moduleFilter = document.createElement( "span" ); + moduleFilter.setAttribute( "id", "qunit-modulefilter-container" ); + moduleFilter.innerHTML = moduleFilterHtml; + addEvent( moduleFilter.lastChild, "change", function() { + var selectBox = moduleFilter.getElementsByTagName("select")[0], + selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); + + window.location = QUnit.url({ + module: ( selectedModule === "" ) ? undefined : selectedModule, + // Remove any existing filters + filter: undefined, + testNumber: undefined + }); + }); + toolbar.appendChild(moduleFilter); + } + } + + // `main` initialized at top of scope + main = id( "qunit-fixture" ); + if ( main ) { + config.fixture = main.innerHTML; + } + + if ( config.autostart ) { + QUnit.start(); + } +}; + +if ( defined.document ) { + addEvent( window, "load", QUnit.load ); +} + +// `onErrorFnPrev` initialized at top of scope +// Preserve other handlers +onErrorFnPrev = window.onerror; + +// Cover uncaught exceptions +// Returning true will suppress the default browser handler, +// returning false will let it run. +window.onerror = function ( error, filePath, linerNr ) { + var ret = false; + if ( onErrorFnPrev ) { + ret = onErrorFnPrev( error, filePath, linerNr ); + } + + // Treat return value as window.onerror itself does, + // Only do our handling if not suppressed. + if ( ret !== true ) { + if ( QUnit.config.current ) { + if ( QUnit.config.current.ignoreGlobalErrors ) { + return true; + } + QUnit.pushFailure( error, filePath + ":" + linerNr ); + } else { + QUnit.test( "global failure", extend( function() { + QUnit.pushFailure( error, filePath + ":" + linerNr ); + }, { validTest: validTest } ) ); + } + return false; + } + + return ret; +}; + +function done() { + config.autorun = true; + + // Log the last module results + if ( config.previousModule ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + delete config.previousModule; + + var i, key, + banner = id( "qunit-banner" ), + tests = id( "qunit-tests" ), + runtime = +new Date() - config.started, + passed = config.stats.all - config.stats.bad, + html = [ + "Tests completed in ", + runtime, + " milliseconds.<br/>", + "<span class='passed'>", + passed, + "</span> assertions of <span class='total'>", + config.stats.all, + "</span> passed, <span class='failed'>", + config.stats.bad, + "</span> failed." + ].join( "" ); + + if ( banner ) { + banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); + } + + if ( tests ) { + id( "qunit-testresult" ).innerHTML = html; + } + + if ( config.altertitle && defined.document && document.title ) { + // show ✖ for good, ✔ for bad suite result in title + // use escape sequences in case file gets loaded with non-utf-8-charset + document.title = [ + ( config.stats.bad ? "\u2716" : "\u2714" ), + document.title.replace( /^[\u2714\u2716] /i, "" ) + ].join( " " ); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + // `key` & `i` initialized at top of scope + for ( i = 0; i < sessionStorage.length; i++ ) { + key = sessionStorage.key( i++ ); + if ( key.indexOf( "qunit-test-" ) === 0 ) { + sessionStorage.removeItem( key ); + } + } + } + + // scroll back to top to show results + if ( config.scrolltop && window.scrollTo ) { + window.scrollTo(0, 0); + } + + runLoggingCallbacks( "done", QUnit, { + failed: config.stats.bad, + passed: passed, + total: config.stats.all, + runtime: runtime + }); +} + +/** @return Boolean: true if this test should be ran */ +function validTest( test ) { + var include, + filter = config.filter && config.filter.toLowerCase(), + module = config.module && config.module.toLowerCase(), + fullName = ( test.module + ": " + test.testName ).toLowerCase(); + + // Internally-generated tests are always valid + if ( test.callback && test.callback.validTest === validTest ) { + delete test.callback.validTest; + return true; + } + + if ( config.testNumber.length > 0 ) { + if ( inArray( test.testNumber, config.testNumber ) < 0 ) { + return false; + } + } + + if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { + return false; + } + + if ( !filter ) { + return true; + } + + include = filter.charAt( 0 ) !== "!"; + if ( !include ) { + filter = filter.slice( 1 ); + } + + // If the filter matches, we need to honour include + if ( fullName.indexOf( filter ) !== -1 ) { + return include; + } + + // Otherwise, do the opposite + return !include; +} + +// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) +// Later Safari and IE10 are supposed to support error.stack as well +// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack +function extractStacktrace( e, offset ) { + offset = offset === undefined ? 3 : offset; + + var stack, include, i; + + if ( e.stacktrace ) { + // Opera + return e.stacktrace.split( "\n" )[ offset + 3 ]; + } else if ( e.stack ) { + // Firefox, Chrome + stack = e.stack.split( "\n" ); + if (/^error$/i.test( stack[0] ) ) { + stack.shift(); + } + if ( fileName ) { + include = []; + for ( i = offset; i < stack.length; i++ ) { + if ( stack[ i ].indexOf( fileName ) !== -1 ) { + break; + } + include.push( stack[ i ] ); + } + if ( include.length ) { + return include.join( "\n" ); + } + } + return stack[ offset ]; + } else if ( e.sourceURL ) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ":" + e.line; + } +} +function sourceFromStacktrace( offset ) { + try { + throw new Error(); + } catch ( e ) { + return extractStacktrace( e, offset ); + } +} + +/** + * Escape text for attribute or text content. + */ +function escapeText( s ) { + if ( !s ) { + return ""; + } + s = s + ""; + // Both single quotes and double quotes (for attributes) + return s.replace( /['"<>&]/g, function( s ) { + switch( s ) { + case "'": + return "'"; + case "\"": + return """; + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + } + }); +} + +function synchronize( callback, last ) { + config.queue.push( callback ); + + if ( config.autorun && !config.blocking ) { + process( last ); + } +} + +function process( last ) { + function next() { + process( last ); + } + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; + + while ( config.queue.length && !config.blocking ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { + config.queue.shift()(); + } else { + setTimeout( next, 13 ); + break; + } + } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } +} + +function saveGlobal() { + config.pollution = []; + + if ( config.noglobals ) { + for ( var key in window ) { + if ( hasOwn.call( window, key ) ) { + // in Opera sometimes DOM element ids show up here, ignore them + if ( /^qunit-test-output/.test( key ) ) { + continue; + } + config.pollution.push( key ); + } + } + } +} + +function checkPollution() { + var newGlobals, + deletedGlobals, + old = config.pollution; + + saveGlobal(); + + newGlobals = diff( config.pollution, old ); + if ( newGlobals.length > 0 ) { + QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); + } + + deletedGlobals = diff( old, config.pollution ); + if ( deletedGlobals.length > 0 ) { + QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); + } +} + +// returns a new Array with the elements that are in a but not in b +function diff( a, b ) { + var i, j, + result = a.slice(); + + for ( i = 0; i < result.length; i++ ) { + for ( j = 0; j < b.length; j++ ) { + if ( result[i] === b[j] ) { + result.splice( i, 1 ); + i--; + break; + } + } + } + return result; +} + +function extend( a, b ) { + for ( var prop in b ) { + if ( hasOwn.call( b, prop ) ) { + // Avoid "Member not found" error in IE8 caused by messing with window.constructor + if ( !( prop === "constructor" && a === window ) ) { + if ( b[ prop ] === undefined ) { + delete a[ prop ]; + } else { + a[ prop ] = b[ prop ]; + } + } + } + } + + return a; +} + +/** + * @param {HTMLElement} elem + * @param {string} type + * @param {Function} fn + */ +function addEvent( elem, type, fn ) { + if ( elem.addEventListener ) { + + // Standards-based browsers + elem.addEventListener( type, fn, false ); + } else if ( elem.attachEvent ) { + + // support: IE <9 + elem.attachEvent( "on" + type, fn ); + } else { + + // Caller must ensure support for event listeners is present + throw new Error( "addEvent() was called in a context without event listener support" ); + } +} + +/** + * @param {Array|NodeList} elems + * @param {string} type + * @param {Function} fn + */ +function addEvents( elems, type, fn ) { + var i = elems.length; + while ( i-- ) { + addEvent( elems[i], type, fn ); + } +} + +function hasClass( elem, name ) { + return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; +} + +function addClass( elem, name ) { + if ( !hasClass( elem, name ) ) { + elem.className += (elem.className ? " " : "") + name; + } +} + +function removeClass( elem, name ) { + var set = " " + elem.className + " "; + // Class name may appear multiple times + while ( set.indexOf(" " + name + " ") > -1 ) { + set = set.replace(" " + name + " " , " "); + } + // If possible, trim it for prettiness, but not necessarily + elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, ""); +} + +function id( name ) { + return defined.document && document.getElementById && document.getElementById( name ); +} + +function registerLoggingCallback( key ) { + return function( callback ) { + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks( key, scope, args ) { + var i, callbacks; + if ( QUnit.hasOwnProperty( key ) ) { + QUnit[ key ].call(scope, args ); + } else { + callbacks = config[ key ]; + for ( i = 0; i < callbacks.length; i++ ) { + callbacks[ i ].call( scope, args ); + } + } +} + +// from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + +function Test( settings ) { + extend( this, settings ); + this.assertions = []; + this.testNumber = ++Test.count; +} + +Test.count = 0; + +Test.prototype = { + init: function() { + var a, b, li, + tests = id( "qunit-tests" ); + + if ( tests ) { + b = document.createElement( "strong" ); + b.innerHTML = this.nameHtml; + + // `a` initialized at top of scope + a = document.createElement( "a" ); + a.innerHTML = "Rerun"; + a.href = QUnit.url({ testNumber: this.testNumber }); + + li = document.createElement( "li" ); + li.appendChild( b ); + li.appendChild( a ); + li.className = "running"; + li.id = this.id = "qunit-test-output" + testId++; + + tests.appendChild( li ); + } + }, + setup: function() { + if ( + // Emit moduleStart when we're switching from one module to another + this.module !== config.previousModule || + // They could be equal (both undefined) but if the previousModule property doesn't + // yet exist it means this is the first test in a suite that isn't wrapped in a + // module, in which case we'll just emit a moduleStart event for 'undefined'. + // Without this, reporters can get testStart before moduleStart which is a problem. + !hasOwn.call( config, "previousModule" ) + ) { + if ( hasOwn.call( config, "previousModule" ) ) { + runLoggingCallbacks( "moduleDone", QUnit, { + name: config.previousModule, + failed: config.moduleStats.bad, + passed: config.moduleStats.all - config.moduleStats.bad, + total: config.moduleStats.all + }); + } + config.previousModule = this.module; + config.moduleStats = { all: 0, bad: 0 }; + runLoggingCallbacks( "moduleStart", QUnit, { + name: this.module + }); + } + + config.current = this; + + this.testEnvironment = extend({ + setup: function() {}, + teardown: function() {} + }, this.moduleTestEnvironment ); + + this.started = +new Date(); + runLoggingCallbacks( "testStart", QUnit, { + name: this.testName, + module: this.module + }); + + /*jshint camelcase:false */ + + + /** + * Expose the current test environment. + * + * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead. + */ + QUnit.current_testEnvironment = this.testEnvironment; + + /*jshint camelcase:true */ + + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); + return; + } + try { + this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert ); + } catch( e ) { + QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + }, + run: function() { + config.current = this; + + var running = id( "qunit-testresult" ); + + if ( running ) { + running.innerHTML = "Running: <br/>" + this.nameHtml; + } + + if ( this.async ) { + QUnit.stop(); + } + + this.callbackStarted = +new Date(); + + if ( config.notrycatch ) { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + return; + } + + try { + this.callback.call( this.testEnvironment, QUnit.assert ); + this.callbackRuntime = +new Date() - this.callbackStarted; + } catch( e ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + + QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); + // else next test will carry the responsibility + saveGlobal(); + + // Restart the tests if they're blocking + if ( config.blocking ) { + QUnit.start(); + } + } + }, + teardown: function() { + config.current = this; + if ( config.notrycatch ) { + if ( typeof this.callbackRuntime === "undefined" ) { + this.callbackRuntime = +new Date() - this.callbackStarted; + } + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); + return; + } else { + try { + this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert ); + } catch( e ) { + QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); + } + } + checkPollution(); + }, + finish: function() { + config.current = this; + if ( config.requireExpects && this.expected === null ) { + QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); + } else if ( this.expected !== null && this.expected !== this.assertions.length ) { + QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); + } else if ( this.expected === null && !this.assertions.length ) { + QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); + } + + var i, assertion, a, b, time, li, ol, + test = this, + good = 0, + bad = 0, + tests = id( "qunit-tests" ); + + this.runtime = +new Date() - this.started; + config.stats.all += this.assertions.length; + config.moduleStats.all += this.assertions.length; + + if ( tests ) { + ol = document.createElement( "ol" ); + ol.className = "qunit-assert-list"; + + for ( i = 0; i < this.assertions.length; i++ ) { + assertion = this.assertions[i]; + + li = document.createElement( "li" ); + li.className = assertion.result ? "pass" : "fail"; + li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); + ol.appendChild( li ); + + if ( assertion.result ) { + good++; + } else { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + + // store result when possible + if ( QUnit.config.reorder && defined.sessionStorage ) { + if ( bad ) { + sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); + } else { + sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); + } + } + + if ( bad === 0 ) { + addClass( ol, "qunit-collapsed" ); + } + + // `b` initialized at top of scope + b = document.createElement( "strong" ); + b.innerHTML = this.nameHtml + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>"; + + addEvent(b, "click", function() { + var next = b.parentNode.lastChild, + collapsed = hasClass( next, "qunit-collapsed" ); + ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); + }); + + addEvent(b, "dblclick", function( e ) { + var target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === "strong" ) { + window.location = QUnit.url({ testNumber: test.testNumber }); + } + }); + + // `time` initialized at top of scope + time = document.createElement( "span" ); + time.className = "runtime"; + time.innerHTML = this.runtime + " ms"; + + // `li` initialized at top of scope + li = id( this.id ); + li.className = bad ? "fail" : "pass"; + li.removeChild( li.firstChild ); + a = li.firstChild; + li.appendChild( b ); + li.appendChild( a ); + li.appendChild( time ); + li.appendChild( ol ); + + } else { + for ( i = 0; i < this.assertions.length; i++ ) { + if ( !this.assertions[i].result ) { + bad++; + config.stats.bad++; + config.moduleStats.bad++; + } + } + } + + runLoggingCallbacks( "testDone", QUnit, { + name: this.testName, + module: this.module, + failed: bad, + passed: this.assertions.length - bad, + total: this.assertions.length, + runtime: this.runtime, + // DEPRECATED: this property will be removed in 2.0.0, use runtime instead + duration: this.runtime + }); + + QUnit.reset(); + + config.current = undefined; + }, + + queue: function() { + var bad, + test = this; + + synchronize(function() { + test.init(); + }); + function run() { + // each of these can by async + synchronize(function() { + test.setup(); + }); + synchronize(function() { + test.run(); + }); + synchronize(function() { + test.teardown(); + }); + synchronize(function() { + test.finish(); + }); + } + + // `bad` initialized at top of scope + // defer when previous test run passed, if storage is available + bad = QUnit.config.reorder && defined.sessionStorage && + +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); + + if ( bad ) { + run(); + } else { + synchronize( run, true ); + } + } +}; + +// `assert` initialized at top of scope +// Assert helpers +// All of these must either call QUnit.push() or manually do: +// - runLoggingCallbacks( "log", .. ); +// - config.current.assertions.push({ .. }); +assert = QUnit.assert = { + /** + * Asserts rough true-ish result. + * @name ok + * @function + * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); + */ + ok: function( result, msg ) { + if ( !config.current ) { + throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); + } + result = !!result; + msg = msg || ( result ? "okay" : "failed" ); + + var source, + details = { + module: config.current.module, + name: config.current.testName, + result: result, + message: msg + }; + + msg = "<span class='test-message'>" + escapeText( msg ) + "</span>"; + + if ( !result ) { + source = sourceFromStacktrace( 2 ); + if ( source ) { + details.source = source; + msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + + escapeText( source ) + + "</pre></td></tr></table>"; + } + } + runLoggingCallbacks( "log", QUnit, details ); + config.current.assertions.push({ + result: result, + message: msg + }); + }, + + /** + * Assert that the first two arguments are equal, with an optional message. + * Prints out both actual and expected values. + * @name equal + * @function + * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); + */ + equal: function( actual, expected, message ) { + /*jshint eqeqeq:false */ + QUnit.push( expected == actual, actual, expected, message ); + }, + + /** + * @name notEqual + * @function + */ + notEqual: function( actual, expected, message ) { + /*jshint eqeqeq:false */ + QUnit.push( expected != actual, actual, expected, message ); + }, + + /** + * @name propEqual + * @function + */ + propEqual: function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name notPropEqual + * @function + */ + notPropEqual: function( actual, expected, message ) { + actual = objectValues(actual); + expected = objectValues(expected); + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name deepEqual + * @function + */ + deepEqual: function( actual, expected, message ) { + QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name notDeepEqual + * @function + */ + notDeepEqual: function( actual, expected, message ) { + QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); + }, + + /** + * @name strictEqual + * @function + */ + strictEqual: function( actual, expected, message ) { + QUnit.push( expected === actual, actual, expected, message ); + }, + + /** + * @name notStrictEqual + * @function + */ + notStrictEqual: function( actual, expected, message ) { + QUnit.push( expected !== actual, actual, expected, message ); + }, + + "throws": function( block, expected, message ) { + var actual, + expectedOutput = expected, + ok = false; + + // 'expected' is optional + if ( !message && typeof expected === "string" ) { + message = expected; + expected = null; + } + + config.current.ignoreGlobalErrors = true; + try { + block.call( config.current.testEnvironment ); + } catch (e) { + actual = e; + } + config.current.ignoreGlobalErrors = false; + + if ( actual ) { + + // we don't want to validate thrown error + if ( !expected ) { + ok = true; + expectedOutput = null; + + // expected is an Error object + } else if ( expected instanceof Error ) { + ok = actual instanceof Error && + actual.name === expected.name && + actual.message === expected.message; + + // expected is a regexp + } else if ( QUnit.objectType( expected ) === "regexp" ) { + ok = expected.test( errorString( actual ) ); + + // expected is a string + } else if ( QUnit.objectType( expected ) === "string" ) { + ok = expected === errorString( actual ); + + // expected is a constructor + } else if ( actual instanceof expected ) { + ok = true; + + // expected is a validation function which returns true is validation passed + } else if ( expected.call( {}, actual ) === true ) { + expectedOutput = null; + ok = true; + } + + QUnit.push( ok, actual, expectedOutput, message ); + } else { + QUnit.pushFailure( message, null, "No exception was thrown." ); + } + } +}; + +/** + * @deprecated since 1.8.0 + * Kept assertion helpers in root for backwards compatibility. + */ +extend( QUnit.constructor.prototype, assert ); + +/** + * @deprecated since 1.9.0 + * Kept to avoid TypeErrors for undefined methods. + */ +QUnit.constructor.prototype.raises = function() { + QUnit.push( false, false, false, "QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead" ); +}; + +/** + * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 + * Kept to avoid TypeErrors for undefined methods. + */ +QUnit.constructor.prototype.equals = function() { + QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); +}; +QUnit.constructor.prototype.same = function() { + QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); +}; + +// Test for equality any JavaScript type. +// Author: Philippe Rathé <prathe@gmail.com> +QUnit.equiv = (function() { + + // Call the o related callback with the given arguments. + function bindCallbacks( o, callbacks, args ) { + var prop = QUnit.objectType( o ); + if ( prop ) { + if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { + return callbacks[ prop ].apply( callbacks, args ); + } else { + return callbacks[ prop ]; // or undefined + } + } + } + + // the real equiv function + var innerEquiv, + // stack to decide between skip/abort functions + callers = [], + // stack to avoiding loops from circular referencing + parents = [], + parentsB = [], + + getProto = Object.getPrototypeOf || function ( obj ) { + /*jshint camelcase:false */ + return obj.__proto__; + }, + callbacks = (function () { + + // for string, boolean, number and null + function useStrictEquality( b, a ) { + /*jshint eqeqeq:false */ + if ( b instanceof a.constructor || a instanceof b.constructor ) { + // to catch short annotation VS 'new' annotation of a + // declaration + // e.g. var i = 1; + // var j = new Number(1); + return a == b; + } else { + return a === b; + } + } + + return { + "string": useStrictEquality, + "boolean": useStrictEquality, + "number": useStrictEquality, + "null": useStrictEquality, + "undefined": useStrictEquality, + + "nan": function( b ) { + return isNaN( b ); + }, + + "date": function( b, a ) { + return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); + }, + + "regexp": function( b, a ) { + return QUnit.objectType( b ) === "regexp" && + // the regex itself + a.source === b.source && + // and its modifiers + a.global === b.global && + // (gmi) ... + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline && + a.sticky === b.sticky; + }, + + // - skip when the property is a method of an instance (OOP) + // - abort otherwise, + // initial === would have catch identical references anyway + "function": function() { + var caller = callers[callers.length - 1]; + return caller !== Object && typeof caller !== "undefined"; + }, + + "array": function( b, a ) { + var i, j, len, loop, aCircular, bCircular; + + // b could be an object literal here + if ( QUnit.objectType( b ) !== "array" ) { + return false; + } + + len = a.length; + if ( len !== b.length ) { + // safe and faster + return false; + } + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + for ( i = 0; i < len; i++ ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + parents.pop(); + parentsB.pop(); + return false; + } + } + } + if ( !loop && !innerEquiv(a[i], b[i]) ) { + parents.pop(); + parentsB.pop(); + return false; + } + } + parents.pop(); + parentsB.pop(); + return true; + }, + + "object": function( b, a ) { + /*jshint forin:false */ + var i, j, loop, aCircular, bCircular, + // Default to true + eq = true, + aProperties = [], + bProperties = []; + + // comparing constructors is more strict than using + // instanceof + if ( a.constructor !== b.constructor ) { + // Allow objects with no prototype to be equivalent to + // objects with Object as their constructor. + if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || + ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { + return false; + } + } + + // stack constructor before traversing properties + callers.push( a.constructor ); + + // track reference to avoid circular references + parents.push( a ); + parentsB.push( b ); + + // be strict: don't ensure hasOwnProperty and go deep + for ( i in a ) { + loop = false; + for ( j = 0; j < parents.length; j++ ) { + aCircular = parents[j] === a[i]; + bCircular = parentsB[j] === b[i]; + if ( aCircular || bCircular ) { + if ( a[i] === b[i] || aCircular && bCircular ) { + loop = true; + } else { + eq = false; + break; + } + } + } + aProperties.push(i); + if ( !loop && !innerEquiv(a[i], b[i]) ) { + eq = false; + break; + } + } + + parents.pop(); + parentsB.pop(); + callers.pop(); // unstack, we are done + + for ( i in b ) { + bProperties.push( i ); // collect b's properties + } + + // Ensures identical properties name + return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); + } + }; + }()); + + innerEquiv = function() { // can take multiple arguments + var args = [].slice.apply( arguments ); + if ( args.length < 2 ) { + return true; // end transition + } + + return (function( a, b ) { + if ( a === b ) { + return true; // catch the most you can + } else if ( a === null || b === null || typeof a === "undefined" || + typeof b === "undefined" || + QUnit.objectType(a) !== QUnit.objectType(b) ) { + return false; // don't lose time with error prone cases + } else { + return bindCallbacks(a, callbacks, [ b, a ]); + } + + // apply transition with (1..n) arguments + }( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) ); + }; + + return innerEquiv; +}()); + +/** + * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | + * http://flesler.blogspot.com Licensed under BSD + * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 + * + * @projectDescription Advanced and extensible data dumping for Javascript. + * @version 1.0.0 + * @author Ariel Flesler + * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} + */ +QUnit.jsDump = (function() { + function quote( str ) { + return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\""; + } + function literal( o ) { + return o + ""; + } + function join( pre, arr, post ) { + var s = jsDump.separator(), + base = jsDump.indent(), + inner = jsDump.indent(1); + if ( arr.join ) { + arr = arr.join( "," + s + inner ); + } + if ( !arr ) { + return pre + post; + } + return [ pre, inner + arr, base + post ].join(s); + } + function array( arr, stack ) { + var i = arr.length, ret = new Array(i); + this.up(); + while ( i-- ) { + ret[i] = this.parse( arr[i] , undefined , stack); + } + this.down(); + return join( "[", ret, "]" ); + } + + var reName = /^function (\w+)/, + jsDump = { + // type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { + stack = stack || [ ]; + var inStack, res, + parser = this.parsers[ type || this.typeOf(obj) ]; + + type = typeof parser; + inStack = inArray( obj, stack ); + + if ( inStack !== -1 ) { + return "recursion(" + (inStack - stack.length) + ")"; + } + if ( type === "function" ) { + stack.push( obj ); + res = parser.call( this, obj, stack ); + stack.pop(); + return res; + } + return ( type === "string" ) ? parser : this.parsers.error; + }, + typeOf: function( obj ) { + var type; + if ( obj === null ) { + type = "null"; + } else if ( typeof obj === "undefined" ) { + type = "undefined"; + } else if ( QUnit.is( "regexp", obj) ) { + type = "regexp"; + } else if ( QUnit.is( "date", obj) ) { + type = "date"; + } else if ( QUnit.is( "function", obj) ) { + type = "function"; + } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { + type = "window"; + } else if ( obj.nodeType === 9 ) { + type = "document"; + } else if ( obj.nodeType ) { + type = "node"; + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { + type = "array"; + } else if ( obj.constructor === Error.prototype.constructor ) { + type = "error"; + } else { + type = typeof obj; + } + return type; + }, + separator: function() { + return this.multiline ? this.HTML ? "<br />" : "\n" : this.HTML ? " " : " "; + }, + // extra can be a number, shortcut for increasing-calling-decreasing + indent: function( extra ) { + if ( !this.multiline ) { + return ""; + } + var chr = this.indentChar; + if ( this.HTML ) { + chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); + } + return new Array( this.depth + ( extra || 0 ) ).join(chr); + }, + up: function( a ) { + this.depth += a || 1; + }, + down: function( a ) { + this.depth -= a || 1; + }, + setParser: function( name, parser ) { + this.parsers[name] = parser; + }, + // The next 3 are exposed so you can use them + quote: quote, + literal: literal, + join: join, + // + depth: 1, + // This is the list of parsers, to modify them, use jsDump.setParser + parsers: { + window: "[Window]", + document: "[Document]", + error: function(error) { + return "Error(\"" + error.message + "\")"; + }, + unknown: "[Unknown]", + "null": "null", + "undefined": "undefined", + "function": function( fn ) { + var ret = "function", + // functions never have name in IE + name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; + + if ( name ) { + ret += " " + name; + } + ret += "( "; + + ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); + return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); + }, + array: array, + nodelist: array, + "arguments": array, + object: function( map, stack ) { + /*jshint forin:false */ + var ret = [ ], keys, key, val, i; + QUnit.jsDump.up(); + keys = []; + for ( key in map ) { + keys.push( key ); + } + keys.sort(); + for ( i = 0; i < keys.length; i++ ) { + key = keys[ i ]; + val = map[ key ]; + ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); + } + QUnit.jsDump.down(); + return join( "{", ret, "}" ); + }, + node: function( node ) { + var len, i, val, + open = QUnit.jsDump.HTML ? "<" : "<", + close = QUnit.jsDump.HTML ? ">" : ">", + tag = node.nodeName.toLowerCase(), + ret = open + tag, + attrs = node.attributes; + + if ( attrs ) { + for ( i = 0, len = attrs.length; i < len; i++ ) { + val = attrs[i].nodeValue; + // IE6 includes all attributes in .attributes, even ones not explicitly set. + // Those have values like undefined, null, 0, false, "" or "inherit". + if ( val && val !== "inherit" ) { + ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); + } + } + } + ret += close; + + // Show content of TextNode or CDATASection + if ( node.nodeType === 3 || node.nodeType === 4 ) { + ret += node.nodeValue; + } + + return ret + open + "/" + tag + close; + }, + // function calls it internally, it's the arguments part of the function + functionArgs: function( fn ) { + var args, + l = fn.length; + + if ( !l ) { + return ""; + } + + args = new Array(l); + while ( l-- ) { + // 97 is 'a' + args[l] = String.fromCharCode(97+l); + } + return " " + args.join( ", " ) + " "; + }, + // object calls it internally, the key part of an item in a map + key: quote, + // function calls it internally, it's the content of the function + functionCode: "[code]", + // node calls it internally, it's an html attribute value + attribute: quote, + string: quote, + date: quote, + regexp: literal, + number: literal, + "boolean": literal + }, + // if true, entities are escaped ( <, >, \t, space and \n ) + HTML: false, + // indentation unit + indentChar: " ", + // if true, items in a collection, are separated by a \n, else just a space. + multiline: true + }; + + return jsDump; +}()); + +/* + * Javascript Diff Algorithm + * By John Resig (http://ejohn.org/) + * Modified by Chu Alan "sprite" + * + * Released under the MIT license. + * + * More Info: + * http://ejohn.org/projects/javascript-diff-algorithm/ + * + * Usage: QUnit.diff(expected, actual) + * + * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over" + */ +QUnit.diff = (function() { + /*jshint eqeqeq:false, eqnull:true */ + function diff( o, n ) { + var i, + ns = {}, + os = {}; + + for ( i = 0; i < n.length; i++ ) { + if ( !hasOwn.call( ns, n[i] ) ) { + ns[ n[i] ] = { + rows: [], + o: null + }; + } + ns[ n[i] ].rows.push( i ); + } + + for ( i = 0; i < o.length; i++ ) { + if ( !hasOwn.call( os, o[i] ) ) { + os[ o[i] ] = { + rows: [], + n: null + }; + } + os[ o[i] ].rows.push( i ); + } + + for ( i in ns ) { + if ( hasOwn.call( ns, i ) ) { + if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { + n[ ns[i].rows[0] ] = { + text: n[ ns[i].rows[0] ], + row: os[i].rows[0] + }; + o[ os[i].rows[0] ] = { + text: o[ os[i].rows[0] ], + row: ns[i].rows[0] + }; + } + } + } + + for ( i = 0; i < n.length - 1; i++ ) { + if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && + n[ i + 1 ] == o[ n[i].row + 1 ] ) { + + n[ i + 1 ] = { + text: n[ i + 1 ], + row: n[i].row + 1 + }; + o[ n[i].row + 1 ] = { + text: o[ n[i].row + 1 ], + row: i + 1 + }; + } + } + + for ( i = n.length - 1; i > 0; i-- ) { + if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && + n[ i - 1 ] == o[ n[i].row - 1 ]) { + + n[ i - 1 ] = { + text: n[ i - 1 ], + row: n[i].row - 1 + }; + o[ n[i].row - 1 ] = { + text: o[ n[i].row - 1 ], + row: i - 1 + }; + } + } + + return { + o: o, + n: n + }; + } + + return function( o, n ) { + o = o.replace( /\s+$/, "" ); + n = n.replace( /\s+$/, "" ); + + var i, pre, + str = "", + out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), + oSpace = o.match(/\s+/g), + nSpace = n.match(/\s+/g); + + if ( oSpace == null ) { + oSpace = [ " " ]; + } + else { + oSpace.push( " " ); + } + + if ( nSpace == null ) { + nSpace = [ " " ]; + } + else { + nSpace.push( " " ); + } + + if ( out.n.length === 0 ) { + for ( i = 0; i < out.o.length; i++ ) { + str += "<del>" + out.o[i] + oSpace[i] + "</del>"; + } + } + else { + if ( out.n[0].text == null ) { + for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { + str += "<del>" + out.o[n] + oSpace[n] + "</del>"; + } + } + + for ( i = 0; i < out.n.length; i++ ) { + if (out.n[i].text == null) { + str += "<ins>" + out.n[i] + nSpace[i] + "</ins>"; + } + else { + // `pre` initialized at top of scope + pre = ""; + + for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { + pre += "<del>" + out.o[n] + oSpace[n] + "</del>"; + } + str += " " + out.n[i].text + nSpace[i] + pre; + } + } + } + + return str; + }; +}()); + +// For browser, export only select globals +if ( typeof window !== "undefined" ) { + extend( window, QUnit.constructor.prototype ); + window.QUnit = QUnit; +} + +// For CommonJS environments, export everything +if ( typeof module !== "undefined" && module.exports ) { + module.exports = QUnit; +} + + +// Get a reference to the global object, like window in browsers +}( (function() { + return this; +})() )); diff --git a/dev/tests/js/jsTestDriver.php.dist b/dev/tests/js/jsTestDriver.php.dist index 882f452bcc01ba44dbfecc3a58af15fa9f282dd5..2177f06cb33fc96f421a7f9d580d4c6d73a16c5f 100644 --- a/dev/tests/js/jsTestDriver.php.dist +++ b/dev/tests/js/jsTestDriver.php.dist @@ -47,7 +47,7 @@ return array( '/app/code/Magento/DesignEditor/view/frontend/css/styles.css', '/pub/lib/mage/cookies.js', '/pub/lib/mage/calendar.js', - '/pub/lib/mage/loader.js', + '/pub/lib/mage/loader_old.js', '/pub/lib/mage/edit-trigger.js', '/pub/lib/mage/translate-inline.js', '/pub/lib/mage/translate-inline-vde.js', diff --git a/dev/tests/js/jsTestDriverOrder.php b/dev/tests/js/jsTestDriverOrder.php index 7fe3e7f813902dfa98532a645f5c611c8c6b1be9..74060e496446810c7da9a04e1713b52175ee2693 100644 --- a/dev/tests/js/jsTestDriverOrder.php +++ b/dev/tests/js/jsTestDriverOrder.php @@ -29,8 +29,8 @@ * @return array */ return array( - '/pub/lib/jquery/jquery.js', - '/pub/lib/jquery/jquery-ui.js', + '/pub/lib/jquery/jquery-1.8.2.js', + '/pub/lib/jquery/jquery-ui-1.9.2.js', '/pub/lib/jquery/jquery.cookie.js', '/pub/lib/headjs/head.load.min.js', '/pub/lib/mage/mage.js', diff --git a/dev/tests/js/testsuite/mage/_demo/index.html b/dev/tests/js/testsuite/mage/_demo/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8a33e936156221f024a3a68c364a7619886963f5 --- /dev/null +++ b/dev/tests/js/testsuite/mage/_demo/index.html @@ -0,0 +1,42 @@ +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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._demo + * @package test + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> + +<!DOCTYPE html> +<html> +<head> + <title>Unit test</title> + <base href="../../../"/> + <link type="text/css" rel="stylesheet" href="framework/qunit/qunit-1.14.0.css"/> + <script type="text/javascript" src="framework/qunit/qunit-1.14.0.js"></script> + + <script type="text/javascript" src="testsuite/mage/_demo/test.js"></script> +</head> +<body> + <div id="qunit"></div> + <div id="qunit-fixture"></div> +</body> +</html> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/di.xml b/dev/tests/js/testsuite/mage/_demo/test.js similarity index 88% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/di.xml rename to dev/tests/js/testsuite/mage/_demo/test.js index c7c5011ea975524750a9ad0d60a0aca0d3888f60..ca71e5cf39dc4f6256a76534cdd6f5c5700b1f28 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/di.xml +++ b/dev/tests/js/testsuite/mage/_demo/test.js @@ -1,5 +1,3 @@ -<?xml version="1.0"?> -<!-- /** * Magento * @@ -19,8 +17,11 @@ * 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._demo + * @package test * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ---> -<config/> +test( "hello test", function() { + ok( 1 == "1", "Passed!" ); +}); \ No newline at end of file diff --git a/dev/tests/js/testsuite/mage/loader/jquery-loader-test.js b/dev/tests/js/testsuite/mage/loader/jquery-loader-test.js new file mode 100644 index 0000000000000000000000000000000000000000..8c39cc2b4333b69d841196d86390d4e7dbc2f9c6 --- /dev/null +++ b/dev/tests/js/testsuite/mage/loader/jquery-loader-test.js @@ -0,0 +1,110 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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.loader + * @package test + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +test('options', function() { + expect(3); + + var element = $("#loader").loader({ + icon: 'icon.gif', + texts: { + imgAlt: 'Image Text', + loaderText: 'Loader Text' + }, + template: '<div class="loading-mask" data-role="loader"><div class="loader"><img alt="{{imgAlt}}" src="{{icon}}"><p>{{loaderText}}</p></div></div>' + }); + element.loader('show'); + equal( element.find('p').text(), 'Loader Text', '.loader() text matches' ); + equal( element.find('img').prop('src').split('/').pop(), 'icon.gif', '.loader() icons match' ); + equal( element.find('img').prop('alt'), 'Image Text', '.loader() image alt text matches' ); + element.loader('destroy'); + +}); + +test( 'element init', function() { + expect(1); + + //Initialize Loader on element + var element = $("#loader").loader({ + icon: 'icon.gif', + texts: { + imgAlt: 'Image Text', + loaderText: 'Loader Text' + }, + template: '<div class="loading-mask" data-role="loader"><div class="loader"><img alt="{{imgAlt}}" src="{{icon}}"><p>{{loaderText}}</p></div></div>' + }); + element.loader('show'); + equal(element.is(':mage-loader'), true, '.loader() init on element'); + element.remove(); + +}); + +test( 'body init', function() { + expect(1); + + //Initialize Loader on Body + var body = $('body').loader(); + body.loader('show'); + equal(true, $('body div:first').is('.loading-mask')); + $('body').find('.loading-mask:first').remove(); + +}); + +test( 'show/hide', function() { + expect(3); + + var element = $('body').loader(); + + //Loader show + element.loader('show'); + equal($('.loading-mask').is(':visible'), true, '.loader() open'); + + //Loader hide + element.loader('hide'); + equal($('.loading-mask').is( ":hidden" ), false, '.loader() closed' ); + + //Loader hide on process complete + element.loader('show'); + element.trigger('processStop'); + equal($('.loading-mask').is('visible'), false, '.loader() closed after process'); + + element.find('.loading-mask').remove(); + +}); + +test( 'destroy', function() { + expect(1); + + var element = $("#loader").loader({ + icon: 'icon.gif', + texts: { + imgAlt: 'Image Text', + loaderText: 'Loader Text' + }, + template: '<div class="loading-mask" data-role="loader"><div class="loader"><img alt="{{imgAlt}}" src="{{icon}}"><p>{{loaderText}}</p></div></div>' + }); + element.loader('show'); + element.loader('destroy'); + equal( $('.loading-mask').is(':visible'), false, '.loader() destroyed'); + +}); \ No newline at end of file diff --git a/dev/tests/js/testsuite/mage/loader/loader.html b/dev/tests/js/testsuite/mage/loader/loader.html new file mode 100644 index 0000000000000000000000000000000000000000..6191bf7693cacfddd165b22b131cbb0ba485b1d0 --- /dev/null +++ b/dev/tests/js/testsuite/mage/loader/loader.html @@ -0,0 +1,57 @@ +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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.loader + * @package test + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<!DOCTYPE html> +<html> +<head> + <title>Unit test</title> + <base href="../../../"/> + <link type="text/css" rel="stylesheet" href="framework/qunit/qunit-1.14.0.css"/> + <script src="../../../pub/lib/jquery/jquery.js"></script> + <script src="../../../pub/lib/jquery/jquery-ui.js"></script> + <script type="text/javascript" src="framework/qunit/qunit-1.14.0.js"></script> + <script type="text/javascript" src="../../../pub/lib/mage/mage.js"></script> + <script src="../../../pub/lib/jquery/handlebars/handlebars-v1.3.0.js"></script> + <script type="text/javascript" src="../../../pub/lib/mage/loader.js"></script> + <script type="text/javascript" src="testsuite/mage/loader/jquery-loader-test.js"></script> +</head> +<script id="loader-template" type="text/x-handlebars-template"> + <div class="loading-mask" data-role="loader"> + <div class="loader"> + <img alt="{{imgAlt}}" src="{{icon}}"> + <p>{{loaderText}}</p> + </div> + </div> +</script> +<body data-mage-init='{"loader": {"template":"#loader-template"}}'> + <div id="qunit"></div> + <div id="qunit-fixture"></div> + <div id="loader"></div> + <script type="text/javascript"> + $.mage.init(); + </script> +</body> +</html> \ No newline at end of file diff --git a/dev/tests/performance/framework/Magento/TestFramework/Helper/Categories.php b/dev/tests/performance/framework/Magento/TestFramework/Helper/Categories.php index 8977afedabb31a365c9db391f7c7dd5db7031d08..c94582d8200c0014fc1847167fcaa6c40453520f 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Helper/Categories.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Helper/Categories.php @@ -58,7 +58,7 @@ class Categories { $rootCategoryId = $this->getObjectManager()->create( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->getDefaultStoreView()->getRootCategoryId(); /** @var $category \Magento\Catalog\Model\Category */ diff --git a/dev/tests/performance/run_scenarios.php b/dev/tests/performance/run_scenarios.php index 5cb61528617cac87ed2553f3592334a517f76d9e..7199d5f31d3579eb1e2cb076d7f93c71ceaa66fc 100644 --- a/dev/tests/performance/run_scenarios.php +++ b/dev/tests/performance/run_scenarios.php @@ -33,7 +33,7 @@ $logWriter = new \Zend_Log_Writer_Stream('php://output'); $logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL)); $logger = new \Zend_Log($logWriter); -$shell = new \Magento\Shell(new \Magento\OSInfo(), $logger); +$shell = new \Magento\Shell(new \Magento\Shell\CommandRenderer(), $logger); $scenarioHandler = new \Magento\TestFramework\Performance\Scenario\Handler\FileFormat(); $scenarioHandler->register( 'jmx', diff --git a/dev/tests/performance/testsuite/fixtures/catalog_200_categories_80k_products.php b/dev/tests/performance/testsuite/fixtures/catalog_200_categories_80k_products.php index 0c956916c1aec6f131f0941d7e709d1989017c7b..5e400f9ad4f1b0bfab39ca38987a942f1bc289db 100644 --- a/dev/tests/performance/testsuite/fixtures/catalog_200_categories_80k_products.php +++ b/dev/tests/performance/testsuite/fixtures/catalog_200_categories_80k_products.php @@ -33,7 +33,7 @@ $anchorStep = 2; $nestingLevel = 1; $parentCategoryId = $defaultParentCategoryId = $this->getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getRootCategoryId(); $nestingPath = "1/{$parentCategoryId}"; $categoryPath = ''; @@ -97,8 +97,6 @@ $pattern = array( 'visibility' => \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH, 'status' => \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, 'tax_class_id' => 0, - - // actually it saves without stock data, but by default system won't show on the frontend products out of stock 'is_in_stock' => 1, 'qty' => 100500, 'use_config_min_qty' => '1', diff --git a/dev/tests/performance/testsuite/fixtures/catalog_category_flat_enabled.php b/dev/tests/performance/testsuite/fixtures/catalog_category_flat_enabled.php index ef6388bca4b3fc55da1950656c22997d3803bcfe..ee1764e16a6b7fae2cecace211fa9658e13498ca 100644 --- a/dev/tests/performance/testsuite/fixtures/catalog_category_flat_enabled.php +++ b/dev/tests/performance/testsuite/fixtures/catalog_category_flat_enabled.php @@ -31,7 +31,7 @@ $configData = $this->getObjectManager()->create('Magento\App\Config\ValueInterfa $configData->setPath( 'catalog/frontend/flat_catalog_category' )->setScope( - \Magento\BaseScopeInterface::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT )->setScopeId( 0 )->setValue( diff --git a/dev/tests/performance/testsuite/fixtures/catalog_product_flat_enabled.php b/dev/tests/performance/testsuite/fixtures/catalog_product_flat_enabled.php index ae30f07ce4200e0cb96d4802abb116fe84d3b1ae..6f8f9e594a94e43f77c0b70f0377d41d35b8aeea 100644 --- a/dev/tests/performance/testsuite/fixtures/catalog_product_flat_enabled.php +++ b/dev/tests/performance/testsuite/fixtures/catalog_product_flat_enabled.php @@ -31,7 +31,7 @@ $configData = $this->getObjectManager()->create('Magento\App\Config\ValueInterfa $configData->setPath( 'catalog/frontend/flat_catalog_product' )->setScope( - \Magento\BaseScopeInterface::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT )->setScopeId( 0 )->setValue( diff --git a/dev/tests/performance/testsuite/fixtures/sales_100k_orders.php b/dev/tests/performance/testsuite/fixtures/sales_100k_orders.php index 2392c4e197a58ca9c9a2a12167162021a3b9f5f6..e70d3170b8832b9df0e1a7d61dd7c5d6ab3b67ba 100644 --- a/dev/tests/performance/testsuite/fixtures/sales_100k_orders.php +++ b/dev/tests/performance/testsuite/fixtures/sales_100k_orders.php @@ -64,7 +64,7 @@ $order->setBaseSubtotal( \Magento\Sales\Model\Order::STATE_NEW, true )->setStoreId( - $this->getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore()->getId() + $this->getObjectManager()->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getId() ); for ($i = 1; $i <= 100000; $i++) { diff --git a/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php b/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php index 1f2a972d83cbbcc617387cf7aae2557d376a5166..4efe847825915a2443b849bf538fc3eabbfc2c13 100644 --- a/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php +++ b/dev/tests/performance/testsuite/fixtures/shipping_flatrate_enabled.php @@ -31,7 +31,7 @@ $configData = $this->getObjectManager()->create('Magento\App\Config\ValueInterfa $configData->setPath( 'carriers/flatrate/active' )->setScope( - \Magento\BaseScopeInterface::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT )->setScopeId( 0 )->setValue( diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ConcreteImplementationTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ConcreteImplementationTest.php deleted file mode 100644 index e46ff1267e85eb992282e5509265905d2e236723..0000000000000000000000000000000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ConcreteImplementationTest.php +++ /dev/null @@ -1,71 +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 tests - * @package static - * @subpackage Integrity - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Test\Integrity; - -/** - * Scan source code for dependency of blacklisted classes - */ -class ConcreteImplementationTest extends \PHPUnit_Framework_TestCase -{ - /** - * Classes that should not be injected as dependency in app code - * - * @var array - */ - protected static $_classesBlacklist = null; - - public function testWrongConcreteImplementation() - { - self::$_classesBlacklist = file(__DIR__ . '/_files/classes/blacklist.txt', FILE_IGNORE_NEW_LINES); - - $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); - $invoker( - /** - * @param string $file - */ - function ($file) { - $content = file_get_contents($file); - - if (strpos($content, "namespace Magento\Core") !== false) { - return; - } - - $result = (bool)preg_match('/function __construct\(([^\)]*)\)/iS', $content, $matches); - if ($result && !empty($matches[1])) { - $arguments = explode(',', $matches[1]); - foreach ($arguments as $argument) { - $type = explode(' ', trim($argument)); - if (in_array(trim($type[0]), self::$_classesBlacklist)) { - $this->fail("Incorrect class dependency found in {$file}:" . trim($type[0])); - } - } - } - }, - \Magento\TestFramework\Utility\Files::init()->getClassFiles(true, false, false, false, false, false) - ); - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php index ee2fcd49b6cd5d58d0ed1c3e72f48d71321496c7..005f0a229e4750cb0439bf4d94475931e67d13bf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -74,7 +74,7 @@ class CompilerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_shell = new \Magento\Shell(new \Magento\OSInfo()); + $this->_shell = new \Magento\Shell(new \Magento\Shell\CommandRenderer()); $basePath = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); $basePath = str_replace('\\', '/', $basePath); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt deleted file mode 100644 index b8dc7df58440314e906937ce85c8d5b651071fb0..0000000000000000000000000000000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt +++ /dev/null @@ -1,23 +0,0 @@ -\Magento\Backend\Model\Url -\Magento\Core\Model\Url\RouteParamsResolver -\Magento\Core\Model\Url\SecurityInfo -\Magento\Core\Model\Url\ScopeResolver -\Magento\Url -\Magento\App\Config -\Magento\App\ReinitableConfig -\Magento\Core\Model\Config\Scope\ReaderPool -\Magento\Core\Model\Config\Scope\Store\Converter -\Magento\Core\Model\Config\Scope\Reader\DefaultReader -\Magento\Core\Model\Config\Scope\Reader\Store -\Magento\Core\Model\Config\Scope\Reader\Website -\Magento\Core\Model\Config\Scope\Processor\Placeholder -\Magento\Core\Model\Config\Storage\Db -\Magento\Core\Model\Config\Value -\Magento\Core\Model\Config\FileResolver -\Magento\Core\Model\Config\Cache -\Magento\Core\Model\Config\Base -\Magento\Translation\Model\String -\Magento\Translation\Model\Inline\Config -\Magento\Translation\Model\Inline\Parser -\Magento\Translate -\Magento\Email\Model\Template diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index de6e42f208ebe047aaa2f363d2e59ebcf063202a..54ed037558e8f7aefab84c00fbefe9e381ea70d8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -137,15 +137,15 @@ return array( 'core_layout_link' => 'Magento_Core', 'core_layout_update' => 'Magento_Core', 'core_resource' => 'Magento_Core', - 'core_session' => 'Magento_Core', - 'core_store' => 'Magento_Core', - 'core_store_group' => 'Magento_Core', 'core_translate' => 'Magento_Core', 'core_url_rewrite' => 'Magento_Core', 'core_url_rewrite_tag' => 'Magento_Core', 'core_variable' => 'Magento_Core', 'core_variable_value' => 'Magento_Core', - 'core_website' => 'Magento_Core', + 'core_session' => 'Magento_Core', + 'store' => 'Magento_Store', + 'store_group' => 'Magento_Store', + 'store_website' => 'Magento_Store', 'cron_schedule' => 'Magento_Cron', 'customer_address_entity' => 'Magento_Customer', 'customer_group' => 'Magento_Customer', @@ -239,13 +239,13 @@ return array( 'persistent_session' => 'Magento_Persistent', 'product_alert_price' => 'Magento_ProductAlert', 'product_alert_stock' => 'Magento_ProductAlert', - 'rating' => 'Magento_Rating', - 'rating_entity' => 'Magento_Rating', - 'rating_option' => 'Magento_Rating', - 'rating_option_vote' => 'Magento_Rating', - 'rating_store' => 'Magento_Rating', - 'rating_title' => 'Magento_Rating', - 'rating_option_vote_aggregated' => 'Magento_Rating', + 'rating' => 'Magento_Review', + 'rating_entity' => 'Magento_Review', + 'rating_option' => 'Magento_Review', + 'rating_option_vote' => 'Magento_Review', + 'rating_store' => 'Magento_Review', + 'rating_title' => 'Magento_Review', + 'rating_option_vote_aggregated' => 'Magento_Review', 'report_compared_product_index' => 'Magento_Reports', 'report_event' => 'Magento_Reports', 'report_event_types' => 'Magento_Reports', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 4671fad457a24913da2b40bc0c7a8a88f7a3ca7a..a56820c01a24448813b97f5a4631d532788cf589 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -599,8 +599,10 @@ return array( array('Mage_Adminhtml_Model_System_Config_Source_Store', 'Magento\Backend\Model\Config\Source\Store'), array('Mage_Adminhtml_Model_System_Config_Source_Website', 'Magento\Backend\Model\Config\Source\Website'), array('Mage_Adminhtml_Model_System_Config_Source_Yesno', 'Magento\Backend\Model\Config\Source\Yesno'), - array('Mage_Adminhtml_Model_System_Config_Source_Yesnocustom', 'Magento\Backend\Model\Config\Source\Yesnocustom'), - array('Mage_Adminhtml_Model_System_Store', 'Magento\Core\Model\System\Store'), + array('Mage_Adminhtml_Model_System_Config_Source_Yesnocustom', + 'Magento\Backend\Model\Config\Source\Yesnocustom' + ), + array('Mage_Adminhtml_Model_System_Store', 'Magento\Store\Model\System\Store'), array('Mage_Adminhtml_Model_Url', 'Magento\Backend\Model\UrlInterface'), array('Mage_Adminhtml_Rss_CatalogController'), array('Mage_Adminhtml_Rss_OrderController'), @@ -832,6 +834,8 @@ return array( array('Mage_Core_Model_Session_Abstract_Varien'), array('Mage_Core_Model_Session_Abstract_Zend'), array('Magento\Core\Model\Source\Email\Variables', 'Magento\Email\Model\Source\Variables'), + array('Magento\Core\Model\Store\ListInterface', 'Magento\Store\Model\StoreManagerInterface'), + array('Magento\Core\Model\Store\StorageInterface', 'Magento\Store\Model\StoreManagerInterface'), array('Mage_Core_Model_Store_Group_Limitation'), array('Mage_Core_Model_Store_Limitation'), array('Magento\Core\Model\Variable\Observer'), @@ -1356,7 +1360,7 @@ return array( array('Magento\HTTP\HandlerInterface'), array('Magento\Backend\Model\Request\PathInfoProcessor'), array('Magento\Backend\Model\Router\NoRouteHandler'), - array('Magento\Core\Model\Request\PathInfoProcessor'), + array('Magento\Core\Model\Request\PathInfoProcessor', 'Magento\Store\App\Request\PathInfoProcessor'), array('Magento\Core\Model\Request\RewriteService'), array('Magento\Core\Model\Router\NoRouteHandler'), array('Magento\Core\Model\Resource\SetupFactory'), @@ -1786,7 +1790,7 @@ return array( array('Magento\Core\Model\Theme\Label', 'Magento\View\Design\Theme\Label'), array('Magento\Core\Model\Theme\LabelFactory', 'Magento\View\Design\Theme\LabelFactory'), array('Magento\Core\Model\DesignLoader', 'Magento\View\DesignLoader'), - array('Magento\Page\Block\Switcher', 'Magento\Core\Block\Switcher'), + array('Magento\Page\Block\Switcher', 'Magento\Store\Block\Switcher'), array('Magento\Core\Model\Layout\PageType\Config', 'Magento\View\Layout\PageType\Config'), array('Magento\Core\Model\Layout\PageType\Config\Converter', 'Magento\View\Layout\PageType\Config\Converter'), array('Magento\Core\Model\Layout\PageType\Config\Reader', 'Magento\View\Layout\PageType\Config\Reader'), @@ -1802,7 +1806,7 @@ return array( array('Magento\Catalog\Model\Resource\Convert'), array('Magento\Reminder\Model\Resource\HelperFactory'), array('Magento\Reminder\Model\Resource\Helper'), - array('Magento\Core\Model\ConfigInterface', 'Magento\App\ConfigInterface'), + array('Magento\Core\Model\ConfigInterface', 'Magento\App\Config\ScopeConfigInterface'), array('Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser'), array( 'Magento\Catalog\Model\Product\Attribute\Backend\Recurring', @@ -1975,7 +1979,7 @@ return array( array('Magento\View\Layout\Argument\HandlerInterface', 'Magento\Data\Argument\InterpreterInterface'), array('Magento\View\Layout\Argument\HandlerFactory', 'Magento\Data\Argument\Interpreter\Composite'), array('Magento\Phrase\Renderer\Factory'), - array('Magento\Core\Model\Layout\Factory', 'Magento\DesignEditor\Model\AreaEmulator'), + array('Magento\View\Layout\Factory', 'Magento\DesignEditor\Model\AreaEmulator'), array('Magento\Catalog\Model\Category\Indexer\Product'), array('Magento\Catalog\Model\Resource\Category\Indexer\Product'), array('Magento\Catalog\Model\Index'), @@ -2126,11 +2130,8 @@ return array( 'Magento\Usa\Model\Shipping\Carrier\AbstractCarrier\Source\Requesttype', 'Magento\Shipping\Model\Config\Source\Online\Requesttype' ), - array('Magento\Catalog\Helper\Product\Url', 'Magento\Filter\Translit'), - array('Magento\Catalog\Model\Product\Indexer\Price'), - array('Magento\Catalog\Model\Resource\Product\Indexer\Price'), - ['Magento\PubSub'], // unused library code which was removed - ['Magento\Outbound'], // unused library code which was removed + ['Magento\PubSub'], + ['Magento\Outbound'], array('Magento\Indexer\Model\Processor\CacheInvalidate', 'Magento\Indexer\Model\Processor\InvalidateCache'), array( 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews', @@ -2203,4 +2204,93 @@ return array( 'Magento\Core\App\Request\RewriteService', 'Magento\UrlRewrite\App\Request\RewriteService' ), + ['Magento\Catalog\Model\Product\Indexer\Price'], + ['Magento\Catalog\Model\Resource\Product\Indexer\Price'], + ['Magento\App\ConfigInterface', 'Magento\App\Config\ScopeConfigInterface'], + ['Magento\Core\Model\Store\ConfigInterface', 'Magento\App\Config\ScopeConfigInterface'], + ['Magento\Core\Model\Store\Config', 'Magento\App\Config\ScopeConfigInterface'], + ['Magento\App\Locale\ScopeConfigInterface', 'Magento\App\Config\ScopeConfigInterface'], + ['Magento\Core\App\Action\Plugin\StoreCheck', 'Magento\Store\App\Action\Plugin\StoreCheck'], + [ + 'Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler', + 'Magento\Store\App\FrontController\Plugin\DispatchExceptionHandler' + ], + [ + 'Magento\Core\App\FrontController\Plugin\RequestPreprocessor', + 'Magento\Store\App\FrontController\Plugin\RequestPreprocessor' + ], + ['Magento\Core\App\Response\Redirect', 'Magento\Store\App\Response\Redirect'], + ['Magento\Core\Block\Store\Switcher', 'Magento\Store\Block\Store\Switcher'], + ['Magento\Core\Block\Switcher', 'Magento\Store\Block\Switcher'], + ['Magento\Core\Helper\Cookie', 'Magento\Store\Helper\Cookie'], + ['Magento\Core\Model\BaseScopeResolver'], + ['Magento\Core\Model\Config\Scope\Processor\Placeholder', 'Magento\Store\Model\Config\Processor\Placeholder'], + ['Magento\Core\Model\Config\Scope\Reader\DefaultReader', 'Magento\Store\Model\Config\Reader\DefaultReader'], + ['Magento\Core\Model\Config\Scope\Reader\Store', 'Magento\Store\Model\Config\Reader\Store'], + ['Magento\Core\Model\Config\Scope\Reader\Website', 'Magento\Store\Model\Config\Reader\Website'], + ['Magento\Core\Model\Config\Scope\ReaderPool', 'Magento\Store\Model\Config\Reader\ReaderPool'], + ['Magento\Core\Model\Resource\Store', 'Magento\Store\Model\Resource\Store'], + ['Magento\Core\Model\Resource\Store\Collection', 'Magento\Store\Model\Resource\Store\Collection'], + ['Magento\Core\Model\Resource\Store\Group', 'Magento\Store\Model\Resource\Group'], + ['Magento\Core\Model\Resource\Store\Group\Collection', 'Magento\Store\Model\Resource\Group\Collection'], + ['Magento\Core\Model\Resource\Website', 'Magento\Store\Model\Resource\Website'], + ['Magento\Core\Model\Resource\Website\Collection', 'Magento\Store\Model\Resource\Website\Collection'], + ['Magento\Core\Model\Resource\Website\Grid\Collection', 'Magento\Store\Model\Resource\Website\Grid\Collection'], + ['Magento\Core\Model\ScopeInterface', 'Magento\Store\Model\ScopeInterface'], + ['Magento\Core\Model\Store', 'Magento\Store\Model\Store'], + ['Magento\Core\Model\Store\Exception', 'Magento\Store\Model\Exception'], + ['Magento\Core\Model\Store\Group', 'Magento\Store\Model\Group'], + ['Magento\Core\Model\Store\Group\Factory', 'Magento\Store\Model\Group\Factory'], + ['Magento\Core\Model\Store\Storage\Db', 'Magento\Store\Model\Storage\Db'], + ['Magento\Core\Model\Store\Storage\DefaultStorage', 'Magento\Store\Model\Storage\DefaultStorage'], + ['Magento\Core\Model\Store\StorageFactory', 'Magento\Store\Model\StorageFactory'], + ['Magento\Core\Model\StoreManager', 'Magento\Store\Model\StoreManager'], + ['Magento\Core\Model\StoreManagerInterface', 'Magento\Store\Model\StoreManagerInterface'], + ['Magento\Core\Model\System\Store', 'Magento\Store\Model\System\Store'], + ['Magento\Core\Model\Website', 'Magento\Store\Model\Website'], + ['Magento\Core\Model\Website\Factory', 'Magento\Store\Model\Website\Factory'], + ['Magento\App\ReinitableConfigInterface', 'Magento\App\Config\ReinitableConfigInterface'], + ['Magento\BaseScopeInterface', 'Magento\App\ScopeInterface'], + ['Magento\BaseScopeResolverInterface', 'Magento\App\ScopeResolverInterface'], + ['Magento\Locale\ScopeConfigInterface'], + ['Magento\Core\Model\Module\Output\Config','Magento\Module\Output\Config'], + ['Magento\Core\Model\Resource\Setup\Context','Magento\Module\Setup\Context'], + ['Magento\Core\Model\Resource\Setup\Migration','Magento\Module\Setup\Migration'], + ['Magento\Core\Model\Resource\Setup\Generic'], + ['Magento\Newsletter\Model\Resource\Setup'], + ['Magento\SalesRule\Model\Resource\Setup'], + ['Magento\Catalog\Helper\Product\Url', 'Magento\Filter\Translit'], + array('Magento\Core\Model\Session', 'Magento\Session\Generic'), + array('Magento\Core\Model\Session\Config', 'Magento\Session\Config'), + array('Magento\Core\Model\Session\SidResolver', 'Magento\Session\SidResolver'), + array('Magento\Core\Model\Session\Validator', 'Magento\Session\Validator'), + ['Magento\Core\Block\Formkey', 'Magento\View\Element\FormKey'], + ['Magento\Rating\Helper\Data', 'Magento\Review\Helper\Data'], + ['Magento\Rating\Controller\Adminhtml\Index', 'Magento\Review\Controller\Adminhtml\Rating'], + ['Magento\Rating\Block\Entity\Detailed', 'Magento\Review\Block\Rating\Entity\Detailed'], + ['Magento\Rating\Block\Adminhtml\Rating', 'Magento\Review\Block\Adminhtml\Rating'], + ['Magento\Rating\Block\Adminhtml\Edit', 'Magento\Review\Block\Adminhtml\Rating\Edit'], + ['Magento\Rating\Block\Adminhtml\Edit\Tabs', 'Magento\Review\Block\Adminhtml\Rating\Edit\Tabs'], + ['Magento\Rating\Block\Adminhtml\Edit\Form', 'Magento\Review\Block\Adminhtml\Rating\Edit\Form'], + ['Magento\Rating\Block\Adminhtml\Edit\Tab\Form', 'Magento\Review\Block\Adminhtml\Rating\Edit\Tab\Form'], + ['Magento\Rating\Block\Adminhtml\Edit\Tab\Options'], + ['Magento\Rating\Model\Rating', 'Magento\Review\Model\Rating'], + [ + 'Magento\Rating\Model\Resource\Rating\Option\Vote\Collection', + 'Magento\Review\Model\Resource\Rating\Option\Vote\Collection' + ], + [ + 'Magento\Rating\Model\Resource\Rating\Option\Collection', + 'Magento\Review\Model\Resource\Rating\Option\Collection' + ], + ['Magento\Rating\Model\Resource\Rating\Grid\Collection', 'Magento\Review\Model\Resource\Rating\Grid\Collection'], + ['Magento\Rating\Model\Resource\Rating\Collection', 'Magento\Review\Model\Resource\Rating\Collection'], + ['Magento\Rating\Model\Resource\Rating\Option\Vote', 'Magento\Review\Model\Resource\Rating\Option\Vote'], + ['Magento\Rating\Model\Rating\Option\Vote', 'Magento\Review\Model\Rating\Option\Vote'], + ['Magento\Rating\Model\Resource\Rating\Option', 'Magento\Review\Model\Resource\Rating\Option'], + ['Magento\Rating\Model\Resource\Rating\Entity', 'Magento\Review\Model\Resource\Rating\Entity'], + ['Magento\Rating\Model\Rating\Entity', 'Magento\Review\Model\Rating\Entity'], + ['Magento\Rating\Model\Resource\Rating', 'Magento\Review\Model\Resource\Rating'], + ['Magento\Rating\Model\Rating\Option', 'Magento\Review\Model\Rating\Option'], + ['Magento\Rating\Model\Observer'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php index 7dd44fadcef11a85d789a3fb23b7b9fa263ae3e1..da9e122609af0b3b2481d539b7019d3b42efcb73 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php @@ -60,7 +60,7 @@ return array( '/config/global/index' => 'This configuration moved to indexers.xml file', '/config/global/catalogrule' => 'This configuration moved to Di configuration of \Magento\CatalogRule\Model\Rule', '/config/global/salesrule' => 'This configuration moved to Di configuration of \Magento\SalesRule\Helper\Coupon', - '/config/global/session' => 'This configuration moved to Di configuration of \Magento\Core\Model\Session\Validator', + '/config/global/session' => 'This configuration moved to Di configuration of \Magento\Session\Validator', '/config/global/ignore_user_agents' => 'This configuration moved to Di configuration of \Magento\Log\Model\Visitor', '/config/global/request' => 'This configuration moved to Di configuration of \Magento\App\RequestInterface', '/config/global/secure_url' => 'This configuration moved to Di configuration of \Magento\Core\Model\Url\SecurityInfo', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index bddf1b0120ca46f5bfc22fb7def4037bc7384476..3dedc2a4aef9ca0d5a0acdb1b61c0bc5c506d419 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -77,7 +77,7 @@ return array( array('DEFAULT_THEME_NAME', 'Magento\Core\Model\Design\PackageInterface'), array('DEFAULT_THEME_NAME', 'Magento\Core\Model\Design\Package'), array('DEFAULT_TIMEZONE', 'Magento\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_TIMEZONE'), - array('DEFAULT_STORE_ID', 'Magento\Catalog\Model\AbstractModel', 'Magento\Core\Model\Store::DEFAULT_STORE_ID'), + array('DEFAULT_STORE_ID', 'Magento\Catalog\Model\AbstractModel', 'Magento\Store\Model\Store::DEFAULT_STORE_ID'), array('DEFAULT_VALUE_TABLE_PREFIX'), array('ENTITY_PRODUCT', 'Magento\Review\Model\Review'), array('EXCEPTION_CODE_IS_GROUPED_PRODUCT'), @@ -130,12 +130,12 @@ return array( array('RULE_PERM_ALLOW', '\Magento\Math\Random'), array('RULE_PERM_DENY', '\Magento\Math\Random'), array('RULE_PERM_INHERIT', '\Magento\Math\Random'), - array('SCOPE_TYPE_GROUP', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_GROUP'), - array('SCOPE_TYPE_STORE', 'Magento\Core\Model\App', 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_STORE'), + array('SCOPE_TYPE_GROUP', 'Magento\Core\Model\App', 'Magento\Store\Model\ScopeInterface::SCOPE_GROUP'), + array('SCOPE_TYPE_STORE', 'Magento\Core\Model\App', 'Magento\Store\Model\ScopeInterface::SCOPE_STORE'), array( 'SCOPE_TYPE_WEBSITE', 'Magento\Core\Model\App', - 'Magento_Core_Model_StoreManagerInterface::SCOPE_TYPE_WEBSITE' + 'Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE' ), array('SEESION_MAX_COOKIE_LIFETIME'), array('TYPE_BINARY', null, 'Magento_DB_Ddl_Table::TYPE_BLOB'), @@ -331,7 +331,7 @@ return array( array('XML_PATH_FRONT_NAME', 'Magento\DesignEditor\Helper\Data'), array('XML_PATH_DISABLED_CACHE_TYPES', 'Magento\DesignEditor\Helper\Data'), array('XML_PATH_ENCRYPTION_MODEL', 'Magento\Core\Helper\Data'), - array('CONFIG_KEY_PATH_TO_MAP_FILE', 'Magento\Core\Model\Resource\Setup\Migration'), + array('CONFIG_KEY_PATH_TO_MAP_FILE', 'Magento\Module\Setup\Migration'), array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\App\UpdaterInterface'), array('XML_PATH_IGNORE_DEV_MODE', 'Magento\Module\UpdaterInterface'), array('XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Magento\Module\UpdaterInterface'), @@ -405,7 +405,7 @@ return array( array( 'XML_PATH_USE_FRONTEND_SID', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\SidResolver::XML_PATH_USE_FRONTEND_SID' + '\Magento\Session\SidResolver::XML_PATH_USE_FRONTEND_SID' ), array( 'SESSION_ID_QUERY_PARAM', @@ -503,20 +503,20 @@ return array( 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped', 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped::CONFIG_THUMBNAIL_SOURCE' ), - array('TYPE_BLOCK', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_CONTAINER', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_ACTION', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_ARGUMENTS', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_ARGUMENT', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_REFERENCE_BLOCK', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_REFERENCE_CONTAINER', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_REMOVE', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('TYPE_MOVE', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('CONTAINER_OPT_HTML_TAG', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('CONTAINER_OPT_HTML_CLASS', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('CONTAINER_OPT_HTML_ID', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('CONTAINER_OPT_LABEL', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), - array('XML_PATH_THEME_ID', '\Magento\Core\Model\View\Design', '\Magento\View\DesignInterface::XML_PATH_THEME_ID'), + array('TYPE_BLOCK', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_CONTAINER', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_ACTION', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_ARGUMENTS', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_ARGUMENT', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_REFERENCE_BLOCK', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_REFERENCE_CONTAINER', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_REMOVE', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('TYPE_MOVE', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('CONTAINER_OPT_HTML_TAG', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('CONTAINER_OPT_HTML_CLASS', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('CONTAINER_OPT_HTML_ID', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('CONTAINER_OPT_LABEL', 'Magento\View\Layout', '\Magento\View\Layout\Element'), + array('XML_PATH_THEME_ID', 'Magento\Core\Model\View\Design', '\Magento\View\DesignInterface::XML_PATH_THEME_ID'), array('UPLOAD_ROOT', 'Magento\Backend\Model\Config\Backend\Logo'), array('UPLOAD_ROOT', 'Magento\Backend\Model\Config\Backend\Favicon'), array('DIRECTORY_SEPARATOR', 'Magento\Filesystem'), diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 1003f04019e4b6c794c00da78f0c72f04c464bdc..51dbfa295fe588c4ec81fcd863b07ac9d387b56f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -51,6 +51,12 @@ return array( array('_canShowField', 'Magento\Backend\Block\System\Config\Form'), array('_canUseCacheForInit', 'Magento\Core\Model\Config'), array('_canUseLocalModules'), + array('_checkCookieStore', 'Magento\Core\Model\App'), + array('_checkCookieStore', 'Magento\Core\Model\Store\Storage\Db', + 'Magento\Store\Model\StorageFactory::_checkCookieStore'), + array('_checkGetStore', 'Magento\Core\Model\App'), + array('_checkGetStore', 'Magento\Core\Model\Store\Storage\Db', + 'Magento\Store\Model\StorageFactory::_checkGetStore'), array('_checkUrlSettings', 'Magento\Backend\Controller\Adminhtml\Action'), array('_collectOrigData', 'Magento\Catalog\Model\Resource\AbstractResource'), array('_decodeInput', 'Magento\Catalog\Controller\Adminhtml\Product'), @@ -108,6 +114,12 @@ return array( array('_getSetData', 'Magento\Backend\Block\Catalog\Product\Attribute\Set\Main'), array('_getSession', 'Magento\Paygate\Model\Authorizenet', 'Magento_Paygate_Model_Authorizenet::_session'), array('_getSHAInSet', '', 'Magento_Ogone_Model_Api::getHash'), + array('_getStoreByGroup', 'Magento\Core\Model\App'), + array('_getStoreByGroup', 'Magento\Core\Model\Store\Storage\Db', + 'Magento\Store\Model\StorageFactory::_getStoreByGroup'), + array('_getStoreByWebsite', 'Magento\Core\Model\App'), + array('_getStoreByWebsite', 'Magento\Core\Model\Store\Storage\Db', + 'Magento\Store\Model\StorageFactory::_getStoreByWebsite'), array('_getStoreTaxRequest', 'Magento\Tax\Model\Sales\Total\Quote\Shipping'), array('_getUploadMaxFilesize', 'Magento\Catalog\Model\Product\Option\Type\File'), array('_hookQueries', 'Magento\Core\Model\Resource\Setup'), @@ -174,14 +186,26 @@ return array( array('_sendUploadResponse', 'Magento\Newsletter\Controller\Adminhtml\Subscriber'), array('_setAttribteValue'), array('_sort', 'Magento\Backend\Model\Config\Structure\Converter'), + array('_submitRecurringPaymentProfiles', 'Magento\Sales\Model\Service\Quote', + '\Magento\RecurringPayment\Model\Observer\CheckoutManagerObserver::submitRecurringPaymentProfiles'), array( - '_submitRecurringPaymentProfiles', + 'submitOrder', 'Magento\Sales\Model\Service\Quote', - '\Magento\RecurringPayment\Model\Observer\CheckoutManagerObserver::submitRecurringPaymentProfiles' + 'Magento\Sales\Model\Service\Quote::submitOrderWithDataObject' + ), + array( + 'submitAll', + 'Magento\Sales\Model\Service\Quote', + 'Magento\Sales\Model\Service\Quote::submitAllWithDataObject' + ), + array( + 'exportCustomerAddress', + 'Magento\Sales\Model\Quote\Address', + 'Magento\Sales\Model\Quote\Address::exportCustomerAddressData' ), array('_toHtml', 'Magento\Backend\Block\Widget\Container'), array('_unhookQueries', 'Magento\Core\Model\Resource\Setup'), - array('_updateMediaPathUseRewrites', 'Magento\Core\Model\Store', '_getMediaScriptUrl'), + array('_updateMediaPathUseRewrites', 'Magento\Store\Model\Store', '_getMediaScriptUrl'), array('_usePriceIncludeTax'), array('addAccountLink', 'Magento\Customer\Block\Account\Link'), array('addAllowedModules', 'Magento\Core\Model\Config'), @@ -260,7 +284,6 @@ return array( array('bundlesAction', 'Magento\Catalog\Controller\Adminhtml\Product'), array('calcTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), array('callbackQueryHook', 'Magento\Core\Model\Resource\Setup'), - array('calculateSpecialPrice', 'Magento\Bundle\Model\Product\Price'), array('canCreateUser', 'Magento\User\Model\Resource\User'), array('canPrint', 'Magento\Checkout\Block\Onepage\Success'), array( @@ -381,10 +404,10 @@ return array( ), array('getDebug', 'Magento\Ogone\Model\Api'), array('getDebug', 'Magento\Paypal\Model\Api\AbstractApi'), - array('getDefaultBasePath', 'Magento\Core\Model\Store'), + array('getDefaultBasePath', 'Magento\Store\Model\Store'), array('getDeleteUrl', 'Magento\Backend\Block\Catalog\Product\Edit'), array('getDirectOutput', 'Magento\View\Element\Template'), - array('getDirectOutput', 'Magento\Core\Model\Layout'), + array('getDirectOutput', 'Magento\View\Layout'), array('getDirectOutput', 'Magento\View\LayoutInterface'), array('getDistroServerVars', 'Magento\Core\Model\Config', 'getDistroBaseUrl'), array('getDuplicateButtonHtml', 'Magento\Catalog\Block\Adminhtml\Product\Edit'), @@ -540,6 +563,7 @@ return array( array('getRowId', 'Magento\Sales\Block\Adminhtml\Order\Create\Customer\Grid'), array('getRowId', 'Magento\Backend\Block\Widget\Grid'), array('getSaveTemplateFlag', 'Magento\Newsletter\Model\Queue'), + array('getSafeStore', 'Magento\Core\Model\StoreManager', 'Magento\Store\Model\StoreManager::getStore'), array('getSectionNode', 'Magento\Core\Model\Config'), array('getSecure', 'Magento\Backend\Model\UrlInterface', 'isSecure'), array('getSecure', 'Magento\Url', 'isSecure'), @@ -643,17 +667,19 @@ return array( array('init', 'Magento\Webapi\Controller\Front'), array('initCache'), array('initControllerRouters', 'Magento\Cms\Controller\Router'), + array('initCurrentStore', 'Magento\Store\Model\Storage\Db', + 'Magento\Store\Model\StorageFactory::_reinitStores'), array('initLabels', 'Magento\Catalog\Model\Resource\Eav\Attribute'), array('initLayoutMessages', 'Magento\App\Action\Action'), array('initSerializerBlock', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Ajax\Serializer'), array('initSerializerBlock', 'Magento\Backend\Block\Widget\Grid\Serializer'), array('insertProductPrice', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'), array('isAbsolutePath'), - array('isAdmin', 'Magento\Core\Model\Store'), + array('isAdmin', 'Magento\Store\Model\Store'), array('isAllowedGuestCheckout', 'Magento\Sales\Model\Quote'), array('isApplicableToQuote', 'Magento\Payment\Model\Method\AbstractMethod'), array('isCheckoutAvailable', 'Magento\Multishipping\Model\Checkout\Type\Multishipping'), - array('isDirectOutput', 'Magento\Core\Model\Layout'), + array('isDirectOutput', 'Magento\View\Layout'), array('isDirectOutput', 'Magento\View\LayoutInterface'), array('isFulAmountCovered'), array('isLeyeredNavigationAllowed'), @@ -719,7 +745,7 @@ return array( array('processBeforeVoid', 'Magento\Payment\Model\Method\AbstractMethod'), array('canUseForMultishipping', 'Magento\Payment\Model\Method\AbstractMethod'), array('processRequest', 'Magento\App\Cache'), - array('processSubst', 'Magento\Core\Model\Store'), + array('processSubst', 'Magento\Store\Model\Store'), array('productEventAggregate'), array('publishRelatedViewFile', 'Magento\View\Publisher', '_publishRelatedViewFile'), array('push', 'Magento\Catalog\Model\Product\Image'), @@ -757,7 +783,7 @@ return array( array('setBlockAlias'), array('setConfig', 'Magento\Captcha\Helper\Data'), array('setCustomerId', 'Magento\Customer\Model\Resource\Address'), - array('setDirectOutput', 'Magento\Core\Model\Layout'), + array('setDirectOutput', 'Magento\View\Layout'), array('setInstance', 'Magento\TestFramework\Bootstrap', 'Magento_TestFramework_Helper_Bootstrap::setInstance'), array('setIsAjaxRequest', 'Magento\Translate\Inline'), array('setNeedUsePriceExcludeTax', '', 'Magento_Tax_Model_Config::setPriceIncludesTax()'), @@ -1068,8 +1094,8 @@ return array( array('noCookiesAction', '\Magento\Core\Controller\Varien\Action'), array('norouteAction', '\Magento\Core\Controller\Varien\Action'), array('getActionMethodName', '\Magento\Core\Controller\Varien\Action'), - array('initLayoutMessages', '\Magento\Core\Controller\Varien\Action', '\Magento\Core\Model\Layout::initMessages'), - array('_initLayoutMessages', '\Magento\Core\Controller\Varien\Action', '\Magento\Core\Model\Layout::initMessages'), + array('initLayoutMessages', '\Magento\Core\Controller\Varien\Action', '\Magento\View\Layout::initMessages'), + array('_initLayoutMessages', '\Magento\Core\Controller\Varien\Action', '\Magento\View\Layout::initMessages'), array('preDispatch', '\Magento\Core\Controller\Varien\Action'), array('postDispatch', '\Magento\Core\Controller\Varien\Action'), array('hasAction', '\Magento\Core\Controller\Varien\Action'), @@ -1232,7 +1258,7 @@ return array( array('helper', 'Magento\View\Element\AbstractBlock'), array('getDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'), array('setDataHelperName', 'Magento\Backend\Block\Dashboard\AbstractDashboard'), - array('addStoresToCollection', '\Magento\Rating\Model\Resource\Rating\Collection'), + array('addStoresToCollection', '\Magento\Review\Model\Resource\Rating\Collection'), array('getLocalPackagesPath', 'Magento\Connect\Helper\Data'), array('getLocalPackagesPathV1x', 'Magento\Connect\Helper\Data'), array('getSessionSaveMethod', '\Magento\Core\Model\Session\AbstractSession', '\Magento\Core\Model\Session\Config'), @@ -1547,6 +1573,10 @@ return array( array('displayGirthValue', 'Magento\Usa\Helper\Data', 'Magento\Usps\Helper\Data::displayGirthValue'), array('reindexProductPrices', '\Magento\Catalog\Model\Observer'), array('getCustomer', 'Magento\Checkout\Block\Onepage\AbstractOnepage'), + ['getStoreConfig', 'Magento\View\Context', '\Magento\View\Context::getScopeConfig'], + ['getStoreConfig', 'Magento\View\Element\Context', '\Magento\View\Element\Context::getScopeConfig'], + ['setConfig', 'Magento\Store\Model\Store'], + ['getConfig', 'Magento\Store\Model\Store'], ['_compareSortOrder', 'Magento\Sales\Model\Config\Ordered'], [ '_toOptionHashOptimized', @@ -1591,4 +1621,20 @@ return array( ['_getStoreId', 'Magento\Translation\Model\Resource\String', 'getScope'], ['getAvailableModes', 'Magento\DesignEditor\Helper\Data'], ['initializeTranslation', 'Magento\DesignEditor\Model\Observer'], + ['filterByCustomer', 'Magento\Wishlist\Model\Resource\Wishlist\Collection'], + ['setConfigData', 'Magento\Module\Setup'], + ['deleteConfigData', 'Magento\Module\Setup'], + array('getReservedAttributes', 'Magento\Catalog\Model\Product'), + array( + 'isReservedAttribute', + 'Magento\Catalog\Model\Product', + 'Magento\Catalog\Model\Product\ReservedAttributeList::isReservedAttribute' + ), + array( + 'getRatingSummary', + 'Magento\Catalog\Model\Product' + ), + ['_getThemeInstance', 'Magento\View\Layout'], + ['getArea', 'Magento\View\Layout'], + ['setArea', 'Magento\View\Layout'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index e0309177413d05aedf48157a7278b8002a762d96..e25728a5f50d6408c1aef26c5ea7897ece40d4f3 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -54,7 +54,7 @@ return array( array('_customerFormFactory', '\Magento\Sales\Block\Adminhtml\Order\Create\Form\Account'), array('_defaultTemplates', 'Magento\Email\Model\Template'), array('_designProductSettingsApplied'), - array('_directOutput', 'Magento\Core\Model\Layout'), + array('_directOutput', 'Magento\View\Layout'), array('_dirs', 'Magento\App\Resource'), array('_distroServerVars'), array('_entityIdsToIncrementIds'), @@ -67,9 +67,9 @@ return array( array('_isGoogleCheckoutLinkAdded', 'Magento\GoogleAnalytics\Model\Observer'), array('_isRuntimeValidated', 'Magento\ObjectManager\Config\Reader\Dom'), array('_itemPriceBlockTypes'), - array('_loadDefault', 'Magento\Core\Model\Resource\Store\Collection'), - array('_loadDefault', 'Magento\Core\Model\Resource\Store\Group\Collection'), - array('_loadDefault', 'Magento\Core\Model\Resource\Website\Collection'), + array('_loadDefault', 'Magento\Store\Model\Resource\Store\Collection'), + array('_loadDefault', 'Magento\Store\Model\Resource\Group\Collection'), + array('_loadDefault', 'Magento\Store\Model\Resource\Website\Collection'), array('_mapper', 'Magento\ObjectManager\Config\Reader\Dom'), array('_menu', 'Magento\Backend\Model\Menu\Builder'), array('_modulesReader', 'Magento\App\ObjectManager\ConfigLoader'), @@ -84,7 +84,7 @@ return array( array('_persistentCustomerGroupId'), array('_queriesHooked', 'Magento\Core\Model\Resource\Setup'), array('_quoteImporter', 'Magento\Paypal\Model\Express\Checkout'), - array('_ratingOptionTable', 'Magento\Rating\Model\Resource\Rating\Option\Collection'), + array('_ratingOptionTable', 'Magento\Review\Model\Resource\Rating\Option\Collection'), array('_readerFactory', 'Magento\App\ObjectManager\ConfigLoader'), array('_recurringPaymentProfiles', '\Magento\Paypal\Model\Api\AbstractApi'), array('_resourceConfig', 'Magento\Core\Model\Resource\Setup'), @@ -154,7 +154,7 @@ return array( array('_lifetime', '\Magento\Stdlib\Cookie'), array('_httpResponse', '\Magento\Stdlib\Cookie'), array('_storeManager', '\Magento\Stdlib\Cookie'), - array('_coreStoreConfig', '\Magento\Stdlib\Cookie'), + array('_scopeConfig', '\Magento\Stdlib\Cookie'), array('_savePath', '\Magento\Core\Model\Session\Context'), array('_cacheLimiter', '\Magento\Core\Model\Session\Context'), array('_dir', '\Magento\Core\Model\Session\Context'), @@ -163,7 +163,7 @@ return array( array('_validator', '\Magento\Core\Model\Session\Context'), array('_logger', '\Magento\Core\Model\Session\Context'), array('_eventManager', '\Magento\Core\Model\Session\Context'), - array('_storeConfig', '\Magento\Core\Model\Session\Context'), + array('_scopeConfig', '\Magento\Core\Model\Session\Context'), array('messageFactory', '\Magento\Core\Model\Session\Context'), array('messagesFactory', '\Magento\Core\Model\Session\Context'), array('_request', '\Magento\Core\Model\Session\Context'), @@ -202,9 +202,9 @@ return array( array('_filesystem', 'Magento\Index\Model\Lock\Storage'), array('_coreDir', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'), array('_coreDir', 'Magento\ScheduledImportExport\Model\Scheduled\Operation'), - array('_dir', 'Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler'), + array('_dir', 'Magento\Store\App\FrontController\Plugin\DispatchExceptionHandler'), array('_dirs', 'Magento\Core\Block\Template'), - array('_applicationDirs', 'Magento\Core\Model\Config\FileResolver'), + array('_applicationDirs', 'Magento\App\Config\FileResolver'), array('_dir', 'Magento\Core\Model\File\Storage'), array('_dir', 'Magento\Locale\Hierarchy\Config\FileResolver'), array('_dirs', 'Magento\Core\Block\Template\Context'), @@ -237,7 +237,7 @@ return array( array('_objectManager', 'Magento\View\Asset\GroupedCollection', 'objectManager'), array('_groups', 'Magento\View\Asset\GroupedCollection', 'groups'), array('_objectManager', 'Magento\View\Asset\MergeService', 'objectManager'), - array('_storeConfig', 'Magento\View\Asset\MergeService', 'config'), + array('_scopeConfig', 'Magento\View\Asset\MergeService', 'config'), array('_filesystem', 'Magento\View\Asset\MergeService', 'filesystem'), array('_dirs', 'Magento\View\Asset\MergeService', 'dirs'), array('_state', 'Magento\View\Asset\MergeService', 'state'), @@ -259,7 +259,7 @@ return array( array('_url', 'Magento\View\Asset\Minified', 'url'), array('_viewUrl', 'Magento\View\Asset\Minified', 'viewUrl'), array('_logger', 'Magento\View\Asset\Minified', 'logger'), - array('_storeConfig', 'Magento\View\Asset\MinifyService', 'Ñonfig'), + array('_scopeConfig', 'Magento\View\Asset\MinifyService', 'Ñonfig'), array('_objectManager', 'Magento\View\Asset\MinifyService', 'objectManager'), array('_enabled', 'Magento\View\Asset\MinifyService', 'enabled'), array('_minifiers', 'Magento\View\Asset\MinifyService', 'minifiers'), @@ -320,7 +320,7 @@ return array( ['_translator', 'Magento\Phrase\Renderer\Translate', 'translator'], ['_translator', 'Magento\Core\Model\Validator\Factory'], ['_configFactory', 'Magento\Core\Model\App\Emulation', 'inlineConfig'], - ['_coreStoreConfig', 'Magento\Translation\Model\Inline\Config', 'config'], + ['_scopeConfig', 'Magento\Translation\Model\Inline\Config', 'config'], ['_translate', 'Magento\Directory\Model\Observer'], ['_translate', 'Magento\Newsletter\Model\Subscriber'], ['_translate', 'Magento\Sendfriend\Model\Sendfriend'], @@ -333,4 +333,7 @@ return array( ['_translate', 'Magento\Rma\Model\Rma'], ['_translate', 'Magento\Rma\Model\Rma\Status\History'], ['_translate', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'], + ['_layout', 'Magento\Install\App\Action\Plugin\Design'], + ['_layout', 'Magento\View\DesignLoader'], + ['_area', 'Magento\View\Layout'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt index 186e9737999df83037349618f05650b8af1924c5..773ae4e63caea7f3fbfe06b4481709199a01f863 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt @@ -7,7 +7,6 @@ app/code/Magento/Backend/Model/Config/Structure/Converter.php app/code/Magento/Backend/Model/Menu/Config.php app/code/Magento/Backend/Block/Widget/Grid app/code/Magento/Backend/view -app/code/Magento/Core/Model/Config/Element.php app/code/Magento/ConfigurableProduct/view app/code/Magento/DesignEditor/view app/code/Magento/Email/view @@ -34,9 +33,10 @@ dev/tests/static/testsuite/Magento/Test/Legacy/_files dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/MysqlStub.php dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php -dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php +dev/tests/unit/testsuite/Magento/Session/ConfigTest.php dev/tests/unit/testsuite/Magento/View/TemplateEngine/_files dev/tools/Magento/Tools/I18n/Zend +lib/Magento/App/Config/Element.php lib/Magento/Archive lib/Magento/Autoload/Simple.php lib/Magento/Backup diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 818dec05dcea68a861f871198286f7f398d2d63e..12d5c4fca627778c8411b24ac5345cc05a9b392a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -49,6 +49,7 @@ Magento/Cms/Block/Adminhtml/Page/Edit Magento/Core/Model/Design/Backend Magento/Core/Model/Layout/File/Source/Override Magento/Core/Model/Store +Magento/Store/Model Magento/Cron/Model/Config/Backend/Product Magento/Customer/Block/Account/Dashboard Magento/Customer/Model/Config/Backend/Show @@ -56,6 +57,7 @@ Magento/Customer/Model/Metadata Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code Magento/DesignEditor/Block/Adminhtml/Theme/Selector/Tab Magento/DesignEditor/Model/Url +Magento/Directory/Model Magento/GiftMessage/Block/Adminhtml/Sales/Order Magento/ImportExport/Model Magento/Index/Model/Process @@ -84,6 +86,7 @@ Magento/Sales/Model/Resource/Report/Order Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab Magento/Shipping/Model/Carrier Magento/Sitemap/Block/Adminhtml/Edit +Magento/Sitemap/Model/ Magento/CatalogRule/Model Magento/Tax/Block/Checkout Magento/Tax/Model/Sales/Pdf diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index db7bf52249bb77d707c20a080b43312586bc3519..a69b437523b7548f2d844567417e8ebfc5c9925d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -36,12 +36,10 @@ app/code/Magento/Cms/Controller/Router.php app/code/Magento/Cms/Model/Template/FilterProvider.php app/code/Magento/ConfigurableProduct app/code/Magento/Core/data -app/code/Magento/Core/Model/Config app/code/Magento/Core/Model/Design.php app/code/Magento/Core/Model/Layout/Update.php app/code/Magento/Core/Model/Resource/Theme app/code/Magento/Core/Model/Resource/Theme.php -app/code/Magento/Core/Model/Session/Validator.php app/code/Magento/Core/Model/Theme app/code/Magento/Core/Model/Theme.php app/code/Magento/Core/Model/Url/SecurityInfo.php @@ -139,3 +137,4 @@ lib/Magento/Url/SecurityInfoInterface.php lib/Magento/View lib/Magento/App/AbstractShell.php lib/Magento/Locale/Validator.php +lib/Magento/App/Config diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 55ae9dfb68591cbad824ad5b7dfa7023e51de5f2..bb83f2e796faefe180923fc1707e0fab44c62782 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -79,9 +79,9 @@ class Adminhtml extends \PHPUnit_Framework_TestCase protected $_cacheMock; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\StoreManager */ + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\StoreManager */ protected $_storeManagerMock; /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Math\Random */ @@ -94,10 +94,10 @@ class Adminhtml extends \PHPUnit_Framework_TestCase { // These mocks are accessed via context $this->_designMock = $this->_makeMock('Magento\View\DesignInterface'); - $this->_sessionMock = $this->_makeMock('Magento\Core\Model\Session'); - $this->_sidResolver = $this->_makeMock('Magento\Core\Model\Session\SidResolver'); + $this->_sessionMock = $this->_makeMock('Magento\Session\Generic'); + $this->_sidResolver = $this->_makeMock('Magento\Session\SidResolver'); $this->_translatorMock = $this->_makeMock('Magento\TranslateInterface'); - $this->_layoutMock = $this->_makeMock('Magento\Core\Model\Layout'); + $this->_layoutMock = $this->_makeMock('Magento\View\Layout'); $this->_requestMock = $this->_makeMock('Magento\App\RequestInterface'); $this->_messagesMock = $this->_makeMock('Magento\View\Element\Messages'); $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); @@ -106,8 +106,8 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_loggerMock = $this->_makeMock('Magento\Logger'); $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); - $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); - $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); + $this->_scopeConfigMock = $this->_makeMock('Magento\App\Config\ScopeConfigInterface'); + $this->_storeManagerMock = $this->_makeMock('Magento\Store\Model\StoreManager'); $viewUrlMock = $this->_makeMock('Magento\View\Url'); $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); @@ -141,7 +141,7 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_designMock, $this->_sessionMock, $this->_sidResolver, - $this->_storeConfigMock, + $this->_scopeConfigMock, $this->_controllerMock, $viewUrlMock, $viewConfigMock, diff --git a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php index fe80118fb58c0d519e2bd567e0599a3ba5602257..f25395e73acfa5e727b007bfd225f9ebd0286d42 100644 --- a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php +++ b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php @@ -41,7 +41,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase 'cache' => 'Magento\App\CacheInterface', 'design' => 'Magento\View\DesignInterface', 'session' => 'Magento\Session\SessionManagerInterface', - 'storeConfig' => 'Magento\Core\Model\Store\Config' + 'scopeConfig' => 'Magento\App\Config\ScopeConfigInterface' ); /** @@ -50,9 +50,9 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_modelDependencies = array( - 'eventManager' => 'Magento\Event\ManagerInterface', - 'cacheManager' => 'Magento\App\CacheInterface', - 'resource' => 'Magento\Model\Resource\AbstractResource', + 'eventManager' => 'Magento\Event\ManagerInterface', + 'cacheManager' => 'Magento\App\CacheInterface', + 'resource' => 'Magento\Model\Resource\AbstractResource', 'resourceCollection' => 'Magento\Data\Collection\Db' ); @@ -91,8 +91,8 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); /** @var $model \Magento\App\Config\ValueInterface */ - $model = $objectManager->getObject('Magento\Core\Model\Config\Value'); - $this->assertInstanceOf('Magento\Core\Model\Config\Value', $model); + $model = $objectManager->getObject('Magento\App\Config\Value'); + $this->assertInstanceOf('Magento\App\Config\Value', $model); foreach ($this->_modelDependencies as $propertyName => $propertyType) { $this->assertAttributeInstanceOf($propertyType, '_' . $propertyName, $model); } @@ -108,7 +108,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase $resourceMock->expects($this->once())->method('_getReadAdapter')->will($this->returnValue(false)); $resourceMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('id')); $arguments = array('resource' => $resourceMock); - $model = $objectManager->getObject('Magento\Core\Model\Config\Value', $arguments); + $model = $objectManager->getObject('Magento\App\Config\Value', $arguments); $this->assertFalse($model->getResource()->getDataVersion('test')); } } diff --git a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/BaseurlTest.php index f4fbc6c93be2e810aa57f5bc02ce0ba31c4ff586..9d1bf7dd185c04084b03f96fecd771bbc3a722c3 100644 --- a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/BaseurlTest.php +++ b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/BaseurlTest.php @@ -66,16 +66,16 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $this->_configMock = $this->getMock('Magento\App\Config', array(), array(), '', false); $this->_urlBuilderMock = $this->getMock('Magento\UrlInterface'); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $configFactoryMock = $this->getMock( - 'Magento\Core\Model\Config\ValueFactory', + 'Magento\App\Config\ValueFactory', array('create'), array(), '', false ); $this->_configDataMock = $this->getMock( - 'Magento\Core\Model\Config\Value', + 'Magento\App\Config\Value', array('getScope', 'getScopeId', 'getCollection', '__sleep', '__wakeup'), array(), '', @@ -125,20 +125,20 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase ); } - public function testGetConfigUrlWithDefaultUnsecureAndSecureBaseUrl() + public function testgetValueUrlWithDefaultUnsecureAndSecureBaseUrl() { $map = array( array( - \Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL, + \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, 'default', null, - \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER + \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER ), array( - \Magento\Core\Model\Store::XML_PATH_SECURE_BASE_URL, + \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, 'default', null, - \Magento\Core\Model\Store::BASE_URL_PLACEHOLDER + \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER ) ); $this->_configMock->expects($this->exactly(2))->method('getValue')->will($this->returnValueMap($map)); @@ -156,16 +156,16 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $this->assertContains('http://some_url', (string)$this->_model->getText()); } - public function testGetConfigUrlWithoutSavedData() + public function testgetValueUrlWithoutSavedData() { $this->_configMock->expects($this->any())->method('getNode')->will($this->returnValue(null)); $this->_urlBuilderMock->expects($this->never())->method('getUrl'); } /** - * @dataProvider getConfigUrlWithSavedDataForStoreScopeDataProvider + * @dataProvider getValueUrlWithSavedDataForStoreScopeDataProvider */ - public function testGetConfigUrlWithSavedDataForScopes($scope, $urlParam, $storeMethod) + public function testgetValueUrlWithSavedDataForScopes($scope, $urlParam, $storeMethod) { $this->_configMock->expects($this->any())->method('getNode')->will($this->returnValue(null)); $this->_iteratorMock->expects($this->once())->method('valid')->will($this->returnValue(true)); @@ -179,7 +179,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $this->_configDataMock->expects($this->once())->method('getScopeId')->will($this->returnValue(1)); - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( @@ -206,7 +206,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $this->assertContains('http://some_url', (string)$this->_model->getText()); } - public function getConfigUrlWithSavedDataForStoreScopeDataProvider() + public function getValueUrlWithSavedDataForStoreScopeDataProvider() { return array( 'storeScope' => array('stores', 'store', 'getStore'), @@ -221,7 +221,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase )->method( 'getValue' )->will( - $this->returnValue(\Magento\Core\Model\Store::BASE_URL_PLACEHOLDER) + $this->returnValue(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER) ); $this->_urlBuilderMock->expects($this->once())->method('getUrl')->will($this->returnValue('')); $this->assertFalse($this->_model->isDisplayed()); @@ -234,7 +234,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase )->method( 'getValue' )->will( - $this->returnValue(\Magento\Core\Model\Store::BASE_URL_PLACEHOLDER) + $this->returnValue(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER) ); $this->_urlBuilderMock->expects($this->once())->method('getUrl')->will($this->returnValue('http://some_url')); $this->assertTrue($this->_model->isDisplayed()); @@ -247,7 +247,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase )->method( 'getValue' )->will( - $this->returnValue(\Magento\Core\Model\Store::BASE_URL_PLACEHOLDER) + $this->returnValue(\Magento\Store\Model\Store::BASE_URL_PLACEHOLDER) ); $this->_urlBuilderMock->expects($this->once())->method('getUrl')->will($this->returnValue('some_url')); $this->assertEquals(md5('BASE_URLsome_url'), $this->_model->getIdentity()); diff --git a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php index 9d05bd18d704ad58ad8be173034615a00a0637f3..84b580f1f4c996a5affbb268e4eec7851cb61b36 100644 --- a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php +++ b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/System/Message/SecurityTest.php @@ -33,7 +33,7 @@ class SecurityTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -54,13 +54,7 @@ class SecurityTest extends \PHPUnit_Framework_TestCase { //Prepare objects for constructor $this->_cacheMock = $this->getMock('Magento\App\CacheInterface'); - $this->_storeConfigMock = $this->getMock( - 'Magento\Core\Model\Store\Config', - array('getConfig'), - array(), - '', - false - ); + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_curlFactoryMock = $this->getMock( 'Magento\HTTP\Adapter\CurlFactory', array('create'), @@ -72,7 +66,7 @@ class SecurityTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $arguments = array( 'cache' => $this->_cacheMock, - 'storeConfig' => $this->_storeConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, 'curlFactory' => $this->_curlFactoryMock ); $this->_messageModel = $objectManagerHelper->getObject( @@ -98,7 +92,7 @@ class SecurityTest extends \PHPUnit_Framework_TestCase $httpAdapterMock->expects($this->any())->method('read')->will($this->returnValue($response)); $this->_curlFactoryMock->expects($this->any())->method('create')->will($this->returnValue($httpAdapterMock)); - $this->_storeConfigMock->expects($this->any())->method('getConfig')->will($this->returnValue(null)); + $this->_scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue(null)); $this->assertEquals($expectedResult, $this->_messageModel->isDisplayed()); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/App/Config/FileResolverTest.php similarity index 96% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php rename to dev/tests/unit/testsuite/Magento/App/Config/FileResolverTest.php index 575af6bf1e5092e16af461748040f059bd1697ce..d55a87abf8c669f75e4c8bc7ad131084d365dd9c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolverTest.php @@ -21,14 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class FileResolverTest extends \PHPUnit_Framework_TestCase { /** * Files resolver * - * @var \Magento\Core\Model\Config\FileResolver + * @var \Magento\App\Config\FileResolver */ protected $model; @@ -68,7 +68,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase '', false ); - $this->model = new \Magento\Core\Model\Config\FileResolver( + $this->model = new \Magento\App\Config\FileResolver( $this->moduleReader, $this->filesystem, $this->iteratorFactory diff --git a/dev/tests/unit/testsuite/Magento/App/Config/ScopePoolTest.php b/dev/tests/unit/testsuite/Magento/App/Config/ScopePoolTest.php index c85f42e44f5088715b92981496497d9f60ea0233..8413ca113314ed52dbecb6b85e615f2c409ab606 100644 --- a/dev/tests/unit/testsuite/Magento/App/Config/ScopePoolTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/ScopePoolTest.php @@ -80,7 +80,8 @@ class ScopePoolTest extends \PHPUnit_Framework_TestCase */ public function testGetScope($scopeType, $scope, array $data, $cachedData) { - $cacheKey = "test_cache_id|{$scopeType}|{$scope}"; + $scopeCode = $scope instanceof \Magento\App\ScopeInterface ? $scope->getCode() : $scope; + $cacheKey = "test_cache_id|{$scopeType}|{$scopeCode}"; $this->_readerPool->expects( $this->any() @@ -124,9 +125,12 @@ class ScopePoolTest extends \PHPUnit_Framework_TestCase public function getScopeDataProvider() { + $baseScope = $this->getMockForAbstractClass('Magento\App\ScopeInterface'); + $baseScope->expects($this->any())->method('getCode')->will($this->returnValue('testScope')); return array( array('scopeType1', 'testScope', array('key' => 'value'), null), - array('scopeType2', 'testScope', array('key' => 'value'), serialize(array('key' => 'value'))) + array('scopeType2', 'testScope', array('key' => 'value'), serialize(array('key' => 'value'))), + array('scopeType1', $baseScope, array('key' => 'value'), null) ); } diff --git a/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/ConfigurationTest.php b/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/ConfigurationTest.php index c53da394c0aa04b0f7cd8ce8e509a39fcdb67dd5..ae2b49ae450063713c96c68e2fa14963559dd16a 100644 --- a/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/ConfigurationTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/ConfigurationTest.php @@ -39,7 +39,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase /* Mock Config model */ $config = $this->getMockBuilder( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->setMethods( array('getValue', 'setValue', 'isSetFlag') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/App/HttpTest.php b/dev/tests/unit/testsuite/Magento/App/HttpTest.php new file mode 100644 index 0000000000000000000000000000000000000000..202c953260ae3336e5c3de5bdae61115be98c540 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/HttpTest.php @@ -0,0 +1,167 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +class HttpTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_stateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_filesystemMock; + + /** + * @var \Magento\App\Http + */ + protected $_http; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_frontControllerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_requestMock; + + public function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_requestMock = $this->getMockBuilder( + 'Magento\App\Request\Http' + )->disableOriginalConstructor()->setMethods(['getFrontName'])->getMock(); + $frontName = 'frontName'; + $this->_requestMock->expects($this->once())->method('getFrontName')->will($this->returnValue($frontName)); + $areaCode = 'areaCode'; + $areaListMock = $this->getMockBuilder('Magento\App\AreaList')->disableOriginalConstructor()->setMethods( + ['getCodeByFrontName'] + )->getMock(); + $areaListMock->expects($this->once())->method('getCodeByFrontName')->with($frontName)->will( + $this->returnValue($areaCode) + ); + $this->_stateMock = $this->getMockBuilder('Magento\App\State')->disableOriginalConstructor()->setMethods( + ['setAreaCode', 'getMode'] + )->getMock(); + $this->_stateMock->expects($this->once())->method('setAreaCode')->with($areaCode); + $areaConfig = []; + $configLoaderMock = $this->getMockBuilder( + 'Magento\App\ObjectManager\ConfigLoader' + )->disableOriginalConstructor()->setMethods(['load'])->getMock(); + $configLoaderMock->expects($this->once())->method('load')->with($areaCode)->will( + $this->returnValue($areaConfig) + ); + $objectManagerMock = $this->getMockBuilder('Magento\ObjectManager')->disableOriginalConstructor()->setMethods( + ['configure', 'get', 'create'] + )->getMock(); + $objectManagerMock->expects($this->once())->method('configure')->with($areaConfig); + $this->_responseMock = $this->getMockBuilder( + 'Magento\App\Response\Http' + )->disableOriginalConstructor()->setMethods( + ['setHttpResponseCode', 'setBody'] + )->getMock(); + $this->_frontControllerMock = $this->getMockBuilder( + 'Magento\App\FrontControllerInterface' + )->disableOriginalConstructor()->setMethods(['dispatch'])->getMock(); + $objectManagerMock->expects($this->once())->method('get')->with('Magento\App\FrontControllerInterface')->will( + $this->returnValue($this->_frontControllerMock) + ); + $this->_frontControllerMock->expects($this->once())->method('dispatch')->with($this->_requestMock)->will( + $this->returnValue($this->_responseMock) + ); + $this->_eventManagerMock = $this->getMockBuilder( + 'Magento\Event\Manager' + )->disableOriginalConstructor()->setMethods( + ['dispatch'] + )->getMock(); + $this->_filesystemMock = $this->getMockBuilder( + 'Magento\App\Filesystem' + )->disableOriginalConstructor()->setMethods( + ['getPath'] + )->getMock(); + + $this->_http = $this->_objectManager->getObject( + 'Magento\App\Http', + [ + 'objectManager' => $objectManagerMock, + 'eventManager' => $this->_eventManagerMock, + 'areaList' => $areaListMock, + 'request' => $this->_requestMock, + 'response' => $this->_responseMock, + 'configLoader' => $configLoaderMock, + 'state' => $this->_stateMock, + 'filesystem' => $this->_filesystemMock + ] + ); + } + + public function testLaunchSuccess() + { + $this->_eventManagerMock->expects($this->once())->method('dispatch')->with( + 'controller_front_send_response_before', + array('request' => $this->_requestMock, 'response' => $this->_responseMock) + ); + $this->assertSame($this->_responseMock, $this->_http->launch()); + } + + public function testLaunchDispatchException() + { + $this->_frontControllerMock->expects($this->once())->method('dispatch')->with($this->_requestMock)->will( + $this->returnCallback( + function () { + throw new \Exception('Message'); + } + ) + ); + $this->_stateMock->expects($this->once())->method('getMode')->will( + $this->returnValue(\Magento\App\State::MODE_DEVELOPER) + ); + $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(500); + + $this->_responseMock->expects($this->once())->method('setBody')->with( + $this->matchesRegularExpression('/Message[\n]+<pre>Message[\n]*(.|\n)*<\/pre>/') + ); + $this->assertSame($this->_responseMock, $this->_http->launch()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/PageCache/FormKeyTest.php b/dev/tests/unit/testsuite/Magento/App/PageCache/FormKeyTest.php index 16112622d6c864da4dc10ad46894a890aa5e5644..57cdb4bafaf128e9ebcc9d0a2dcd0f6844f9f79a 100644 --- a/dev/tests/unit/testsuite/Magento/App/PageCache/FormKeyTest.php +++ b/dev/tests/unit/testsuite/Magento/App/PageCache/FormKeyTest.php @@ -50,7 +50,7 @@ class FormKeyTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->cookieMock = $this->getMock('Magento\Stdlib\Cookie', array('get'), array(), '', false); - $this->formKey = new FormKey($this->cookieMock); + $this->formKey = new \Magento\App\PageCache\FormKey($this->cookieMock); } public function testGet() @@ -61,7 +61,7 @@ class FormKeyTest extends \PHPUnit_Framework_TestCase //Verification $this->cookieMock->expects($this->once()) ->method('get') - ->with(FormKey::COOKIE_NAME) + ->with(\Magento\App\PageCache\FormKey::COOKIE_NAME) ->will($this->returnValue($formKey)); $this->assertEquals($formKey, $this->formKey->get()); diff --git a/dev/tests/unit/testsuite/Magento/App/ReinitableConfigTest.php b/dev/tests/unit/testsuite/Magento/App/ReinitableConfigTest.php index 6e186c084baa1750cacfd18033ece6fc1fa10e6b..f7532d498944eed02e3fc4c21223c15f39ca3b16 100644 --- a/dev/tests/unit/testsuite/Magento/App/ReinitableConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/App/ReinitableConfigTest.php @@ -35,6 +35,6 @@ class ReinitableConfigTest extends \PHPUnit_Framework_TestCase $scopePool->expects($this->once())->method('clean'); /** @var \Magento\Core\Model\ReinitableConfig $config */ $config = $helper->getObject('Magento\App\ReinitableConfig', array('scopePool' => $scopePool)); - $this->assertInstanceOf('\Magento\App\ReinitableConfigInterface', $config->reinit()); + $this->assertInstanceOf('\Magento\App\Config\ReinitableConfigInterface', $config->reinit()); } } diff --git a/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php b/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php index c66c4f44c4be8345b8824f87ba8c8bdfbae19794..db755d4881e974f851286a244d490bec9b9df0d4 100644 --- a/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Request/HttpTest.php @@ -276,4 +276,99 @@ class HttpTest extends \PHPUnit_Framework_TestCase $this->_model->setRouteName('test')->setControllerName('controller')->setActionName('action'); $this->assertEquals('test/controller/action', $this->_model->getFullActionName('/')); } + + public function testInitForward() + { + $expected = $this->_initForward(); + $this->assertEquals($expected, $this->_model->getBeforeForwardInfo()); + } + + public function testGetBeforeForwardInfo() + { + $beforeForwardInfo = $this->_initForward(); + $this->assertNull($this->_model->getBeforeForwardInfo('not_existing_forward_info_key')); + foreach (array_keys($beforeForwardInfo) as $key) { + $this->assertEquals($beforeForwardInfo[$key], $this->_model->getBeforeForwardInfo($key)); + } + $this->assertEquals($beforeForwardInfo, $this->_model->getBeforeForwardInfo()); + } + + /** + * Initialize $_beforeForwardInfo + * + * @return array Contents of $_beforeForwardInfo + */ + protected function _initForward() + { + $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock); + $beforeForwardInfo = [ + 'params' => ['one' => '111', 'two' => '222'], + 'action_name' => 'ActionName', + 'controller_name' => 'ControllerName', + 'module_name' => 'ModuleName', + 'route_name' => 'RouteName' + ]; + $this->_model->setParams($beforeForwardInfo['params']); + $this->_model->setActionName($beforeForwardInfo['action_name']); + $this->_model->setControllerName($beforeForwardInfo['controller_name']); + $this->_model->setModuleName($beforeForwardInfo['module_name']); + $this->_model->setRouteName($beforeForwardInfo['route_name']); + $this->_model->initForward(); + return $beforeForwardInfo; + } + + public function testIsAjax() + { + $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock); + + $this->assertFalse($this->_model->isAjax()); + + $this->_model->clearParams(); + $this->_model->setParam('ajax', 1); + $this->assertTrue($this->_model->isAjax()); + + $this->_model->clearParams(); + $this->_model->setParam('isAjax', 1); + $this->assertTrue($this->_model->isAjax()); + + $this->_model->clearParams(); + $server = $_SERVER; + $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; + $this->assertTrue($this->_model->isAjax()); + $_SERVER['HTTP_X_REQUESTED_WITH'] = 'NotXMLHttpRequest'; + $this->assertFalse($this->_model->isAjax()); + $_SERVER = $server; + } + + public function testSetPost() + { + $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock); + + $post = ['one' => '111', 'two' => '222']; + $this->_model->setPost($post); + $this->assertEquals($post, $_POST); + + $this->_model->setPost([]); + $this->assertEmpty($_POST); + + $_POST = ['post_var' => 'post_value']; + $this->_model->setPost('post_var 2', 'post_value 2'); + $this->assertEquals(['post_var' => 'post_value', 'post_var 2' => 'post_value 2'], $_POST); + } + + public function testGetFiles() + { + $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock); + + $_FILES = ['one' => '111', 'two' => '222']; + $this->assertEquals($_FILES, $this->_model->getFiles()); + + foreach ($_FILES as $key => $value) { + $this->assertEquals($value, $this->_model->getFiles($key)); + } + + $this->assertNull($this->_model->getFiles('no_such_file')); + + $this->assertEquals('default', $this->_model->getFiles('no_such_file', 'default')); + } } diff --git a/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php index 46196cd03c3edff8f102526d7ee0b9f6d7785953..259634f21e17ffb90d253991665cec84ff045a04 100644 --- a/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/ConfigTest.php @@ -50,6 +50,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_resourcesConfig; + /** + * @var array + */ + protected $_initialResources; + protected function setUp() { $this->_scopeMock = $this->getMock('Magento\Config\ScopeInterface'); @@ -61,9 +66,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'mainResourceName' => array('name' => 'mainResourceName', 'extends' => 'anotherResourceName'), 'otherResourceName' => array('name' => 'otherResourceName', 'connection' => 'otherConnectionName'), 'anotherResourceName' => array('name' => 'anotherResourceName', 'connection' => 'anotherConnection'), - 'brokenResourceName' => array('name' => 'brokenResourceName', 'extends' => 'absentResourceName') + 'brokenResourceName' => array('name' => 'brokenResourceName', 'extends' => 'absentResourceName'), + 'extendedResourceName' => array('name' => 'extendedResourceName', 'extends' => 'validResource') ); + $this->_initialResources = [ + 'validResource' => ['connection' => 'validConnectionName'] + ]; + $this->_cacheMock->expects( $this->any() )->method( @@ -76,7 +86,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_readerMock, $this->_scopeMock, $this->_cacheMock, - 'cacheId' + 'cacheId', + $this->_initialResources ); } @@ -90,6 +101,20 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertEquals($connectionName, $this->_model->getConnectionName($resourceName)); } + /** + * @expectedException \InvalidArgumentException + */ + public function testExceptionConstructor() + { + new \Magento\App\Resource\Config( + $this->_readerMock, + $this->_scopeMock, + $this->_cacheMock, + 'cacheId', + ['validResource' => ['somekey' => 'validConnectionName']] + ); + } + /** * @return array */ @@ -101,7 +126,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase array( 'resourceName' => 'brokenResourceName', 'connectionName' => \Magento\App\Resource\Config::DEFAULT_SETUP_CONNECTION - ) + ), + array('resourceName' => 'extendedResourceName', 'connectionName' => 'default'), + array('resourceName' => 'validResource', 'connectionName' => 'validConnectionName') ); } } diff --git a/dev/tests/unit/testsuite/Magento/App/ResourceTest.php b/dev/tests/unit/testsuite/Magento/App/ResourceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..58d303beeb95f559604b9889374066f4263f022d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/ResourceTest.php @@ -0,0 +1,202 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +class ResourceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_config; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_connectionFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_cache; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_connection; + + /** + * @var \Magento\App\Resource + */ + protected $_resorce; + + const RESOURCE_NAME = \Magento\App\Resource::DEFAULT_READ_RESOURCE; + + const CONNECTION_NAME = 'Connection Name'; + + public function setUp() + { + $this->_cache = $this->getMockBuilder('Magento\App\CacheInterface')->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $this->_connectionFactory = $this->getMockBuilder( + 'Magento\App\Resource\ConnectionFactory' + )->disableOriginalConstructor()->setMethods(['create'])->getMock(); + $this->_connection = $this->getMockBuilder( + 'Magento\DB\Adapter\AdapterInterface' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $this->_config = $this->getMockBuilder( + 'Magento\App\Resource\ConfigInterface' + )->disableOriginalConstructor()->setMethods(['getConnectionName'])->getMock(); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_resorce = $objectManager->getObject( + 'Magento\App\Resource', + [ + 'cache' => $this->_cache, + 'resourceConfig' => $this->_config, + 'adapterFactory' => $this->_connectionFactory + ] + ); + $this->_config->expects($this->any())->method('getConnectionName')->with(self::RESOURCE_NAME)->will( + $this->returnValue(self::CONNECTION_NAME) + ); + } + + public function testGetConnectionFail() + { + $this->_connectionFactory->expects($this->once())->method('create')->with(self::CONNECTION_NAME)->will( + $this->returnValue(null) + ); + $this->assertFalse($this->_resorce->getConnection(self::RESOURCE_NAME)); + } + + public function testGetConnectionInitConnection() + { + $this->_connectionFactory->expects($this->once())->method('create')->with(self::CONNECTION_NAME)->will( + $this->returnValue($this->_connection) + ); + $this->_connection->expects($this->once())->method('setCacheAdapter')->with( + $this->isInstanceOf('Magento\Cache\FrontendInterface') + ); + $frontendInterface = $this->getMockBuilder( + 'Magento\Cache\FrontendInterface' + )->disableOriginalConstructor()->setMethods([])->getMock(); + $this->_cache->expects($this->once())->method('getFrontend')->will($this->returnValue($frontendInterface)); + + $this->assertInstanceOf( + 'Magento\DB\Adapter\AdapterInterface', + $this->_resorce->getConnection(self::RESOURCE_NAME) + ); + $this->assertInstanceOf( + 'Magento\DB\Adapter\AdapterInterface', + $this->_resorce->getConnection(self::RESOURCE_NAME) + ); + } + + public function testGetTableName() + { + $expected = 'tableName'; + $modelEntity = $this->prepareTableName($expected); + $this->assertEquals($expected, $this->_resorce->getTableName($modelEntity)); + } + + public function testGetTableNameWithPrefix() + { + $this->setConnection(); + $modelEntity = ['modelEntity', 'tableSuffix']; + $expected = 'tablename'; + $tablePrefix = 'tablePrefix'; + $this->_resorce->setTablePrefix($tablePrefix); + + $this->_connection->expects($this->once())->method('getTableName')->with( + $tablePrefix . $modelEntity[0] . '_' . $modelEntity[1] + )->will($this->returnValue($expected)); + + $this->assertEquals($expected, $this->_resorce->getTableName($modelEntity)); + } + + public function testGetIdxName() + { + $expectedTableName = 'tablename'; + $modelEntity = $this->prepareTableName($expectedTableName); + + $fields = ['field']; + $this->_connection->expects($this->once())->method('getIndexName')->with( + $expectedTableName, $fields, \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + )->will($this->returnValue('idxName')); + $this->assertEquals( + 'idxName', + $this->_resorce->getIdxName($modelEntity, $fields, \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX) + ); + } + + public function testGetFkName() + { + $expectedTableName = 'tablename'; + $modelEntity = $this->prepareTableName($expectedTableName, false); + $columnName = 'columnName'; + + $this->_connection->expects($this->once())->method('getForeignKeyName')->with( + $expectedTableName, $columnName, $expectedTableName, $columnName + )->will($this->returnValue('fkName')); + + $this->assertEquals('fkName', $this->_resorce->getFkName($modelEntity, $columnName, $modelEntity, $columnName)); + } + + /** + * Prepares data for \Resource::getTableName($modelEntity) + * + * @param string $expected + * @param bool $useSuffix does an entity has a suffix + * @return array $modelEntity + */ + private function prepareTableName($expected, $useSuffix = true) + { + $this->setConnection(); + $modelEntity = ['modelEntity', 'tableSuffix']; + $mappedName = 'mappedName'; + $this->_resorce->setMappedTableName($modelEntity[0], $mappedName); + + $this->_connection->expects($this->any())->method('getTableName')->with( + $useSuffix ? $mappedName . '_' . $modelEntity[1] : $mappedName + )->will($this->returnValue($expected)); + return $useSuffix ? $modelEntity : $modelEntity[0]; + } + + /** + * Sets connection for resource + */ + private function setConnection() + { + $connectionSetter = \Closure::bind( + function (\Magento\App\Resource $resource, $connection, $connectionName) { + $resource->_connections[$connectionName] = $connection; + }, null, 'Magento\App\Resource' + ); + + $connectionSetter($this->_resorce, $this->_connection, self::CONNECTION_NAME); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Response/HttpTest.php b/dev/tests/unit/testsuite/Magento/App/Response/HttpTest.php index cf4344396a7cd6e649b3dd6914cc160e0d8feee8..4dcf6a2be937e15982bb107be55a9198c119d48b 100644 --- a/dev/tests/unit/testsuite/Magento/App/Response/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Response/HttpTest.php @@ -79,6 +79,15 @@ class HttpTest extends \PHPUnit_Framework_TestCase $this->_model->sendVary(); } + public function testSendVaryEmptyData() + { + $this->_cookieMock + ->expects($this->once()) + ->method('set') + ->with(Http::COOKIE_VARY_STRING, null, -1, '/'); + $this->_model->sendVary(); + } + /** * Test setting public cache headers */ diff --git a/dev/tests/unit/testsuite/Magento/App/Route/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/App/Route/Config/SchemaLocatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8fe0af7719e5f033e6e67de0cc1b9ddc12f7ed56 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Route/Config/SchemaLocatorTest.php @@ -0,0 +1,49 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Route\Config; + +class SchemaLocatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Route\Config\SchemaLocator + */ + protected $_config; + + protected function setUp() + { + $this->_config = new \Magento\App\Route\Config\SchemaLocator(); + } + + public function testGetSchema() + { + $actual = $this->_config->getSchema(); + $this->assertContains('routes_merged.xsd', $actual); + } + + public function testGetPerFileSchema() + { + $actual = $this->_config->getPerFileSchema(); + $this->assertContains('routes.xsd', $actual); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php b/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php index bf734d4a1dc14a9c8ce39ec0965eaec86334d7c5..3496fd63359701c772dcd9d45ab775d583607656 100644 --- a/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Route/ConfigTest.php @@ -84,4 +84,34 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals('routerCode', $this->_config->getRouteFrontName('routerCode')); } + + public function testGetRouteByFrontName() + { + $this->_cacheMock->expects( + $this->once() + )->method( + 'load' + )->with( + 'areaCode::RoutesConfig' + )->will( + $this->returnValue(serialize(array('routerCode' => ['frontName' => 'routerName']))) + ); + $this->assertEquals('routerCode', $this->_config->getRouteByFrontName('routerName')); + } + + public function testGetModulesByFrontName() + { + $this->_cacheMock->expects( + $this->once() + )->method( + 'load' + )->with( + 'areaCode::RoutesConfig' + )->will( + $this->returnValue( + serialize(array('routerCode' => ['frontName' => 'routerName', 'modules' => ['Module1']])) + ) + ); + $this->assertEquals(['Module1'], $this->_config->getModulesByFrontName('routerName')); + } } diff --git a/dev/tests/unit/testsuite/Magento/App/Router/DefaultRouterTest.php b/dev/tests/unit/testsuite/Magento/App/Router/DefaultRouterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a8d8f69c887deebe842dc9f36c9ee43ac4b68a06 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Router/DefaultRouterTest.php @@ -0,0 +1,59 @@ +<?php +/** + * RouterList model test class + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App\Router; + +class DefaultRouterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Router\DefaultRouter + */ + protected $_model; + + public function testMatch() + { + $request = $this->getMock('Magento\App\RequestInterface', [], [], '', false); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $actionFactory = $this->getMock('Magento\App\ActionFactory', [], [], '', false); + $actionFactory->expects($this->once())->method('createController')->with( + 'Magento\App\Action\Forward', + array('request' => $request) + )->will( + $this->returnValue($this->getMockForAbstractClass('Magento\App\Action\AbstractAction', [], '', false)) + ); + $noRouteHandler = $this->getMock('Magento\Core\App\Router\NoRouteHandler', [], [], '', false); + $noRouteHandler->expects($this->any())->method('process')->will($this->returnValue(true)); + $noRouteHandlerList = $this->getMock('Magento\App\Router\NoRouteHandlerList', [], [], '', false); + $noRouteHandlerList->expects($this->any())->method('getHandlers')->will($this->returnValue([$noRouteHandler])); + $this->_model = $helper->getObject( + 'Magento\App\Router\DefaultRouter', + array( + 'actionFactory' => $actionFactory, + 'noRouteHandlerList' => $noRouteHandlerList + ) + ); + $this->assertInstanceOf('Magento\App\Action\AbstractAction', $this->_model->match($request)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/ScopeResolverPoolTest.php b/dev/tests/unit/testsuite/Magento/App/ScopeResolverPoolTest.php new file mode 100644 index 0000000000000000000000000000000000000000..388f92c4664a6e877c52f8e1a862abf5fa22be50 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/ScopeResolverPoolTest.php @@ -0,0 +1,75 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +class ScopeResolverPoolTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_helper; + + protected function setUp() + { + $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + public function testGet() + { + $scope = $this->getMock('\Magento\App\ScopeResolverInterface'); + $scopeResolver = $this->_helper->getObject('Magento\App\ScopeResolverPool', [ + 'scopeResolvers' => [ + 'test' => $scope + ] + ]); + $this->assertSame($scope, $scopeResolver->get('test')); + } + + /** + * @param string $scope + * + * @covers \Magento\App\ScopeResolverPool::get() + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Invalid scope type + * @dataProvider testGetExceptionDataProvider + */ + public function testGetException($scope) + { + $scopeResolver = $this->_helper->getObject('Magento\App\ScopeResolverPool', [ + 'scopeResolvers' => [ + 'test' => new \Magento\Object() + ] + ]); + $scopeResolver->get($scope); + } + + public function testGetExceptionDataProvider() + { + return [ + ['undefined'], + ['test'], + ]; + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/App/ViewTest.php b/dev/tests/unit/testsuite/Magento/App/ViewTest.php index d5d6eec24e342a833771200bdefdd1395cfc8da8..ed3a480c18a5cd6f6aebb8f7541eb82274530852 100644 --- a/dev/tests/unit/testsuite/Magento/App/ViewTest.php +++ b/dev/tests/unit/testsuite/Magento/App/ViewTest.php @@ -26,7 +26,7 @@ namespace Magento\App; class ViewTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Backend\Model\View + * @var \Magento\App\View */ protected $_view; @@ -63,7 +63,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_configScopeMock = $this->getMock('Magento\Config\ScopeInterface'); $this->_layoutProcessor = $this->getMock('Magento\View\Layout\ProcessorInterface'); @@ -91,14 +91,6 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testGetLayout() { - $this->_configScopeMock->expects( - $this->once() - )->method( - 'getCurrentScope' - )->will( - $this->returnValue('areaCode') - ); - $this->_layoutMock->expects($this->once())->method('setArea')->with('areaCode'); $this->assertEquals($this->_layoutMock, $this->_view->getLayout()); } diff --git a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php index 971be84e6819c89b4eb74f564f7003bf8b08a5ab..176590187191c1e90a6c98cd975c2a6fe90f871d 100644 --- a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php +++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php @@ -48,7 +48,7 @@ class BackendTest extends \PHPUnit_Framework_TestCase $this->_orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', array('create'), array(), '', false); $this->_model = new Backend( $contextMock, - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false), $this->_orderFactory, $this->_urlBuilder ); diff --git a/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php index a21f7b4472cef62eb9a0dc62eb5584a68631cc5b..c042bccc9e24b22dbe74753ffe02d2db7557151f 100644 --- a/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Directpost/ObserverTest.php @@ -43,9 +43,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->coreRegistry = $this->getMock('Magento\Registry', array()); - $storeManager = $this->getMockForAbstractClass('Magento\Core\Model\StoreManagerInterface'); + $storeManager = $this->getMockForAbstractClass('Magento\Store\Model\StoreManagerInterface'); $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); $payment = $this->getMock('Magento\Authorizenet\Model\Directpost', null, array(), '', false); $this->coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php index 7cc55d1d21ecea3a93836d2b19443e0824eb383f..e90099f0caebc5e991ce38406f43d4f3c87b9fa2 100644 --- a/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php @@ -60,7 +60,7 @@ class AuthorizationV1Test extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Service\Exception + * @expectedException \Magento\Webapi\ServiceException */ public function testRemovePermissionsException() { diff --git a/dev/tests/unit/testsuite/Magento/Backend/App/Area/Request/PathInfoProcessorTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/Area/Request/PathInfoProcessorTest.php index 27aeee2a7ac301061a6e96a8c3a2050d40704f49..4a749f50eb98e39b58491343176d1435cb231902 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/App/Area/Request/PathInfoProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/Area/Request/PathInfoProcessorTest.php @@ -54,7 +54,7 @@ class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase { $this->_requestMock = $this->getMock('\Magento\App\RequestInterface'); $this->_subjectMock = $this->getMock( - '\Magento\Core\App\Request\PathInfoProcessor', + '\Magento\Store\App\Request\PathInfoProcessor', array(), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Backend/App/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/ConfigTest.php index e6eac0559d284c2115b0952521a65c2a3f0d3cfb..3a3a268d4753eafee1492fd8956b69f5a1ae2bee 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/App/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/ConfigTest.php @@ -93,12 +93,6 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->model->setValue($path, $value); } - public function testReinit() - { - $this->sectionPool->expects($this->once())->method('clean'); - $this->model->reinit(); - } - /** * @param mixed $configValue * @param bool $expectedResult diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Page/System/Config/Robots/ResetTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Page/System/Config/Robots/ResetTest.php index 544febc2cfc2f35a3fd87bac445970222e2523d7..bb1518a82f235a55961ed0d122642c0562fdd3ff 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Page/System/Config/Robots/ResetTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Page/System/Config/Robots/ResetTest.php @@ -38,19 +38,21 @@ class ResetTest extends \PHPUnit_Framework_TestCase private $_resetRobotsBlock; /** - * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $coreConfigMock; + protected $configMock; protected function setUp() { - $this->coreConfigMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); - $this->_resetRobotsBlock = new Reset( - $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false), - $this->coreConfigMock, - array() + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $context = $objectHelper->getObject( + 'Magento\Backend\Block\Template\Context', + array('scopeConfig' => $this->configMock) ); + + $this->_resetRobotsBlock = new Reset($context, array()); } /** @@ -59,13 +61,7 @@ class ResetTest extends \PHPUnit_Framework_TestCase public function testGetRobotsDefaultCustomInstructions() { $expectedInstructions = 'User-agent: *'; - $this->coreConfigMock->expects( - $this->once() - )->method( - 'getValue' - )->will( - $this->returnValue($expectedInstructions) - ); + $this->configMock->expects($this->once())->method('getValue')->will($this->returnValue($expectedInstructions)); $this->assertEquals($expectedInstructions, $this->_resetRobotsBlock->getRobotsDefaultCustomInstructions()); } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Store/SwitcherTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Store/SwitcherTest.php deleted file mode 100644 index 2d9b7f5f177c4bb32d3d82fd5cb321e3932221d3..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Store/SwitcherTest.php +++ /dev/null @@ -1,215 +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 Magento - * @package Magento_Backend - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Block\Store; - -class SwitcherTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Backend\Block\Store\Switcher - */ - protected $_object; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_storeManagerMock; - - /** - * @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_websiteFactoryMock; - - /** - * @var \Magento\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_contextMock; - - /** - * @var \Magento\Core\Helper\PostData|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_helperMock; - - /** - * @var \Magento\Core\Block\Switcher - */ - protected $_block; - - /** - * @var \Magento\Core\Model\Store - */ - protected $_storeMock; - - /** - * Set up - */ - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_websiteFactoryMock = $this->getMock('Magento\Core\Model\Website\Factory', array(), array(), '', false); - - $this->_object = $helper->getObject( - 'Magento\Backend\Block\Store\Switcher', - array('websiteFactory' => $this->_websiteFactoryMock, 'storeManager' => $this->_storeManagerMock) - ); - } - - /** - * @covers \Magento\Backend\Block\Store\Switcher::getWebsiteCollection - */ - public function testGetWebsiteCollectionWhenWebSiteIdsEmpty() - { - $websiteModel = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false, false); - $collection = $this->getMock( - 'Magento\Core\Model\Resource\Website\Collection', - array(), - array(), - '', - false, - false - ); - $websiteModel->expects($this->once())->method('getResourceCollection')->will($this->returnValue($collection)); - - $expected = array('test', 'data', 'some'); - $collection->expects($this->once())->method('load')->will($this->returnValue($expected)); - $collection->expects($this->never())->method('addIdFilter'); - - $this->_websiteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($websiteModel)); - - $this->_object->setWebsiteIds(null); - - $actual = $this->_object->getWebsiteCollection(); - $this->assertEquals($expected, $actual); - } - - /** - * @covers \Magento\Backend\Block\Store\Switcher::getWebsiteCollection - */ - public function testGetWebsiteCollectionWhenWebSiteIdsIsSet() - { - $websiteModel = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false, false); - $collection = $this->getMock( - 'Magento\Core\Model\Resource\Website\Collection', - array(), - array(), - '', - false, - false - ); - $websiteModel->expects($this->once())->method('getResourceCollection')->will($this->returnValue($collection)); - - $ids = array(1, 2, 3); - $this->_object->setWebsiteIds($ids); - - $expected = array('test', 'data', 'some'); - $collection->expects($this->once())->method('load')->will($this->returnValue($expected)); - $collection->expects($this->once())->method('addIdFilter')->with($ids); - - $this->_websiteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($websiteModel)); - - $actual = $this->_object->getWebsiteCollection(); - $this->assertEquals($expected, $actual); - } - - /** - * @covers \Magento\Backend\Block\Store\Switcher::getWebsites - */ - public function testGetWebsitesWhenWebSiteIdsIsNotSet() - { - $this->_object->setWebsiteIds(null); - - $expected = array('test', 'data', 'some'); - $this->_storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($expected)); - - $this->assertEquals($expected, $this->_object->getWebsites()); - } - - /** - * @covers \Magento\Backend\Block\Store\Switcher::getWebsites - */ - public function testGetWebsitesWhenWebSiteIdsIsSetAndMatchWebsites() - { - $ids = array(1, 3, 5); - $webSites = array(1 => 'site 1', 2 => 'site 2', 3 => 'site 3', 4 => 'site 4', 5 => 'site 5'); - - $this->_object->setWebsiteIds($ids); - - $expected = array(1 => 'site 1', 3 => 'site 3', 5 => 'site 5'); - $this->_storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($webSites)); - - $this->assertEquals($expected, $this->_object->getWebsites()); - } - - /** - * @covers \Magento\Backend\Block\Store\Switcher::getWebsites - */ - public function testGetWebsitesWhenWebSiteIdsIsSetAndNotMatchWebsites() - { - $ids = array(8, 10, 12); - $webSites = array(1 => 'site 1', 2 => 'site 2', 3 => 'site 3', 4 => 'site 4', 5 => 'site 5'); - - $this->_object->setWebsiteIds($ids); - - $expected = array(); - $this->_storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($webSites)); - - $this->assertEquals($expected, $this->_object->getWebsites()); - } - - /** - * - */ - public function testGetTargetStorePostData() - { - $targetStoreCode = 'TargetStoreName'; - $targetStoreUrl = 'target-store-url'; - $expectedResult = 'serialised-result'; - - $this->_contextMock = $this->getMock('Magento\View\Element\Template\Context', - array(), array(), '', false); - $this->_helperMock = $this->getMock('Magento\Core\Helper\PostData', - array(), array(), '', false); - $this->_storeMock = $this->getMock('Magento\Core\Model\Store', - array('getCode', '__wakeup'), array(), '', false); - - $this->_storeMock->expects($this->once()) - ->method('getCode') - ->will($this->returnValue($targetStoreCode)); - - $this->_helperMock->expects($this->once()) - ->method('getPostData') - ->with($this->equalTo($targetStoreUrl), $this->equalTo(array( - '___store' => $targetStoreCode - ))) - ->will($this->returnValue($expectedResult)); - - $this->_block = new \Magento\Core\Block\Switcher($this->_contextMock, $this->_helperMock); - $this->_block->setHomeUrl($targetStoreUrl); - $actualResult = $this->_block->getTargetStorePostData($this->_storeMock); - $this->assertEquals($expectedResult, $actualResult); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/EditTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/EditTest.php index b438a37f485cd1a75326811f959d082fc35a1c1a..20deb6a7e5968e7d5e00cf1e553fcef68c04b9ec 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/EditTest.php @@ -80,7 +80,7 @@ class EditTest extends \PHPUnit_Framework_TestCase $this->returnValue('test_section') ); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldTest.php index 756887334fa7054069b5287674e45865ab086c41..5388f3f31be8728f54d003d34dd4c450a66683ee 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldTest.php @@ -56,7 +56,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_storeManagerMock = $this->getMock( - 'Magento\Core\Model\StoreManager', + 'Magento\Store\Model\StoreManager', array(), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php index 8646a071a76552e71e2b0901d45e2a4fb9407679..b0c04e5465b4a88c2d6917c4cfec4507ed60210e 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/FieldsetTest.php @@ -72,7 +72,7 @@ class FieldsetTest extends \PHPUnit_Framework_TestCase { $this->_requestMock = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false, false); $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $groupMock = $this->getMock( 'Magento\Backend\Model\Config\Structure\Element\Group', array(), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php index 93a8685ed37c361684128f729c6b311589a71da2..e600b154a0d1064a2a4b63149d782ae1de230459 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -96,7 +96,7 @@ class FormTest extends \PHPUnit_Framework_TestCase ); $requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap($requestParams)); - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $this->_urlModelMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false); $configFactoryMock = $this->getMock( @@ -131,7 +131,7 @@ class FormTest extends \PHPUnit_Framework_TestCase false, false ); - $this->_coreConfigMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false, false); + $this->_coreConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_backendConfigMock = $this->getMock('Magento\Backend\Model\Config', array(), array(), '', false, false); @@ -161,19 +161,29 @@ class FormTest extends \PHPUnit_Framework_TestCase false, false ); + + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $context = $helper->getObject( + 'Magento\Backend\Block\Template\Context', + array( + 'scopeConfig' => $this->_coreConfigMock, + 'request' => $requestMock, + 'urlBuilder' => $this->_urlModelMock + ) + ); + $data = array( 'request' => $requestMock, 'layout' => $layoutMock, - 'urlBuilder' => $this->_urlModelMock, 'configStructure' => $this->_systemConfigMock, 'configFactory' => $configFactoryMock, 'formFactory' => $this->_formFactoryMock, 'fieldsetFactory' => $this->_fieldsetFactoryMock, 'fieldFactory' => $this->_fieldFactoryMock, - 'coreConfig' => $this->_coreConfigMock + 'context' => $context ); - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_object = $helper->getObject('Magento\Backend\Block\System\Config\Form', $data); $this->_object->setData('scope_id', 1); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php index a9204c2a7ea1afeffe40cf29cf40cfb1f09d846d..29ba3b5b6b3b9ecf4528848cadf022ed44ae5ead 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/ButtonTest.php @@ -54,7 +54,7 @@ class ButtonTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $arguments = array( 'urlBuilder' => $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false, false), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/MultistoreTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/MultistoreTest.php index f3325ad27c0aeca9220063080445f337c78d646a..76139dba5c1c49bc5cadae908f9836692f3b75be 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/MultistoreTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/MultistoreTest.php @@ -40,7 +40,7 @@ class MultistoreTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $arguments = array( 'storeManager' => $this->_storeManagerMock, diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/CurrencyTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/CurrencyTest.php index c938b331b72d90389cadf8900c7af57956309a25..a828791950a1d88dc62d3e258e0785a4748fe9b6 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/CurrencyTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/Column/Renderer/CurrencyTest.php @@ -70,7 +70,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->_localeMock = $this->getMock('Magento\Locale\CurrencyInterface'); $this->_requestMock = $this->getMock('Magento\App\RequestInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php index ddec99fc0fb737610432fc8267cb3662f15ad927..4aa6df81b8c345ef691f17ca5a05c8eee13388fc 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnSetTest.php @@ -72,7 +72,7 @@ class ColumnSetTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->_layoutMock->expects( $this->any() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnTest.php index 5f1271acde7bff298749e32a935cea70963c6c56..2849f7253fccce7ff952812f2f7616423b90d4e7 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/ColumnTest.php @@ -49,7 +49,7 @@ class ColumnTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $this->_blockMock = $this->getMock( 'Magento\View\Element\Template', array('setColumn', 'getHtml'), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index d7d0152a20ae98930d546d3b9d6a09158b27642b..a6b512f65daf4fc7cf0a77f614181020dd52a815 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -68,7 +68,7 @@ class MassactionTest extends \PHPUnit_Framework_TestCase $this->_gridMock->expects($this->any())->method('getId')->will($this->returnValue('test_grid')); $this->_layoutMock = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getParentName', 'getBlock', 'helper'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php index a4c37c6cd56fe5e7e9e5045a0132e7c1b662e6b2..f9e422c9c6dc2be6aadabc6ccb9128b6384b4aa7 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -52,10 +52,10 @@ class GridTest extends \PHPUnit_Framework_TestCase { $urlMock = $this->getMock('Magento\Url', array(), array(), '', false); - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->any())->method('isUseStoreInUrl')->will($this->returnValue($isUseStoreInUrl)); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); @@ -64,11 +64,9 @@ class GridTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $block = $helper->getObject('Magento\Backend\Block\Widget\Grid', array( - 'storeManager' => $storeManagerMock, - 'urlModel' => $urlMock, - 'urlBuilder' => $urlBuilderMock, - ) + $block = $helper->getObject( + 'Magento\Backend\Block\Widget\Grid', + array('storeManager' => $storeManagerMock, 'urlModel' => $urlMock, 'urlBuilder' => $urlBuilderMock) ); $this->assertFalse($block->getRssLists()); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php index 2e42ecb04f06e85506854e6b9ee419dbefc3d5b6..7914a74d33aed19f2b02daeb263fd16646341898 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php @@ -55,7 +55,7 @@ class AuthTest extends \PHPUnit_Framework_TestCase $this->getMock('\Magento\Backend\Helper\Data', array(), array(), '', false), $this->getMock('\Magento\Backend\Model\Auth\StorageInterface'), $this->_credentialStorage, - $this->getMock('\Magento\App\ConfigInterface', array(), array(), '', false), + $this->getMock('\Magento\App\Config\ScopeConfigInterface'), $this->_modelFactoryMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index dbee3f484bcc7049c4e0c7fdd08f2458fe596083..60966b9a5f9d7e581fcc1eaba946ae2b09e6d4d3 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -30,9 +30,13 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); $cacheManager = $this->getMock('Magento\App\CacheInterface'); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $actionValidatorMock = $this->getMock( - 'Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + 'Magento\Model\ActionValidator\RemoveAction', + array(), + array(), + '', + false ); $context = new \Magento\Model\Context( @@ -48,17 +52,16 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase $resourceCollection = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false); $mergeService = $this->getMock('Magento\View\Asset\MergeService', array(), array(), '', false); $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false); - $coreConfig = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $coreConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $model = $this->getMock( 'Magento\Backend\Model\Config\Backend\Baseurl', array('getOldValue'), - array($context, $coreRegistry, $storeManager, $coreConfig, $mergeService, $resource, $resourceCollection) + array($context, $coreRegistry, $coreConfig, $mergeService, $resource, $resourceCollection) ); $mergeService->expects($this->once())->method('cleanMergedJsCss'); - $model->setValue('http://example.com/')->setPath(\Magento\Core\Model\Store::XML_PATH_UNSECURE_BASE_URL); + $model->setValue('http://example.com/')->setPath(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL); $model->save(); } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php index 08b130b79add125614b20aa9282a34998f0c31c4..374d898591473519d0605b4c978eabed4a2e7018 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php @@ -66,7 +66,7 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $this->_configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_encryptorMock = $this->getMock('Magento\Encryption\EncryptorInterface', array(), array(), '', false); $this->_model = $helper->getObject( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php index 0d66f30e247f1d3cd2dae7422cb053ac69404c24..c2591ae6c2733195c8443de97afde5d92de54995 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php @@ -32,7 +32,11 @@ class SecureTest extends \PHPUnit_Framework_TestCase $cacheManager = $this->getMock('Magento\App\CacheInterface'); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $actionValidatorMock = $this->getMock( - '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + '\Magento\Model\ActionValidator\RemoveAction', + array(), + array(), + '', + false ); $context = new \Magento\Model\Context( $logger, @@ -47,13 +51,12 @@ class SecureTest extends \PHPUnit_Framework_TestCase $resourceCollection = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false); $mergeService = $this->getMock('Magento\View\Asset\MergeService', array(), array(), '', false); $coreRegistry = $this->getMock('Magento\Registry', array(), array(), '', false); - $coreConfig = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $coreConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $model = $this->getMock( 'Magento\Backend\Model\Config\Backend\Secure', array('getOldValue'), - array($context, $coreRegistry, $storeManager, $coreConfig, $mergeService, $resource, $resourceCollection) + array($context, $coreRegistry, $coreConfig, $mergeService, $resource, $resourceCollection) ); $mergeService->expects($this->once())->method('cleanMergedJsCss'); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/LoaderTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/LoaderTest.php index 53c5f61a16dfa708586de20760b69c795cf798f3..fc4490773ae6a404d5cfe5e553c85345dd76f836 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/LoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/LoaderTest.php @@ -46,7 +46,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_configValueFactory = $this->getMock( - 'Magento\Core\Model\Config\ValueFactory', + 'Magento\App\Config\ValueFactory', array('create', 'getCollection'), array(), '', @@ -73,7 +73,7 @@ class LoaderTest extends \PHPUnit_Framework_TestCase $this->returnSelf() ); - $configDataMock = $this->getMock('Magento\Core\Model\Config\Value', array(), array(), '', false); + $configDataMock = $this->getMock('Magento\App\Config\Value', array(), array(), '', false); $this->_configValueFactory->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/ScopeDefinerTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/ScopeDefinerTest.php index 16f83ade8f097ac7d28c2887a16ae1f57d1f1f06..7495f9e44ddbb3c26e50fe7a21fb6626435f79ff 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/ScopeDefinerTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/ScopeDefinerTest.php @@ -46,7 +46,7 @@ class ScopeDefinerTest extends \PHPUnit_Framework_TestCase public function testGetScopeReturnsDefaultScopeIfNoScopeDataIsSpecified() { - $this->assertEquals(\Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT, $this->_model->getScope()); + $this->assertEquals(\Magento\App\ScopeInterface::SCOPE_DEFAULT, $this->_model->getScope()); } public function testGetScopeReturnsStoreScopeIfStoreIsSpecified() @@ -58,7 +58,7 @@ class ScopeDefinerTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValueMap(array(array('website', null, 'someWebsite'), array('store', null, 'someStore'))) ); - $this->assertEquals(\Magento\Backend\Model\Config\ScopeDefiner::SCOPE_STORE, $this->_model->getScope()); + $this->assertEquals(\Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_model->getScope()); } public function testGetScopeReturnsWebsiteScopeIfWebsiteIsSpecified() @@ -70,6 +70,6 @@ class ScopeDefinerTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValueMap(array(array('website', null, 'someWebsite'), array('store', null, null))) ); - $this->assertEquals(\Magento\Backend\Model\Config\ScopeDefiner::SCOPE_WEBSITE, $this->_model->getScope()); + $this->assertEquals(\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, $this->_model->getScope()); } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php index a47d14a3f9784b4e1b3e6cccd1e1ca15ddf1db61..c1faa24a5717d58c3c6977e53997ec9403cf92f4 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/AbstractElementTest.php @@ -40,7 +40,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_model = $this->getMockForAbstractClass( 'Magento\Backend\Model\Config\Structure\AbstractElement', @@ -98,7 +98,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->_storeManager->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(true)); $this->_model->setData( array('showInDefault' => 1, 'showInStore' => 0, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT ); $this->assertTrue($this->_model->isVisible()); } @@ -108,7 +108,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->_storeManager->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(true)); $this->_model->setData( array('hide_in_single_store_mode' => 1, 'showInDefault' => 1, 'showInStore' => 0, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT ); $this->assertFalse($this->_model->isVisible()); } @@ -121,7 +121,7 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase $this->_storeManager->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(true)); $this->_model->setData( array('showInDefault' => 0, 'showInStore' => 0, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT ); $this->assertFalse($this->_model->isVisible()); } @@ -142,15 +142,15 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase return array( array( array('showInDefault' => 1, 'showInStore' => 0, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT ), array( array('showInDefault' => 0, 'showInStore' => 1, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_STORE + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), array( array('showInDefault' => 0, 'showInStore' => 0, 'showInWebsite' => 1), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_WEBSITE + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE ) ); } @@ -171,15 +171,15 @@ class AbstractElementTest extends \PHPUnit_Framework_TestCase return array( array( array('showInDefault' => 0, 'showInStore' => 1, 'showInWebsite' => 1), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT ), array( array('showInDefault' => 1, 'showInStore' => 0, 'showInWebsite' => 1), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_STORE + \Magento\Store\Model\ScopeInterface::SCOPE_STORE ), array( array('showInDefault' => 1, 'showInStore' => 1, 'showInWebsite' => 0), - \Magento\Backend\Model\Config\ScopeDefiner::SCOPE_WEBSITE + \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php index a9c9656454763f66ac2d50a55ed1ce8a95194586..97fe0232672b4cfaa0775d34cc43ae5e2b0a725d 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/AbstractCompositeTest.php @@ -64,7 +64,7 @@ class AbstractCompositeTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_model = $this->getMockForAbstractClass( 'Magento\Backend\Model\Config\Structure\Element\AbstractComposite', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/Dependency/MapperTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/Dependency/MapperTest.php index d9275d3520054b3703975361b1dca433cd69387b..bc6e99344b85fe1e64227265138a61bea7133abf 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/Dependency/MapperTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/Dependency/MapperTest.php @@ -57,11 +57,6 @@ class MapperTest extends \PHPUnit_Framework_TestCase */ protected $_model; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_storeManagerMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -88,11 +83,6 @@ class MapperTest extends \PHPUnit_Framework_TestCase 'field_y' => array('id' => self::FIELD_ID2) ); - $this->_storeManagerMock = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' - )->setMethods( - array('getStore') - )->disableOriginalConstructor()->getMock(); $this->_configStructureMock = $this->getMockBuilder( 'Magento\Backend\Model\Config\Structure' )->setMethods( @@ -103,10 +93,13 @@ class MapperTest extends \PHPUnit_Framework_TestCase )->setMethods( array('create') )->disableOriginalConstructor()->getMock(); + $this->_scopeConfigMock = $this->getMockBuilder( + '\Magento\App\Config\ScopeConfigInterface' + )->disableOriginalConstructor()->getMock(); $this->_model = new \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper( - $this->_storeManagerMock, $this->_configStructureMock, - $this->_fieldFactoryMock + $this->_fieldFactoryMock, + $this->_scopeConfigMock ); } @@ -114,7 +107,6 @@ class MapperTest extends \PHPUnit_Framework_TestCase { unset($this->_model); unset($this->_configStructureMock); - unset($this->_storeManagerMock); unset($this->_fieldFactoryMock); unset($this->_testData); } @@ -125,17 +117,6 @@ class MapperTest extends \PHPUnit_Framework_TestCase */ public function testGetDependenciesWhenDependentIsInvisible($isValueSatisfy) { - $storeMock = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); - $this->_storeManagerMock->expects( - $this->exactly(count($this->_testData)) - )->method( - 'getStore' - )->with( - self::STORE_CODE - )->will( - $this->returnValue($storeMock) - ); - $expected = array(); $rowData = array_values($this->_testData); for ($i = 0; $i < count($this->_testData); ++$i) { @@ -170,12 +151,14 @@ class MapperTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($dependencyField) ); - $storeMock->expects( + $this->_scopeConfigMock->expects( $this->at($i) )->method( - 'getConfig' + 'getValue' )->with( - $dependentPath + $dependentPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + self::STORE_CODE )->will( $this->returnValue(self::VALUE_IN_STORE) ); @@ -194,8 +177,6 @@ class MapperTest extends \PHPUnit_Framework_TestCase public function testGetDependenciesIsVisible() { - $this->_storeManagerMock->expects($this->never())->method('getStore'); - $expected = array(); $rowData = array_values($this->_testData); for ($i = 0; $i < count($this->_testData); ++$i) { diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php index 68c98f96bf367f0c48988d557de68d16857aa9bf..3fb088bd7199f09f84c0e3526fb6c5460afa2802 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php @@ -81,7 +81,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_backendFactoryMock = $this->getMock( 'Magento\Backend\Model\Config\BackendFactory', array(), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php index d2bfcc4d65bcb999ce7481c0778c499f963eabbe..5fd6f34042d422f5fe3b6281b55600ec3886c9d7 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php @@ -62,7 +62,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_cloneFactoryMock = $this->getMock( 'Magento\Backend\Model\Config\BackendClone\Factory', array(), diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/SectionTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/SectionTest.php index 2f59546518df37de520b63d7af0bdefc20b233d7..889c8d13f59a6926091c0a4003a4ef5a2ea0dca2 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/SectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/SectionTest.php @@ -57,7 +57,7 @@ class SectionTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_authorizationMock = $this->getMock('Magento\AuthorizationInterface'); $this->_model = new \Magento\Backend\Model\Config\Structure\Element\Section( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/TabTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/TabTest.php index 79fd1f1a00a77f94ce973093936a65e8c6fc5fe4..3b1eca549440176160b851087388ecae99442dd2 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/TabTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/TabTest.php @@ -52,7 +52,7 @@ class TabTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_model = new \Magento\Backend\Model\Config\Structure\Element\Tab( $this->_storeManagerMock, diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php index 9462383369d5d7e72fa22da8f0b40d3fecca5480..5f0343979d18ae5c92166442aaaa9ac53dc4c1c2 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php @@ -49,7 +49,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_transFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ReinitableConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_appConfigMock; @@ -69,10 +69,15 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_dataFactoryMock; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; + /** + * @var \Magento\Backend\Model\Config\Structure + */ + protected $_configStructure; + protected function setUp() { $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); @@ -83,21 +88,30 @@ class ConfigTest extends \PHPUnit_Framework_TestCase '', false ); - $structureMock = $this->getMock('Magento\Backend\Model\Config\Structure', array(), array(), '', false); + $this->_configStructure = $this->getMock( + 'Magento\Backend\Model\Config\Structure', + array(), + array(), + '', + false + ); $this->_structureReaderMock->expects( $this->any() )->method( 'getConfiguration' )->will( - $this->returnValue($structureMock) + $this->returnValue($this->_configStructure) ); $this->_transFactoryMock = $this->getMock( 'Magento\DB\TransactionFactory', - array('create'), array(), '', false + array('create'), + array(), + '', + false ); - $this->_appConfigMock = $this->getMock('Magento\App\ReinitableConfigInterface', array(), array(), '', false); + $this->_appConfigMock = $this->getMock('Magento\App\Config\ReinitableConfigInterface'); $this->_configLoaderMock = $this->getMock( 'Magento\Backend\Model\Config\Loader', array('getConfigByPath'), @@ -106,19 +120,19 @@ class ConfigTest extends \PHPUnit_Framework_TestCase false ); $this->_dataFactoryMock = $this->getMock( - 'Magento\Core\Model\Config\ValueFactory', + 'Magento\App\Config\ValueFactory', array(), array(), '', false ); - $this->_storeManager = $this->getMockForAbstractClass('Magento\Core\Model\StoreManagerInterface'); + $this->_storeManager = $this->getMockForAbstractClass('Magento\Store\Model\StoreManagerInterface'); $this->_model = new \Magento\Backend\Model\Config( $this->_appConfigMock, $this->_eventManagerMock, - $structureMock, + $this->_configStructure, $this->_transFactoryMock, $this->_configLoaderMock, $this->_dataFactoryMock, @@ -146,9 +160,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testSaveToCheckAdminSystemConfigChangedSectionEvent() { - $transactionMock = $this->getMock( - 'Magento\DB\Transaction', array(), array(), '', false - ); + $transactionMock = $this->getMock('Magento\DB\Transaction', array(), array(), '', false); $this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock)); @@ -175,4 +187,101 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_model->setGroups(array('1' => array('data'))); $this->_model->save(); } + + public function testSaveToCheckScopeDataSet() + { + $transactionMock = $this->getMock('Magento\DB\Transaction', array(), array(), '', false); + + $this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock)); + + $this->_configLoaderMock->expects($this->any())->method('getConfigByPath')->will($this->returnValue(array())); + + $this->_eventManagerMock->expects( + $this->at(0) + )->method( + 'dispatch' + )->with( + $this->equalTo('admin_system_config_changed_section_'), + $this->arrayHasKey('website') + ); + + $this->_eventManagerMock->expects( + $this->at(0) + )->method( + 'dispatch' + )->with( + $this->equalTo('admin_system_config_changed_section_'), + $this->arrayHasKey('store') + ); + + $group = $this->getMock('Magento\Backend\Model\Config\Structure\Element\Group', array(), array(), '', false); + + $field = $this->getMock('Magento\Backend\Model\Config\Structure\Element\Field', array(), array(), '', false); + + $this->_configStructure->expects( + $this->at(0) + )->method( + 'getElement' + )->with( + '/1' + )->will( + $this->returnValue($group) + ); + + $this->_configStructure->expects( + $this->at(1) + )->method( + 'getElement' + )->with( + '/1/key' + )->will( + $this->returnValue($field) + ); + + $website = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); + $this->_storeManager->expects($this->any())->method('getWebsite')->will($this->returnValue($website)); + $this->_storeManager->expects($this->any())->method('getWebsites')->will($this->returnValue(array($website))); + $this->_storeManager->expects($this->any())->method('isSingleStoreMode')->will($this->returnValue(true)); + + $this->_model->setWebsite('website'); + + $this->_model->setGroups(array('1' => array('fields' => array('key' => array('data'))))); + + $backendModel = $this->getMock( + 'Magento\App\Config\Value', + array('setPath', 'addData', '__sleep', '__wakeup'), + array(), + '', + false + ); + $backendModel->expects( + $this->once() + )->method( + 'addData' + )->with( + array( + 'field' => 'key', + 'groups' => array(1 => array('fields' => array('key' => array('data')))), + 'group_id' => null, + 'scope' => 'websites', + 'scope_id' => 0, + 'scope_code' => 'website', + 'field_config' => null, + 'fieldset_data' => array('key' => null) + ) + ); + $backendModel->expects( + $this->once() + )->method( + 'setPath' + )->with( + '/key' + )->will( + $this->returnValue($backendModel) + ); + + $this->_dataFactoryMock->expects($this->any())->method('create')->will($this->returnValue($backendModel)); + + $this->_model->save(); + } } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php index 25b42ca197115084f8c896863cfce91a805aae6e..24ea3fb9024cbdc4dd806c9e2a7ffe5b09877a50 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ConfigTest.php @@ -124,11 +124,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_menuFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_menuMock)); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - - $storeManagerMock->expects($this->atLeastOnce())->method('getStore')->will($this->returnValue($storeMock)); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_configReaderMock->expects($this->any())->method('read')->will($this->returnValue(array())); @@ -149,7 +145,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_cacheInstanceMock, $this->_eventManagerMock, $this->_logger, - $storeManagerMock, + $scopeConfig, $appState ); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/ValidatorTest.php index f4327b978802234c631f2fcc11ab1823efac4f41..eb9214344a02060096d36cba930ec61e0efbd133 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/ValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/Item/ValidatorTest.php @@ -61,7 +61,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * Data to be validated diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php index 5b7c8ee1341034b375e21b1dd4195fa9d7f7dc2e..8982729bd61a2e74be7ecda8a7272233d0a03220 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Menu/ItemTest.php @@ -51,7 +51,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -84,7 +84,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_aclMock = $this->getMock('Magento\AuthorizationInterface'); - $this->_storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_menuFactoryMock = $this->getMock( 'Magento\Backend\Model\MenuFactory', array('create'), @@ -104,7 +104,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase array( 'validator' => $this->_validatorMock, 'authorization' => $this->_aclMock, - 'storeConfig' => $this->_storeConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, 'menuFactory' => $this->_menuFactoryMock, 'urlModel' => $this->_urlModelMock, 'moduleList' => $this->_moduleListMock, @@ -219,7 +219,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->returnValue(array('name' => 'Magento_Backend')) ); - $this->_storeConfigMock->expects($this->once())->method('getConfigFlag')->will($this->returnValue(true)); + $this->_scopeConfigMock->expects($this->once())->method('isSetFlag')->will($this->returnValue(true)); $this->assertFalse($this->_model->isDisabled()); } diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php index e1f6a725fe5e46d429b42858ad9885a1bef4021c..19bf38732381b3244f3a51c6778fd17ac50e8415 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/UrlTest.php @@ -53,7 +53,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -90,6 +90,10 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected $_encryptor; + /** + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ protected function setUp() { $this->_menuMock = $this->getMock('Magento\Backend\Model\Menu', array(), array(), '', false); @@ -130,11 +134,11 @@ class UrlTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($this->_areaFrontName) ); - $this->_storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $this->_scopeConfigMock->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( \Magento\Backend\Model\Url::XML_PATH_STARTUP_MENU_ITEM )->will( @@ -173,7 +177,29 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->_model = $helper->getObject( 'Magento\Backend\Model\Url', array( - 'coreStoreConfig' => $this->_storeConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, + 'backendHelper' => $helperMock, + 'formKey' => $this->_formKey, + 'menuConfig' => $this->_menuConfigMock, + 'coreData' => $this->_coreDataMock, + 'authSession' => $this->_authSessionMock, + 'encryptor' => $this->_encryptor, + 'routeParamsResolver' => $this->_paramsResolverMock + ) + ); + $this->_paramsResolverMock->expects( + $this->any() + )->method( + 'create' + )->will( + $this->returnValue( + $this->getMock('Magento\Core\Model\Url\RouteParamsResolver', array(), array(), '', false) + ) + ); + $this->_model = $helper->getObject( + 'Magento\Backend\Model\Url', + array( + 'scopeConfig' => $this->_scopeConfigMock, 'backendHelper' => $helperMock, 'formKey' => $this->_formKey, 'menuConfig' => $this->_menuConfigMock, diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/ViewTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/ViewTest.php index 69cb92d0339eb4e9b453f9332a414644bfc1b61c..b1279fc4f478c01aa9b6a6d1d7e11f31544660c0 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/ViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/ViewTest.php @@ -39,7 +39,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $aclFilter = $this->getMock('Magento\Backend\Model\Layout\Filter\Acl', array(), array(), '', false); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $layoutProcessor = $this->getMock('Magento\View\Layout\ProcessorInterface'); $node = new \Magento\Simplexml\Element('<node/>'); $this->_layoutMock->expects($this->once())->method('getNode')->will($this->returnValue($node)); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php index 19ecf03928ec93130bc515245fcb97494ff5be57..5384aeb10ba62f4b703d9b09f7cc8a4e5d619a78 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php @@ -67,7 +67,7 @@ class BundleTest extends \PHPUnit_Framework_TestCase $optionBlock->expects($this->any())->method('setOption')->will($this->returnValue($optionBlock)); $optionBlock->expects($this->any())->method('getPriceBlockTypes')->will($this->returnValue(array())); $optionBlock->expects($this->any())->method('toHtml')->will($this->returnValue('option html')); - $layout = $this->getMock('\Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array('getChildName', 'getBlock'), array(), '', false); $layout->expects($this->any())->method('getChildName')->will($this->returnValue('name')); $layout->expects($this->any())->method('getBlock')->will($this->returnValue($optionBlock)); $this->_bundleBlock->setLayout($layout); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php index 97eba477750402cfe3bd1ef53edcd47665e30f71..d27232919f8c7acde8fc4723d7214093a71adf5b 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CatalogPriceTest.php @@ -57,7 +57,7 @@ class CatalogPriceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->commonPriceMock = $this->getMock( 'Magento\Catalog\Model\Product\CatalogPrice', array(), @@ -114,7 +114,7 @@ class CatalogPriceTest extends \PHPUnit_Framework_TestCase public function testGetCatalogPriceWithCustomStore() { - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->coreRegistryMock->expects($this->once())->method('unregister')->with('rule_data'); $this->productMock->expects($this->once())->method('getStoreId')->will($this->returnValue('store_id')); $this->productMock->expects($this->once())->method('getWebsiteId')->will($this->returnValue('website_id')); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..44aa48703b82f217c2399fd0feb4ff32f15dd060 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/PriceTest.php @@ -0,0 +1,132 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Bundle\Model\Product; + +class PriceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $ruleFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $localeDateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $customerSessionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $taxHelperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \Magento\Bundle\Model\Product\Price + */ + protected $model; + + protected function setUp() + { + $this->ruleFactoryMock = $this->getMock( + '\Magento\CatalogRule\Model\Resource\RuleFactory', array(), array(), '', false + ); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); + $this->localeDateMock = $this->getMock('\Magento\Stdlib\DateTime\TimezoneInterface'); + $this->customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', array(), array(), '', false); + $this->eventManagerMock = $this->getMock('\Magento\Event\ManagerInterface'); + $this->taxHelperMock = $this->getMock('\Magento\Tax\Helper\Data', array(), array(), '', false); + $this->storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); + + $this->model = new \Magento\Bundle\Model\Product\Price( + $this->ruleFactoryMock, + $this->storeManagerMock, + $this->localeDateMock, + $this->customerSessionMock, + $this->eventManagerMock, + $this->taxHelperMock + ); + } + + /** + * @param float $finalPrice + * @param float $specialPrice + * @param int $callsNumber + * @param bool $dateInInterval + * @param float $expected + * + * @covers \Magento\Bundle\Model\Product\Price::calculateSpecialPrice + * @covers \Magento\Bundle\Model\Product\Price::__construct + * @dataProvider calculateSpecialPrice + */ + public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumber, $dateInInterval, $expected) + { + $this->localeDateMock->expects($this->exactly($callsNumber)) + ->method('isScopeDateInInterval')->will($this->returnValue($dateInInterval)); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore')->will($this->returnValue($this->storeMock)); + + $this->storeMock->expects($this->any()) + ->method('roundPrice')->will($this->returnArgument(0)); + + $this->assertEquals( + $expected, + $this->model->calculateSpecialPrice($finalPrice, $specialPrice, date('Y-m-d'), date('Y-m-d')) + ); + } + + /** + * @return array + */ + public function calculateSpecialPrice() + { + return array( + array(10, null, 0, true, 10), + array(10, false, 0, true, 10), + array(10, 50, 1, false, 10), + array(10, 50, 1, true, 5), + array(0, 50, 1, true, 0), + array(10, 100, 1, true, 10), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php index 5e37c889a772ca892845b5c95a59f69b207ac258..c6ab71c750abe84676efc868d502ab29e83fc466 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php @@ -41,7 +41,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $backendConfig = $this->getMockBuilder( 'Magento\Backend\App\ConfigInterface' )->disableOriginalConstructor()->setMethods( - array('getValue', 'setValue', 'reinit', 'isSetFlag') + array('getValue', 'setValue', 'isSetFlag') )->getMock(); $backendConfig->expects( $this->any() @@ -61,8 +61,8 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\Captcha\Helper\Adminhtml\Data( $this->getMock('Magento\App\Helper\Context', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), - $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $filesystemMock, $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false), $backendConfig diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php index 90d0f10a7b2d34ff583f40bd4698190380536d2f..d904602f46746890ee3d10377bf6ce02a0fec8d3 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php @@ -41,7 +41,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function _getHelper($store, $config, $factory) { $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $storeManager->expects($this->any())->method('getWebsite')->will($this->returnValue($this->_getWebsiteStub())); $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); @@ -57,10 +57,11 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetCaptcha() { $store = $this->_getStoreStub(); - $store->expects( + $config = $this->_getConfigStub(); + $config->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'customer/captcha/type' )->will( @@ -85,7 +86,6 @@ class DataTest extends \PHPUnit_Framework_TestCase ) ); - $config = $this->_getConfigStub(); $helper = $this->_getHelper($store, $config, $factoryMock); $this->assertInstanceOf('Magento\Captcha\Model\DefaultModel', $helper->getCaptcha('user_create')); } @@ -96,18 +96,20 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetConfigNode() { $store = $this->_getStoreStub(); - $store->expects( + $config = $this->_getConfigStub(); + $config->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( - 'customer/captcha/enable' + 'customer/captcha/enable', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue('1') ); $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); - $object = $this->_getHelper($store, $this->_getConfigStub(), $factoryMock); + $object = $this->_getHelper($store, $config, $factoryMock); $object->getConfig('enable'); } @@ -124,7 +126,22 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); - $object = $this->_getHelper($this->_getStoreStub(), $this->_getConfigStub(), $factoryMock); + + $config = $this->_getConfigStub(); + $configData = array('font_code' => array('label' => 'Label', 'path' => 'path/to/fixture.ttf')); + + $config->expects( + $this->any() + )->method( + 'getValue' + )->with( + 'captcha/fonts', + 'default' + )->will( + $this->returnValue($configData) + ); + + $object = $this->_getHelper($this->_getStoreStub(), $config, $factoryMock); $fonts = $object->getFonts(); $this->assertArrayHasKey('font_code', $fonts); // fixture @@ -192,35 +209,22 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * Create Config Stub * - * @return \Magento\App\ConfigInterface + * @return \Magento\App\Config\ScopeConfigInterface */ protected function _getConfigStub() { - $config = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - - $configData = array('font_code' => array('label' => 'Label', 'path' => 'path/to/fixture.ttf')); - - $config->expects( - $this->any() - )->method( - 'getValue' - )->with( - 'captcha/fonts', - 'default' - )->will( - $this->returnValue($configData) - ); + $config = $this->getMock('Magento\App\Config\ScopeConfigInterface'); return $config; } /** * Create Website Stub * - * @return \Magento\Core\Model\Website + * @return \Magento\Store\Model\Website */ protected function _getWebsiteStub() { - $website = $this->getMock('Magento\Core\Model\Website', array('getCode', '__wakeup'), array(), '', false); + $website = $this->getMock('Magento\Store\Model\Website', array('getCode', '__wakeup'), array(), '', false); $website->expects($this->any())->method('getCode')->will($this->returnValue('base')); @@ -230,11 +234,11 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * Create store stub * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getStoreStub() { - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $store->expects($this->any())->method('getBaseUrl')->will($this->returnValue('http://localhost/pub/media/')); diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php index d8bb40f7bc9d407311bd68ed1320c63e03d7db2d..ccdcce716772c0dcb7c0a586479ad99ac9cf38cd 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php @@ -55,7 +55,7 @@ class CronTest extends \PHPUnit_Framework_TestCase protected $_directory; /** - * @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_storeManager; @@ -78,7 +78,7 @@ class CronTest extends \PHPUnit_Framework_TestCase $this->_adminHelper = $this->getMock('Magento\Captcha\Helper\Adminhtml\Data', array(), array(), '', false); $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); - $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_filesystem->expects( $this->once() @@ -158,13 +158,13 @@ class CronTest extends \PHPUnit_Framework_TestCase public function getExpiredImages() { $website = $this->getMock( - 'Magento\Core\Model\Website', + 'Magento\Store\Model\Website', array('__wakeup', 'getDefaultStore'), array(), '', false ); - $store = $this->getMock('Magento\Core\Model\Store', array('__wakeup'), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array('__wakeup'), array(), '', false); $website->expects($this->any())->method('getDefaultStore')->will($this->returnValue($store)); $time = time(); return array( diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php index 1ef1624506d190b1ab56699b0b4f8e59edeece70..04e74bcb294bbae93c8b03946b1cfa51e0f277c3 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/DefaultTest.php @@ -101,7 +101,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->session = $this->_getSessionStub(); $this->_storeManager = $this->getMock( - 'Magento\Core\Model\StoreManager', + 'Magento\Store\Model\StoreManager', array('getStore'), array(), '', @@ -353,11 +353,11 @@ class DefaultTest extends \PHPUnit_Framework_TestCase /** * Create store stub * - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getStoreStub() { - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $store->expects($this->any())->method('getBaseUrl')->will($this->returnValue('http://localhost/pub/media/')); $store->expects($this->any())->method('isAdmin')->will($this->returnValue(false)); return $store; diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php index 99a466bd4967d6630d29ca4f722af37271633838..2de9dca0f49a3d3db390d6bdd0c200228a36ae77 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/ObserverTest.php @@ -191,7 +191,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $formId = 'contact_us'; $captchaValue = 'some-value'; $warningMessage = 'Incorrect CAPTCHA.'; - $redirectRoutePath = 'contacts/index/index'; + $redirectRoutePath = 'contact/index/index'; $redirectUrl = 'http://magento.com/contacts/'; $request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/OptionsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/OptionsTest.php index c103d56cf1462041613d0a8dee65bf9adaf1a401..26a67c53eef4f882ffe8cd04742d1e3dab87dc55 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/OptionsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/OptionsTest.php @@ -63,7 +63,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase public function testGetOptionHtml() { $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', 'renderElement'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php index dc37c1725a28503edaf3a6b72f19c7fc686fc1e0..3ac4c55d4215c52f210c7d2e1cf15956a3ac8f83 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php @@ -33,16 +33,16 @@ class AlertsTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $storeConfigMock; + protected $scopeConfigMock; protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->alerts = $helper->getObject( 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts', - array('storeConfig' => $this->storeConfigMock) + array('scopeConfig' => $this->scopeConfigMock) ); } @@ -56,10 +56,20 @@ class AlertsTest extends \PHPUnit_Framework_TestCase public function testCanShowTab($priceAllow, $stockAllow, $canShowTab) { $valueMap = array( - array('catalog/productalert/allow_price', null, $priceAllow), - array('catalog/productalert/allow_stock', null, $stockAllow) + array( + 'catalog/productalert/allow_price', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + $priceAllow + ), + array( + 'catalog/productalert/allow_stock', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + $stockAllow + ) ); - $this->storeConfigMock->expects($this->any())->method('getConfig')->will($this->returnValueMap($valueMap)); + $this->scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValueMap($valueMap)); $this->assertEquals($canShowTab, $this->alerts->canShowTab()); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/NavigationTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/NavigationTest.php index 55996a5f3544c32cbdb8efae538bb686f3b3824b..bc46d7cfe77e85711daf17c4a9efb2728fdc3f10 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/NavigationTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/NavigationTest.php @@ -54,7 +54,7 @@ class NavigationTest extends \PHPUnit_Framework_TestCase public function testGetIdentities() { $this->assertEquals( - array(\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Core\Model\Store\Group::CACHE_TAG), + array(\Magento\Catalog\Model\Category::CACHE_TAG, \Magento\Store\Model\Group::CACHE_TAG), $this->block->getIdentities() ); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php index 6cb0b8e8909e5293d99d02a2b10d51c4758f71d2..82e3b1e038e19c9441850241db166c36b6ecc4ff 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ProductList/ToolbarTest.php @@ -47,9 +47,9 @@ class ToolbarTest extends \PHPUnit_Framework_TestCase protected $helper; /** - * @var \Magento\Core\Model\Store\Config | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface | \PHPUnit_Framework_MockObject_MockObject */ - protected $storeConfig; + protected $scopeConfig; /** * @var \Magento\Catalog\Model\Config | \PHPUnit_Framework_MockObject_MockObject */ @@ -76,9 +76,9 @@ class ToolbarTest extends \PHPUnit_Framework_TestCase false ); $this->urlBuilder = $this->getMock('Magento\Url', array('getUrl'), array(), '', false); - $this->storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array('getConfig'), array(), '', false); + $this->scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); - $storeConfig = array( + $scopeConfig = array( array(\Magento\Catalog\Model\Config::XML_PATH_LIST_DEFAULT_SORT_BY, null, 'name'), array(\Magento\Catalog\Helper\Product\ProductList::XML_PATH_LIST_MODE, null, 'grid-list'), array('catalog/frontend/list_per_page_values', null, '10,20,30'), @@ -86,9 +86,9 @@ class ToolbarTest extends \PHPUnit_Framework_TestCase array('catalog/frontend/list_allow_all', null, false) ); - $this->storeConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValueMap($storeConfig)); + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->will($this->returnValueMap($scopeConfig)); $this->catalogConfig = $this->getMock( 'Magento\Catalog\Model\Config', @@ -113,7 +113,7 @@ class ToolbarTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->urlBuilder)); $context->expects($this->any()) ->method('getStoreConfig') - ->will($this->returnValue($this->storeConfig)); + ->will($this->returnValue($this->scopeConfig)); $this->productListHelper = $this->getMock('Magento\Catalog\Helper\Product\ProductList', array(), diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php index 67d021217b2985291db7c212be23827cc17dcaeb..dc36dad8a8830efd9e317a385bce7c0a8a2f85ec 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/OptionsTest.php @@ -67,7 +67,7 @@ class OptionsTest extends \PHPUnit_Framework_TestCase public function testGetOptionHtml() { $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', 'renderElement'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/TabsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/TabsTest.php index c56458ce6cf1641eefcbc0bad9b7d9c73d3a1322..6df490f34204a9c4d0a2841f57c89b996e36fc0e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/TabsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/View/TabsTest.php @@ -30,7 +30,7 @@ class TabsTest extends \PHPUnit_Framework_TestCase $tabBlock = $this->getMock('Magento\View\Element\Template', array(), array(), '', false); $tabBlock->expects($this->once())->method('setTemplate')->with('template')->will($this->returnSelf()); - $layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array(), array(), '', false); $layout->expects($this->once())->method('createBlock')->with('block')->will($this->returnValue($tabBlock)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php index 61c2284c5ce8aa86e9f76e1e00df5ec5570933e7..26d7de33b2423faa3b55d043a11d9e8e44b5e9b3 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php @@ -73,9 +73,10 @@ class HelperTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); - $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $this->websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->jsHelperMock = $this->getMock('Magento\Backend\Helper\Js', array(), array(), '', false); + $this->storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->stockFilterMock = $this->getMock( 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php index 7d8a45af16f86048d13e67ff2fe165ade9e7fe15..55c2eee865111cd5142437c06633b5ab3d9397cb 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; - +use \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter; class StockDataFilterTest extends \PHPUnit_Framework_TestCase { /** @@ -33,32 +33,20 @@ class StockDataFilterTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $storeManagerMock; + protected $scopeConfigMock; /** - * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter + * @var StockDataFilter */ protected $stockDataFilter; protected function setUp() { - $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - - $this->storeMock->expects( - $this->any() - )->method( - 'getConfig' - )->with( - \Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK - )->will( - $this->returnValue(1) - ); - - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); - $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->storeMock)); + $this->scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue(1)); - $this->stockDataFilter = new StockDataFilter($this->storeManagerMock); + $this->stockDataFilter = new StockDataFilter($this->scopeConfigMock); } /** @@ -95,13 +83,10 @@ class StockDataFilterTest extends \PHPUnit_Framework_TestCase ), 'case3' => array( 'inputStockData' => array( - 'qty' => - \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE + - 1 + 'qty' => StockDataFilter::MAX_QTY_VALUE + 1 ), 'outputStockData' => array( - 'qty' => - \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE, + 'qty' => StockDataFilter::MAX_QTY_VALUE, 'is_decimal_divided' => 0, 'use_config_manage_stock' => 0 ) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php index dc47d9bd6ec70cbe0d6f3c29a2447acbb420540c..e01d0022e5ac3a5a2cee48dc059d59a487fefe7f 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Helper/Product/Flat/IndexerTest.php @@ -36,7 +36,7 @@ class IndexerTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_storeManagerMock; @@ -91,7 +91,7 @@ class IndexerTest extends \PHPUnit_Framework_TestCase $eavFactoryMock = $this->getMock('Magento\Eav\Model\Entity\AttributeFactory', array(), array(), '', false); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->_connectionMock = $this->getMock( 'Magento\DB\Adapter\Pdo\Mysql', @@ -276,7 +276,7 @@ class IndexerTest extends \PHPUnit_Framework_TestCase $stores = array(); foreach ($storeIds as $storeId) { $store = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('getId', '__sleep', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Category/Attribute/Backend/SortbyTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Category/Attribute/Backend/SortbyTest.php index ec24a9b8a628a7875f4d952791e5c71419bf4fa3..b293e55290f6b5a8193f80fa066ff0081a26a9ff 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Category/Attribute/Backend/SortbyTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Category/Attribute/Backend/SortbyTest.php @@ -40,10 +40,10 @@ class SortbyTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = $this->_objectHelper->getObject( 'Magento\Catalog\Model\Category\Attribute\Backend\Sortby', - array('coreStoreConfig' => $coreStoreConfig) + array('scopeConfig' => $scopeConfig) ); $attribute = $this->getMockForAbstractClass( 'Magento\Eav\Model\Entity\Attribute\AbstractAttribute', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php index 8a0331bc7c6a5531489e708cf01b98535c621204..724476e993a6dab67a776747cd503938a7407cb1 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php @@ -17,7 +17,7 @@ * 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. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -73,10 +73,10 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase '', false ); - $this->subjectMock = $this->getMock('Magento\Core\Model\Resource\Store\Group', array(), array(), '', false); + $this->subjectMock = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false); $this->groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', @@ -110,7 +110,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase { $this->stateMock->expects($this->never())->method('isFlatEnabled'); $this->groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php index 7d57e9b80652012564515a0b50c5a9bef1875ae7..0f66723ed9c7596addca826cb0bbb9343614b683 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php @@ -17,7 +17,7 @@ * 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. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -71,7 +71,7 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase $this->closureMock = function () { return false; }; - $this->subjectMock = $this->getMock('Magento\Core\Model\Resource\Store', array(), array(), '', false); + $this->subjectMock = $this->getMock('Magento\Store\Model\Resource\Store', array(), array(), '', false); $this->model = new StoreView($this->indexerMock, $this->stateMock); } @@ -80,7 +80,7 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase $this->mockConfigFlatEnabled(); $this->mockIndexerMethods(); $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', @@ -93,21 +93,12 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase public function testAroundSaveHasChanged() { $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', false ); - $storeMock->expects( - $this->once() - )->method( - 'dataHasChangedFor' - )->with( - 'group_id' - )->will( - $this->returnValue(true) - ); $this->assertFalse($this->model->aroundSave($this->subjectMock, $this->closureMock, $storeMock)); } @@ -115,21 +106,12 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase { $this->mockConfigFlatEnabledNeever(); $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', false ); - $storeMock->expects( - $this->once() - )->method( - 'dataHasChangedFor' - )->with( - 'group_id' - )->will( - $this->returnValue(false) - ); $this->assertFalse($this->model->aroundSave($this->subjectMock, $this->closureMock, $storeMock)); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php index 25b58adf9ba87a6b5f23ff3d70127657c55a2cce..dc116424472cfccfa0c01e63cb4d5efd3b905f82 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php @@ -31,9 +31,9 @@ class StateTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \Magento\Core\Model\Store\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $storeConfigMock; + protected $scopeConfigMock; /** * @var \Magento\Indexer\Model\IndexerInterface|\PHPUnit_Framework_MockObject_MockObject @@ -42,15 +42,7 @@ class StateTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeConfigMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Store\ConfigInterface', - array(), - '', - false, - false, - true, - array('getConfigFlag', '__wakeup') - ); + $this->scopeConfigMock = $this->getMockForAbstractClass('Magento\App\Config\ScopeConfigInterface'); $this->flatIndexerMock = $this->getMockForAbstractClass( 'Magento\Indexer\Model\IndexerInterface', @@ -65,10 +57,10 @@ class StateTest extends \PHPUnit_Framework_TestCase public function testIsFlatEnabled() { - $this->storeConfigMock->expects( + $this->scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( 'catalog/frontend/flat_catalog_category' )->will( @@ -76,7 +68,7 @@ class StateTest extends \PHPUnit_Framework_TestCase ); $this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State( - $this->storeConfigMock, + $this->scopeConfigMock, $this->flatIndexerMock ); $this->assertEquals(true, $this->model->isFlatEnabled()); @@ -95,10 +87,10 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->flatIndexerMock->expects($this->any())->method('load')->with('catalog_category_flat'); $this->flatIndexerMock->expects($this->any())->method('isValid')->will($this->returnValue($isValid)); - $this->storeConfigMock->expects( + $this->scopeConfigMock->expects( $this->any() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( 'catalog/frontend/flat_catalog_category' )->will( @@ -106,7 +98,7 @@ class StateTest extends \PHPUnit_Framework_TestCase ); $this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State( - $this->storeConfigMock, + $this->scopeConfigMock, $this->flatIndexerMock, $isAvailable ); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php index bcf7b2a2bf9216a564101c13bcd3ac72f2892b69..04f21ac5facf62cf9e60ba037a149c91b037e49d 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php @@ -31,7 +31,7 @@ class ModeTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; @@ -47,7 +47,7 @@ class ModeTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->indexerStateMock = $this->getMock( 'Magento\Indexer\Model\Indexer\State', array('loadByIndexer', 'setStatus', 'save', '__wakeup'), diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php index b0bca79608f0c8bafc697b70b59cf8ce83adf2c2..78108d267133c9fcacdf75d353a74da8b3961a64 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php @@ -17,7 +17,7 @@ * 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. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,7 +57,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase array('getId', 'getState', '__wakeup') ); $this->model = new StoreGroup($this->indexerMock); - $this->subject = $this->getMock('Magento\Core\Model\Resource\Store\Group', array(), array(), '', false); + $this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false); } /** @@ -68,7 +68,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase { $this->mockIndexerMethods(); $groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', @@ -88,7 +88,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase public function testAroundSaveNotNew($valueMap) { $groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', @@ -114,7 +114,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase public function testAroundSaveWithoutChanges() { $groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('dataHasChangedFor', 'isObjectNew', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php index 14ba152b6e8ec3318bfd6092d1ad8915262aabac..3d1c930b4509483cbd82a2bcef5991523020829b 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php @@ -17,7 +17,7 @@ * 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. - * + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -57,14 +57,14 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase array('getId', 'getState', '__wakeup') ); $this->model = new StoreView($this->indexerMock); - $this->subject = $this->getMock('Magento\Core\Model\Resource\Store\Group', array(), array(), '', false); + $this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false); } public function testAroundSaveNewObject() { $this->mockIndexerMethods(); $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', @@ -78,7 +78,7 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase public function testAroundSaveHasChanged() { $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', @@ -100,7 +100,7 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase public function testAroundSaveNoNeed() { $storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('isObjectNew', 'dataHasChangedFor', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroupTest.php index fc3851231e09a6c6b15f1c3d19990f95a3350bc6..6f33d2d7eeee7543ea601107ec2d2c17a328058f 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroupTest.php @@ -34,7 +34,7 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase protected $processorMock; /** - * @var \Magento\Core\Model\Store\Group|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $storeGroupMock; @@ -53,9 +53,9 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase false ); - $this->subjectMock = $this->getMock('Magento\Core\Model\Resource\Store\Group', array(), array(), '', false); + $this->subjectMock = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false); $this->storeGroupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('getId', '__wakeup', 'dataHasChangedFor'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreTest.php index 80f1931823bc125a3745617ee4e9562aa3cc8917..c84c70837eb4ed016a3f94d50307b97d042b1050 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreTest.php @@ -34,7 +34,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase protected $processorMock; /** - * @var \Magento\Core\Model\Store|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $storeMock; @@ -53,9 +53,9 @@ class StoreTest extends \PHPUnit_Framework_TestCase false ); - $this->subjectMock = $this->getMock('Magento\Core\Model\Resource\Store', array(), array(), '', false); + $this->subjectMock = $this->getMock('\Magento\Store\Model\Resource\Store', array(), array(), '', false); $this->storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('getId', '__wakeup', 'dataHasChangedFor'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php index 767c98b68faf631fc0d69589e03787516abbc846..ae9bdb329baae010483b70465772241e68dcbbd8 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/StateTest.php @@ -50,11 +50,11 @@ class StateTest extends \PHPUnit_Framework_TestCase '', false ); - $configMock = $this->getMock('Magento\Core\Model\Store\ConfigInterface', array(), array(), '', false); + $configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = $this->_objectManager->getObject( 'Magento\Catalog\Model\Indexer\Product\Flat\State', array( - 'storeConfig' => $configMock, + 'scopeConfig' => $configMock, 'flatIndexer' => $indexerMock, 'flatIndexerHelper' => $flatIndexerHelperMock, false diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/ModeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/ModeTest.php index ecc3d19fc73be1545d53f31b642c33b800f99f50..27fc59be7cad2d442d07a6a53278edfc71f506b3 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/ModeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/ModeTest.php @@ -31,7 +31,7 @@ class ModeTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; @@ -47,7 +47,7 @@ class ModeTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->indexerStateMock = $this->getMock( 'Magento\Indexer\Model\Indexer\State', array('loadByIndexer', 'setStatus', 'save', '__wakeup'), diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/ObserverTest.php index 8d80a06f5a917d218218411f3b3cbcdad637523b..83d77ab58e5a2119a98845f8aa5286875859b562 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/ObserverTest.php @@ -39,7 +39,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_storeManagerMock; @@ -73,7 +73,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_storeManagerMock = $this->getMock( - 'Magento\Core\Model\StoreManagerInterface', + 'Magento\Store\Model\StoreManagerInterface', array(), array(), '', @@ -124,20 +124,24 @@ class ObserverTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($idsToProcess) ); - $this->_resourceMock->expects( $this->once() - )->method( + ) + ->method( 'getConnection' - )->with( + ) + ->with( 'write' - )->will( + ) + ->will( $this->returnValue($connectionMock) ); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->any())->method('getId')->will($this->returnValue(1)); + $this->_storeManagerMock->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/WebsiteTest.php index a9bb82ac82b5f60f2faf2543b361469cc7352c68..aa9723736a92e7ce1ce2dcf78c39477475a9dee5 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/WebsiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/WebsiteTest.php @@ -65,7 +65,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase { $this->_priceProcessorMock->expects($this->once())->method('markIndexerAsInvalid'); - $websiteMock = $this->getMock('Magento\Core\Model\Resource\Website', array(), array(), '', false); + $websiteMock = $this->getMock('Magento\Store\Model\Resource\Website', array(), array(), '', false); $this->assertEquals('return_value', $this->_model->afterDelete($websiteMock, 'return_value')); } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php index b41f4b16294deb428cd47f7f632ee1419d116601..aaf79b27217b61c897f6a6c1618f06cbee72248c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php @@ -58,8 +58,8 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase $contextMock = $this->getMock('Magento\Model\Context', array(), array(), '', false); $registryMock = $this->getMock('Magento\Registry', array(), array(), '', false); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); - $configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false); + $configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = $this->_objectManager->getObject( diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/FilterableAttributeListTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/FilterableAttributeListTest.php index 775e2f9eb97695d0d0900a705c82d2c4af571ef2..7cd6d53bb376ece6db69010f0939e3ecc57ecd3c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/FilterableAttributeListTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/FilterableAttributeListTest.php @@ -52,7 +52,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase '\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory', array('create'), array(), '', false); $this->storeManagerMock = $this->getMock( - '\Magento\Core\Model\StoreManagerInterface', array(), array(), '', false + '\Magento\Store\Model\StoreManagerInterface', array(), array(), '', false ); $this->layerMock = $this->getMock( @@ -90,7 +90,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase $setIds = array(2, 3, 5); $productCollectionMock->expects($this->once())->method('getSetIds')->will($this->returnValue($setIds)); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeId = 4321; diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/StateKeyTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/StateKeyTest.php index 924140632da63c7a431bbee82d462fdf9c867a6e..7552c2b6d8b79e090fda61c84563d0422895447c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/StateKeyTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Category/StateKeyTest.php @@ -43,7 +43,7 @@ class StateKeyTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', array(), array(), '', false); $this->model = new StateKey($this->storeManagerMock, $this->customerSessionMock); } @@ -57,7 +57,7 @@ class StateKeyTest extends \PHPUnit_Framework_TestCase $categoryMock = $this->getMock('\Magento\Catalog\Model\Category', array(), array(), '', false); $categoryMock->expects($this->once())->method('getId')->will($this->returnValue('1')); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('getId')->will($this->returnValue('2')); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/CollectionFilterTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/CollectionFilterTest.php index cd75e0cc67c107a67670e6e4ab04ad3396c24d27..4e6697923485262dacde3c09a7183ab2671a7719 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/CollectionFilterTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/CollectionFilterTest.php @@ -56,7 +56,7 @@ class CollectionFilterTest extends \PHPUnit_Framework_TestCase $this->visibilityMock = $this->getMock('Magento\Catalog\Model\Product\Visibility', array(), array(), '', false); $this->catalogConfigMock = $this->getMock('\Magento\Catalog\Model\Config', array(), array(), '', false); $this->helperMock = $this->getMock('\Magento\CatalogSearch\Helper\Data', array(), array(), '', false); - $this->storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->model = new CollectionFilter( $this->catalogConfigMock, $this->helperMock, $this->storeManagerMock, $this->visibilityMock diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/FilterableAttributeListTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/FilterableAttributeListTest.php index 2d680340ed995c645715f66a4ae24b4aa1121bb4..33c8811c8c5f6c8406c425ad4d2525201f9a653e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/FilterableAttributeListTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/FilterableAttributeListTest.php @@ -52,7 +52,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase '\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory', array('create'), array(), '', false); $this->storeManagerMock = $this->getMock( - '\Magento\Core\Model\StoreManagerInterface', array(), array(), '', false + '\Magento\Store\Model\StoreManagerInterface', array(), array(), '', false ); $this->layerMock = $this->getMock( @@ -80,7 +80,7 @@ class FilterableAttributeListTest extends \PHPUnit_Framework_TestCase $setIds = array(2, 3, 5); $productCollectionMock->expects($this->once())->method('getSetIds')->will($this->returnValue($setIds)); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeId = 4321; diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/StateKeyTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/StateKeyTest.php index 6b6171a5a4f71baca2510a899bab8447b5a41a6c..a799898a55d36c7f2943c993f693a72210557b0d 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/StateKeyTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Search/StateKeyTest.php @@ -48,7 +48,7 @@ class StateKeyTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', array(), array(), '', false); $this->helperMock = $this->getMock('\Magento\CatalogSearch\Helper\Data', array(), array(), '', false); @@ -64,7 +64,7 @@ class StateKeyTest extends \PHPUnit_Framework_TestCase $categoryMock = $this->getMock('\Magento\Catalog\Model\Category', array(), array(), '', false); $categoryMock->expects($this->once())->method('getId')->will($this->returnValue('1')); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('getId')->will($this->returnValue('2')); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php index 7f083cb5fe076a5e23c6afee1f8ecbb7e3cdfa65..3a342baa3fb02515098e4d6ebcef1d6cd42a3990 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php @@ -47,9 +47,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); $currencyFactoryMock = $this->getMock('Magento\Directory\Model\CurrencyFactory', array(), array(), '', false); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false); $productTypeMock = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false); - $configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = $this->getMockForAbstractClass( 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice', diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php index 868dad2d4420b6b794acfb438d28c2cb6e363dba..3462d0b4001c35f5577b8a79f05e6fd2dbe43c2c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php @@ -110,7 +110,7 @@ class CopierTest extends \PHPUnit_Framework_TestCase )->method( 'setStoreId' )->with( - \Magento\Core\Model\Store::DEFAULT_STORE_ID + \Magento\Store\Model\Store::DEFAULT_STORE_ID ); $duplicateMock->expects($this->once())->method('setData')->with('product data'); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ReservedAttributeListTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ReservedAttributeListTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0fb2d23d0b623d2feaff3dccbb548c3dddba02c3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ReservedAttributeListTest.php @@ -0,0 +1,69 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product; + +class ReservedAttributeListTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ReservedAttributeList + */ + protected $model; + + protected function setUp() + { + $this->model = new ReservedAttributeList('Magento\Catalog\Model\Product', ['some_value'], ['some_attribute']); + } + + /** + * @covers \Magento\Catalog\Model\Product\ReservedAttributeList::isReservedAttribute + * @dataProvider dataProvider + */ + public function testIsReservedAttribute($isUserDefined, $attributeCode, $expected) + { + $attribute = $this->getMock( + '\Magento\Catalog\Model\Entity\Attribute', + ['getIsUserDefined', 'getAttributeCode', '__sleep', '__wakeup'], + [], + '', + false + ); + + $attribute->expects($this->once())->method('getIsUserDefined')->will($this->returnValue($isUserDefined)); + $attribute->expects($this->any())->method('getAttributeCode')->will($this->returnValue($attributeCode)); + + $this->assertEquals($expected, $this->model->isReservedAttribute($attribute)); + } + + public function dataProvider() + { + return [ + [false, 'some_code', false], + [true, 'some_value', true], + [true, 'name', true], + [true, 'price', true], + [true, 'category_id', true], + [true, 'some_code', false], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php index ec3727b3ce8c4e2040c034a976d5d910cab6eb37..1f126af0f6563ad4f1c7fab92eaff682dc1b5fbb 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php @@ -121,7 +121,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\Catalog\Model\Product( $contextMock, $this->getMock('Magento\Registry', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->getMock('Magento\Catalog\Model\Product\Url', array(), array(), '', false), $this->getMock('Magento\Catalog\Model\Product\Link', array(), array(), '', false), $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php index 2c0cc8b30191c37d00e58acedb6e88c2fbf2b890..5186da83dd1d0206b66ed2f4b86c0de037936bb2 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.php @@ -31,6 +31,7 @@ return array( 'index_priority' => 40, 'can_use_qty_decimals' => true, 'is_qty' => true, + 'sort_order' => 100, 'price_model' => 'Instance_Type_One', 'price_indexer' => 'Instance_Type_Two', 'stock_indexer' => 'Instance_Type_Three' @@ -43,6 +44,7 @@ return array( 'index_priority' => 0, 'can_use_qty_decimals' => true, 'is_qty' => false, + 'sort_order' => 0, 'allowed_selection_types' => array('type_two' => 'type_two'), 'custom_attributes' => array('some_name' => 'some_value') ), @@ -54,6 +56,7 @@ return array( 'index_priority' => 20, 'can_use_qty_decimals' => false, 'is_qty' => false, + 'sort_order' => 5, 'price_model' => 'Instance_Type_Three', 'price_indexer' => 'Instance_Type_Three', 'stock_indexer' => 'Instance_Type_Three' diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml index ba1023b9b83371c2fff243e90a97e5d3fb98974b..c0bc28217472094405dcf59bb4e34c77fa34efa2 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/Config/_files/product_types.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Catalog/etc/product_types.xsd"> - <type name="type_one" label="Label One" modelInstance="Instance_Type" composite="true" indexPriority="40" canUseQtyDecimals="true" isQty="true"> + <type name="type_one" label="Label One" modelInstance="Instance_Type" composite="true" indexPriority="40" canUseQtyDecimals="true" isQty="true" sortOrder="100"> <priceModel instance="Instance_Type_One" /> <indexerModel instance="Instance_Type_Two" /> <stockIndexerModel instance="Instance_Type_Three" /> @@ -37,7 +37,7 @@ <attribute name="some_name" value="some_value" /> </customAttributes> </type> - <type name="type_three" label="Label Three" modelInstance="Instance_Type" composite="false" indexPriority="20" canUseQtyDecimals="false" isQty="false"> + <type name="type_three" label="Label Three" modelInstance="Instance_Type" composite="false" indexPriority="20" canUseQtyDecimals="false" isQty="false" sortOrder="5"> <priceModel instance="Instance_Type_Three" /> <indexerModel instance="Instance_Type_Three" /> <stockIndexerModel instance="Instance_Type_Three" /> diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php index 38e6da7ebdce5f3607a43ead52cea79f9a655067..b0f416903a8ce74444e79d92aa6692b359da424e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/AbstractTest.php @@ -109,7 +109,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Locale\FormatInterface'), $this->getMock('Magento\Eav\Model\Resource\Helper', array(), array(), '', false, false), $this->getMock('Magento\Validator\UniversalFactory', array(), array(), '', false, false), - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->getMock('Magento\Catalog\Model\Factory', array(), array(), '', false), array() ) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php index a13b5f948964eee1ad54329ce9584c893f69477f..373c7264066dc48dab1f4ccfce2432645a1ed79d 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php @@ -86,11 +86,11 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Entity\TypeFactory', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->getMock('Magento\Eav\Model\Resource\Helper', array(), array(), '', false), $this->getMock('Magento\Validator\UniversalFactory', array(), array(), '', false), - $this->getMock('\Magento\Stdlib\DateTime\TimezoneInterface', array(), array(), '', false), - $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false), + $this->getMock('Magento\Stdlib\DateTime\TimezoneInterface', array(), array(), '', false), + $this->getMock('Magento\Catalog\Model\Product\ReservedAttributeList', array(), array(), '', false), $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false), $this->getMock('Magento\Index\Model\Indexer', array(), array(), '', false), $this->_processor, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/FlatTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/FlatTest.php index 50db21c656b6415faed54ff623f86a46da42f5d6..45c23a4b542c32654bb3a0e4e0a04494ea1b36d7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/FlatTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/FlatTest.php @@ -34,20 +34,20 @@ class FlatTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Store + * @var \Magento\Store\Model\Store */ protected $_store; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManagerInterface; public function setUp() { - $this->_store = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $this->_store = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); - $this->_storeManagerInterface = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->_storeManagerInterface = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->_storeManagerInterface->expects( $this->any() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php index b8a5b12babacfdfb57a56784caa8a411cf27aa06..65ff10da99e9060ec82298bdaa21d391e40af674 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php @@ -56,7 +56,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected $optionsFactoryMock; /** - * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $storeManagerMock; @@ -92,7 +92,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase '', false ); - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->resourceMock = $this->getMock( 'Magento\Catalog\Model\Resource\Product\Option', array('getReadConnection', '__wakeup', 'getMainTable', 'getTable'), diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php index 950044c1416e424ac25b4144187ab5bf6f4011f4..bd8d022c30f038bfb9c3f0fa0ea64e4504875b39 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueTest.php @@ -40,7 +40,7 @@ class ValueTest extends \PHPUnit_Framework_TestCase */ public static $valueTitleData = array( 'id' => 2, - 'store_id' => \Magento\Core\Model\Store::DEFAULT_STORE_ID, + 'store_id' => \Magento\Store\Model\Store::DEFAULT_STORE_ID, 'scope' => array('title' => 1) ); diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Plugin/LayerTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Plugin/LayerTest.php index b3aa3cb4c6a6f24cb35d0ced8e8cdf624b5bf3aa..6482ca2a4a229665f5593fd1bce6319fe222f082 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Plugin/LayerTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Plugin/LayerTest.php @@ -31,9 +31,9 @@ class LayerTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Store\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \Magento\CatalogInventory\Model\Stock\Status|\PHPUnit_Framework_MockObject_MockObject @@ -42,13 +42,7 @@ class LayerTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_storeConfigMock = $this->getMock( - '\Magento\Core\Model\Store\Config', - array('getConfigFlag'), - array(), - '', - false - ); + $this->_scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->_stockStatusMock = $this->getMock( '\Magento\CatalogInventory\Model\Stock\Status', array(), @@ -59,7 +53,7 @@ class LayerTest extends \PHPUnit_Framework_TestCase $this->_model = new \Magento\CatalogInventory\Model\Plugin\Layer( $this->_stockStatusMock, - $this->_storeConfigMock + $this->_scopeConfigMock ); } @@ -68,10 +62,10 @@ class LayerTest extends \PHPUnit_Framework_TestCase */ public function testAddStockStatusDisabledShow() { - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( 'cataloginventory/options/show_out_of_stock' )->will( @@ -94,10 +88,10 @@ class LayerTest extends \PHPUnit_Framework_TestCase */ public function testAddStockStatusEnabledShow() { - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( 'cataloginventory/options/show_out_of_stock' )->will( diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3958571f35ee8dd132cb7322dd1027b3784bc5f2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Stock/ItemTest.php @@ -0,0 +1,107 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\CatalogInventory\Model\Stock; + +/** + * Class ItemTest + * @package Magento\CatalogInventory\Model\Stock + */ +class ItemTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\CatalogInventory\Model\Stock\Item + */ + protected $item; + + /** + * @var \Magento\CatalogInventory\Model\Resource\Stock\Item | \PHPUnit_Framework_MockObject_MockObject + */ + protected $resource; + + /** + * @var \Magento\Event\Manager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + protected function setUp() + { + $this->resource = $this->getMock( + 'Magento\CatalogInventory\Model\Resource\Stock\Item', + [], + [], + '', + false + ); + $this->eventManager = $this->getMock( + 'Magento\Event\Manager', + ['dispatch'], + [], + '', + false + ); + $context = $this->getMock( + '\Magento\Model\Context', + ['getEventDispatcher'], + [], + '', + false + ); + $context->expects($this->any()) + ->method('getEventDispatcher') + ->will($this->returnValue($this->eventManager)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->item = $objectManager->getObject( + 'Magento\CatalogInventory\Model\Stock\Item', + [ + 'resource' => $this->resource, + 'context' => $context + ] + ); + } + + protected function tearDown() + { + $this->item = null; + } + + public function testSave() + { + $this->item->setData('key', 'value'); + + $this->eventManager->expects($this->at(0)) + ->method('dispatch') + ->with('model_save_before', ['object' => $this->item]); + $this->eventManager->expects($this->at(1)) + ->method('dispatch') + ->with('cataloginventory_stock_item_save_before', ['data_object' => $this->item, 'item' => $this->item]); + + + $this->resource->expects($this->once()) + ->method('addCommitCallback') + ->will($this->returnValue($this->resource)); + + $this->assertEquals($this->item, $this->item->save()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php index 94a2600d78565fcdb446285dcc7ef06925475273..9d861a57fe15d44c038f4dc25b0052c87d3100a3 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php @@ -34,12 +34,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $storeManagerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $storeMock; + protected $scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -70,9 +65,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase { $this->subjectMock = $this->getMock('Magento\Catalog\Model\Layer\AvailabilityFlagInterface'); $this->layerMock = $this->getMock('\Magento\Catalog\Model\Layer', array(), array(), '', false); - $this->storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->engineMock = $this->getMock('\Magento\CatalogSearch\Model\Resource\EngineInterface'); - $this->storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); $this->collectionMock = $this->getMock( '\Magento\Catalog\Model\Resource\Product\Collection', array(), array(), '', false ); @@ -81,11 +75,10 @@ class PluginTest extends \PHPUnit_Framework_TestCase ); $this->engineProviderMock->expects($this->any())->method('get')->will($this->returnValue($this->engineMock)); - $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->storeMock)); $this->layerMock->expects($this->any())->method('getProductCollection') ->will($this->returnValue($this->collectionMock)); - $this->model = new Plugin($this->storeManagerMock, $this->engineProviderMock); + $this->model = new Plugin($this->scopeConfigMock, $this->engineProviderMock); } /** @@ -98,8 +91,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase ->method('isLayeredNavigationAllowed') ->will($this->returnValue(false)); - $this->storeMock->expects($this->never()) - ->method('getConfig'); + $this->scopeConfigMock->expects($this->never())->method('getValue'); $proceed = function () { $this->fail('Proceed should not be called in this scenario'); @@ -123,9 +115,9 @@ class PluginTest extends \PHPUnit_Framework_TestCase ->method('isLayeredNavigationAllowed') ->will($this->returnValue(true)); - $this->storeMock->expects($this->once()) - ->method('getConfig') - ->with(Plugin::XML_PATH_DISPLAY_LAYER_COUNT) + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with(Plugin::XML_PATH_DISPLAY_LAYER_COUNT, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) ->will($this->returnValue($availableResCount)); $this->collectionMock->expects($this->once()) @@ -167,8 +159,8 @@ class PluginTest extends \PHPUnit_Framework_TestCase ->method('isLayeredNavigationAllowed') ->will($this->returnValue(true)); - $this->storeMock->expects($this->once()) - ->method('getConfig') + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') ->will($this->returnValue(10)); $this->collectionMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Resource/EngineProviderTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Resource/EngineProviderTest.php index a5df39cd2d979f0d2356acff84592892b5087a60..fb6f35964303e8b9a70fc486abfd56f277d194bb 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Resource/EngineProviderTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Resource/EngineProviderTest.php @@ -39,9 +39,9 @@ class EngineProviderTest extends \PHPUnit_Framework_TestCase protected $_engineFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\Config + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfigMock; + protected $_scopeConfigMock; protected function setUp() { @@ -52,17 +52,11 @@ class EngineProviderTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeConfigMock = $this->getMock( - 'Magento\Core\Model\Store\Config', - array('getConfig'), - array(), - '', - false - ); + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\CatalogSearch\Model\Resource\EngineProvider( $this->_engineFactoryMock, - $this->_storeConfigMock + $this->_scopeConfigMock ); } @@ -77,10 +71,10 @@ class EngineProviderTest extends \PHPUnit_Framework_TestCase ); $engineMock->expects($this->once())->method('test')->will($this->returnValue(true)); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'catalog/search/engine' )->will( @@ -111,10 +105,10 @@ class EngineProviderTest extends \PHPUnit_Framework_TestCase ); $engineMock->expects($this->never())->method('test'); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'catalog/search/engine' )->will( diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/AbstractTest.php index 38ae825cff37004d44901074f6198a6ef6ef9c43..faa103bfd891b023cfbf36182ac88bf2079de5ff 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/AbstractTest.php @@ -55,7 +55,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->returnValue('rendererObject') ); - $layout = $this->getMock('Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array('getChildName', 'getBlock'), array(), '', false); $layout->expects($this->once())->method('getChildName')->will($this->returnValue('renderer.list')); @@ -97,7 +97,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testGetItemRendererThrowsExceptionForNonexistentRenderer() { - $layout = $this->getMock('Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array('getChildName', 'getBlock'), array(), '', false); $layout->expects($this->once())->method('getChildName')->will($this->returnValue(null)); /** @var $block \Magento\Checkout\Block\Cart\AbstractCart */ diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php index cdfa5d184c342cbcede8e30bb01408770826c5f8..d09b17e333ebdbecffe812bada13114fd439cc4a 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/SidebarTest.php @@ -38,7 +38,7 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $childBlock = $this->getMock('Magento\View\Element\AbstractBlock', array(), array(), '', false); /** @var $layout \Magento\View\LayoutInterface */ $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('createBlock', 'getChildName', 'setChild'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Controller/CartTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Controller/CartTest.php index 0cd2d1b89e46d6ba49eebba7a3efed4785ac5f4d..bc1a67104c8bd7a0a736b318c0a89f950bec4683 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Controller/CartTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Controller/CartTest.php @@ -39,7 +39,7 @@ class CartTest extends \PHPUnit_Framework_TestCase public function testGoBack() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $responseMock = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); $responseMock->headersSentThrowsException = false; @@ -90,14 +90,14 @@ class CartTest extends \PHPUnit_Framework_TestCase $this->returnValue('http://some-url/index.php/checkout/cart/') ); - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue('http://some-url/')); - $configMock = $this->getMock('Magento\Core\Model\Store\ConfigInterface'); + $configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $configMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'checkout/cart/redirect_to_cart' )->will( @@ -108,7 +108,7 @@ class CartTest extends \PHPUnit_Framework_TestCase 'response' => $responseMock, 'request' => $requestMock, 'checkoutSession' => $checkoutSessionMock, - 'storeConfig' => $configMock, + 'scopeConfig' => $configMock, 'redirect' => $redirect, 'storeManager' => $storeManagerMock ); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php index f4dce9972633697664426df3869f85b6f1f746ec..39357af04e2983e342c6ce8edcfd7d5eb84df9ab 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php @@ -45,26 +45,61 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_translator = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $context = $this->getMock('\Magento\App\Helper\Context', array(), array(), '', false); - $storeConfig = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); - $storeConfig->expects( + $scopeConfig = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); + $scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->will( $this->returnValueMap( array( - array('checkout/payment_failed/template', 8, 'fixture_email_template_payment_failed'), - array('checkout/payment_failed/receiver', 8, 'sysadmin'), - array('trans_email/ident_sysadmin/email', 8, 'sysadmin@example.com'), - array('trans_email/ident_sysadmin/name', 8, 'System Administrator'), - array('checkout/payment_failed/identity', 8, 'noreply@example.com'), - array('carriers/ground/title', null, 'Ground Shipping'), - array('payment/fixture-payment-method/title', null, 'Check Money Order') + array( + 'checkout/payment_failed/template', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 8, + 'fixture_email_template_payment_failed' + ), + array( + 'checkout/payment_failed/receiver', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 8, + 'sysadmin' + ), + array( + 'trans_email/ident_sysadmin/email', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 8, + 'sysadmin@example.com' + ), + array( + 'trans_email/ident_sysadmin/name', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 8, + 'System Administrator' + ), + array( + 'checkout/payment_failed/identity', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + 8, + 'noreply@example.com' + ), + array( + 'carriers/ground/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + 'Ground Shipping' + ), + array( + 'payment/fixture-payment-method/title', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + 'Check Money Order' + ) ) ) ); - $storeManager = $this->getMock('\Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); + $storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface', array(), array(), '', false); $checkoutSession = $this->getMock('\Magento\Checkout\Model\Session', array(), array(), '', false); @@ -89,7 +124,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_helper = new Data( $context, - $storeConfig, + $scopeConfig, $storeManager, $checkoutSession, $localeDate, @@ -180,10 +215,8 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->getMock('Magento\Mail\TransportInterface')) ); - $this->_translator->expects($this->at(1)) - ->method('suspend'); - $this->_translator->expects($this->at(1)) - ->method('resume'); + $this->_translator->expects($this->at(1))->method('suspend'); + $this->_translator->expects($this->at(1))->method('resume'); $productOne = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); $productOne->expects($this->once())->method('getName')->will($this->returnValue('Product One')); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Layout/DepersonalizePluginTest.php index 26b28df9e61a566e63710a5416256c26cecf26bb..ea6af0b662cb742223fd3cf4f063d542f54b6d31 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Model/Layout/DepersonalizePluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Layout/DepersonalizePluginTest.php @@ -66,9 +66,9 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->checkoutSessionMock = $this->getMock( - 'Magento\Core\Model\Session', + 'Magento\Session\Generic', array('clearStorage', 'setData', 'getData'), array(), '', @@ -97,7 +97,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXml() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock->expects($this->once()) ->method('isEnabled') ->with($this->equalTo('Magento_PageCache')) diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php index da751f7891c635efa2e1445ba3ef92e7353d68f8..ba55fcaadb02b83bc9b27318760caee928984da7 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php @@ -27,7 +27,6 @@ */ namespace Magento\Checkout\Model; -include __DIR__ . '/../_files/session.php'; class SessionTest extends \PHPUnit_Framework_TestCase { /** @@ -71,7 +70,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase $constructArguments = $this->_helper->getConstructArguments( 'Magento\Checkout\Model\Session', array( - 'request' => $this->getMock('Magento\App\RequestInterface', array(), array(), '', false), + 'request' => $request, 'orderFactory' => $orderFactory, 'messageCollectionFactory' => $messageCollectionFactory, 'quoteFactory' => $quoteFactory, @@ -174,8 +173,8 @@ class SessionTest extends \PHPUnit_Framework_TestCase $orderFactory->expects($this->once())->method('create')->will($this->returnValue($order)); $quoteFactory = $this->getMock('Magento\Sales\Model\QuoteFactory', array('create'), array(), '', false); $storage = $this->getMock('Magento\Session\Storage', null); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $storeManager = $this->getMockForAbstractClass('Magento\Core\Model\StoreManagerInterface'); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $storeManager = $this->getMockForAbstractClass('Magento\Store\Model\StoreManagerInterface'); $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); $eventManager = $this->getMockForAbstractClass('Magento\Event\ManagerInterface'); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php deleted file mode 100644 index 5b9b754fa294d40c07e459bf6278b08e58db4b7d..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php +++ /dev/null @@ -1,156 +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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Checkout\Model\Type; - -/** - * Test class for \Magento\Checkout\Model\Type\AbstractType - */ -class AbstractTypeTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Checkout\Model\Type\AbstractType */ - protected $model; - - /** - * @var \Magento\Checkout\Model\Session|\PHPUnit_Framework_MockObject_MockObject - */ - protected $checkoutSession; - - /** @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ - protected $customerSession; - - /** @var \Magento\Sales\Model\OrderFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $orderFactory; - - /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $customerAddressService; - - /** @var \Magento\Customer\Service\V1\Data\Customer|\PHPUnit_Framework_MockObject_MockObject */ - protected $customerObject; - - public function setUp() - { - $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); - $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); - $this->orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', [], [], '', false); - $this->customerAddressService = $this->getMock('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); - - $this->customerObject = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); - $this->model = $this->getMockForAbstractClass( - '\Magento\Checkout\Model\Type\AbstractType', - [ - 'checkoutSession' => $this->checkoutSession, - 'customerSession' => $this->customerSession, - 'orderFactory' => $this->orderFactory, - 'customerAddressService' => $this->customerAddressService - ], - '', - true - ); - } - - public function testGetCheckoutSession() - { - $this->assertSame($this->checkoutSession, $this->model->getCheckoutSession()); - } - - public function testGetCustomerSession() - { - $this->assertSame($this->customerSession, $this->model->getCustomerSession()); - } - - public function testGetCustomer() - { - $this->customerSession->expects($this->once())->method('getCustomerDataObject') - ->will($this->returnValue($this->customerObject)); - $this->assertSame($this->customerObject, $this->model->getCustomer()); - } - - public function testGetQuote() - { - $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); - $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); - - $this->assertSame($quoteMock, $this->model->getQuote()); - } - - public function testGetQuoteItems() - { - $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); - $itemMock = $this->getMock('Magento\Sales\Model\Quote\Item', [], [], '', false); - $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); - $quoteMock->expects($this->once())->method('getAllItems')->will($this->returnValue([$itemMock])); - - $this->assertEquals([$itemMock], $this->model->getQuoteItems()); - } - - /** - * @param string $serviceMethod - * @param string $modelMethod - * @dataProvider getDefaultAddressDataProvider - */ - public function testGetCustomerDefaultShippingAddress($serviceMethod, $modelMethod) - { - $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); - $customerId = 1; - $this->customerSession->expects($this->once())->method('getCustomerDataObject') - ->will($this->returnValue($this->customerObject)); - $this->customerObject->expects($this->once())->method('getId') - ->will($this->returnValue($customerId)); - $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) - ->will($this->returnValue($address)); - $this->customerAddressService->expects($this->never())->method('getAddresses'); - - $this->assertSame($address, $this->model->$modelMethod()); - } - - /** - * @param string $serviceMethod - * @param string $modelMethod - * @dataProvider getDefaultAddressDataProvider - */ - public function testGetCustomerDefaultShippingAddressIfDefaultNotAvailable($serviceMethod, $modelMethod) - { - $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); - $customerId = 1; - $this->customerSession->expects($this->once())->method('getCustomerDataObject') - ->will($this->returnValue($this->customerObject)); - $this->customerObject->expects($this->once())->method('getId') - ->will($this->returnValue($customerId)); - $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) - ->will($this->returnValue(null)); - $this->customerAddressService->expects($this->once())->method('getAddresses')->with($customerId) - ->will($this->returnValue([$address])); - - $this->assertSame($address, $this->model->$modelMethod()); - } - - public function getDefaultAddressDataProvider() - { - return [ - ['getDefaultShippingAddress', 'getCustomerDefaultShippingAddress'], - ['getDefaultBillingAddress', 'getCustomerDefaultBillingAddress'], - ]; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php b/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php deleted file mode 100644 index 59765fcb996f191c70a1fc7842cc64ddf58d3ad7..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Checkout/_files/session.php +++ /dev/null @@ -1,48 +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 Magento - * @package Magento_Customer - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Session; - - -/** - * Mock headers_sent function to prevent check whether headers have been already sent - * - * @see \Magento\Core\Model\Session\AbstractSession - */ -function headers_sent() -{ - return false; -} - -/** - * Mock session_start function to prevent check whether headers have been already sent - * - * @see \Magento\Core\Model\Session\AbstractSession - */ -function session_start() -{ - return true; -} diff --git a/dev/tests/unit/testsuite/Magento/Cms/Controller/NorouteTest.php b/dev/tests/unit/testsuite/Magento/Cms/Controller/NorouteTest.php index 3350548cacc5d26f4aa31fde09ca5ba6ecac9ec3..3581740316e46e53c13acf0893b949d1fe7d101a 100644 --- a/dev/tests/unit/testsuite/Magento/Cms/Controller/NorouteTest.php +++ b/dev/tests/unit/testsuite/Magento/Cms/Controller/NorouteTest.php @@ -66,18 +66,22 @@ class NorouteTest extends \PHPUnit_Framework_TestCase $this->returnValue($responseMock) ); - $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_cmsHelperMock = $this->getMock('Magento\Cms\Helper\Page', array(), array(), '', false); $valueMap = array( - array('Magento\Core\Model\Store\Config', $storeConfigMock), + array( + 'Magento\App\Config\ScopeConfigInterface', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $scopeConfigMock + ), array('Magento\Cms\Helper\Page', $this->_cmsHelperMock) ); $objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($valueMap)); - $storeConfigMock->expects( + $scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( \Magento\Cms\Helper\Page::XML_PATH_NO_ROUTE_PAGE )->will( diff --git a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php index 9da0143025c754626c2fd76f8a88cef0f76fdfe4..9a732d96ba54b63e8cf2dc42cc44e7f5604e0612 100644 --- a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php @@ -43,7 +43,7 @@ class MinifierTest extends \PHPUnit_Framework_TestCase /** * @var string */ - protected $minifyDir = 'minify'; + protected $minifyDir = 'pub/cache/minify'; /** * @var \Magento\Filesystem\Directory\Read|\PHPUnit_Framework_MockObject_MockObject @@ -70,7 +70,7 @@ class MinifierTest extends \PHPUnit_Framework_TestCase ); $this->rootDirectory = $this->getMock( 'Magento\Filesystem\Directory\Read', - array('getRelativePath', 'isExist'), + array('getRelativePath', 'isExist', 'getAbsolutePath'), array(), '', false @@ -108,9 +108,10 @@ class MinifierTest extends \PHPUnit_Framework_TestCase */ public function testGetMinifiedFile() { - $originalFile = '/pub/cache/' . $this->minifyDir . '/original/some.js'; - $originalFileRelative = $this->minifyDir . '/original/some.js'; - $minifiedFileRelative = $this->minifyDir . '/original/some.min.js'; + $originalFile = 'basedir/pub/lib/original/some.js'; + $originalFileRelative = 'pub/lib/original/some.js'; + $originalMinifiedFileRelative = 'pub/lib/original/some.min.js'; + $minifiedFileGeneratedPattern = $this->minifyDir . '%ssome.min.js'; $this->rootDirectory->expects( $this->at(0) @@ -127,41 +128,21 @@ class MinifierTest extends \PHPUnit_Framework_TestCase )->method( 'isExist' )->with( - $minifiedFileRelative + $originalMinifiedFileRelative )->will( $this->returnValue(false) ); - $this->pubViewCacheDir->expects( - $this->once() - )->method( - 'getAbsolutePath' - )->with( - $this->matches($this->minifyDir . '%ssome.min.js') - )->will( - $this->returnValue('/pub/cache/' . $this->minifyDir . '/original/some.min.js') - ); - - $this->pubViewCacheDir->expects( - $this->once() - )->method( - 'getRelativePath' - )->with( - $this->matches($this->minifyDir . '%ssome.min.js') - )->will( - $this->returnValue($this->minifyDir . '/original/some.min.js') - ); - $this->strategy->expects( $this->once() )->method( 'minifyFile' )->with( - $this->minifyDir . '/original/some.js', - $this->matches($this->minifyDir . '%ssome.min.js') + $originalFileRelative, + $this->matches($minifiedFileGeneratedPattern) ); $minifiedFile = $this->minifier->getMinifiedFile($originalFile); - $this->assertStringMatchesFormat('/pub/cache/' . $this->minifyDir . '%ssome.min.js', $minifiedFile); + $this->assertStringMatchesFormat($this->minifyDir . '%ssome.min.js', $minifiedFile); } /** @@ -180,18 +161,19 @@ class MinifierTest extends \PHPUnit_Framework_TestCase */ public function testGetMinifiedFileExistsMinified() { - $originalFile = '/pub/cache/' . $this->minifyDir . '/original/some.js'; - $expectedMinifiedFile = '/pub/cache/' . $this->minifyDir . '/original/some.min.js'; - $expectedMinifiedFileRelative = $this->minifyDir . '/original/some.min.js'; + $originalAbsolutePath = 'basedir/pub/lib/original/some.js'; + $originalRelativePath = 'pub/lib/original/some.js'; + $originalMinifiedRelativePath = 'pub/lib/original/some.min.js'; + $originalMinifiedAbsolutePath = 'basedir/pub/lib/original/some.min.js'; $this->rootDirectory->expects( $this->at(0) )->method( 'getRelativePath' )->with( - $originalFile + $originalAbsolutePath )->will( - $this->returnValue($this->minifyDir . '/original/some.js') + $this->returnValue($originalRelativePath) ); $this->rootDirectory->expects( @@ -199,32 +181,21 @@ class MinifierTest extends \PHPUnit_Framework_TestCase )->method( 'isExist' )->with( - $this->minifyDir . '/original/some.min.js' + $originalMinifiedRelativePath )->will( $this->returnValue(true) ); - $this->pubViewCacheDir->expects( - $this->once() + $this->rootDirectory->expects( + $this->at(2) )->method( 'getAbsolutePath' )->with( - $this->minifyDir . '/original/some.min.js' - )->will( - $this->returnValue($expectedMinifiedFile) - ); - - $this->pubViewCacheDir->expects( - $this->once() - )->method( - 'getRelativePath' - )->with( - $this->minifyDir . '/original/some.min.js' + $originalMinifiedRelativePath )->will( - $this->returnValue($expectedMinifiedFileRelative) + $this->returnValue($originalMinifiedAbsolutePath) ); - $minifiedFile = $this->minifier->getMinifiedFile($originalFile); - $this->assertStringEndsWith($minifiedFile, $expectedMinifiedFile); + $this->assertEquals($originalMinifiedAbsolutePath, $this->minifier->getMinifiedFile($originalAbsolutePath)); } } diff --git a/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php b/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php index da0bb67ce775d6b73a3df7d4df080fb414104483..e64893328e33353c54287adc69d6ddd685c663ca 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Model/File/Validator/NotProtectedExtensionTest.php @@ -31,9 +31,9 @@ class NotProtectedExtensionTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var string @@ -42,26 +42,21 @@ class NotProtectedExtensionTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_coreStoreConfig = $this->getMock( - '\Magento\Core\Model\Store\Config', - array('getConfig'), - array(), - '', - false - ); - $this->_coreStoreConfig->expects( + $this->_scopeConfig = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); + $this->_scopeConfig->expects( $this->atLeastOnce() )->method( - 'getConfig' + 'getValue' )->with( $this->equalTo( \Magento\Core\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS ), + $this->equalTo(\Magento\Store\Model\ScopeInterface::SCOPE_STORE), $this->equalTo(null) )->will( $this->returnValue($this->_protectedList) ); - $this->_model = new \Magento\Core\Model\File\Validator\NotProtectedExtension($this->_coreStoreConfig); + $this->_model = new \Magento\Core\Model\File\Validator\NotProtectedExtension($this->_scopeConfig); } public function testGetProtectedFileExtensions() diff --git a/dev/tests/unit/testsuite/Magento/Config/Data/ScopedTest.php b/dev/tests/unit/testsuite/Magento/Config/Data/ScopedTest.php index d21daf49870926b204557b76d1ae110ebd69f36a..d9c7fef6e840a673b801e3e12bf89fdc6812d24e 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Data/ScopedTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Data/ScopedTest.php @@ -63,9 +63,9 @@ class ScopedTest extends \PHPUnit_Framework_TestCase * @param string $path * @param mixed $expectedValue * @param string $default - * @dataProvider getValueByPathDataProvider + * @dataProvider getConfigByPathDataProvider */ - public function testGetValueByPath($path, $expectedValue, $default) + public function testgetConfigByPath($path, $expectedValue, $default) { $testData = array( 'key_1' => array( @@ -78,7 +78,7 @@ class ScopedTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expectedValue, $this->_model->get($path, $default)); } - public function getValueByPathDataProvider() + public function getConfigByPathDataProvider() { return array( array('key_1/key_1.1/key_1.1.1', 'value_1.1.1', 'error'), diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php index dcaf675e29fa967028b9b49145d50cdb67c85d31..a449d74f609beda6af77eb2872ffbe05fb9f2ad9 100644 --- a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php +++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Adminhtml/Product/Edit/Tab/Super/Config/MatrixTest.php @@ -40,10 +40,15 @@ class MatrixTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_appConfig = $this->getMock('Magento\App\ConfigInterface'); + $this->_appConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $context = $objectHelper->getObject( + 'Magento\Backend\Block\Template\Context', + array('scopeConfig' => $this->_appConfig) + ); $this->_locale = $this->getMock('Magento\Locale\CurrencyInterface', array(), array(), '', false); $data = array( - 'applicationConfig' => $this->_appConfig, + 'context' => $context, 'localeCurrency' => $this->_locale, 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'productFactory' => $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false) diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php index b7763b2a2a910d3d710e11f92c8c61c4bb1aac7a..2ad76bf2b5f264bd9f3d647464de210df494936b 100644 --- a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php +++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/ConfigurableTest.php @@ -34,12 +34,12 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject */ protected $_imageHelper; - /** @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfig; + /** @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_scopeConfig; /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $productConfigMock; - + /** @var Renderer */ protected $_renderer; @@ -55,7 +55,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->productConfigMock = $this->getMock( 'Magento\Catalog\Helper\Product\Configuration', array(), @@ -68,7 +68,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase array( 'viewConfig' => $this->_configManager, 'imageHelper' => $this->_imageHelper, - 'storeConfig' => $this->_storeConfig, + 'scopeConfig' => $this->_scopeConfig, 'productConfig' => $this->productConfigMock ) ); @@ -198,13 +198,13 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase protected function _initProducts($childHasThumbnail = true, $useParentThumbnail = false) { /** Set option which can force usage of parent product thumbnail when configurable product is displayed */ - $thumbnailToBeUsed = $useParentThumbnail ? - ThumbnailSource::OPTION_USE_PARENT_IMAGE : - ThumbnailSource::OPTION_USE_OWN_IMAGE; - $this->_storeConfig->expects( + $thumbnailToBeUsed = $useParentThumbnail + ? ThumbnailSource::OPTION_USE_PARENT_IMAGE + : ThumbnailSource::OPTION_USE_OWN_IMAGE; + $this->_scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( Renderer::CONFIG_THUMBNAIL_SOURCE )->will( diff --git a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/LastUrlTest.php b/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/LastUrlTest.php index 11bf327004799df76e9dc8d44c920efb62ba0c8c..fa26c4e484be80ac102a7b6750602722dd6260da 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/LastUrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/LastUrlTest.php @@ -27,7 +27,7 @@ class LastUrlTest extends \PHPUnit_Framework_TestCase { public function testAfterDispatch() { - $session = $this->getMock('\Magento\Core\Model\Session', array('setLastUrl'), array(), '', false); + $session = $this->getMock('\Magento\Session\Generic', array('setLastUrl'), array(), '', false); $subjectMock = $this->getMock('Magento\App\Action\Action', array(), array(), '', false); $closureMock = function () { return 'result'; diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/App/Action/ContextPluginTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/App/Action/ContextPluginTest.php index 517dbeccb12d945fc54ab89f428d5b95f852b6bf..e2dda2bd2ce308fae8c702a3e35638f68e57b40c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/App/Action/ContextPluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/App/Action/ContextPluginTest.php @@ -53,12 +53,12 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase protected $httpRequestMock; /** - * @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ protected $storeManagerMock; /** - * @var \Magento\Core\Model\Store|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $storeMock; @@ -68,7 +68,7 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase protected $currencyMock; /** - * @var \Magento\Core\Model\Website|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject */ protected $websiteMock; @@ -92,19 +92,19 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->sessionMock = $this->getMock('Magento\Core\Model\Session', + $this->sessionMock = $this->getMock('Magento\Session\Generic', array('getCurrencyCode'), array(), '', false); $this->httpContextMock = $this->getMock('Magento\App\Http\Context', array(), array(), '', false); $this->httpRequestMock = $this->getMock('Magento\App\Request\Http', array('getCookie', 'getParam'), array(), '', false); - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array('getWebsite', '__wakeup'), array(), '', false); - $this->storeMock = $this->getMock('Magento\Core\Model\Store', + $this->storeMock = $this->getMock('Magento\Store\Model\Store', array('__wakeup', 'getDefaultCurrency'), array(), '', false); $this->currencyMock = $this->getMock('Magento\Directory\Model\Currency', array('getCode', '__wakeup'), array(), '', false); - $this->websiteMock = $this->getMock('Magento\Core\Model\Website', + $this->websiteMock = $this->getMock('Magento\Store\Model\Website', array('getDefaultStore', '__wakeup'), array(), '', false); $this->closureMock = function () { return 'ExpectedValue'; @@ -147,7 +147,7 @@ class ContextPluginTest extends \PHPUnit_Framework_TestCase $this->httpRequestMock->expects($this->once()) ->method('getCookie') - ->with($this->equalTo(\Magento\Core\Model\Store::COOKIE_NAME)) + ->with($this->equalTo(\Magento\Store\Model\Store::COOKIE_NAME)) ->will($this->returnValue(null)); $this->httpContextMock->expects($this->atLeastOnce()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/CacheTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/CacheTest.php deleted file mode 100644 index a4fdf48d5c3c7b3fa3c5510d731e25b1c0e0655e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/CacheTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/** - * Test class for \Magento\Core\Model\Config\Cache - * - * 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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\Config; - -class CacheTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config\Cache - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_baseFactoryMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_cacheMock; - - protected function setUp() - { - $this->_cacheMock = $this->getMock('Magento\App\Cache\Type\Config', array(), array(), '', false, false); - $this->_baseFactoryMock = $this->getMock( - 'Magento\Core\Model\Config\BaseFactory', - array(), - array(), - '', - false, - false - ); - $this->_model = new \Magento\Core\Model\Config\Cache($this->_cacheMock, $this->_baseFactoryMock); - } - - protected function tearDown() - { - unset($this->_cacheMock); - unset($this->_configSectionsMock); - unset($this->_contFactoryMock); - unset($this->_baseFactoryMock); - unset($this->_model); - } - - public function testCacheLifetime() - { - $lifetime = 10; - $this->_model->setCacheLifetime($lifetime); - $this->assertEquals($lifetime, $this->_model->getCacheLifeTime()); - } - - public function testLoadWithoutConfig() - { - $this->assertFalse($this->_model->load()); - } - - public function testLoadWithConfig() - { - $this->_cacheMock->expects( - $this->once() - )->method( - 'load' - )->will( - $this->returnValue(array('sourceData' => 'test_config')) - ); - - $this->_baseFactoryMock->expects( - $this->once() - )->method( - 'create' - )->with( - $this->equalTo(array('sourceData' => 'test_config')) - )->will( - $this->returnValue('some_instance') - ); - - $this->assertEquals('some_instance', $this->_model->load()); - } - - public function testSave() - { - $configMock = $this->getMock('Magento\Core\Model\Config\Base', array(), array(), '', false); - $nodeMock = $this->getMock('stdClass', array('asNiceXml')); - - $configMock->expects($this->once())->method('getNode')->will($this->returnValue($nodeMock)); - $nodeMock->expects($this->once())->method('asNiceXml')->with('', false)->will($this->returnValue('test')); - $this->_cacheMock->expects($this->once())->method('save')->with('test'); - $this->_model->save($configMock); - } - - public function testClean() - { - $this->_cacheMock->expects($this->once())->method('clean'); - $this->_model->clean(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/custom/config.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/custom/config.xml deleted file mode 100644 index 7d29da47b0e4205a05efe5036e0f89d9fecadfba..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/app/etc/custom/config.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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 Magento - * @package Magento_Core - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config/> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Storage/DbTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Storage/DbTest.php deleted file mode 100644 index 01bcf6515f7af2762ad865677fba0c456573ddd6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Storage/DbTest.php +++ /dev/null @@ -1,111 +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. - * - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Test class for \Magento\Core\Model\Config\Storage\Db - */ -namespace Magento\Core\Model\Config\Storage; - -class DbTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\Config\Storage\Db - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_resourceMock; - - protected function setUp() - { - $this->_resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\Config', - array(), - array(), - '', - false, - false - ); - $this->_model = new \Magento\Core\Model\Config\Storage\Db($this->_resourceMock); - } - - protected function tearDown() - { - unset($this->_resourceMock); - unset($this->_model); - } - - public function testDelete() - { - $this->_resourceMock->expects($this->once())->method('deleteConfig')->with('test/path', 'store', 1); - $this->_model->delete('test/path/', 'store', 1); - } - - public function testDeleteWithDefaultParams() - { - $this->_resourceMock->expects( - $this->once() - )->method( - 'deleteConfig' - )->with( - 'test/path', - \Magento\Core\Model\Store::DEFAULT_CODE, - 0 - ); - $this->_model->delete('test/path'); - } - - public function testSave() - { - $this->_resourceMock->expects( - $this->once() - )->method( - 'saveConfig' - )->with( - 'test/path', - 'test_value', - 'store', - 1 - ); - $this->_model->save('test/path/', 'test_value', 'store', 1); - } - - public function testSaveWithDefaultParams() - { - $this->_resourceMock->expects( - $this->once() - )->method( - 'saveConfig' - )->with( - 'test/path', - 'test_value', - \Magento\Core\Model\Store::DEFAULT_CODE, - 0 - ); - $this->_model->save('test/path', 'test_value'); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php index 0f66de76774c6a86edd2d345374c45f5ccc07e77..21ee32859da222081fa4882a9c72980541264a6d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php @@ -41,26 +41,26 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase protected $_requestMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject */ - protected $_layoutMock; + protected $appState; protected function setUp() { $this->_areaListMock = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); - $this->_layoutMock = $this->getMock('Magento\View\LayoutInterface'); + $this->appState = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_model = new \Magento\View\DesignLoader( $this->_requestMock, $this->_areaListMock, - $this->_layoutMock + $this->appState ); } public function testLoad() { $area = $this->getMock('Magento\Core\Model\App\Area', array(), array(), '', false); - $this->_layoutMock->expects($this->once())->method('getArea')->will($this->returnValue('area')); + $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('area')); $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area)); $area->expects($this->at(0))->method('load') ->with(\Magento\Core\Model\App\Area::PART_DESIGN)->will($this->returnValue($area)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php index d23c519243cf471ba7aa5f01e603a3fc7d32fac1..c95d1a9cb1af26fb8ba86eda881a7240c20e6a22 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php @@ -67,7 +67,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase protected $directoryFactoryMock; /** - * @var \Magento\App\ConfigInterface |\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface |\PHPUnit_Framework_MockObject_MockObject */ protected $configMock; @@ -115,7 +115,6 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase '', false ); - $this->configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); $this->resourceDirectoryDatabaseMock = $this->getMock( 'Magento\Core\Model\Resource\File\Storage\Directory\Database', array(), @@ -133,10 +132,17 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->directoryMock) ); - $this->configMock->expects($this->any()) - ->method('getValue') - ->with(\Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, 'default') - ->will($this->returnValue($this->customConnectionName)); + $this->configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $this->configMock->expects( + $this->any() + )->method( + 'getValue' + )->with( + \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, + 'default' + )->will( + $this->returnValue($this->customConnectionName) + ); $this->contextMock->expects($this->once())->method('getLogger')->will($this->returnValue($this->loggerMock)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/DepersonalizePluginTest.php index e9c7b45a69bf60a9bf104703199a2ee89d46ab53..fd7cf925841c7478bc7d3748329471cfb3d1ce83 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/DepersonalizePluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/DepersonalizePluginTest.php @@ -69,7 +69,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->moduleManagerMock = $this->getMock('Magento\Module\Manager', array(), array(), '', false); $this->eventManagerMock = $this->getMock('Magento\Event\Manager', array(), array(), '', false); @@ -94,7 +94,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlPageCacheEnabled() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->cacheConfigMock->expects($this->once()) ->method('isEnabled') ->will($this->returnValue(true)); @@ -124,7 +124,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlPageCacheDisabled() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock->expects($this->once()) ->method('isEnabled') ->with($this->equalTo('Magento_PageCache')) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php index daafb972e2f253b18dffe4020b4379a41468dfe6..4f15c5ab74ab4e175907ba91fee02e950a760e5c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php @@ -81,9 +81,9 @@ class MergeTest extends \PHPUnit_Framework_TestCase $design = $this->getMockForAbstractClass('Magento\View\DesignInterface'); - $this->_store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->_store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_store->expects($this->any())->method('getId')->will($this->returnValue(20)); - $storeManager = $this->getMockForAbstractClass('Magento\Core\Model\StoreManagerInterface'); + $storeManager = $this->getMockForAbstractClass('Magento\Store\Model\StoreManagerInterface'); $storeManager->expects($this->once())->method('getStore')->with(null)->will($this->returnValue($this->_store)); $this->_resource = $this->getMock('Magento\Core\Model\Resource\Layout\Update', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/arguments.xml b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/arguments.xml index 6ab339c71f2231da29b9966356172032b06ec2c8..27f648f31b9bd38d0f071b57c6bf21d041d01803 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/arguments.xml +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/_files/arguments.xml @@ -58,7 +58,7 @@ </argument> <argument name="testOptions" xsi:type="options" model="Magento\Core\Model\Layout\Argument\Handler\TestOptions"/> <argument name="testSimpleObject" xsi:type="object"> - Magento\Core\Model\Layout\Argument\Handler\TestObject + Magento\View\Layout\Argument\Handler\TestObject </argument> <argument name="testComplexObject" xsi:type="object"><updater>Magento_Test_Updater</updater>Magento\Core\Model\Layout\Argument\Handler\TestObject</argument> </arguments> diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/ObserverTest.php index 747686cf3d66580365dcd00b7187aeeec35bc834..eba6fe9e035a2e5fa6afb4cb4d83e4722ee669cf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/ObserverTest.php @@ -102,6 +102,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase false, false ); + $this->_configMock = $this->getMock( + '\Magento\App\Config\ReinitableConfigInterface', + array(), + array(), + '', + false, + false + ); $this->_assetFactory = $this->getMock( 'Magento\View\Asset\PublicFileFactory', diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/TemplateEngine/Plugin/DebugHintsTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/TemplateEngine/Plugin/DebugHintsTest.php index a39f870a47972c79acd2fe1d3f945ef015e49190..588e89f674c965661f5737cb35546a016f317c5f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/TemplateEngine/Plugin/DebugHintsTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/TemplateEngine/Plugin/DebugHintsTest.php @@ -38,7 +38,7 @@ class DebugHintsTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -53,10 +53,10 @@ class DebugHintsTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->subjectMock = $this->getMock('Magento\View\TemplateEngineFactory', array(), array(), '', false); - $this->_model = new DebugHints($this->_objectManager, $this->_storeConfig, $this->_coreData); + $this->_model = new DebugHints($this->_objectManager, $this->_scopeConfig, $this->_coreData); } /** @@ -118,15 +118,25 @@ class DebugHintsTest extends \PHPUnit_Framework_TestCase */ protected function _setupConfigFixture($showTemplateHints, $showBlockHints) { - $this->_storeConfig->expects( + $this->_scopeConfig->expects( $this->atLeastOnce() )->method( - 'getConfig' + 'getValue' )->will( $this->returnValueMap( array( - array(DebugHints::XML_PATH_DEBUG_TEMPLATE_HINTS, null, $showTemplateHints), - array(DebugHints::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, null, $showBlockHints) + array( + DebugHints::XML_PATH_DEBUG_TEMPLATE_HINTS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + $showTemplateHints + ), + array( + DebugHints::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + $showBlockHints + ) ) ) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php index 5d5e3207dc7c88b87911f518a1a48f80cd0420f0..047b26b4a1f330474a638581f484ee65a82826a5 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php @@ -48,7 +48,7 @@ class PathTest extends \PHPUnit_Framework_TestCase protected $_viewUrlMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\StoreManager + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Store\Model\StoreManager */ protected $_storeManagerMock; @@ -56,7 +56,7 @@ class PathTest extends \PHPUnit_Framework_TestCase { $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_viewUrlMock = $this->getMock('Magento\View\Url', array(), array(), '', false); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_filesystem->expects( $this->any() @@ -85,7 +85,7 @@ class PathTest extends \PHPUnit_Framework_TestCase */ public function testPreviewImageDirectoryUrlGetter() { - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $store->expects($this->any())->method('getBaseUrl')->will($this->returnValue('http://localhost/')); $this->_storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($store)); $this->assertEquals('http://localhost/theme/preview/', $this->_model->getPreviewImageDirectoryUrl()); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ResolverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7eb27a0f5a8d3d4d867467432797f44d73309c96 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ResolverTest.php @@ -0,0 +1,284 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Model\Theme; + +class ResolverTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Core\Model\Theme\Resolver + */ + protected $model; + + /** + * @var \Magento\View\DesignInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $designMock; + + /** + * @var \Magento\Core\Model\Resource\Theme\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $themeCollectionFactoryMock; + + /** + * @var \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject + */ + protected $appStateMock; + + /** + * @var \Magento\Core\Model\Resource\Theme\Collection|\PHPUnit_Framework_MockObject_MockObject + */ + protected $themeCollectionMock; + + /** + * @var \Magento\View\Design\ThemeInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $themeMock; + + protected function setUp() + { + $this->designMock = $this->getMockForAbstractClass('Magento\View\DesignInterface'); + $this->themeCollectionFactoryMock = $this->getMock( + 'Magento\Core\Model\Resource\Theme\CollectionFactory', + ['create'], + [], + '', + false + ); + $this->themeCollectionMock = $this->getMock( + 'Magento\Core\Model\Resource\Theme\Collection', + [], + [], + '', + false + ); + $this->appStateMock = $this->getMock( + 'Magento\App\State', + [], + [], + '', + false + ); + $this->themeMock = $this->getMockForAbstractClass('Magento\View\Design\ThemeInterface'); + + $this->model = new \Magento\Core\Model\Theme\Resolver( + $this->appStateMock, + $this->designMock, + $this->themeCollectionFactoryMock + ); + } + + public function testGetByAreaWithThemeDefaultArea() + { + $this->designMock->expects( + $this->exactly(2) + )->method( + 'getDesignTheme' + )->will( + $this->returnValue($this->themeMock) + ); + $this->designMock->expects($this->never())->method('getArea'); + $this->designMock->expects($this->never())->method('getConfigurationDesignTheme'); + + $this->themeMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('theme_area') + ); + + $this->themeCollectionFactoryMock->expects($this->never())->method('create'); + + $this->appStateMock->expects( + $this->once() + )->method( + 'getAreaCode' + )->will( + $this->returnValue('theme_area') + ); + + $this->assertEquals($this->themeMock, $this->model->get()); + } + + public function testGetByAreaWithDesignDefaultArea() + { + $this->designMock->expects( + $this->exactly(2) + )->method( + 'getDesignTheme' + )->will( + $this->returnValue($this->themeMock) + ); + $this->designMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('design_area') + ); + $this->designMock->expects($this->never())->method('getConfigurationDesignTheme'); + + $this->themeMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('theme_area') + ); + + $this->themeCollectionFactoryMock->expects($this->never())->method('create'); + + $this->appStateMock->expects( + $this->once() + )->method( + 'getAreaCode' + )->will( + $this->returnValue('design_area') + ); + + $this->assertEquals($this->themeMock, $this->model->get()); + } + + public function testGetByAreaWithOtherAreaAndStringThemeId() + { + $this->designMock->expects( + $this->once() + )->method( + 'getDesignTheme' + )->will( + $this->returnValue($this->themeMock) + ); + $this->designMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('design_area') + ); + $this->designMock->expects( + $this->once() + )->method( + 'getConfigurationDesignTheme' + )->will( + $this->returnValue('other_theme') + ); + + $this->themeMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('theme_area') + ); + + $this->themeCollectionFactoryMock->expects( + $this->once() + )->method( + 'create' + )->will( + $this->returnValue($this->themeCollectionMock) + ); + + $this->themeCollectionMock->expects( + $this->once() + )->method( + 'getThemeByFullPath' + )->with( + 'other_area' . \Magento\View\Design\ThemeInterface::PATH_SEPARATOR . 'other_theme' + )->will( + $this->returnValue($this->themeMock) + ); + + $this->appStateMock->expects( + $this->once() + )->method( + 'getAreaCode' + )->will( + $this->returnValue('other_area') + ); + + $this->assertEquals($this->themeMock, $this->model->get()); + } + + public function testGetByAreaWithOtherAreaAndNumericThemeId() + { + $this->designMock->expects( + $this->once() + )->method( + 'getDesignTheme' + )->will( + $this->returnValue($this->themeMock) + ); + $this->designMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('design_area') + ); + $this->designMock->expects( + $this->once() + )->method( + 'getConfigurationDesignTheme' + )->will( + $this->returnValue(12) + ); + + $this->themeMock->expects( + $this->once() + )->method( + 'getArea' + )->will( + $this->returnValue('theme_area') + ); + + $this->themeCollectionFactoryMock->expects( + $this->once() + )->method( + 'create' + )->will( + $this->returnValue($this->themeCollectionMock) + ); + + $this->themeCollectionMock->expects( + $this->once() + )->method( + 'getItemById' + )->with( + 12 + )->will( + $this->returnValue($this->themeMock) + ); + + $this->appStateMock->expects( + $this->once() + )->method( + 'getAreaCode' + )->will( + $this->returnValue('other_area') + ); + + $this->assertEquals($this->themeMock, $this->model->get()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ThemeProviderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ThemeProviderTest.php index c22bd31389406c9a5dbf4a3084248f36d2996446..a488be2a72d0a91ba40ca3043ae252c3a3c2f7aa 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ThemeProviderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ThemeProviderTest.php @@ -27,7 +27,7 @@ class ThemeProviderTest extends \PHPUnit_Framework_TestCase { public function testGetByFullPath() { - $path = 'frontend/magento_plushe'; + $path = 'frontend/Magento/plushe'; $collectionFactory = $this->getMock( 'Magento\Core\Model\Resource\Theme\CollectionFactory', array('create'), diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php index ce1d57e8625652b68efb53dba1b4ca091201dc7d..16b1941c926f915bfb248e1a970b4e6bab9f4f7f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/ValidationTest.php @@ -33,137 +33,70 @@ namespace Magento\Core\Model\Theme; class ValidationTest extends \PHPUnit_Framework_TestCase { /** - * Test validator with valid data + * @param array $data + * @param bool $result + * @param array $messages * * @covers \Magento\View\Design\Theme\Validator::validate + * @dataProvider dataProviderValidate */ - public function testValidateWithValidData() + public function testValidate(array $data, $result, array $messages) { /** @var $themeMock \Magento\Object */ $themeMock = new \Magento\Object(); - $themeMock->setData($this->_getThemeValidData()); + $themeMock->setData($data); - /** @var $validatorMock \Magento\View\Design\Theme\Validator */ - $validatorMock = $this->getMock( - 'Magento\View\Design\Theme\Validator', - array('_setThemeValidators'), - array(), - '', - false - ); - - $versionValidators = array( - array( - 'name' => 'available', - 'class' => 'Zend_Validate_Regex', - 'break' => true, - 'options' => array('pattern' => '/([a-z0-9\_]+)/'), - 'message' => 'Theme code has not compatible format' - ) - ); + $validator = new \Magento\View\Design\Theme\Validator(); - $validatorMock->addDataValidators('theme_code', $versionValidators); - $this->assertEquals(true, $validatorMock->validate($themeMock)); + $this->assertEquals($result, $validator->validate($themeMock)); + $this->assertEquals($messages, $validator->getErrorMessages()); } - /** - * Test validator with invalid data - * - * @covers \Magento\View\Design\Theme\Validator::validate - */ - public function testValidateWithInvalidData() + public function dataProviderValidate() { - /** @var $themeMock \Magento\Object */ - $themeMock = new \Magento\Object(); - $themeMock->setData($this->_getThemeInvalidData()); - - /** @var $helper \Magento\Core\Helper\Data */ - $helper = $this->getMockBuilder('Magento\Core\Helper\Data')->disableOriginalConstructor()->getMock(); - - /** @var $validatorMock \Magento\View\Design\Theme\Validator */ - $validatorMock = $this->getMock( - 'Magento\View\Design\Theme\Validator', - array('_setThemeValidators'), - array($helper), - '', - true - ); - - $codeValidators = array( + return array( array( - 'name' => 'available', - 'class' => 'Zend_Validate_Regex', - 'break' => true, - 'options' => array('pattern' => '/^[a-z]+$/'), - 'message' => 'Theme code has not compatible format' - ) - ); - - $versionValidators = array( + array( + 'theme_code' => 'Magento/iphone', + 'theme_title' => 'Iphone', + 'theme_version' => '2.0.0.0', + 'parent_theme' => array('default', 'default'), + 'theme_path' => 'Magento/iphone', + 'preview_image' => 'images/preview.png' + ), + true, + array(), + ), array( - 'name' => 'available', - 'class' => 'Zend_Validate_Regex', - 'break' => true, - 'options' => array('pattern' => '/(\d+\.\d+\.\d+\.\d+(\-[a-zA-Z0-9]+)?)|\*/'), - 'message' => 'Theme version has not compatible format.' - ) - ); - - $validatorMock->addDataValidators( - 'theme_code', - $codeValidators - )->addDataValidators( - 'theme_version', - $versionValidators - ); - $this->assertEquals(false, $validatorMock->validate($themeMock)); - $this->assertEquals($this->_getErrorMessages(), $validatorMock->getErrorMessages()); - } - - /** - * Get theme valid data - * - * @return array - */ - protected function _getThemeValidData() - { - return array( - 'theme_code' => 'iphone', - 'theme_title' => 'Iphone', - 'theme_version' => '2.0.0.0', - 'parent_theme' => array('default', 'default'), - 'theme_path' => 'magento_iphone', - 'preview_image' => 'images/preview.png' - ); - } - - /** - * Get theme invalid data - * - * @return array - */ - protected function _getThemeInvalidData() - { - return array( - 'theme_code' => 'iphone#theme!!!!', - 'theme_title' => 'Iphone', - 'theme_version' => 'last theme version', - 'parent_theme' => array('default', 'default'), - 'theme_path' => 'magento_iphone', - 'preview_image' => 'images/preview.png' + array( + 'theme_code' => 'iphone#theme!!!!', + 'theme_title' => 'Iphone', + 'theme_version' => 'last theme version', + 'parent_theme' => array('default', 'default'), + 'theme_path' => 'magento_iphone', + 'preview_image' => 'images/preview.png' + ), + false, + array( + 'theme_version' => array('Theme version has not compatible format.') + ), + ), + array( + array( + 'theme_code' => 'iphone#theme!!!!', + 'theme_title' => '', + 'theme_version' => '', + 'parent_theme' => array('default', 'default'), + 'theme_path' => 'magento_iphone', + 'preview_image' => 'images/preview.png' + ), + false, + array( + 'theme_version' => array('Field can\'t be empty'), + 'theme_title' => array('Field title can\'t be empty') + ), + ), ); } - /** - * Get error messages - * - * @return array - */ - protected function _getErrorMessages() - { - return array( - 'theme_code' => array('Theme code has not compatible format'), - 'theme_version' => array('Theme version has not compatible format.') - ); - } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Url/ScopeResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Url/ScopeResolverTest.php index 7bf1c938f98b9f5d15a0db514147afb2b174c3f4..079300ec177779dc123d7498d56072fb5f642bcf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Url/ScopeResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Url/ScopeResolverTest.php @@ -38,7 +38,7 @@ class ScopeResolverTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_storeManagerMock = $this->getMockBuilder('Magento\Core\Model\StoreManagerInterface')->getMock(); + $this->_storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManagerInterface')->getMock(); $this->_object = $objectManager->getObject( 'Magento\Core\Model\Url\ScopeResolver', array('storeManager' => $this->_storeManagerMock) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Url/SecurityInfoTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Url/SecurityInfoTest.php index e07d05874d85c9624975d80f137c3fe5141a9cd7..8cc7bc1d6c59b6eab9a00d4d609273acba7f95e4 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Url/SecurityInfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Url/SecurityInfoTest.php @@ -28,7 +28,7 @@ class SecurityInfoTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeMock; + protected $_scopeConfigMock; /** * @var \Magento\Core\Model\Url\SecurityInfo @@ -37,21 +37,13 @@ class SecurityInfoTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeMock = $this->getMock( - 'Magento\Core\Model\Store', - array('getConfig', '__wakeup'), - array(), - '', - false - ); - $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); - $storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->_storeMock)); - $this->_model = new \Magento\Core\Model\Url\SecurityInfo($storeManagerMock, array('/account', '/cart')); + $this->_scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); + $this->_model = new \Magento\Core\Model\Url\SecurityInfo($this->_scopeConfigMock, array('/account', '/cart')); } public function testIsSecureReturnsFalseIfDisabledInConfig() { - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(false)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(false)); $this->assertFalse($this->_model->isSecure('http://example.com/account')); } @@ -62,7 +54,7 @@ class SecurityInfoTest extends \PHPUnit_Framework_TestCase */ public function testIsSecureChecksIfUrlIsInSecureList($url, $expected) { - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(true)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(true)); $this->assertEquals($expected, $this->_model->isSecure($url)); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/View/Url/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/View/Url/ConfigTest.php index 533336029a114dd9b559e685e6100a671ff91c0d..681b49d69706739b8853a4d2bf6c8b0b6fe621c0 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/View/Url/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/View/Url/ConfigTest.php @@ -34,30 +34,30 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\Config + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; protected function setUp() { - $this->_storeConfig = $this->getMockBuilder( - 'Magento\Core\Model\Store\Config' + $this->_scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); - $this->_model = new \Magento\Core\Model\View\Url\Config($this->_storeConfig); + $this->_model = new \Magento\Core\Model\View\Url\Config($this->_scopeConfig); } /** * @param $path * @param $expectedValue * - * @dataProvider getValueDataProvider + * @dataProvider getConfigDataProvider */ public function testGetValue($path, $expectedValue) { - $this->_storeConfig->expects( + $this->_scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( $path )->will( @@ -70,7 +70,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @return array */ - public function getValueDataProvider() + public function getConfigDataProvider() { return array( array('some/valid/path1', 'someValue'), diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php index a37683413db989e7d7a32a8295cd895f4e504126..88d8ba2384e8dbe273590daf96f81adaa6f75129 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php @@ -28,7 +28,7 @@ namespace Magento\Cron\Model\Config\Reader; class DbTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\Reader\DefaultReader|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Config\Reader\DefaultReader|\PHPUnit_Framework_MockObject_MockObject */ protected $_defaultReader; @@ -48,7 +48,7 @@ class DbTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_defaultReader = $this->getMockBuilder( - 'Magento\Core\Model\Config\Scope\Reader\DefaultReader' + 'Magento\Store\Model\Config\Reader\DefaultReader' )->disableOriginalConstructor()->getMock(); $this->_converter = new \Magento\Cron\Model\Config\Converter\Db(); $this->_reader = new \Magento\Cron\Model\Config\Reader\Db($this->_defaultReader, $this->_converter); diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php index dd7e556c6ac878e1200a75625e9c3d7b7994d983..d120cdc2e6fddc85112ef1671c8fc6348e5c8a90 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/XmlTest.php @@ -38,7 +38,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function setUp() { $fileResolver = $this->getMockBuilder( - 'Magento\Core\Model\Config\FileResolver' + 'Magento\App\Config\FileResolver' )->disableOriginalConstructor()->getMock(); $converter = $this->getMockBuilder( 'Magento\Cron\Model\Config\Converter\Xml' diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index 5c1d55219cdfbb4a572cd6a6d7b2ab219ee347fa..02c6155546d9e990c27c543c5ed93e813e114389 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -57,9 +57,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_scheduleFactory; /** - * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\App\Console\Request|\PHPUnit_Framework_MockObject_MockObject @@ -67,7 +67,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_request; /** - * @var \Magento\Shell|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\ShellInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_shell; @@ -89,8 +89,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase )->disableOriginalConstructor()->getMock(); $this->_cache = $this->getMock('Magento\App\CacheInterface'); $this->_config = $this->getMockBuilder('Magento\Cron\Model\Config')->disableOriginalConstructor()->getMock(); - $this->_coreStoreConfig = $this->getMockBuilder( - 'Magento\Core\Model\Store\Config' + $this->_scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); $this->_collection = $this->getMockBuilder( 'Magento\Cron\Model\Resource\Schedule\Collection' @@ -108,7 +108,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase 'Magento\App\Console\Request' )->disableOriginalConstructor()->getMock(); $this->_shell = $this->getMockBuilder( - 'Magento\Shell' + 'Magento\ShellInterface' )->disableOriginalConstructor()->setMethods( array('execute') )->getMock(); @@ -118,7 +118,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_scheduleFactory, $this->_cache, $this->_config, - $this->_coreStoreConfig, + $this->_scopeConfig, $this->_request, $this->_shell ); @@ -130,12 +130,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoPendingJobs() { $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(0)); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue(array())); @@ -152,12 +148,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoJobConfig() { $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(0)); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $this->_config->expects( $this->once() @@ -187,12 +179,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchCanNotLock() { $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(0)); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -228,12 +216,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $exceptionMessage = 'Too late for the schedule'; $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(0)); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -306,17 +290,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue(strtotime('+1 day')) - ); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -363,12 +339,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(strtotime('+1 day'))); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -449,12 +421,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_cache->expects($this->any()) - ->method('load') - ->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any()) - ->method('getConfig') - ->will($this->returnValue(strtotime('+1 day'))); + $this->_cache->expects($this->any())->method('load')->will($this->returnValue($lastRun)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -492,16 +460,26 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->returnValue(array('test_group' => array())) ); - $this->_cache->expects($this->at(0)) - ->method('load') - ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) - ->will($this->returnValue(time() - 10000000)); - $this->_cache->expects($this->at(2)) - ->method('load') - ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) - ->will($this->returnValue(time() + 10000000)); + $this->_cache->expects( + $this->at(0) + )->method( + 'load' + )->with( + $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) + )->will( + $this->returnValue(time() - 10000000) + ); + $this->_cache->expects( + $this->at(2) + )->method( + 'load' + )->with( + $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) + )->will( + $this->returnValue(time() + 10000000) + ); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -544,16 +522,26 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ); $this->_config->expects($this->at(1))->method('getJobs')->will($this->returnValue($jobs)); - $this->_cache->expects($this->at(0)) - ->method('load') - ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) - ->will($this->returnValue(time() - 10000000)); - $this->_cache->expects($this->at(2)) - ->method('load') - ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) - ->will($this->returnValue(time() + 10000000)); + $this->_cache->expects( + $this->at(0) + )->method( + 'load' + )->with( + $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) + )->will( + $this->returnValue(time() - 10000000) + ); + $this->_cache->expects( + $this->at(2) + )->method( + 'load' + )->with( + $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) + )->will( + $this->returnValue(time() + 10000000) + ); - $this->_coreStoreConfig->expects($this->at(0))->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfig->expects($this->at(0))->method('getValue')->will($this->returnValue(0)); $scheduleMethods = array('getJobCode', 'getScheduledAt', 'trySchedule', 'unsScheduleId', 'save', '__wakeup'); $schedule = $this->getMockBuilder( @@ -605,14 +593,10 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); - $this->_cache->expects($this->at(0)) - ->method('load') - ->will($this->returnValue(time() + 10000000)); - $this->_cache->expects($this->at(1)) - ->method('load') - ->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(0))->method('load')->will($this->returnValue(time() + 10000000)); + $this->_cache->expects($this->at(1))->method('load')->will($this->returnValue(time() - 10000000)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(0)); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php index 3e56e38aa7661beb96bf861ffbaeff37712f6994..7eec92bf5b5c423850f28ec37e4a7f833399619c 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Account/LinkTest.php @@ -37,7 +37,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase array('getAccountUrl') )->getMock(); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('helper') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Form/RegisterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Form/RegisterTest.php index a728ac5659e4d2b0d93513ff259b43e5bb5fd954..2e11b4e52ce691c1b2e599654255586de4057c25 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Form/RegisterTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Form/RegisterTest.php @@ -46,8 +46,8 @@ class RegisterTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Helper\Data */ private $_coreData; - /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Model\Store\Config */ - private $_storeConfig; + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\App\Config\ScopeConfigInterface */ + private $_scopeConfig; /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Model\Session */ private $_customerSession; @@ -63,7 +63,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_moduleManager = $this->getMock('Magento\Module\Manager', array(), array(), '', false); $this->_coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_customerHelper = $this->getMock('Magento\Customer\Helper\Data', array(), array(), '', false); @@ -76,7 +76,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase ); $context = $this->getMock('Magento\View\Element\Template\Context', array(), array(), '', false); - $context->expects($this->any())->method('getStoreConfig')->will($this->returnValue($this->_storeConfig)); + $context->expects($this->any())->method('getScopeConfig')->will($this->returnValue($this->_scopeConfig)); $this->_block = new Register( $context, @@ -99,7 +99,7 @@ class RegisterTest extends \PHPUnit_Framework_TestCase */ public function testGetConfig($path, $configValue) { - $this->_storeConfig->expects($this->once())->method('getConfig')->will($this->returnValue($configValue)); + $this->_scopeConfig->expects($this->once())->method('getValue')->will($this->returnValue($configValue)); $this->assertEquals($configValue, $this->_block->getConfig($path)); } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Block/Widget/DobTest.php b/dev/tests/unit/testsuite/Magento/Customer/Block/Widget/DobTest.php index 6c1a15c1fc0264ad8b73fe234afe1190fb8392c7..6c57091dfcdd42d34ced4740503fec3540448bd0 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Block/Widget/DobTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Block/Widget/DobTest.php @@ -287,6 +287,22 @@ class DobTest extends \PHPUnit_Framework_TestCase $this->assertEquals(self::MONTH_HTML . self::DAY_HTML . self::YEAR_HTML, $this->_block->getSortedDateInputs()); } + /** + * This tests the Dob::setDateInput() method. The Dob::getSortedDateInputs() uses the value of + * Dob::getDateFormat() to derive the return value, which is equivalent to self::DATE_FORMAT. + */ + public function testGetSortedDateInputsWithoutStrippingNonInputChars() + { + $this->_block->setDateInput('d', self::DAY_HTML); + $this->_block->setDateInput('m', self::MONTH_HTML); + $this->_block->setDateInput('y', self::YEAR_HTML); + + $this->assertEquals( + self::MONTH_HTML . '/' . self::DAY_HTML . '/' . self::YEAR_HTML, + $this->_block->getSortedDateInputs(false) + ); + } + /** * @param array $validationRules The date Min/Max validation rules * @param int $expectedValue The value we expect from Dob::getMinDateRange() diff --git a/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php index bb4cd1691caf6d6aef6ea668f71f9d3a11b87c2d..9fba7eba44e1ba9aae83afb0fb5e78272a783ba8 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/AccountTest.php @@ -166,7 +166,7 @@ class AccountTest extends \PHPUnit_Framework_TestCase $this->returnValueMap( array( array('Magento\Customer\Helper\Data', new \Magento\Object(array('account_url' => 1))), - array('Magento\Core\Model\Store\Config', new \Magento\Object(array('config_flag' => 1))), + array('Magento\App\Config\ScopeConfigInterface', new \Magento\Object(array('config_flag' => 1))), array( 'Magento\Core\Helper\Data', $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false) diff --git a/dev/tests/unit/testsuite/Magento/Customer/Helper/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Helper/AddressTest.php index c26cbdf83e136d13d698da16eba113c0cbc1810a..7ff98c67f80ef2f8d6284abdd009ab3ba9b5fe4e 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Helper/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Helper/AddressTest.php @@ -34,11 +34,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** @var \Magento\View\Element\BlockFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $blockFactory; - /** @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $storeManager; - /** @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $coreStoreConfig; + /** @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $scopeConfig; /** @var \Magento\Customer\Service\V1\CustomerMetadataServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $customerMetadataService; @@ -53,10 +53,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'Magento\View\Element\BlockFactory' )->disableOriginalConstructor()->getMock(); $this->storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->disableOriginalConstructor()->getMock(); - $this->coreStoreConfig = $this->getMockBuilder( - 'Magento\Core\Model\Store\Config' + $this->scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); $this->customerMetadataService = $this->getMockBuilder( 'Magento\Customer\Service\V1\CustomerMetadataServiceInterface' @@ -72,7 +72,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'context' => $this->context, 'blockFactory' => $this->blockFactory, 'storeManager' => $this->storeManager, - 'coreStoreConfig' => $this->coreStoreConfig, + 'scopeConfig' => $this->scopeConfig, 'customerMetadataService' => $this->customerMetadataService, 'addressConfig' => $this->addressConfig ) @@ -99,7 +99,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->returnValue($attributeMock) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store)); $this->assertEquals($expectedNumLines, $this->helper->getStreetLines()); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConfigTest.php index c5e0a1efaf7f6b043f3b1685be99994587f5aef5..b179725bce4fdf382869d7a817bac454ed103faf 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Address/ConfigTest.php @@ -50,6 +50,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $_storeMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_scopeConfigMock; + /** * @var \Magento\Customer\Model\Address\Config */ @@ -62,7 +67,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->_storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->_scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->_readerMock = $this->getMock( 'Magento\Customer\Model\Address\Config\Reader', @@ -72,7 +78,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase false ); $this->_cacheMock = $this->getMock('Magento\Config\CacheInterface'); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( @@ -112,6 +118,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_cacheMock, $this->_storeManagerMock, $this->_addressHelperMock, + $this->_scopeConfigMock, $this->_cacheId ); } @@ -133,9 +140,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->_storeMock->expects($this->once())->method('getId'); - $this->_storeMock->expects($this->any())->method('getConfig')->will($this->returnValue('someValue')); - - + $this->_scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue('someValue')); $rendererMock = $this->getMock('Magento\Object'); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Backend/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Backend/CustomerTest.php index 7ac7fd984f6760806e3ac02431c677b509ce26c4..7cd89a352b555eaf7260c547486675f6edba5da9 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Backend/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Backend/CustomerTest.php @@ -31,7 +31,7 @@ namespace Magento\Customer\Model\Backend; class CustomerTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_storeManager; /** @var \Magento\Customer\Model\Backend\Customer */ @@ -42,7 +42,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( 'Magento\Customer\Model\Backend\Customer', diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php index faaaef5cb333a09a33ebd4ea0eb7d98639c075f3..b42fc46e5ef15fcf6d3d336581d067414e646088 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/CustomerTest.php @@ -34,10 +34,10 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Model\Customer */ protected $_model; - /** @var \Magento\Core\Model\Website|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject */ protected $_website; - /** @var \Magento\Core\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\StoreManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_storeManager; /** @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ @@ -46,8 +46,8 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Eav\Model\Attribute|\PHPUnit_Framework_MockObject_MockObject */ protected $_attribute; - /** @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $_coreStoreConfigMock; + /** @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_scopeConfigMock; /** @var \Magento\Mail\Template\TransportBuilder|\PHPUnit_Framework_MockObject_MockObject */ protected $_transportBuilderMock; @@ -60,12 +60,12 @@ class CustomerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_website = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $this->_website = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $this->_config = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false); $this->_attribute = $this->getMock('Magento\Eav\Model\Attribute', array(), array(), '', false); - $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_storetMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); - $this->_coreStoreConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); + $this->_storetMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); + $this->_scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->_transportBuilderMock = $this->getMock( '\Magento\Mail\Template\TransportBuilder', array(), @@ -82,7 +82,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase 'storeManager' => $this->_storeManager, 'config' => $this->_config, 'transportBuilder' => $this->_transportBuilderMock, - 'coreStoreConfig' => $this->_coreStoreConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, 'encryptor' => $this->_encryptor ) ); @@ -146,22 +146,24 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_website->expects($this->once())->method('getStoreIds')->will($this->returnValue($storeIds)); - $this->_coreStoreConfigMock->expects( + $this->_scopeConfigMock->expects( $this->at(0) )->method( - 'getConfig' + 'getValue' )->with( \Magento\Customer\Model\Customer::XML_PATH_RESET_PASSWORD_TEMPLATE, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId )->will( $this->returnValue('templateId') ); - $this->_coreStoreConfigMock->expects( + $this->_scopeConfigMock->expects( $this->at(1) )->method( - 'getConfig' + 'getValue' )->with( \Magento\Customer\Model\Customer::XML_PATH_FORGOT_EMAIL_IDENTITY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId )->will( $this->returnValue('sender') diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php index 704ee5a9d56d5f02bc008fff51424fb14ff89583..eecbb584dc2499cb360c6affd7aa205bdfbad001 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php @@ -40,12 +40,12 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase protected $plugin; /** - * @var \Magento\Core\Model\Layout|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Layout|\PHPUnit_Framework_MockObject_MockObject */ protected $layoutMock; /** - * @var \Magento\Core\Model\Session|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Session\Generic|\PHPUnit_Framework_MockObject_MockObject */ protected $sessionMock; @@ -88,9 +88,9 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->sessionMock = $this->getMock( - 'Magento\Core\Model\Session', + 'Magento\Session\Generic', array('clearStorage', 'setData', 'getData'), array(), '', @@ -240,7 +240,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlPageCacheEnabled() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock ->expects($this->once()) ->method('isEnabled') @@ -299,7 +299,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlPageCacheDisabled() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock ->expects($this->once()) ->method('isEnabled') @@ -317,7 +317,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlRequestIsAjax() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock ->expects($this->once()) ->method('isEnabled') @@ -342,7 +342,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase */ public function testAfterGenerateXmlLayoutIsNotCacheable() { - $expectedResult = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $expectedResult = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->moduleManagerMock ->expects($this->once()) ->method('isEnabled') diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php index b087c5db0356e27b69112bd85f129ba07a526445..158a8cd5af3ca6a98c8f0c812bde651b15e9ffb0 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/Group/Grid/ServiceCollectionTest.php @@ -32,7 +32,7 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase /** @var \Magento\TestFramework\Helper\ObjectManager */ protected $objectManager; - /** @var \Magento\Customer\Service\V1\Data\FilterBuilder */ + /** @var \Magento\Service\V1\Data\FilterBuilder */ protected $filterBuilder; /** @var \Magento\Customer\Service\V1\Data\SearchCriteriaBuilder */ @@ -50,47 +50,39 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->filterBuilder = new \Magento\Customer\Service\V1\Data\FilterBuilder(); - $this->searchCriteriaBuilder = new \Magento\Customer\Service\V1\Data\SearchCriteriaBuilder(); - $this->groupServiceMock = $this->getMockBuilder( - '\Magento\Customer\Service\V1\CustomerGroupServiceInterface' - )->getMock(); + $this->filterBuilder = new \Magento\Service\V1\Data\FilterBuilder(); + $this->searchCriteriaBuilder = $this->objectManager + ->getObject('\Magento\Customer\Service\V1\Data\SearchCriteriaBuilder'); + $this->groupServiceMock = $this->getMockBuilder('\Magento\Customer\Service\V1\CustomerGroupServiceInterface') + ->getMock(); $this->searchResults = (new \Magento\Customer\Service\V1\Data\SearchResultsBuilder())->create(); - $this->serviceCollection = $this->objectManager->getObject( - 'Magento\Customer\Model\Resource\Group\Grid\ServiceCollection', - array( - 'filterBuilder' => $this->filterBuilder, - 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, - 'groupService' => $this->groupServiceMock - ) - ); + $this->serviceCollection = $this->objectManager + ->getObject( + 'Magento\Customer\Model\Resource\Group\Grid\ServiceCollection', + [ + 'filterBuilder' => $this->filterBuilder, + 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, + 'groupService' => $this->groupServiceMock, + ] + ); } public function testGetSearchCriteriaImplicitEq() { /** @var SearchCriteria $expectedSearchCriteria */ - $expectedSearchCriteria = $this->searchCriteriaBuilder->setCurrentPage( - 1 - )->setPageSize( - 0 - )->addSortOrder( - 'name', - SearchCriteria::SORT_ASC - )->addFilter( - $this->filterBuilder->setField('name')->setConditionType('eq')->setValue('Magento')->create() - )->create(); + $expectedSearchCriteria = $this->searchCriteriaBuilder + ->setCurrentPage(1) + ->setPageSize(0) + ->addSortOrder('name', SearchCriteria::SORT_ASC) + ->addFilter($this->filterBuilder->setField('name')->setConditionType('eq')->setValue('Magento')->create()) + ->create(); // Verifies that the search criteria Data Object created by the serviceCollection matches expected - $this->groupServiceMock->expects( - $this->once() - )->method( - 'searchGroups' - )->with( - $this->equalTo($expectedSearchCriteria) - )->will( - $this->returnValue($this->searchResults) - ); + $this->groupServiceMock->expects($this->once()) + ->method('searchGroups') + ->with($this->equalTo($expectedSearchCriteria)) + ->will($this->returnValue($this->searchResults)); // Now call service collection to load the data. This causes it to create the search criteria Data Object $this->serviceCollection->addFieldToFilter('name', 'Magento'); @@ -105,30 +97,23 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase $value = '35'; /** @var SearchCriteria $expectedSearchCriteria */ - $expectedSearchCriteria = $this->searchCriteriaBuilder->setCurrentPage( - 1 - )->setPageSize( - 0 - )->addSortOrder( - 'name', - SearchCriteria::SORT_ASC - )->addFilter( - $this->filterBuilder->setField($field)->setConditionType($conditionType)->setValue($value)->create() - )->create(); + $expectedSearchCriteria = $this->searchCriteriaBuilder + ->setCurrentPage(1) + ->setPageSize(0) + ->addSortOrder('name', SearchCriteria::SORT_ASC) + ->addFilter( + $this->filterBuilder->setField($field)->setConditionType($conditionType)->setValue($value)->create() + ) + ->create(); // Verifies that the search criteria Data Object created by the serviceCollection matches expected - $this->groupServiceMock->expects( - $this->once() - )->method( - 'searchGroups' - )->with( - $this->equalTo($expectedSearchCriteria) - )->will( - $this->returnValue($this->searchResults) - ); + $this->groupServiceMock->expects($this->once()) + ->method('searchGroups') + ->with($this->equalTo($expectedSearchCriteria)) + ->will($this->returnValue($this->searchResults)); // Now call service collection to load the data. This causes it to create the search criteria Data Object - $this->serviceCollection->addFieldToFilter($field, array($conditionType => $value)); + $this->serviceCollection->addFieldToFilter($field, [$conditionType => $value]); $this->serviceCollection->setOrder('name', ServiceCollection::SORT_ORDER_ASC); $this->serviceCollection->loadData(); } @@ -141,33 +126,26 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase $value = 1; /** @var SearchCriteria $expectedSearchCriteria */ - $expectedSearchCriteria = $this->searchCriteriaBuilder->setCurrentPage( - 1 - )->setPageSize( - 0 - )->addSortOrder( - 'name', - SearchCriteria::SORT_ASC - )->addOrGroup( - array( - $this->filterBuilder->setField($fieldA)->setConditionType('eq')->setValue($value)->create(), - $this->filterBuilder->setField($fieldB)->setConditionType('eq')->setValue($value)->create() + $expectedSearchCriteria = $this->searchCriteriaBuilder + ->setCurrentPage(1) + ->setPageSize(0) + ->addSortOrder('name', SearchCriteria::SORT_ASC) + ->addOrGroup( + [ + $this->filterBuilder->setField($fieldA)->setConditionType('eq')->setValue($value)->create(), + $this->filterBuilder->setField($fieldB)->setConditionType('eq')->setValue($value)->create(), + ] ) - )->create(); + ->create(); // Verifies that the search criteria Data Object created by the serviceCollection matches expected - $this->groupServiceMock->expects( - $this->once() - )->method( - 'searchGroups' - )->with( - $this->equalTo($expectedSearchCriteria) - )->will( - $this->returnValue($this->searchResults) - ); + $this->groupServiceMock->expects($this->once()) + ->method('searchGroups') + ->with($this->equalTo($expectedSearchCriteria)) + ->will($this->returnValue($this->searchResults)); // Now call service collection to load the data. This causes it to create the search criteria Data Object - $this->serviceCollection->addFieldToFilter(array($fieldA, $fieldB), array($value, $value)); + $this->serviceCollection->addFieldToFilter([$fieldA, $fieldB], [$value, $value]); $this->serviceCollection->setOrder('name', ServiceCollection::SORT_ORDER_ASC); $this->serviceCollection->loadData(); } @@ -180,33 +158,23 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase $value = 1; /** @var SearchCriteria $expectedSearchCriteria */ - $expectedSearchCriteria = $this->searchCriteriaBuilder->setCurrentPage( - 1 - )->setPageSize( - 0 - )->addSortOrder( - 'name', - SearchCriteria::SORT_ASC - )->addFilter( - $this->filterBuilder->setField($fieldA)->setConditionType('gt')->setValue($value)->create() - )->addFilter( - $this->filterBuilder->setField($fieldB)->setConditionType('gt')->setValue($value)->create() - )->create(); + $expectedSearchCriteria = $this->searchCriteriaBuilder + ->setCurrentPage(1) + ->setPageSize(0) + ->addSortOrder('name', SearchCriteria::SORT_ASC) + ->addFilter($this->filterBuilder->setField($fieldA)->setConditionType('gt')->setValue($value)->create()) + ->addFilter($this->filterBuilder->setField($fieldB)->setConditionType('gt')->setValue($value)->create()) + ->create(); // Verifies that the search criteria Data Object created by the serviceCollection matches expected - $this->groupServiceMock->expects( - $this->once() - )->method( - 'searchGroups' - )->with( - $this->equalTo($expectedSearchCriteria) - )->will( - $this->returnValue($this->searchResults) - ); + $this->groupServiceMock->expects($this->once()) + ->method('searchGroups') + ->with($this->equalTo($expectedSearchCriteria)) + ->will($this->returnValue($this->searchResults)); // Now call service collection to load the data. This causes it to create the search criteria Data Object - $this->serviceCollection->addFieldToFilter($fieldA, array('gt' => $value)); - $this->serviceCollection->addFieldToFilter($fieldB, array('gt' => $value)); + $this->serviceCollection->addFieldToFilter($fieldA, ['gt' => $value]); + $this->serviceCollection->addFieldToFilter($fieldB, ['gt' => $value]); $this->serviceCollection->setOrder('name', ServiceCollection::SORT_ORDER_ASC); $this->serviceCollection->loadData(); } @@ -226,9 +194,15 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase public function addFieldToFilterInconsistentArraysDataProvider() { - return array( - 'missingCondition' => array(array('fieldA', 'missingCondition'), array(array('eq' => 'A'))), - 'missingField' => array(array('fieldA'), array(array('eq' => 'A'), array('eq' => 'B'))) - ); + return [ + 'missingCondition' => [ + ['fieldA', 'missingCondition'], + [['eq' => 'A']] + ], + 'missingField' => [ + ['fieldA'], + [['eq' => 'A'], ['eq' => 'B']] + ], + ]; } } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/SessionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d5f4db38212ab19671dc462f0837dd8be1273634 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/SessionTest.php @@ -0,0 +1,112 @@ +<?php +/** + * Unit test for session \Magento\Customer\Model\Session + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Customer\Model; + +class SessionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_converterMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storageMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_httpContextMock; + + /** + * @var \Magento\Customer\Model\Session + */ + protected $_model; + + protected function setUp() + { + $this->_converterMock = $this->getMock('Magento\Customer\Model\Converter', [], [], '', false); + $this->_storageMock = $this->getMock('Magento\Customer\Model\Session\Storage', [], [], '', false); + $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', [], [], '', false); + $this->_httpContextMock = $this->getMock('Magento\App\Http\Context', [], [], '', false); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_model = $helper->getObject('Magento\Customer\Model\Session', + [ + 'converter' => $this->_converterMock, + 'storage' => $this->_storageMock, + 'eventManager' => $this->_eventManagerMock, + 'httpContext' => $this->_httpContextMock + ] + ); + } + + public function testSetCustomerAsLoggedIn() + { + $customer = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); + $customerDto = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $this->_converterMock->expects($this->any()) + ->method('createCustomerFromModel') + ->will($this->returnValue($customerDto)); + + $this->_eventManagerMock->expects($this->at(0)) + ->method('dispatch') + ->with('customer_login', ['customer' => $customer]); + $this->_eventManagerMock->expects($this->at(1)) + ->method('dispatch') + ->with('customer_data_object_login', ['customer' => $customerDto]); + + $_SESSION = array(); + $this->_model->setCustomerAsLoggedIn($customer); + $this->assertSame($customer, $this->_model->getCustomer()); + } + + public function testSetCustomerDataAsLoggedIn() + { + $customer = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); + $customerDto = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + + $this->_converterMock->expects($this->any()) + ->method('createCustomerModel') + ->will($this->returnValue($customer)); + + $this->_eventManagerMock->expects($this->at(0)) + ->method('dispatch') + ->with('customer_login', ['customer' => $customer]); + $this->_eventManagerMock->expects($this->at(1)) + ->method('dispatch') + ->with('customer_data_object_login', ['customer' => $customerDto]); + + $this->_model->setCustomerDataAsLoggedIn($customerDto); + $this->assertSame($customer, $this->_model->getCustomer()); + } + +} diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index 60b5c365d7c848274d2aa5afe02680c2286f3a29..d345c5037bbbcd51f02e40f1fe7119caf78025b1 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -24,10 +24,12 @@ namespace Magento\Customer\Service\V1; use Magento\Customer\Model\Converter; +use Magento\Customer\Service\V1\Data\Search\AndGroupBuilder; use Magento\Exception\InputException; use Magento\Exception\NoSuchEntityException; -use Magento\Exception\StateException; use Magento\Customer\Service\V1\Data\CustomerBuilder; +use Magento\Service\V1\Data\FilterBuilder; +use Magento\Mail\Exception as MailException; /** * \Magento\Customer\Service\V1\CustomerAccountService @@ -42,19 +44,12 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase { /** Sample values for testing */ const ID = 1; - const FIRSTNAME = 'Jane'; - const LASTNAME = 'Doe'; - const NAME = 'J'; - const EMAIL = 'janedoe@example.com'; - const EMAIL_CONFIRMATION_KEY = 'blj487lkjs4confirmation_key'; - const PASSWORD = 'password'; - const WEBSITE_ID = 1; /** @@ -73,7 +68,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase private $_eventManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Model\StoreManagerInterface + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */ private $_storeManagerMock; @@ -88,7 +83,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase private $_converter; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Model\Store + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\Store */ private $_storeMock; @@ -131,6 +126,12 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\ObjectManager */ protected $_objectManagerMock; + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Model\Config\Share */ + private $_configShareMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Encryption\EncryptorInterface */ + private $_encryptorMock; + public function setUp() { $this->_customerFactoryMock = $this->getMockBuilder( @@ -139,56 +140,57 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase array('create') )->getMock(); - $this->_customerModelMock = $this->getMockBuilder( - 'Magento\Customer\Model\Customer' - )->disableOriginalConstructor()->setMethods( - array( - 'getCollection', - 'getId', - 'getFirstname', - 'getLastname', - 'getName', - 'getEmail', - 'getAttributes', - 'getConfirmation', - 'setConfirmation', - 'save', - 'load', - '__wakeup', - 'authenticate', - 'getData', - 'getDefaultBilling', - 'getDefaultShipping', - 'getDefaultShippingAddress', - 'getDefaultBillingAddress', - 'getStoreId', - 'getAddressById', - 'getAddresses', - 'getAddressItemById', - 'getParentId', - 'isConfirmationRequired', - 'isDeleteable', - 'isReadonly', - 'addAddress', - 'loadByEmail', - 'sendNewAccountEmail', - 'setFirstname', - 'setLastname', - 'setEmail', - 'setPassword', - 'setData', - 'setWebsiteId', - 'getAttributeSetId', - 'setAttributeSetId', - 'validate', - 'getRpToken', - 'setRpToken', - 'setRpTokenCreatedAt', - 'isResetPasswordLinkTokenExpired', - 'changeResetPasswordLinkToken', - 'sendPasswordResetConfirmationEmail', - 'sendPasswordResetNotificationEmail' - ) + $this->_customerModelMock = $this->getMockBuilder('Magento\Customer\Model\Customer') + ->disableOriginalConstructor() + ->setMethods( + array( + 'getCollection', + 'getId', + 'getFirstname', + 'getLastname', + 'getName', + 'getEmail', + 'getAttributes', + 'getConfirmation', + 'setConfirmation', + 'save', + 'load', + '__wakeup', + 'authenticate', + 'getData', + 'getDefaultBilling', + 'getDefaultShipping', + 'getDefaultShippingAddress', + 'getDefaultBillingAddress', + 'getStoreId', + 'getAddressById', + 'getAddresses', + 'getAddressItemById', + 'getParentId', + 'isConfirmationRequired', + 'isDeleteable', + 'isReadonly', + 'addAddress', + 'loadByEmail', + 'sendNewAccountEmail', + 'setFirstname', + 'setLastname', + 'setEmail', + 'setPassword', + 'setPasswordHash', + 'setData', + 'setWebsiteId', + 'getAttributeSetId', + 'setAttributeSetId', + 'validate', + 'getRpToken', + 'setRpToken', + 'setRpTokenCreatedAt', + 'isResetPasswordLinkTokenExpired', + 'changeResetPasswordLinkToken', + 'sendPasswordResetConfirmationEmail', + 'sendPasswordResetNotificationEmail', + ) )->getMock(); $this->_eventManagerMock = $this->getMockBuilder( @@ -259,11 +261,17 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_customerHelperMock) ); - $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface') + $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface')->disableOriginalConstructor()->getMock(); + + $this->_loggerMock = $this->getMockBuilder('\Magento\Logger') ->disableOriginalConstructor() ->getMock(); - $this->_loggerMock = $this->getMockBuilder('\Magento\Logger') + $this->_encryptorMock = $this->getMockBuilder('Magento\Encryption\EncryptorInterface') + ->disableOriginalConstructor() + ->getMock(); + + $this->_configShareMock = $this->getMockBuilder('Magento\Customer\Model\Config\Share') ->disableOriginalConstructor() ->getMock(); } @@ -745,34 +753,45 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_mockReturnValue( $this->_customerModelMock, array( - 'getId' => self::ID, + 'getId' => self::ID, 'setWebsiteId' => $this->_customerModelMock, - 'loadByEmail' => $this->_customerModelMock, + 'loadByEmail' => $this->_customerModelMock ) ); - $this->_customerFactoryMock->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_customerModelMock)); + $this->_customerFactoryMock->expects( + $this->any() + )->method( + 'create' + )->will( + $this->returnValue($this->_customerModelMock) + ); - $exception = new \Magento\Mail\Exception(__('The mail server is down')); + $exception = new MailException(__('The mail server is down')); - $this->_customerModelMock->expects($this->once()) - ->method('sendPasswordResetConfirmationEmail') - ->will($this->throwException($exception)); + $this->_customerModelMock->expects( + $this->once() + )->method( + 'sendPasswordResetConfirmationEmail' + )->will( + $this->throwException($exception) + ); - $this->_loggerMock->expects($this->once()) - ->method('logException') - ->with($exception); + $this->_loggerMock->expects($this->once())->method('logException')->with($exception); $customerService = $this->_createService(); - $customerService->initiatePasswordReset($email, self::WEBSITE_ID, CustomerAccountServiceInterface::EMAIL_RESET); + $customerService->initiatePasswordReset( + $email, + self::WEBSITE_ID, + CustomerAccountServiceInterface::EMAIL_RESET + ); } public function testResetPassword() { $resetToken = 'lsdj579slkj5987slkj595lkj'; $password = 'password_secret'; + $encryptedHash = 'password_encrypted_hash'; $this->_mockReturnValue( $this->_customerModelMock, @@ -791,25 +810,22 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_customerModelMock) ); - $this->_customerModelMock->expects($this->once())->method('setRpToken')->with(null)->will($this->returnSelf()); - $this->_customerModelMock->expects( - $this->once() - )->method( - 'setRpTokenCreatedAt' - )->with( - null - )->will( - $this->returnSelf() - ); - $this->_customerModelMock->expects( - $this->once() - )->method( - 'setPassword' - )->with( - $password - )->will( - $this->returnSelf() - ); + $this->_customerModelMock->expects($this->once()) + ->method('setRpToken') + ->with(null) + ->will($this->returnSelf()); + $this->_customerModelMock->expects($this->once()) + ->method('setRpTokenCreatedAt') + ->with(null) + ->will($this->returnSelf()); + $this->_encryptorMock->expects($this->once()) + ->method('getHash') + ->with($password, true) + ->will($this->returnValue($encryptedHash)); + $this->_customerModelMock->expects($this->once()) + ->method('setPasswordHash') + ->with($encryptedHash) + ->will($this->returnSelf()); $customerService = $this->_createService(); @@ -820,6 +836,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase { $resetToken = 'lsdj579slkj5987slkj595lkj'; $password = ''; + $encryptedHash = 'password_encrypted_hash'; $this->_mockReturnValue( $this->_customerModelMock, @@ -838,25 +855,22 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_customerModelMock) ); - $this->_customerModelMock->expects($this->once())->method('setRpToken')->with(null)->will($this->returnSelf()); - $this->_customerModelMock->expects( - $this->once() - )->method( - 'setRpTokenCreatedAt' - )->with( - null - )->will( - $this->returnSelf() - ); - $this->_customerModelMock->expects( - $this->once() - )->method( - 'setPassword' - )->with( - $password - )->will( - $this->returnSelf() - ); + $this->_customerModelMock->expects($this->once()) + ->method('setRpToken') + ->with(null) + ->will($this->returnSelf()); + $this->_customerModelMock->expects($this->once()) + ->method('setRpTokenCreatedAt') + ->with(null) + ->will($this->returnSelf()); + $this->_encryptorMock->expects($this->once()) + ->method('getHash') + ->with($password, true) + ->will($this->returnValue($encryptedHash)); + $this->_customerModelMock->expects($this->once()) + ->method('setPasswordHash') + ->with($encryptedHash) + ->will($this->returnSelf()); $customerService = $this->_createService(); @@ -1084,36 +1098,44 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase public function testResendConfirmationWithMailException() { - $this->_customerFactoryMock->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_customerModelMock)); - $this->_customerModelMock->expects($this->any()) - ->method('getId') - ->will($this->returnValue(55)); - $this->_customerModelMock->expects($this->once()) - ->method('setWebsiteId') - ->will($this->returnSelf()); - $this->_customerModelMock->expects($this->any()) - ->method('isConfirmationRequired') - ->will($this->returnValue(true)); - $this->_customerModelMock->expects($this->any()) - ->method('getConfirmation') - ->will($this->returnValue('123abc')); + $this->_customerFactoryMock->expects( + $this->any() + )->method( + 'create' + )->will( + $this->returnValue($this->_customerModelMock) + ); + $this->_customerModelMock->expects($this->any())->method('getId')->will($this->returnValue(55)); + $this->_customerModelMock->expects($this->once())->method('setWebsiteId')->will($this->returnSelf()); + $this->_customerModelMock->expects( + $this->any() + )->method( + 'isConfirmationRequired' + )->will( + $this->returnValue(true) + ); + $this->_customerModelMock->expects( + $this->any() + )->method( + 'getConfirmation' + )->will( + $this->returnValue('123abc') + ); - $exception = new \Magento\Mail\Exception(__('The mail server is down')); + $exception = new MailException(__('The mail server is down')); - $this->_customerModelMock->expects($this->once()) - ->method('sendNewAccountEmail') - ->withAnyParameters() - ->will($this->throwException($exception)); + $this->_customerModelMock->expects( + $this->once() + )->method( + 'sendNewAccountEmail' + )->withAnyParameters()->will( + $this->throwException($exception) + ); - $this->_loggerMock->expects($this->once()) - ->method('logException') - ->with($exception); + $this->_loggerMock->expects($this->once())->method('logException')->with($exception); $customerService = $this->_createService(); $customerService->resendConfirmation('email', 1); - // If we call sendNewAccountEmail and no exception is returned, the test succeeds } /** @@ -1635,8 +1657,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase ); $customerService = $this->_createService(); - $searchBuilder = new Data\SearchCriteriaBuilder(); - $filterBuilder = new Data\FilterBuilder(); + $searchBuilder = new Data\SearchCriteriaBuilder(new AndGroupBuilder(new FilterBuilder())); + $filterBuilder = new FilterBuilder(); $filter = $filterBuilder->setField('email')->setValue('customer@search.example.com')->create(); $searchBuilder->addFilter($filter); @@ -1706,8 +1728,8 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase ); $customerService = $this->_createService(); - $searchBuilder = new Data\SearchCriteriaBuilder(); - $filterBuilder = new Data\FilterBuilder(); + $searchBuilder = new Data\SearchCriteriaBuilder(new AndGroupBuilder(new FilterBuilder())); + $filterBuilder = new FilterBuilder(); $filter = $filterBuilder->setField('email')->setValue(self::EMAIL)->create(); $searchBuilder->addFilter($filter); @@ -1830,82 +1852,83 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase public function testCreateAccountMailException() { - $this->_customerFactoryMock->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_customerModelMock)); + $this->_customerFactoryMock->expects( + $this->any() + )->method( + 'create' + )->will( + $this->returnValue($this->_customerModelMock) + ); // This is to get the customer model through validation - $this->_customerModelMock->expects($this->any()) - ->method('getFirstname') - ->will($this->returnValue('John')); + $this->_customerModelMock->expects($this->any())->method('getFirstname')->will($this->returnValue('John')); - $this->_customerModelMock->expects($this->any()) - ->method('getLastname') - ->will($this->returnValue('Doe')); + $this->_customerModelMock->expects($this->any())->method('getLastname')->will($this->returnValue('Doe')); - $this->_customerModelMock->expects($this->any()) - ->method('getEmail') - ->will($this->returnValue('somebody@example.com')); + $this->_customerModelMock->expects( + $this->any() + )->method( + 'getEmail' + )->will( + $this->returnValue('somebody@example.com') + ); // This is to get the customer model through Converter::getCustomerModel - $this->_customerModelMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); + $this->_customerModelMock->expects($this->once())->method('load')->will($this->returnSelf()); - $this->_customerModelMock->expects($this->any()) - ->method('getId') - ->will($this->returnValue(true)); + $this->_customerModelMock->expects($this->any())->method('getId')->will($this->returnValue(true)); - $exception = new \Magento\Mail\Exception(__('The mail server is down')); + $exception = new MailException(__('The mail server is down')); - $this->_customerModelMock->expects($this->once()) - ->method('sendNewAccountEmail') - ->will($this->throwException($exception)); - - $this->_loggerMock->expects($this->once()) - ->method('logException') - ->with($exception); + $this->_customerModelMock->expects( + $this->once() + )->method( + 'sendNewAccountEmail' + )->will( + $this->throwException($exception) + ); - $this->_customerModelMock->expects($this->once()) - ->method('getAttributes') - ->will($this->returnValue([])); + $this->_loggerMock->expects($this->once())->method('logException')->with($exception); $mockCustomer = $this->getMockBuilder('Magento\Customer\Service\V1\Data\Customer') ->disableOriginalConstructor() ->getMock(); - $mockCustomer->expects($this->any()) - ->method('getStoreId') - ->will($this->returnValue(true)); + $mockCustomer->expects($this->any())->method('getStoreId')->will($this->returnValue(true)); + + $mockCustomer->expects( + $this->once() + )->method( + '__toArray' + )->will( + $this->returnValue(array('attributeSetId' => true)) + ); - $mockCustomer->expects($this->once()) - ->method('__toArray') - ->will($this->returnValue(['attributeSetId' => true])); + $this->_customerModelMock->expects($this->once()) + ->method('getAttributes') + ->will($this->returnValue([])); /** - * @var \Magento\Customer\Service\V1\Data\CustomerDetails | \PHPUnit_Framework_MockObject_MockObject + * @var Data\CustomerDetails | \PHPUnit_Framework_MockObject_MockObject */ - $mockCustomerDetail = $this->getMockBuilder('Magento\Customer\Service\V1\Data\CustomerDetails') - ->disableOriginalConstructor() - ->getMock(); + $mockCustomerDetail = $this->getMockBuilder( + 'Magento\Customer\Service\V1\Data\CustomerDetails' + )->disableOriginalConstructor()->getMock(); - $mockCustomerDetail->expects($this->once()) - ->method('getCustomer') - ->will($this->returnValue($mockCustomer)); + $mockCustomerDetail->expects($this->once())->method('getCustomer')->will($this->returnValue($mockCustomer)); $service = $this->_createService(); $service->createAccount($mockCustomerDetail, 'abc123'); - // If we get no mail exception, the test in considered a success } private function _setupStoreMock() { $this->_storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManagerInterface' + '\Magento\Store\Model\StoreManagerInterface' )->disableOriginalConstructor()->getMock(); $this->_storeMock = $this->getMockBuilder( - '\Magento\Core\Model\Store' + '\Magento\Store\Model\Store' )->disableOriginalConstructor()->getMock(); $this->_storeManagerMock->expects( @@ -1943,15 +1966,15 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_validator, $objectManager->getObject('\Magento\Customer\Service\V1\Data\CustomerBuilder'), $this->_customerDetailsBuilder, - new Data\SearchResultsBuilder(), + new Data\SearchResultsBuilder, + new Data\CustomerValidationResultsBuilder(), $this->_customerAddressServiceMock, $this->_customerMetadataService, $this->_urlMock, $this->_loggerMock, - $this->_objectManagerMock + $this->_encryptorMock, + $this->_configShareMock ); return $customerService; } - - } diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php index 37012da72476e1f38ba3be102bf81066eb569fca..10096a75c5e36139e419d9bb7e4824b6625b0060 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php @@ -89,7 +89,7 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase private $_customerModelMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Model\StoreManagerInterface + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManagerInterface */ private $_storeManagerMock; @@ -99,7 +99,7 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase private $_customerConverter; /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Model\Store + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\Store */ private $_storeMock; @@ -839,11 +839,11 @@ class CustomerAddressServiceTest extends \PHPUnit_Framework_TestCase private function _setupStoreMock() { $this->_storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManagerInterface' + '\Magento\Store\Model\StoreManagerInterface' )->disableOriginalConstructor()->getMock(); $this->_storeMock = $this->getMockBuilder( - '\Magento\Core\Model\Store' + '\Magento\Store\Model\Store' )->disableOriginalConstructor()->getMock(); $this->_storeManagerMock->expects( diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerCurrentServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerCurrentServiceTest.php index d255cb18c33d5c995dc86f7cbe167278033d0b68..8aa63b0280cf1c71c8c840994997393dcfba85c3 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerCurrentServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerCurrentServiceTest.php @@ -86,7 +86,7 @@ class CustomerCurrentServiceTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->customerSessionMock = $this->getMock('Magento\Customer\Model\Session', array(), array(), '', false); - $this->layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->customerDataBuilderMock = $this->getMock( 'Magento\Customer\Service\V1\Data\CustomerBuilder', array('create', 'setGroupId'), diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php index 72c985181a2786abd25c3662352a7ed154b40834..ee7b721ff261ffe3f9c662ec8e8473ceb2768eb1 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerMetadataServiceTest.php @@ -135,7 +135,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -160,10 +160,10 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase $options = $attributeMetadata->getOptions(); $this->assertNotEquals(array(), $options); - $this->assertEquals('label1', $options['label1']->getLabel()); - $this->assertEquals('value1', $options['label1']->getValue()); - $this->assertEquals('label2', $options['label2']->getLabel()); - $this->assertEquals('value2', $options['label2']->getValue()); + $this->assertEquals('label1', $options[0]->getLabel()); + $this->assertEquals('value1', $options[0]->getValue()); + $this->assertEquals('label2', $options[1]->getLabel()); + $this->assertEquals('value2', $options[1]->getValue()); } public function testGetAttributeMetadataWithoutAttributeMetadata() @@ -174,7 +174,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -230,7 +230,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -273,7 +273,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -308,7 +308,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -345,7 +345,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase '\Magento\Customer\Model\Resource\Form\Attribute\CollectionFactory' )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); @@ -394,7 +394,7 @@ class CustomerMetadataServiceTest extends \PHPUnit_Framework_TestCase )->disableOriginalConstructor()->getMock(); $storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); $optionBuilder = new \Magento\Customer\Service\V1\Data\Eav\OptionBuilder(); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php index d366d42605f8b42058d7c88e04528cb809a17d3f..b0e14bd4a293bfacf8e6249ee8b115d00321fa93 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/ContainerTest.php @@ -85,7 +85,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase /** @var $block \Magento\DesignEditor\Block\Adminhtml\Editor\Container */ $block = $this->_helper->getObject('Magento\DesignEditor\Block\Adminhtml\Editor\Container', $arguments); - $layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array(), array(), '', false); $block->setLayout($layout); $expectedButtonData = array( @@ -94,7 +94,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase 'onclick' => 'setLocation(\'\')', 'class' => 'back', 'id' => 'back_button', - 'region' => 'header', + 'region' => 'toolbar', 'sort_order' => 10 ) ); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php index cd4703f09ecd90857e1f10b63863c4f13a5a645f..8150cbcfffcf2e7352cfe7f1ffa57ca753c088a8 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/CustomTest.php @@ -84,7 +84,7 @@ class CustomTest extends \PHPUnit_Framework_TestCase $this->_model = $objectManagerHelper->getObject( 'Magento\DesignEditor\Block\Adminhtml\Editor\Tools\Code\Custom', array( - 'config' => $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false), + 'config' => $this->getMock('Magento\App\Config\ScopeConfigInterface'), 'formFactory' => $this->getMock('Magento\Data\FormFactory', array(), array(), '', false), 'urlBuilder' => $this->_urlBuilder, 'themeContext' => $this->_themeContext diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/SelectorList/AbstractTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/SelectorList/AbstractTest.php index ecee4926d58c07383174045477402cb73e019cb1..0cea0b8c704301e69243c2e843f540ac3b44644d 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/SelectorList/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/Theme/Selector/SelectorList/AbstractTest.php @@ -91,7 +91,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase false ); /** @var $layoutMock \Magento\View\LayoutInterface */ - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array('createBlock'), array(), '', false); + $layoutMock = $this->getMock('Magento\View\Layout', array('createBlock'), array(), '', false); /** @var $buttonMock \Magento\Backend\Block\Widget\Button */ $buttonMock = $this->getMock('Magento\Backend\Block\Widget\Button', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php index c2b5bd8f56921f6ac0d4cbf381d2491b9cb4ad6c..272cce9c8d75505d35c932b646d9f1febf0809a3 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Adminhtml/System/Design/EditorTest.php @@ -51,9 +51,9 @@ class EditorTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $layoutMock \Magento\Core\Model\Layout|PHPUnit_Framework_MockObject_MockObject */ + /** @var $layoutMock \Magento\View\Layout|PHPUnit_Framework_MockObject_MockObject */ $layoutMock = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array( 'getBlock', 'getUpdate', @@ -215,7 +215,7 @@ class EditorTest extends \PHPUnit_Framework_TestCase $translate->expects($this->any())->method('translate')->will($this->returnSelf()); $storeManager = $this->getMock( - 'Magento\Core\Model\StoreManager', + 'Magento\Store\Model\StoreManager', array('getStore', 'getBaseUrl'), array(), '', @@ -224,7 +224,7 @@ class EditorTest extends \PHPUnit_Framework_TestCase $storeManager->expects($this->any())->method('getStore')->will($this->returnSelf()); $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + $configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $authMock = $this->getMock('Magento\AuthorizationInterface'); $authMock->expects($this->any())->method('filterAclNodes')->will($this->returnSelf()); $backendSession = $this->getMock( @@ -251,9 +251,9 @@ class EditorTest extends \PHPUnit_Framework_TestCase $this->_getThemeCollectionFactory($countCustomization) ), array('Magento\TranslateInterface', $translate), - array('Magento\App\ConfigInterface', $configMock), + array('Magento\App\Config\ScopeConfigInterface', $configMock), array('Magento\Event\ManagerInterface', $eventManager), - array('Magento\Core\Model\StoreManager', $storeManager), + array('Magento\Store\Model\StoreManager', $storeManager), array('Magento\AuthorizationInterface', $authMock), array('Magento\Backend\Model\Session', $backendSession), array('Magento\Translate\Inline', $inlineMock), diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/AreaEmulatorTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/AreaEmulatorTest.php index 9f52a3947804b42fc3e175812d4c3008067d0182..ffae7c85efe65cb6cf10c90470a4179a5e1f7fa3 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/AreaEmulatorTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/AreaEmulatorTest.php @@ -44,7 +44,7 @@ class AreaEmulatorTest extends \PHPUnit_Framework_TestCase public function testEmulateLayoutArea() { $configuration = array( - 'Magento\Core\Model\Layout' => array( + 'Magento\View\Layout' => array( 'arguments' => array( 'area' => 'test_area' ) diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php index 099fd826672891504bd3d50dce2d669bdb75f011..167efaa791faf9bfabe41745323973ac615d15ad 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php @@ -31,7 +31,7 @@ class StateTest extends \PHPUnit_Framework_TestCase /** * Name of layout classes that will be used as main layout */ - const LAYOUT_NAVIGATION_CLASS_NAME = 'Magento\Core\Model\Layout'; + const LAYOUT_NAVIGATION_CLASS_NAME = 'Magento\View\Layout'; /** * Url model classes that will be used instead of \Magento\UrlInterface in different vde modes @@ -102,7 +102,7 @@ class StateTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_configMock; @@ -161,29 +161,31 @@ class StateTest extends \PHPUnit_Framework_TestCase ); $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_application = $this->getMock('Magento\Core\Model\App', array('getStore', 'getConfig'), - array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array('setConfig'), array(), '', false); - $storeManager->expects( + $mutableConfig = $this->getMockForAbstractClass('\Magento\App\Config\MutableScopeConfigInterface'); + $mutableConfig->expects( $this->any() )->method( - 'setConfig' + 'setValue' )->with( $this->equalTo(\Magento\View\DesignInterface::XML_PATH_THEME_ID), - $this->equalTo(self::THEME_ID) + $this->equalTo(self::THEME_ID), + $this->equalTo(\Magento\Store\Model\ScopeInterface::SCOPE_STORE) )->will( $this->returnSelf() ); - $this->_configMock = $this->getMock('Magento\App\ConfigInterface'); - $this->_configMock->expects($this->any()) - ->method('setNode') - ->with( - $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), - $this->equalTo(self::THEME_ID) - ) - ->will($this->returnSelf()); + $this->_configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $this->_configMock->expects( + $this->any() + )->method( + 'setNode' + )->with( + $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), + $this->equalTo(self::THEME_ID) + )->will( + $this->returnSelf() + ); $this->_theme = $this->getMock('Magento\Core\Model\Theme', array('getId', '__wakeup'), array(), '', false); $this->_theme->expects($this->any())->method('getId')->will($this->returnValue(self::THEME_ID)); @@ -212,7 +214,7 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->_objectManager, $this->_configMock, $this->_themeContext, - $storeManager + $mutableConfig ); } @@ -323,6 +325,6 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->_areaEmulator->expects($this->once())->method('emulateLayoutArea')->with(self::AREA_CODE); $controller = $this->getMock('Magento\Backend\Controller\Adminhtml\Action', array(), array(), '', false); - $this->assertNull($this->_model->update(self::AREA_CODE, $request, $controller)); + $this->_model->update(self::AREA_CODE, $request, $controller); } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php index 2e0722895867391daa8ef9f0152a3a593db75852..b35875f98a8ec329e6f99793345f9797055bc21c 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php @@ -120,7 +120,7 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase ); $store = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('getBaseUrl', 'isAdmin', 'isAdminUrlSecure', 'isFrontUrlSecure', '__sleep', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php index 4a833874ddf66fc4d73fc8db2ae6c311459e8028..6609d010795f4e626317131d098e508705dbdd48 100644 --- a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php @@ -49,18 +49,18 @@ class CarrierTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $coreStoreConfig = $this->getMockBuilder( - '\Magento\Core\Model\Store\Config' + $scopeConfig = $this->getMockBuilder( + '\Magento\App\Config\ScopeConfigInterface' )->setMethods( - array('getConfigFlag', 'getConfig') + array('isSetFlag', 'getValue') )->disableOriginalConstructor()->getMock(); - $coreStoreConfig->expects($this->any())->method('getConfigFlag')->will($this->returnValue(true)); - $coreStoreConfig->expects( + $scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue(true)); + $scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->will( - $this->returnCallback(array($this, 'coreStoreConfigGetConfig')) + $this->returnCallback(array($this, 'scopeConfiggetValue')) ); // xml element factory @@ -149,12 +149,12 @@ class CarrierTest extends \PHPUnit_Framework_TestCase )->getMock(); $filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($modulesDirectory)); $storeManager = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getWebsite') )->getMock(); $website = $this->getMockBuilder( - '\Magento\Core\Model\Website' + '\Magento\Store\Model\Website' )->disableOriginalConstructor()->setMethods( array('getBaseCurrencyCode', '__wakeup') )->getMock(); @@ -164,7 +164,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase $this->_model = $this->_helper->getObject( 'Magento\Dhl\Model\Carrier', array( - 'coreStoreConfig' => $coreStoreConfig, + 'scopeConfig' => $scopeConfig, 'xmlElFactory' => $xmlElFactory, 'rateFactory' => $rateFactory, 'rateMethodFactory' => $rateMethodFactory, @@ -177,11 +177,11 @@ class CarrierTest extends \PHPUnit_Framework_TestCase } /** - * Callback function, emulates getConfig function + * Callback function, emulates getValue function * @param $path * @return null|string */ - public function coreStoreConfigGetConfig($path) + public function scopeConfiggetValue($path) { $pathMap = array( 'carriers/dhl/shipment_days' => 'Mon,Tue,Wed,Thu,Fri,Sat', diff --git a/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php index f2ea199edae7f8b25f6a5b0be38a46a40a076027..24b310b2d90ff920085a8e1bf38a51e51b250095 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php @@ -41,10 +41,15 @@ class DataTest extends \PHPUnit_Framework_TestCase protected $_coreHelper; /** - * @var \Magento\Core\Model\Store|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ protected $_store; + /** + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_config; + /** * @var \Magento\Directory\Helper\Data */ @@ -89,12 +94,14 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_coreHelper = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $this->_store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); + $this->_store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false); $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->_store)); $currencyFactory = $this->getMock('Magento\Directory\Model\CurrencyFactory', array(), array(), '', false); + $this->_config = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $arguments = array( 'context' => $context, 'configCacheType' => $configCacheType, @@ -103,7 +110,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'coreHelper' => $this->_coreHelper, 'storeManager' => $storeManager, 'currencyFactory' => $currencyFactory, - 'config' => $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false) + 'config' => $this->_config ); $this->_object = $objectManager->getObject('Magento\Directory\Helper\Data', $arguments); } @@ -184,10 +191,10 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetCountriesWithStatesRequired($configValue, $expected) { - $this->_store->expects( + $this->_config->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'general/region/state_required' )->will( @@ -205,10 +212,10 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetCountriesWithOptionalZip($configValue, $expected) { - $this->_store->expects( + $this->_config->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'general/country/optional_zip_countries' )->will( diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php index 85fec4ab4507118255a335a59de33449a0f71afe..4a046f93ffd94550550e6feac31d9e74148978d7 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php @@ -51,19 +51,26 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $backendData = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_requestMock = $this->getMockForAbstractClass('Magento\App\RequestInterface', - array($backendData), '', false, false, true, array('getParam')); - $this->_configMock = $this->getMock('\Magento\App\ConfigInterface'); - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_requestMock = $this->getMockForAbstractClass( + 'Magento\App\RequestInterface', + array($backendData), + '', + false, + false, + true, + array('getParam') + ); + $this->_configMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_model = new \Magento\Directory\Model\Currency\DefaultLocator( - $this->_configMock, $this->_storeManagerMock + $this->_configMock, + $this->_storeManagerMock ); } public function testGetDefaultCurrencyReturnDefaultStoreDefaultCurrencyIfNoStoreIsSpecified() { - $this->_configMock->expects($this->once())->method('getValue') - ->will($this->returnValue('storeCurrency')); + $this->_configMock->expects($this->once())->method('getValue')->will($this->returnValue('storeCurrency')); $this->assertEquals('storeCurrency', $this->_model->getDefaultCurrency($this->_requestMock)); } @@ -78,7 +85,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('someStore') ); - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->once())->method('getBaseCurrencyCode')->will($this->returnValue('storeCurrency')); $this->_storeManagerMock->expects( $this->once() @@ -101,7 +108,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValueMap(array(array('store', null, ''), array('website', null, 'someWebsite'))) ); - $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $websiteMock->expects( $this->once() )->method( @@ -132,7 +139,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase array(array('store', null, ''), array('website', null, ''), array('group', null, 'someGroup')) ) ); - $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $websiteMock->expects( $this->once() )->method( @@ -141,7 +148,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase $this->returnValue('websiteCurrency') ); - $groupMock = $this->getMock('Magento\Core\Model\Store\Group', array(), array(), '', false); + $groupMock = $this->getMock('Magento\Store\Model\Group', array(), array(), '', false); $groupMock->expects($this->once())->method('getWebsite')->will($this->returnValue($websiteMock)); $this->_storeManagerMock->expects( diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php index 038e8abd6ef86c370ecac93eecf7f81acdcfac84..0ed9b7c3ed297c54461e6647cae0e193897d3685 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php @@ -56,7 +56,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $countryFactory = $this->getMock( 'Magento\Directory\Model\Resource\CountryFactory', @@ -72,7 +72,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase 'localeLists' => $localeListsMock, 'fetchStrategy' => $fetchStrategy, 'entityFactory' => $entityFactory, - 'coreStoreConfig' => $storeConfigMock, + 'scopeConfig' => $scopeConfigMock, 'countryFactory' => $countryFactory, 'resource' => $resource ); diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php index 15d2e90b82c1721dc1224272c2f15db94343ddaa..1ef8ec76065097e5d32ac42e227a3c5bc42fc157 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php @@ -86,7 +86,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->_downloadableFileMock, $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $this->_filesystemMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php index e0ea91910b9c3d77c7cb051f30a7372ead755dab..59421a4aaf6792df5e3a621b3496b9de0340c750 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php @@ -43,9 +43,9 @@ class DataTest extends \PHPUnit_Framework_TestCase { $context = $this->getMock('\Magento\App\Helper\Context', [], [], '', false); $attributeConfig = $this->getMock('\Magento\Eav\Model\Entity\Attribute\Config', [], [], '', false); - $coreStoreConfig = $this->getMock('\Magento\Core\Model\Store\Config', [], [], '', false); + $scopeConfig = $this->getMock('\Magento\App\Config\ScopeConfigInterface', [], [], '', false); $eavConfig = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false); - $this->_helper = new Data($context, $attributeConfig, $coreStoreConfig, $eavConfig); + $this->_helper = new Data($context, $attributeConfig, $scopeConfig, $eavConfig); $this->_eavConfig = $eavConfig; } diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php index 282a2038d62d558d7382ab496aaa4af575319a82..4d30e36a3298053f07860a9a2b284c5f116371fd 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php @@ -305,11 +305,11 @@ class AbstractTest extends \PHPUnit_Framework_TestCase true, true, true, - array('_getConfig') + array('_getValue') ); $configMock = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false); - $model->expects($this->any())->method('_getConfig')->will($this->returnValue($configMock)); + $model->expects($this->any())->method('_getValue')->will($this->returnValue($configMock)); $model->setConnection($this->_getAdapterMock()); $model->isPartialSave(true); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php index a7b7e1753aa5de2d8eddb5d4c4507bfdc1a21a23..1679301a3f7a24308f33c092f653d3a9abe8fd22 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php @@ -56,7 +56,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected $coreResourceMock; /** - * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $storeManagerMock; @@ -95,7 +95,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase false ); $this->storeManagerMock = $this->getMock( - 'Magento\Core\Model\StoreManagerInterface', + 'Magento\Store\Model\StoreManagerInterface', array(), array(), '', @@ -103,7 +103,12 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ); $this->connectionMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); $this->resourceMock = $this->getMockForAbstractClass( - 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, true, true, + 'Magento\Model\Resource\Db\AbstractDb', + array(), + '', + false, + true, + true, array('__wakeup', 'getReadConnection', 'getMainTable', 'getTable') ); $this->selectMock = $this->getMock('Zend_Db_Select', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php index a5410faa5f3d35e57267e1c396c90444586dda45..47d4bd915a7a5e51043200a820b79a7b0784b2cc 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php @@ -252,7 +252,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ) ); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array('getStores'), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManager', array('getStores'), array(), '', false); $storeManager->expects( $this->any() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php index 47ebb679cac07b3537ff29e8be82d77326e43bde..d2e3564f8e14cf7f8a5ca666fb6836da8747788c 100644 --- a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php @@ -71,7 +71,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_registryMock = $this->getMock('Magento\Registry', array(), array(), '', false, false); - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false, false); $menuConfigMock = $this->getMock('Magento\Backend\Model\Menu\Config', array(), array(), '', false, false); $menuMock = $this->getMock('Magento\Backend\Model\Menu', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php index fa267d49f7c9e3f6c5e04aaccc2d73e68dd1606a..ad9b8a61cd9371d80006b830533f796764fc3a77 100644 --- a/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/Email/Model/TemplateTest.php @@ -49,12 +49,11 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Model\View\Design', array(), array(), '', false), $this->getMock('Magento\Registry', array(), array(), '', false), $this->getMock('Magento\Core\Model\App\Emulation', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false), $this->getMock('Magento\App\Filesystem', array(), array(), '', false), $this->getMock('Magento\View\Url', array(), array(), '', false), $this->getMock('Magento\View\FileSystem', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), - $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $this->getMock('Magento\Email\Model\Template\FilterFactory', array(), array(), '', false), $emailConfig, array('template_id' => 10) diff --git a/dev/tests/unit/testsuite/Magento/Filter/TranslitTest.php b/dev/tests/unit/testsuite/Magento/Filter/TranslitTest.php index c6b9b0d1bfa685345704e20f07c6ca00d41fe13e..06989dbcfc46a467a750380d9e384bfb67d874ff 100644 --- a/dev/tests/unit/testsuite/Magento/Filter/TranslitTest.php +++ b/dev/tests/unit/testsuite/Magento/Filter/TranslitTest.php @@ -80,7 +80,7 @@ class TranslitTest extends \PHPUnit_Framework_TestCase public function testFilterConfigured() { $config = $this->getMockBuilder( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->setMethods( array('getValue', 'setValue', 'isSetFlag') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php index 34513387d80aabaa2440190d3adb7caa4293b446..21e1ad634c42f16224f9ea1bb915f02b85174b2f 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Helper/DataTest.php @@ -38,7 +38,7 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -52,14 +52,8 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - $this->_storeConfigMock = $this->getMock( - 'Magento\Core\Model\Store\ConfigInterface', - array(), - array(), - '', - false - ); + $this->_configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_registryMock = $this->getMock('Magento\Registry', array(), array(), '', false); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -68,7 +62,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'Magento\GoogleAdwords\Helper\Data', array( 'config' => $this->_configMock, - 'storeConfig' => $this->_storeConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, 'registry' => $this->_registryMock, 'context' => $context ) @@ -96,16 +90,16 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testIsGoogleAdwordsActive($isActive, $returnConfigValue, $returnValue) { - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->any() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( \Magento\GoogleAdwords\Helper\Data::XML_PATH_ACTIVE )->will( $this->returnValue($isActive) ); - $this->_storeConfigMock->expects($this->any())->method('getConfig')->with($this->isType('string'))->will( + $this->_scopeConfigMock->expects($this->any())->method('getValue')->with($this->isType('string'))->will( $this->returnCallback( function () use ($returnConfigValue) { return $returnConfigValue; @@ -224,10 +218,10 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetStoreConfigValue($method, $xmlPath, $returnValue) { - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( $xmlPath )->will( @@ -240,10 +234,10 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetConversionValueDynamic() { $returnValue = 4.1; - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( \Magento\GoogleAdwords\Helper\Data::XML_PATH_CONVERSION_VALUE_TYPE )->will( @@ -277,20 +271,20 @@ class DataTest extends \PHPUnit_Framework_TestCase */ public function testGetConversionValueConstant($conversionValueConst, $returnValue) { - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->at(0) )->method( - 'getConfig' + 'getValue' )->with( \Magento\GoogleAdwords\Helper\Data::XML_PATH_CONVERSION_VALUE_TYPE )->will( $this->returnValue(\Magento\GoogleAdwords\Helper\Data::CONVERSION_VALUE_TYPE_CONSTANT) ); $this->_registryMock->expects($this->never())->method('registry'); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->at(1) )->method( - 'getConfig' + 'getValue' )->with( \Magento\GoogleAdwords\Helper\Data::XML_PATH_CONVERSION_VALUE )->will( diff --git a/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Helper/DataTest.php index 029a009a3bf4e94ebd7095474a8ca44d78ec806f..2e4de489ef360128ffd9fb62b319e0e28ad9f9e7 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Helper/DataTest.php @@ -34,7 +34,7 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -48,7 +48,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeConfigMock = $this->getMock('Magento\Core\Model\Store\ConfigInterface'); + $this->_scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_googleAnalyticsHelperMock = $this->getMock( 'Magento\GoogleAnalytics\Helper\Data', array(), @@ -62,7 +62,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_helper = $objectManagerHelper->getObject( 'Magento\GoogleOptimizer\Helper\Data', array( - 'storeConfig' => $this->_storeConfigMock, + 'scopeConfig' => $this->_scopeConfigMock, 'analyticsHelper' => $this->_googleAnalyticsHelperMock, 'context' => $context ) @@ -76,12 +76,13 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGoogleExperimentIsEnabled($isExperimentsEnabled) { $store = 1; - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( \Magento\GoogleOptimizer\Helper\Data::XML_PATH_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store )->will( $this->returnValue($isExperimentsEnabled) @@ -107,12 +108,13 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGoogleExperimentIsActive($isExperimentsEnabled, $isAnalyticsAvailable, $result) { $store = 1; - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( \Magento\GoogleOptimizer\Helper\Data::XML_PATH_ENABLED, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store )->will( $this->returnValue($isExperimentsEnabled) diff --git a/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Model/Observer/Block/Category/TabTest.php b/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Model/Observer/Block/Category/TabTest.php index 06f402d4ccb01fabf9b4649e6b39b081c746b20b..436fb6aff708595794967b9e4c26906a4eaa7024 100644 --- a/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Model/Observer/Block/Category/TabTest.php +++ b/dev/tests/unit/testsuite/Magento/GoogleOptimizer/Model/Observer/Block/Category/TabTest.php @@ -60,7 +60,7 @@ class TabTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_helperMock = $this->getMock('Magento\GoogleOptimizer\Helper\Data', array(), array(), '', false); - $this->_layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false); $this->_tabsMock = $this->getMock( 'Magento\Catalog\Block\Adminhtml\Category\Tabs', array(), diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php index 510695442b7cb004c46c686b9846d8907849e7a3..d85a38f0eb6088b0ea024a422484bf67c5f32dce 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php @@ -56,29 +56,23 @@ class GroupedTest extends \PHPUnit_Framework_TestCase $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); $this->coreHelperMock = $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false); $this->storeManagerMock = $this->getMock( - '\Magento\Core\Model\StoreManagerInterface', + '\Magento\Store\Model\StoreManagerInterface', array(), array(), '', false ); - $customerMock = $this->getMockBuilder('\Magento\Customer\Service\V1\Data\Customer') - ->disableOriginalConstructor() - ->getMock(); - $customerMock - ->expects($this->any()) - ->method('getId') - ->will($this->returnValue(1)); + $customerMock = $this->getMockBuilder( + '\Magento\Customer\Service\V1\Data\Customer' + )->disableOriginalConstructor()->getMock(); + $customerMock->expects($this->any())->method('getId')->will($this->returnValue(1)); - $priceHelperMock = $this->getMockBuilder('Magento\Catalog\Helper\Product\Price') - ->disableOriginalConstructor() - ->getMock(); + $priceHelperMock = $this->getMockBuilder( + 'Magento\Catalog\Helper\Product\Price' + )->disableOriginalConstructor()->getMock(); - $priceHelperMock - ->expects($this->any()) - ->method('getCustomer') - ->will($this->returnValue($customerMock)); + $priceHelperMock->expects($this->any())->method('getCustomer')->will($this->returnValue($customerMock)); $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->block = $objectHelper->getObject( @@ -105,7 +99,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase '', false ); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->productMock->expects($this->any())->method('getTypeInstance')->will($this->returnValue($instanceMock)); @@ -129,7 +123,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase '', false ); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->productMock->expects($this->any())->method('getTypeInstance')->will($this->returnValue($instanceMock)); diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Cart/Item/Renderer/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Cart/Item/Renderer/GroupedTest.php index 7dcec439913d5437ed72f2bb37da119d5e4e93a0..8faa6df1aa0b4b200e789605979fdb892cff9344 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Cart/Item/Renderer/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Cart/Item/Renderer/GroupedTest.php @@ -31,8 +31,8 @@ use Magento\Catalog\Model\Config\Source\Product\Thumbnail as ThumbnailSource; class GroupedTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfig; + /** @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $_scopeConfig; /** @var Renderer */ protected $_renderer; @@ -41,10 +41,10 @@ class GroupedTest extends \PHPUnit_Framework_TestCase { parent::setUp(); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_renderer = $objectManagerHelper->getObject( 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped', - array('storeConfig' => $this->_storeConfig) + array('scopeConfig' => $this->_scopeConfig) ); } @@ -110,13 +110,13 @@ class GroupedTest extends \PHPUnit_Framework_TestCase protected function _initProducts($childHasThumbnail = true, $useParentThumbnail = false) { /** Set option which can force usage of parent product thumbnail when grouped product is displayed */ - $thumbnailToBeUsed = $useParentThumbnail ? - ThumbnailSource::OPTION_USE_PARENT_IMAGE : - ThumbnailSource::OPTION_USE_OWN_IMAGE; - $this->_storeConfig->expects( + $thumbnailToBeUsed = $useParentThumbnail + ? ThumbnailSource::OPTION_USE_PARENT_IMAGE + : ThumbnailSource::OPTION_USE_OWN_IMAGE; + $this->_scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( Renderer::CONFIG_THUMBNAIL_SOURCE )->will( diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php index 0a42dcf8fd4519bfa3cb18a016a9f097a94232b7..aa55d421f20a42798a7156ed8c802432dde6bce1 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php @@ -65,8 +65,8 @@ class ListAssociatedProductsTest extends \PHPUnit_Framework_TestCase $this->contextMock = $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false); $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false); $this->productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); - $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->typeInstanceMock = $this->getMock( 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CatalogPriceTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CatalogPriceTest.php index 22a092e137244d90e063e51f6f1583a516027be9..b8a69ad321732619bc82e42cbfb2d3e5a2407970 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CatalogPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CatalogPriceTest.php @@ -62,7 +62,7 @@ class CatalogPriceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->commonPriceMock = $this->getMock( 'Magento\Catalog\Model\Product\CatalogPrice', array(), @@ -163,7 +163,7 @@ class CatalogPriceTest extends \PHPUnit_Framework_TestCase public function testGetCatalogPriceWithCustomStoreAndSubProductIsSalable() { - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->productMock->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Image/Adapter/Gd2Test.php b/dev/tests/unit/testsuite/Magento/Image/Adapter/Gd2Test.php index 95924facf6143ad61bdd51385936ab5d87a86cb8..e1cab85d93280e595ab5ff11bf8811832fb90351 100644 --- a/dev/tests/unit/testsuite/Magento/Image/Adapter/Gd2Test.php +++ b/dev/tests/unit/testsuite/Magento/Image/Adapter/Gd2Test.php @@ -163,8 +163,10 @@ class Gd2Test extends \PHPUnit_Framework_TestCase return array( 'positive_M' => array($smallFile, false, '2M'), - 'positive_KB' => array($smallFile, false, '2048KB'), - 'negative_bytes' => array($bigFile, 'OverflowException', '2048000') + 'positive_KB' => array($smallFile, false, '2048K'), + 'negative_KB' => array($bigFile, 'OverflowException', '2048K'), + 'negative_bytes' => array($bigFile, 'OverflowException', '2048000'), + 'positive_no_limit' => array($smallFile, false, -1), ); } } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php index ea366593f755ca392e2734530c09702beea6eb6c..e471a9621fa92220ba40ed6ce73047071cd57d40 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php @@ -38,7 +38,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase * * @var array */ - protected $_websites = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID => 'admin', 1 => 'website1'); + protected $_websites = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID => 'admin', 1 => 'website1'); /** * Attributes array @@ -86,7 +86,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $storeManager->expects( $this->once() )->method( @@ -97,7 +97,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = new \Magento\ImportExport\Model\Export\Entity\Eav\Customer\Address( - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $storeManager, $this->getMock('Magento\ImportExport\Model\Export\Factory', array(), array(), '', false), $this->getMock( @@ -218,7 +218,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase unset($websites[0]); } foreach ($this->_websites as $id => $code) { - if (!$withDefault && $id == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { + if (!$withDefault && $id == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { continue; } $websiteData = array('id' => $id, 'code' => $code); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php index bf67facee9e6cbc296e49fb943c0da159d90979b..dff8d86167c7b0f5cd1069a3e2e8b0efd1ee9ba6 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php @@ -40,7 +40,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase * * @var array */ - protected $_websites = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID => 'admin', 1 => 'website1'); + protected $_websites = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID => 'admin', 1 => 'website1'); /** * Stores array (store id => code) @@ -72,7 +72,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $storeManager->expects( $this->any() @@ -91,7 +91,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase ); $this->_model = new \Magento\ImportExport\Model\Export\Entity\Eav\Customer( - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $storeManager, $this->getMock('Magento\ImportExport\Model\Export\Factory', array(), array(), '', false), $this->getMock( @@ -169,7 +169,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase unset($websites[0]); } foreach ($this->_websites as $id => $code) { - if (!$withDefault && $id == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { + if (!$withDefault && $id == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { continue; } $websiteData = array('id' => $id, 'code' => $code); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index 764ba955bf46a9422a00549b335db8f8c860144e..418174f7e5a00ecedcb3e9acfc8e4bbf44f39e87 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -170,12 +170,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $this->_getCustomerEntityMock(); $data['address_entity'] = $this->_getAddressEntityMock(); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -225,12 +225,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['address_entity'] = $addressEntity; $data['data_source_model'] = $dataSourceMock; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -280,12 +280,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -469,12 +469,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -526,12 +526,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -687,12 +687,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -729,12 +729,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -774,12 +774,12 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, @@ -824,7 +824,7 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase ); $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToCsvFile, $directoryMock); $this->_model->setSource($source); - $this->_model->validateData(); // assertions processed in self::verifyPrepareRowForDbData + $this->_model->validateData(); } /** @@ -974,11 +974,11 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $data = $this->_getModelDependencies(); $data['customer_entity'] = $customerEntity; $data['address_entity'] = $addressEntity; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\CustomerComposite( $this->_coreHelper, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index 4a852ff44f10eea511a0d04f8647cb73941697ce..8877190b89edf914b12b1b1f9847a9430af95fcc 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -31,13 +31,20 @@ * @todo Fix tests in the scope of https://wiki.magento.com/display/MAGE2/Technical+Debt+%28Team-Donetsk-B%29 */ namespace Magento\ImportExport\Model\Import\Entity\Eav\Customer; +use \Magento\ImportExport\Model\Import\AbstractEntity; +use \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address; +/** + * Class AddressTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * + */ class AddressTest extends \PHPUnit_Framework_TestCase { /** * Customer address entity adapter mock * - * @var \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address|\PHPUnit_Framework_MockObject_MockObject + * @var Address|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -226,7 +233,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false, false), $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false, false), $this->getMock('Magento\Eav\Model\Entity\TypeFactory'), - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false, false), $this->getMock('Magento\Eav\Model\Resource\Helper', array(), array(), '', false, false), $this->getMock('Magento\Validator\UniversalFactory', array(), array(), '', false, false) ) @@ -319,7 +326,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase unset($websites[0]); } foreach ($this->_websites as $id => $code) { - if (!$withDefault && $id == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { + if (!$withDefault && $id == \Magento\Store\Model\Store::DEFAULT_STORE_ID) { continue; } $websiteData = array('id' => $id, 'code' => $code); @@ -350,22 +357,19 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** * Create mock for custom behavior test * - * @return \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address|\PHPUnit_Framework_MockObject_MockObject + * @return Address|\PHPUnit_Framework_MockObject_MockObject */ protected function _getModelMockForTestImportDataWithCustomBehaviour() { // input data $customBehaviorRows = array( array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => 'update', - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_ADDRESS_ID => - $this->_customBehaviour['update_id'] + AbstractEntity::COLUMN_ACTION => 'update', + Address::COLUMN_ADDRESS_ID => $this->_customBehaviour['update_id'] ), array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION_VALUE_DELETE, - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_ADDRESS_ID => - $this->_customBehaviour['delete_id'] + AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE, + Address::COLUMN_ADDRESS_ID => $this->_customBehaviour['delete_id'] ) ); $updateResult = array( @@ -448,12 +452,12 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** * Create mock for customer address model class * - * @return \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address|\PHPUnit_Framework_MockObject_MockObject + * @return Address|\PHPUnit_Framework_MockObject_MockObject */ protected function _getModelMock() { - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $storeManager = $this->getMock('\Magento\Core\Model\StoreManager', array('getWebsites'), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $storeManager = $this->getMock('\Magento\Store\Model\StoreManager', array('getWebsites'), array(), '', false); $storeManager->expects( $this->once() )->method( @@ -462,10 +466,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->returnCallback(array($this, 'getWebsites')) ); - $modelMock = new \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address( + $modelMock = new Address( $this->_coreDataMock, $this->_stringLib, - $coreStoreConfig, + $scopeConfig, $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false), $this->getMock('Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false), $this->getMock('Magento\App\Resource', array(), array(), '', false), @@ -516,7 +520,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'no customer' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_update_no_customer.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_CUSTOMER_NOT_FOUND => array( + Address::ERROR_CUSTOMER_NOT_FOUND => array( array(1, null) ) ) @@ -524,16 +528,16 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'absent required attribute' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_update_absent_required_attribute.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_VALUE_IS_REQUIRED => array( - array(1, \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_COUNTRY_ID) + Address::ERROR_VALUE_IS_REQUIRED => array( + array(1, Address::COLUMN_COUNTRY_ID) ) ) ), 'invalid region' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_update_invalid_region.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_INVALID_REGION => array( - array(1, \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_REGION) + Address::ERROR_INVALID_REGION => array( + array(1, Address::COLUMN_REGION) ) ) ) @@ -556,7 +560,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'empty address id' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_delete_empty_address_id.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_ADDRESS_ID_IS_EMPTY => array( + Address::ERROR_ADDRESS_ID_IS_EMPTY => array( array(1, null) ) ) @@ -564,7 +568,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'invalid address' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_delete_address_not_found.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_ADDRESS_NOT_FOUND => array( + Address::ERROR_ADDRESS_NOT_FOUND => array( array(1, null) ) ) @@ -572,7 +576,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'no customer' => array( '$rowData' => include __DIR__ . '/_files/row_data_address_delete_no_customer.php', '$errors' => array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_CUSTOMER_NOT_FOUND => array( + Address::ERROR_CUSTOMER_NOT_FOUND => array( array(1, null) ) ) @@ -581,10 +585,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase } /** - * Test \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow() with add/update action + * Test Address::validateRow() with add/update action * - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::_validateRowForUpdate + * @covers Address::validateRow + * @covers Address::_validateRowForUpdate * @dataProvider validateRowForUpdateDataProvider * * @param array $rowData @@ -604,11 +608,11 @@ class AddressTest extends \PHPUnit_Framework_TestCase } /** - * Test \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow() + * Test Address::validateRow() * with 2 rows with identical PKs in case when add/update behavior is performed * - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::_validateRowForUpdate + * @covers Address::validateRow + * @covers Address::_validateRowForUpdate */ public function testValidateRowForUpdateDuplicateRows() { @@ -645,7 +649,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $secondRow['postcode'] = '90210'; $errors = array( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::ERROR_DUPLICATE_PK => array(array(2, null)) + Address::ERROR_DUPLICATE_PK => array(array(2, null)) ); $this->assertTrue($this->_model->validateRow($firstRow, 0)); @@ -655,9 +659,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase } /** - * Test \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow() with delete action + * Test Address::validateRow() with delete action * - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::validateRow + * @covers Address::validateRow * @dataProvider validateRowForDeleteDataProvider * * @param array $rowData @@ -692,12 +696,12 @@ class AddressTest extends \PHPUnit_Framework_TestCase $attributeMapping = $this->_model->getDefaultAddressAttributeMapping(); $this->assertInternalType('array', $attributeMapping, 'Default address attribute mapping must be an array.'); $this->assertArrayHasKey( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_DEFAULT_BILLING, + Address::COLUMN_DEFAULT_BILLING, $attributeMapping, 'Default address attribute mapping array must have a default billing column.' ); $this->assertArrayHasKey( - \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::COLUMN_DEFAULT_SHIPPING, + Address::COLUMN_DEFAULT_SHIPPING, $attributeMapping, 'Default address attribute mapping array must have a default shipping column.' ); @@ -706,7 +710,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** * Test if correct methods are invoked according to different custom behaviours * - * @covers \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address::_importData + * @covers Address::_importData */ public function testImportDataWithCustomBehaviour() { @@ -721,7 +725,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase * Validation method for _saveAddressEntities (callback for _saveAddressEntities) * * @param array $addUpdateRows - * @return \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address|\PHPUnit_Framework_MockObject_MockObject + * @return Address|\PHPUnit_Framework_MockObject_MockObject */ public function validateSaveAddressEntities(array $addUpdateRows) { @@ -734,7 +738,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase * Validation method for _deleteAddressEntities (callback for _deleteAddressEntities) * * @param array $deleteRowIds - * @return \Magento\ImportExport\Model\Import\Entity\Eav\Customer\Address|\PHPUnit_Framework_MockObject_MockObject + * @return Address|\PHPUnit_Framework_MockObject_MockObject */ public function validateDeleteAddressEntities(array $deleteRowIds) { diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php index ba159e44482e30e74644a9478db186e43776f0f0..46185c25d8fd44c25b4670d54090da785fef7032 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php @@ -70,7 +70,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected $_resourceHelper; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -88,7 +88,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase { $this->_coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $this->_string = new \Magento\Stdlib\String(); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_importFactory = $this->getMock( 'Magento\ImportExport\Model\ImportFactory', @@ -105,7 +105,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_collectionFactory = $this->getMock( 'Magento\ImportExport\Model\Export\Factory', array(), @@ -120,7 +120,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase array( $this->_coreDataMock, $this->_string, - $coreStoreConfig, + $scopeConfig, $this->_importFactory, $this->_resourceHelper, $this->_resource, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php index 6983db1aead558741b8cd13473541d2f79d48a77..1dca5e4a20204f3eeaa339eb4953464da42e3f29 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/Product/OptionTest.php @@ -240,13 +240,13 @@ class OptionTest extends \PHPUnit_Framework_TestCase $catalogDataMock = $this->getMock('Magento\Catalog\Helper\Data', array('__construct'), array(), '', false); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_model = new \Magento\ImportExport\Model\Import\Entity\Product\Option( $this->getMock('Magento\ImportExport\Model\Resource\Import\Data', array(), array(), '', false), $this->getMock('Magento\App\Resource', array(), array(), '', false), $this->getMock('Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false), - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false), $this->getMock( 'Magento\Catalog\Model\Resource\Product\Option\CollectionFactory', @@ -263,7 +263,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase false ), $catalogDataMock, - $coreStoreConfig, + $scopeConfig, new \Magento\Stdlib\DateTime(), $this->_getModelDependencies($addExpectations, $deleteBehavior, $doubleOptions) ); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php index fcdfcfa94ec22480498171a112956e0dc4c696be..70eef8bb49a774b7e959b3b75d75464a325bb8ec 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php @@ -56,7 +56,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase protected $_optionModel; /** - * @var \Magento\Core\Model\StoreManager + * @var \Magento\Store\Model\StoreManager */ protected $_storeManager; @@ -148,7 +148,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase ); $this->_storeManager = $this->getMock( - '\Magento\Core\Model\StoreManager', + '\Magento\Store\Model\StoreManager', array('getWebsites', 'getStores'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 5f60c0b1ad59b8cdb5e0ced6d8ac1c8ed6e6a6a3..9113535726487e63049769204211b2aca2ccddc4 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -31,13 +31,14 @@ * @todo Fix tests in the scope of https://wiki.magento.com/display/MAGE2/Technical+Debt+%28Team-Donetsk-B%29 */ namespace Magento\ImportExport\Model\Import; +use \Magento\ImportExport\Model\Import\AbstractEntity; class EntityAbstractTest extends \PHPUnit_Framework_TestCase { /** * Abstract import entity model * - * @var \Magento\ImportExport\Model\Import\AbstractEntity|\PHPUnit_Framework_MockObject_MockObject + * @var AbstractEntity|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -74,7 +75,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase { $coreHelper = $this->getMock('Magento\Core\Helper\Data', array('__construct'), array(), '', false); $string = new \Magento\Stdlib\String(); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $importFactory = $this->getMock('Magento\ImportExport\Model\ImportFactory', array(), array(), '', false); $resourceHelper = $this->getMock('Magento\ImportExport\Model\Resource\Helper', array(), array(), '', false); $resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); @@ -82,7 +83,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase $data = array( 'coreData' => $coreHelper, 'coreString' => $string, - 'coreStoreConfig' => $coreStoreConfig, + 'scopeConfig' => $scopeConfig, 'importFactory' => $importFactory, 'resourceHelper' => $resourceHelper, 'resource' => $resource, @@ -103,7 +104,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method _prepareRowForDb() * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::_prepareRowForDb + * @covers AbstractEntity::_prepareRowForDb */ public function testPrepareRowForDb() { @@ -183,7 +184,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase */ public function testIsDataValid() { - /** @var $model \Magento\ImportExport\Model\Import\AbstractEntity|\PHPUnit_Framework_MockObject_MockObject */ + /** @var $model AbstractEntity|\PHPUnit_Framework_MockObject_MockObject */ $model = $this->getMockForAbstractClass( 'Magento\ImportExport\Model\Import\AbstractEntity', array(), @@ -232,7 +233,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method getBehavior() with $rowData argument = null * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::getBehavior + * @covers AbstractEntity::getBehavior */ public function testGetBehaviorWithoutRowData() { @@ -240,7 +241,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase $property->setAccessible(true); $property->setValue($this->_model, $this->_availableBehaviors); - $default = \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior(); + $default = AbstractEntity::getDefaultBehavior(); foreach ($this->_availableBehaviors as $behavior) { $this->_model->setParameters(array('behavior' => $behavior)); @@ -252,7 +253,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase } /** - * Different cases to cover all code parts in \Magento\ImportExport\Model\Import\AbstractEntity::getBehavior() + * Different cases to cover all code parts in AbstractEntity::getBehavior() * * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @return array @@ -263,76 +264,73 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase "add/update behavior and row with delete in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION_VALUE_DELETE + AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "delete behavior and row with delete in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION_VALUE_DELETE + AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ), "custom behavior and row with delete in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION_VALUE_DELETE + AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ), "add/update behavior and row with update in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => 'update'), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => 'update'), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "delete behavior and row with update in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => 'update'), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => 'update'), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ), "custom behavior and row with update in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => 'update'), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => 'update'), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "add/update behavior and row with bogus string in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => microtime(true) + AbstractEntity::COLUMN_ACTION => microtime(true) ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "delete behavior and row with bogus string in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => microtime(true) + AbstractEntity::COLUMN_ACTION => microtime(true) ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ), "custom behavior and row with bogus string in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => microtime(true) + AbstractEntity::COLUMN_ACTION => microtime(true) ), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "add/update behavior and row with null in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => null), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => null), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "delete behavior and row with null in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => null), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => null), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE ), "custom behavior and row with null in action column" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => null), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => null), '$expectedBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_ADD_UPDATE ), "add/update behavior and empty row" => array( @@ -363,35 +361,34 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase "custom behavior and empty row is empty array" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => array(), - '$expectedBehavior' => \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior() + '$expectedBehavior' => AbstractEntity::getDefaultBehavior() ), "custom behavior and row with delete in action column and empty available behaviors" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION_VALUE_DELETE + AbstractEntity::COLUMN_ACTION => AbstractEntity::COLUMN_ACTION_VALUE_DELETE ), - '$expectedBehavior' => \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior(), + '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => array() ), "custom behavior and row with update in action column and empty available behaviors" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => 'update'), - '$expectedBehavior' => \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior(), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => 'update'), + '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => array() ), "custom behavior and row with bogus string in action column and empty available behaviors" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, '$rowData' => array( - \Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => microtime(true) + AbstractEntity::COLUMN_ACTION => microtime(true) ), - '$expectedBehavior' => \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior(), + '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => array() ), "custom behavior and row with null in action column and empty available behaviors" => array( '$inputBehavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_CUSTOM, - '$rowData' => array(\Magento\ImportExport\Model\Import\AbstractEntity::COLUMN_ACTION => null), - '$expectedBehavior' => \Magento\ImportExport\Model\Import\AbstractEntity::getDefaultBehavior(), + '$rowData' => array(AbstractEntity::COLUMN_ACTION => null), + '$expectedBehavior' => AbstractEntity::getDefaultBehavior(), '$availableBehaviors' => array() ) ); @@ -400,7 +397,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method getBehavior() with $rowData argument = null * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::getBehavior + * @covers AbstractEntity::getBehavior * * @dataProvider dataProviderForTestGetBehaviorWithRowData * @param $inputBehavior @@ -453,7 +450,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase */ public function attributeList() { - $longString = str_pad('', \Magento\ImportExport\Model\Import\AbstractEntity::DB_MAX_TEXT_LENGTH, 'x'); + $longString = str_pad('', AbstractEntity::DB_MAX_TEXT_LENGTH, 'x'); return array( array($this->_getDataSet('test1', 'decimal', 1.5, 'test')), @@ -462,7 +459,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase 'test2', 'varchar', 'test string', - substr($longString, 0, \Magento\ImportExport\Model\Import\AbstractEntity::DB_MAX_VARCHAR_LENGTH) + substr($longString, 0, AbstractEntity::DB_MAX_VARCHAR_LENGTH) ) ), array( @@ -549,7 +546,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method validateData() * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData + * @covers AbstractEntity::validateData * @expectedException \Magento\Model\Exception */ public function testValidateDataPermanentAttributes() @@ -568,7 +565,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method validateData() * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData + * @covers AbstractEntity::validateData * @expectedException \Magento\Model\Exception */ public function testValidateDataEmptyColumnName() @@ -580,7 +577,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method validateData() * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData + * @covers AbstractEntity::validateData * @expectedException \Magento\Model\Exception */ public function testValidateDataColumnNameWithWhitespaces() @@ -592,7 +589,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Test for method validateData() * - * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData + * @covers AbstractEntity::validateData * @expectedException \Magento\Model\Exception */ public function testValidateDataAttributeNames() diff --git a/dev/tests/unit/testsuite/Magento/Indexer/Model/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Indexer/Model/Config/ReaderTest.php index d36611665431356a834ee4a63c5e02b45916a6ba..b0b0427363b24ccb23469aea65df3eb89d235854 100644 --- a/dev/tests/unit/testsuite/Magento/Indexer/Model/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Indexer/Model/Config/ReaderTest.php @@ -36,14 +36,14 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected $_converter; /** - * @var \Magento\Core\Model\Config\FileResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\FileResolver|\PHPUnit_Framework_MockObject_MockObject */ protected $_fileResolverMock; protected function setUp() { $this->_fileResolverMock = $this->getMock( - 'Magento\Core\Model\Config\FileResolver', + 'Magento\App\Config\FileResolver', array('get'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php b/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php index 6985c4a993ad714aa60157665cfce06b75f0fa9a..e599cb3efd72a2da58538c0dca2069023ba8cbde 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Controller/WizardTest.php @@ -133,7 +133,7 @@ class WizardTest extends \PHPUnit_Framework_TestCase $this->_layoutMock = $this->getMock( - '\Magento\Core\Model\Layout', + '\Magento\View\Layout', array('getBlock', 'initMessages', 'addBlock'), array(), '', @@ -266,7 +266,7 @@ class WizardTest extends \PHPUnit_Framework_TestCase 'wizard' => $this->_wizardMock, 'session' => $this->_sessionMock, 'dbUpdater' => $this->_getClearMock('Magento\Module\UpdaterInterface'), - 'storeManager' => $this->_getClearMock('Magento\Core\Model\StoreManagerInterface'), + 'storeManager' => $this->_getClearMock('Magento\Store\Model\StoreManagerInterface'), 'appState' => $this->_getClearMock('Magento\App\State') ) ); diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php index 0d11a3b475b27da0fd3683b463055f3bad63fa0d..77d2a8257a967d8616b4bdbdae16bdd6686e5540 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -80,7 +80,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Install\Model\Installer', array(), array(), '', false), $this->getMock('Magento\App\RequestInterface', array(), array(), '', false), $this->_filesystemMock, - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->_messageManager ); } diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php index 0bcb3a34e11be1ad7b0bc83abfbd874deaf58068..51c5b3533b9c5581af56afc7b901e7fb0142a2a9 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/InstallerTest.php @@ -45,7 +45,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase /** * Application config model * - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; @@ -76,7 +76,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_cache = $this->getMock('\Magento\App\CacheInterface', array(), array(), '', false); - $this->_config = $this->getMock('\Magento\App\ReinitableConfigInterface', array(), array(), '', false); + $this->_config = $this->getMock('\Magento\App\Config\ReinitableConfigInterface', array(), array(), '', false); $this->_cacheState = $this->getMock('\Magento\App\Cache\StateInterface', array(), array(), '', false); $this->_cacheTypeList = $this->getMock('\Magento\App\Cache\TypeListInterface', array(), array(), '', false); $this->_appState = $this->getMock('\Magento\App\State', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php index c1b609c6b57c606623db798f69d2f4af9935e2ef..72e7823ec25933e952799acd617c18510a9ab2cc 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -47,7 +47,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Backend\Model\Layout\Filter\Acl|\PHPUnit_Framework_MockObject_MockObject */ protected $_layoutFilterMock; - /** @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_configMock; /** @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -115,7 +115,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase )->disableOriginalConstructor()->getMock(); // Initialize mocks which are used in several test cases $this->_configMock = $this->getMockBuilder( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); $this->_eventManagerMock = $this->getMockBuilder( 'Magento\Event\ManagerInterface' @@ -883,8 +883,8 @@ HANDLE; protected function _verifyLoadAndRenderLayout() { $map = array( - array('Magento\App\ConfigInterface', $this->_configMock), - array('Magento\Backend\Model\Layout\Filter\Acl', $this->_layoutFilterMock), + array('Magento\App\Config\ScopeConfigInterface', $this->_configMock), + array('Magento\Core\Model\Layout\Filter\Acl', $this->_layoutFilterMock), array('Magento\Backend\Model\Session', $this->_backendSessionMock), array('Magento\TranslateInterface', $this->_translateModelMock), array('Magento\Config\ScopeInterface', $this->_configScopeMock) @@ -903,7 +903,7 @@ HANDLE; array( Info::DATA_NAME => 'nameTest', Info::DATA_ID => self::INTEGRATION_ID, - 'id' => self::INTEGRATION_ID, // This will allow usage of both getIntegrationId() and getId() + 'id' => self::INTEGRATION_ID, Info::DATA_EMAIL => 'test@magento.com', Info::DATA_ENDPOINT => 'http://magento.ll/endpoint', Info::DATA_SETUP_TYPE => IntegrationModel::TYPE_MANUAL diff --git a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php index 48f24511904e4c2ea11146936158c3eb7e998715..5937f3cad677a89d7655498f56d57a2dfef84224 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php @@ -25,7 +25,7 @@ namespace Magento\Integration\Helper\Oauth; class ConsumerTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManagerMock; /** @var \Magento\Integration\Model\Oauth\Consumer\Factory */ @@ -43,7 +43,7 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Integration\Model\Oauth\Token */ protected $_tokenMock; - /** @var \Magento\Core\Model\Store */ + /** @var \Magento\Store\Model\Store */ protected $_storeMock; /** @var \Magento\Integration\Helper\Oauth\Data */ @@ -80,9 +80,11 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase $this->_tokenFactory->expects($this->any())->method('create')->will($this->returnValue($this->_tokenMock)); $this->_storeManagerMock = $this->getMockBuilder( - 'Magento\Core\Model\StoreManagerInterface' + 'Magento\Store\Model\StoreManagerInterface' )->disableOriginalConstructor()->getMockForAbstractClass(); - $this->_storeMock = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $this->_storeMock = $this->getMockBuilder( + 'Magento\Store\Model\Store' + )->disableOriginalConstructor()->getMock(); $this->_storeManagerMock->expects( $this->any() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/DataTest.php b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/DataTest.php index ef3483d63d1999364ab356b0fa10f332e8cb6819..e56a65279b36b0ee5fce0e35be22dee9cd32aaf9 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/DataTest.php @@ -25,42 +25,42 @@ namespace Magento\Integration\Helper\Oauth; class DataTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\Store\Config */ - protected $_storeConfigMock; + /** @var \Magento\App\Config\ScopeConfigInterface */ + protected $_scopeConfigMock; /** @var \Magento\Integration\Helper\Oauth\Data */ protected $_dataHelper; protected function setUp() { - $this->_storeConfigMock = $this->getMockBuilder( - 'Magento\Core\Model\Store\Config' + $this->_scopeConfigMock = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' )->disableOriginalConstructor()->getMock(); - $this->_dataHelper = new \Magento\Integration\Helper\Oauth\Data($this->_storeConfigMock); + $this->_dataHelper = new \Magento\Integration\Helper\Oauth\Data($this->_scopeConfigMock); } protected function tearDown() { - unset($this->_storeConfigMock); + unset($this->_scopeConfigMock); unset($this->_dataHelper); } public function testIsCleanupProbabilityZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(0)); $this->assertFalse($this->_dataHelper->isCleanupProbability()); } public function testIsCleanupProbabilityRandomOne() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(1)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(1)); $this->assertTrue($this->_dataHelper->isCleanupProbability()); } public function testGetCleanupExpirationPeriodZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(0)); $this->assertEquals( \Magento\Integration\Helper\Oauth\Data::CLEANUP_EXPIRATION_PERIOD_DEFAULT, $this->_dataHelper->getCleanupExpirationPeriod() @@ -69,25 +69,25 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetCleanupExpirationPeriodNonZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(10)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(10)); $this->assertEquals(10, $this->_dataHelper->getCleanupExpirationPeriod()); } public function testConsumerPostMaxRedirectsZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(0)); $this->assertEquals(0, $this->_dataHelper->getConsumerPostMaxRedirects()); } public function testConsumerPostMaxRedirectsNonZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(10)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(10)); $this->assertEquals(10, $this->_dataHelper->getConsumerPostMaxRedirects()); } public function testGetConsumerPostTimeoutZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(0)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(0)); $this->assertEquals( \Magento\Integration\Helper\Oauth\Data::CONSUMER_POST_TIMEOUT_DEFAULT, $this->_dataHelper->getConsumerPostTimeout() @@ -96,7 +96,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetConsumerPostTimeoutNonZero() { - $this->_storeConfigMock->expects($this->once())->method('getConfig')->will($this->returnValue(10)); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->will($this->returnValue(10)); $this->assertEquals(10, $this->_dataHelper->getConsumerPostTimeout()); } } diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php index 34a525ac0ce9f4448a4656bfcc73b258108e8b19..3b2b6a0aa8854379d431198b9bc73909ccdbaaf5 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php @@ -109,7 +109,7 @@ class OauthV1Test extends \PHPUnit_Framework_TestCase ); $this->_service = new \Magento\Integration\Service\OauthV1( - $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false), + $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false), $this->_consumerFactory, $this->_tokenFactoryMock, $this->getMock('Magento\Integration\Helper\Oauth\Data', array(), array(), '', false), diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/Shell/Command/CleanTest.php b/dev/tests/unit/testsuite/Magento/Log/Model/Shell/Command/CleanTest.php index 299328c568db2785012fe3d1952bfb6f8172087f..ac1f6c42a85723af199114a8fc538a4704569301 100644 --- a/dev/tests/unit/testsuite/Magento/Log/Model/Shell/Command/CleanTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/Model/Shell/Command/CleanTest.php @@ -28,7 +28,7 @@ class CleanTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeManagerMock; + protected $_mutableConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -42,7 +42,7 @@ class CleanTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $this->_mutableConfigMock = $this->getMock('Magento\App\Config\MutableScopeConfigInterface'); $this->_logFactoryMock = $this->getMock('Magento\Log\Model\LogFactory', array('create'), array(), '', false); $this->_logMock = $this->getMock('Magento\Log\Model\Log', array(), array(), '', false); $this->_logFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_logMock)); @@ -50,20 +50,24 @@ class CleanTest extends \PHPUnit_Framework_TestCase public function testExecuteWithoutDaysOffset() { - $model = new \Magento\Log\Model\Shell\Command\Clean($this->_storeManagerMock, $this->_logFactoryMock, 0); - $this->_storeManagerMock->expects($this->never())->method('getStore'); + $model = new \Magento\Log\Model\Shell\Command\Clean($this->_mutableConfigMock, $this->_logFactoryMock, 0); + $this->_mutableConfigMock->expects($this->never())->method('setValue'); $this->_logMock->expects($this->once())->method('clean'); $this->assertStringStartsWith('Log cleaned', $model->execute()); } public function testExecuteWithDaysOffset() { - $model = new \Magento\Log\Model\Shell\Command\Clean($this->_storeManagerMock, $this->_logFactoryMock, 10); - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); - $this->_storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); + $model = new \Magento\Log\Model\Shell\Command\Clean($this->_mutableConfigMock, $this->_logFactoryMock, 10); + $this->_mutableConfigMock->expects($this->once()) + ->method('setValue') + ->with( + \Magento\Log\Model\Log::XML_LOG_CLEAN_DAYS, + 10, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); $this->_logMock->expects($this->once())->method('clean'); - $storeMock->expects($this->once())->method('setConfig')->with(\Magento\Log\Model\Log::XML_LOG_CLEAN_DAYS, 10); $this->assertStringStartsWith('Log cleaned', $model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/VisitorTest.php b/dev/tests/unit/testsuite/Magento/Log/Model/VisitorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..af4de9a04dab0add94c87e608d510c7ae6e8c7e2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Log/Model/VisitorTest.php @@ -0,0 +1,69 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Log\Model; + +class VisitorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Log\Model\Visitor + */ + protected $_model; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_model = $helper->getObject('Magento\Log\Model\Visitor'); + } + + public function testBindCustomerLogin() + { + $customer = new \Magento\Object(['id' => '1']); + $observer = new \Magento\Object([ + 'event' => new \Magento\Object(['customer' => $customer]) + ]); + + $this->_model->bindCustomerLogin($observer); + $this->assertTrue($this->_model->getDoCustomerLogin()); + $this->assertEquals($customer->getId(), $this->_model->getCustomerId()); + + $this->_model->unsetData(); + $this->_model->setCustomerId('2'); + $this->_model->bindCustomerLogin($observer); + $this->assertNull($this->_model->getDoCustomerLogin()); + $this->assertEquals('2', $this->_model->getCustomerId()); + } + + public function testBindCustomerLogout() + { + $observer = new \Magento\Object(); + + $this->_model->setCustomerId('1'); + $this->_model->bindCustomerLogout($observer); + $this->assertTrue($this->_model->getDoCustomerLogout()); + + $this->_model->unsetData(); + $this->_model->bindCustomerLogout($observer); + $this->assertNull($this->_model->getDoCustomerLogout()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php b/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php index d5067a824ed8601d8486379115191ce42c9c371b..90188a6168ad207db7bdba680efbac37f3b3cb84 100644 --- a/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Mail/Template/TransportBuilderTest.php @@ -55,6 +55,11 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase */ protected $senderResolverMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_mailTransportFactoryMock; + public function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -62,14 +67,17 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase $this->messageMock = $this->getMock('Magento\Mail\Message'); $this->objectManagerMock = $this->getMock('Magento\ObjectManager'); $this->senderResolverMock = $this->getMock('Magento\Mail\Template\SenderResolverInterface'); - + $this->_mailTransportFactoryMock = $this->getMockBuilder( + 'Magento\Mail\TransportInterfaceFactory' + )->disableOriginalConstructor()->setMethods(['create'])->getMock(); $this->builder = $helper->getObject( $this->builderClassName, array( 'templateFactory' => $this->templateFactoryMock, 'message' => $this->messageMock, 'objectManager' => $this->objectManagerMock, - 'senderResolver' => $this->senderResolverMock + 'senderResolver' => $this->senderResolverMock, + 'mailTransportFactory' => $this->_mailTransportFactoryMock ) ); } @@ -139,19 +147,18 @@ class TransportBuilderTest extends \PHPUnit_Framework_TestCase $transport = $this->getMock('\Magento\Mail\TransportInterface'); - $this->objectManagerMock->expects( + $this->_mailTransportFactoryMock->expects( $this->at(0) )->method( 'create' )->with( - $this->equalTo('Magento\Mail\TransportInterface'), $this->equalTo(array('message' => $this->messageMock)) )->will( $this->returnValue($transport) ); $this->objectManagerMock->expects( - $this->at(1) + $this->at(0) )->method( 'create' )->with( diff --git a/dev/tests/unit/testsuite/Magento/Math/CalculatorTest.php b/dev/tests/unit/testsuite/Magento/Math/CalculatorTest.php index 1e5c4fbc614651c7e617fac7199631d373899036..a2c030311c6e850b516a8410ea5ba1e3619a0108 100644 --- a/dev/tests/unit/testsuite/Magento/Math/CalculatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Math/CalculatorTest.php @@ -37,7 +37,7 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_scopeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->_scopeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_scopeMock->expects($this->any()) ->method('roundPrice') ->will($this->returnCallback(function ($argument) { diff --git a/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php index f5096d4f7e4ca3928d7e1055eeb602979d607b31..c8554441c4fb6b555e69affb279bde33fe99fc7a 100644 --- a/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Message/ManagerTest.php @@ -192,7 +192,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase $this->returnValue($messageCollection) ); - $this->eventManager->expects($this->once())->method('dispatch')->with('core_session_abstract_clear_messages'); + $this->eventManager->expects($this->once())->method('dispatch')->with('session_abstract_clear_messages'); $this->assertEquals($messageCollection, $this->model->getMessages(true)); } @@ -265,7 +265,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ->method('getData') ->will($this->returnValue($messageCollection)); $this->eventManager->expects($this->once()) - ->method('dispatch')->with('core_session_abstract_add_message'); + ->method('dispatch')->with('session_abstract_add_message'); $this->messageFactory->expects($this->once()) ->method('create')->with($type, $message) ->will($this->returnValue($this->messageMock)); @@ -351,7 +351,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ->method('getData') ->will($this->returnValue($messageCollection)); $this->eventManager->expects($this->once()) - ->method('dispatch')->with('core_session_abstract_add_message'); + ->method('dispatch')->with('session_abstract_add_message'); $messageCollection->expects($this->once())->method('addMessage')->with($this->messageMock); $this->model->addMessages(array($this->messageMock)); diff --git a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php index fab87b4a6045e34dc1a886bc8cef616292273b9d..707debc7427dba6e4018f21ca4e8c1758e3247cd 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php @@ -71,7 +71,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_protFactoryMock = $this->getMock( - 'Magento\Core\Model\Config\BaseFactory', + 'Magento\App\Config\BaseFactory', array(), array(), '', @@ -79,7 +79,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase false ); $this->_dirsMock = $this->getMock('Magento\Module\Dir', array(), array(), '', false, false); - $this->_baseConfigMock = $this->getMock('Magento\Core\Model\Config\Base', array(), array(), '', false, false); + $this->_baseConfigMock = $this->getMock('Magento\App\Config\Base', array(), array(), '', false, false); $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); $this->_filesystemMock = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false, false); $this->_fileIteratorFactory = $this->getMock('\Magento\Config\FileIteratorFactory', array(), array(), diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Module/Setup/MigrationTest.php similarity index 70% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/MigrationTest.php index 5d0c371866a9d1924fe5580b452955d8764ce8e2..d926677c5f424dc897f2bfd5ee60e2d0e2d5b30c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/MigrationTest.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -28,7 +28,7 @@ /** * Tests for resource setup model needed for migration process between Magento versions */ -namespace Magento\Core\Model\Resource\Setup; +namespace Magento\Module\Setup; class MigrationTest extends \PHPUnit_Framework_TestCase { @@ -156,55 +156,41 @@ class MigrationTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Setup\Migration::appendClassAliasReplace + * @covers \Magento\Module\Setup\Migration::appendClassAliasReplace */ public function testAppendClassAliasReplace() { $moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); $moduleListMock->expects($this->once())->method('getModule')->will($this->returnValue(array())); - $contextMock = $this->getMock('Magento\Core\Model\Resource\Setup\Context', array(), array(), '', false); $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); - $contextMock->expects($this->any())->method('getFilesystem')->will($this->returnValue($filesystemMock)); $modulesDirMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); $filesystemMock->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($modulesDirMock)); - $contextMock->expects( - $this->once() - )->method( - 'getEventManager' - )->will( - $this->returnValue($this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false)) - ); - $contextMock->expects( - $this->once() - )->method( - 'getResourceModel' - )->will( - $this->returnValue($this->getMock('Magento\App\Resource', array(), array(), '', false)) - ); - $contextMock->expects( - $this->once() - )->method( - 'getLogger' - )->will( - $this->returnValue($this->getMock('Magento\Logger', array(), array(), '', false)) - ); - $contextMock->expects( - $this->once() - )->method( - 'getModulesReader' - )->will( - $this->returnValue($this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false)) - ); + $contextMock = $this->getMock('Magento\Module\Setup\Context', array(), array(), '', false); + $contextMock->expects($this->any())->method('getFilesystem')->will($this->returnValue($filesystemMock)); + $contextMock->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false))); + $contextMock->expects($this->once()) + ->method('getResourceModel') + ->will($this->returnValue($this->getMock('Magento\App\Resource', array(), array(), '', false))); + $contextMock->expects($this->once()) + ->method('getLogger') + ->will($this->returnValue($this->getMock('Magento\Logger', array(), array(), '', false))); + $contextMock->expects($this->once()) + ->method('getModulesReader') + ->will($this->returnValue($this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false))); $contextMock->expects($this->once())->method('getModuleList')->will($this->returnValue($moduleListMock)); - $setupModel = new \Magento\Core\Model\Resource\Setup\Migration( + $migrationData = $this->getMock('Magento\Module\Setup\MigrationData', array(), array(), '', false); + + $setupModel = new \Magento\Module\Setup\Migration( $contextMock, 'core_setup', - $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), - $this->getMock('Magento\App\Filesystem', array(), array(), '', false), - '' + 'Magento_Core', + $migrationData, + 'app/etc/aliases_to_classes_map.json' ); $setupModel->appendClassAliasReplace( @@ -232,25 +218,25 @@ class MigrationTest extends \PHPUnit_Framework_TestCase /** * @dataProvider updateClassAliasesDataProvider - * @covers \Magento\Core\Model\Resource\Setup\Migration::doUpdateClassAliases - * @covers \Magento\Core\Model\Resource\Setup\Migration::_updateClassAliasesInTable - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getRowsCount - * @covers \Magento\Core\Model\Resource\Setup\Migration::_applyFieldRule - * @covers \Magento\Core\Model\Resource\Setup\Migration::_updateRowsData - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getTableData - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getReplacement - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getCorrespondingClassName - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getModelReplacement - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getPatternReplacement - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getClassName - * @covers \Magento\Core\Model\Resource\Setup\Migration::_isFactoryName - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getModuleName - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getCompositeModuleName - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getAliasFromMap - * @covers \Magento\Core\Model\Resource\Setup\Migration::_pushToMap - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getAliasesMap - * @covers \Magento\Core\Model\Resource\Setup\Migration::_getAliasInSerializedStringReplacement - * @covers \Magento\Core\Model\Resource\Setup\Migration::_parseSerializedString + * @covers \Magento\Module\Setup\Migration::doUpdateClassAliases + * @covers \Magento\Module\Setup\Migration::_updateClassAliasesInTable + * @covers \Magento\Module\Setup\Migration::_getRowsCount + * @covers \Magento\Module\Setup\Migration::_applyFieldRule + * @covers \Magento\Module\Setup\Migration::_updateRowsData + * @covers \Magento\Module\Setup\Migration::_getTableData + * @covers \Magento\Module\Setup\Migration::_getReplacement + * @covers \Magento\Module\Setup\Migration::_getCorrespondingClassName + * @covers \Magento\Module\Setup\Migration::_getModelReplacement + * @covers \Magento\Module\Setup\Migration::_getPatternReplacement + * @covers \Magento\Module\Setup\Migration::_getClassName + * @covers \Magento\Module\Setup\Migration::_isFactoryName + * @covers \Magento\Module\Setup\Migration::_getModuleName + * @covers \Magento\Module\Setup\Migration::_getCompositeModuleName + * @covers \Magento\Module\Setup\Migration::_getAliasFromMap + * @covers \Magento\Module\Setup\Migration::_pushToMap + * @covers \Magento\Module\Setup\Migration::_getAliasesMap + * @covers \Magento\Module\Setup\Migration::_getAliasInSerializedStringReplacement + * @covers \Magento\Module\Setup\Migration::_parseSerializedString */ public function testDoUpdateClassAliases($replaceRules, $tableData, $expected, $aliasesMap = array()) { @@ -259,19 +245,19 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $this->_actualUpdateResult = array(); $tableRowsCount = count($tableData); - $setupModel = new \Magento\Core\Model\Resource\Setup\Migration( + $setupModel = new \Magento\Module\Setup\Migration( $this->getMock('Magento\App\Resource', array(), array(), '', false, false), $this->getMock('Magento\App\Filesystem', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false, false), + $this->getMock('Magento\App\Config\ScopeConfigInterface'), $this->getMock('Magento\Module\ModuleListInterface'), $this->getMock('Magento\Module\Dir\Reader', array(), array(), '', false, false), $this->getMock('Magento\Install\Model\Resource\Resource', array(), array(), '', false), $this->getMock('Magento\Core\Model\Resource\Theme\CollectionFactory', array(), array(), '', false), $this->getMock('Magento\Core\Model\Theme\CollectionFactory', array(), array(), '', false), - $this->getMock('Magento\Core\Model\Resource\Setup\MigrationFactory', array(), array(), '', false), + $this->getMock('Magento\Module\Setup\MigrationFactory', array(), array(), '', false), 'core_setup', 'app/etc/aliases_to_classes_map.json', $this->_getModelDependencies($tableRowsCount, $tableData, $aliasesMap) @@ -313,22 +299,6 @@ class MigrationTest extends \PHPUnit_Framework_TestCase ); } - /** - * @covers \Magento\Core\Model\Resource\Setup\Migration::getCompositeModules - */ - public function testGetCompositeModules() - { - $compositeModules = \Magento\Core\Model\Resource\Setup\Migration::getCompositeModules(); - $this->assertInternalType('array', $compositeModules); - $this->assertNotEmpty($compositeModules); - foreach ($compositeModules as $classAlias => $className) { - $this->assertInternalType('string', $classAlias); - $this->assertInternalType('string', $className); - $this->assertNotEmpty($classAlias); - $this->assertNotEmpty($className); - } - } - /** * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Filesystem */ diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_model.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_model.php similarity index 87% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_model.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_model.php index a2db59d3ecc4f8f936e71a30c6adbe2ab176285e..54f026d1f8451a7d59927e6319643d01eaf09808 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_model.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_model.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'field', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN ) ), '$tableData' => array( @@ -62,14 +62,14 @@ return array( ) ), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL => array( 'customer/customer' => 'Magento\Customer\Model\Customer_FROM_MAP', 'customer/attribute_data_postcode' => 'Magento\Customer\Model\Attribute\Data\Postcode' ) ) ), '$aliasesMap' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL => array( 'customer/customer' => 'Magento\Customer\Model\Customer_FROM_MAP' ) ) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_pk_fields.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_pk_fields.php similarity index 86% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_pk_fields.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_pk_fields.php index 17ce7a8a6277104a45f6820677968c46a371cb40..072f2d4a14ec872abd49c13b8a2a83c85db42d67 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_pk_fields.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_pk_fields.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'collection', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_RESOURCE, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array('pk_field1', 'pk_field2') ) ), @@ -48,7 +48,7 @@ return array( ) ), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_RESOURCE => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_RESOURCE => array( 'customer/attribute_collection' => 'Magento\Customer\Model\Resource\Attribute\Collection' ) ) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_resource.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_resource.php similarity index 86% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_resource.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_resource.php index 237273fa85ffeb28c614ecdea7c963952dba34b3..ba91a7ce822e6e1b53515d564078051828e4646c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_plain_resource.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_plain_resource.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'collection', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_RESOURCE, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, + \Magento\Module\Setup\Migration::ENTITY_TYPE_RESOURCE, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, array(), 'flag = 1' ) @@ -48,7 +48,7 @@ return array( ), 'where' => array('flag = 1'), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_RESOURCE => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_RESOURCE => array( 'customer/attribute_collection' => 'Magento\Customer\Model\Resource\Attribute\Collection' ) ) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_serialized.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_serialized.php similarity index 86% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_serialized.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_serialized.php index 3b7bbdb9977fff63e4275bc41ae9f44e5a326df6..fac477557452c01e5b02541ce0f11def1314faa9 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_serialized.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_serialized.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'field', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_SERIALIZED ) ), '$tableData' => array( @@ -48,7 +48,7 @@ return array( ) ), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_MODEL => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_MODEL => array( 'catalogrule/rule_condition_combine' => 'Magento\CatalogRule\Model\Rule\Condition\Combine' ) ) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_wiki.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_wiki.php similarity index 88% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_wiki.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_wiki.php index 00cd06582feab3ce75ecbb87fd7ebb4d14b4d5bf..4a347d2c5145faed3c26d2c0d9f6a22131a854be 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_wiki.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_wiki.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'field', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_WIKI + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_WIKI ) ), '$tableData' => array( @@ -55,7 +55,7 @@ return array( ) ), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK => array( 'productalert/product_view' => 'Magento\ProductAlert\Block\Product\View', 'catalogSearch/result' => 'Magento\CatalogSearch\Block\Result' ) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_xml.php b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_xml.php similarity index 89% rename from dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_xml.php rename to dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_xml.php index 1eb4d8c919a2be21e61d74b21feb62321939ebee..670d837a4a74732c835a7a9a385758801378e2fb 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/_files/data_content_xml.php +++ b/dev/tests/unit/testsuite/Magento/Module/Setup/_files/data_content_xml.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -30,8 +30,8 @@ return array( array( 'table', 'field', - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Core\Model\Resource\Setup\Migration::FIELD_CONTENT_TYPE_XML + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK, + \Magento\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML ) ), '$tableData' => array( @@ -55,7 +55,7 @@ return array( ) ), 'aliases_map' => array( - \Magento\Core\Model\Resource\Setup\Migration::ENTITY_TYPE_BLOCK => array( + \Magento\Module\Setup\Migration::ENTITY_TYPE_BLOCK => array( 'catalog/product_newProduct' => 'Magento\Catalog\Block\Product\NewProduct', 'catalogSearch/result' => 'Magento\CatalogSearch\Block\Result' ) diff --git a/dev/tests/unit/testsuite/Magento/Multishipping/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Multishipping/Helper/DataTest.php index 614dff6eaa56f4dd70a5072294b7888472ffaade..63f04b4554313d9b749805de8ada5e76c5e0b1a7 100644 --- a/dev/tests/unit/testsuite/Magento/Multishipping/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Multishipping/Helper/DataTest.php @@ -38,9 +38,9 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * Core store config mock * - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\Config + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ - protected $coreStoreConfigMock; + protected $scopeConfigMock; /** * Context mock @@ -66,7 +66,7 @@ class DataTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->contextMock = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false); - $this->coreStoreConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->checkoutSessionMock = $this->getMock('\Magento\Checkout\Model\Session', array(), array(), '', false); $this->quoteMock = $this->getMock('\Magento\Sales\Model\Quote', array(), array(), '', false); @@ -75,7 +75,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'Magento\Multishipping\Helper\Data', array( 'context' => $this->contextMock, - 'coreStoreConfig' => $this->coreStoreConfigMock, + 'scopeConfig' => $this->scopeConfigMock, 'checkoutSession' => $this->checkoutSessionMock ) ); @@ -84,10 +84,10 @@ class DataTest extends \PHPUnit_Framework_TestCase public function testGetMaximumQty() { $maximumQty = 10; - $this->coreStoreConfigMock->expects( + $this->scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( \Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY )->will( @@ -120,10 +120,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $maximumQty, $hasNominalItems ) { - $this->coreStoreConfigMock->expects( + $this->scopeConfigMock->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( \Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_AVAILABLE )->will( @@ -168,10 +168,10 @@ class DataTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($itemVirtualQty) ); - $this->coreStoreConfigMock->expects( + $this->scopeConfigMock->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->with( \Magento\Multishipping\Helper\Data::XML_PATH_CHECKOUT_MULTIPLE_MAXIMUM_QUANTITY )->will( diff --git a/dev/tests/unit/testsuite/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecureTest.php b/dev/tests/unit/testsuite/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecureTest.php index 016ed8e0b91bef3ddd282a8d0e0734070c7dc09e..21a7741f3b9251d357d770fc2a6c133184e0d4d8 100644 --- a/dev/tests/unit/testsuite/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecureTest.php +++ b/dev/tests/unit/testsuite/Magento/Multishipping/Model/Payment/Method/Specification/Is3DSecureTest.php @@ -45,14 +45,14 @@ class Is3DSecureTest extends \PHPUnit_Framework_TestCase /** * Store config mock * - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\Config + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ - protected $storeConfigMock; + protected $scopeConfigMock; public function setUp() { $this->paymentConfigMock = $this->getMock('\Magento\Payment\Model\Config', array(), array(), '', false); - $this->storeConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); } @@ -76,17 +76,17 @@ class Is3DSecureTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($methodsInfo) ); - $this->storeConfigMock->expects( + $this->scopeConfigMock->expects( $this->any() )->method( - 'getConfigFlag' + 'isSetFlag' )->will( $this->returnValue($is3DSecureEnabled) ); $configSpecification = $this->objectManager->getObject( 'Magento\Multishipping\Model\Payment\Method\Specification\Is3DSecure', - array('paymentConfig' => $this->paymentConfigMock, 'storeConfig' => $this->storeConfigMock) + array('paymentConfig' => $this->paymentConfigMock, 'scopeConfig' => $this->scopeConfigMock) ); $this->assertEquals( diff --git a/dev/tests/unit/testsuite/Magento/Mview/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Mview/Config/ReaderTest.php index da45c88f950100e37b82f74ad233a81a101128c8..7ec6ec7bb7b5f02c2c9c9abfb96f7e7fabce9d9b 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/Config/ReaderTest.php @@ -36,14 +36,14 @@ class ReaderTest extends \PHPUnit_Framework_TestCase protected $_converter; /** - * @var \Magento\Core\Model\Config\FileResolver|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\FileResolver|\PHPUnit_Framework_MockObject_MockObject */ protected $_fileResolverMock; protected function setUp() { $this->_fileResolverMock = $this->getMock( - 'Magento\Core\Model\Config\FileResolver', + 'Magento\App\Config\FileResolver', array('get'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php index dfedf552b4c4873af217202b33f5b9ed7a22b23d..074ab9a5f5884e383e3c4d2969c8201ed71fe6b8 100644 --- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php +++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/Queue/TransportBuilderTest.php @@ -110,19 +110,18 @@ class TransportBuilderTest extends \Magento\Mail\Template\TransportBuilderTest $transport = $this->getMock('\Magento\Mail\TransportInterface'); - $this->objectManagerMock->expects( + $this->_mailTransportFactoryMock->expects( $this->at(0) )->method( - 'create' - )->with( - $this->equalTo('Magento\Mail\TransportInterface'), - $this->equalTo(array('message' => $this->messageMock)) - )->will( - $this->returnValue($transport) - ); + 'create' + )->with( + $this->equalTo(array('message' => $this->messageMock)) + )->will( + $this->returnValue($transport) + ); $this->objectManagerMock->expects( - $this->at(1) + $this->at(0) )->method( 'create' )->with( diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php index b42c9b1c61ba7747382355ce9dbbf5056882cd9a..cc0b7cecb321839886e262abc7e35926e1a9d475 100644 --- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php @@ -35,13 +35,13 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $context = $this->getMock('Magento\Model\Context', array(), array(), '', false); $registry = $this->getMock('Magento\Registry', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false); $storeManager->expects($this->once())->method('hasSingleStore')->will($this->returnValue($isSingleStore)); $request = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false); if ($isSingleStore) { - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $store->expects($this->once())->method('getId')->will($this->returnValue('test_id')); $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store)); @@ -71,7 +71,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->returnValue('processed text') ); - $storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $templateFactory = $this->getMock('Magento\Newsletter\Model\TemplateFactory'); $data = array('template_text' => 'template text'); @@ -89,7 +89,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $storeManager, $request, $filter, - $storeConfig, + $scopeConfig, $templateFactory, $filterManager, $data diff --git a/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/BanktransferTest.php b/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/BanktransferTest.php index 3d911c07595084af110a813aaaef1a5912e4608b..7ff9f1a1a486aabb0eebb90ab66c6b72ff0487dc 100644 --- a/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/BanktransferTest.php +++ b/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/BanktransferTest.php @@ -38,14 +38,14 @@ class BanktransferTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $adapterFactoryMock = $this->getMock('Magento\Logger\AdapterFactory', array('create'), array(), '', false); $this->_object = $objectManagerHelper->getObject( 'Magento\OfflinePayments\Model\Banktransfer', array( 'eventManager' => $eventManager, 'paymentData' => $paymentDataMock, - 'coreStoreConfig' => $coreStoreConfig, + 'scopeConfig' => $scopeConfig, 'logAdapterFactory' => $adapterFactoryMock ) ); diff --git a/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/CashondeliveryTest.php b/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/CashondeliveryTest.php index f63d5716b50a41a46be25e7bea4628bd06d7d369..7b7b10f210a441ba39375315d3ca6f71fd786f28 100644 --- a/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/CashondeliveryTest.php +++ b/dev/tests/unit/testsuite/Magento/OfflinePayments/Model/CashondeliveryTest.php @@ -41,13 +41,13 @@ class CashondeliveryTest extends \PHPUnit_Framework_TestCase $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $adapterFactoryMock = $this->getMock('Magento\Logger\AdapterFactory', array('create'), array(), '', false); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_object = $helper->getObject( 'Magento\OfflinePayments\Model\Cashondelivery', array( 'eventManager' => $eventManager, 'paymentData' => $paymentDataMock, - 'coreStoreConfig' => $coreStoreConfig, + 'scopeConfig' => $scopeConfig, 'logAdapterFactory' => $adapterFactoryMock ) ); diff --git a/dev/tests/unit/testsuite/Magento/OfflineShipping/Block/Adminhtml/Form/Field/ExportTest.php b/dev/tests/unit/testsuite/Magento/OfflineShipping/Block/Adminhtml/Form/Field/ExportTest.php index 54e3fc463a2daec75849d72287150d9c6962bb82..86e695328a2d3a04ca2ac46c603892b7b48c52d7 100644 --- a/dev/tests/unit/testsuite/Magento/OfflineShipping/Block/Adminhtml/Form/Field/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/OfflineShipping/Block/Adminhtml/Form/Field/ExportTest.php @@ -56,7 +56,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase false, false ); - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $blockMock = $this->getMock('Magento\Backend\Block\Widget\Button', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php b/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php index a709ccf1717455dc8453218d2cf7fa62b025b88b..69c7e0d47d039f8b54f3205cacc5a64ffa125591 100644 --- a/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php +++ b/dev/tests/unit/testsuite/Magento/Ogone/Model/ApiTest.php @@ -41,19 +41,19 @@ class ApiTest extends \PHPUnit_Framework_TestCase $sourceString = 'Ë£'; // Test protected method via reflection - $storeManager = $this->getMock('Magento\Core\Model\StoreManagerInterface', array(), array(), '', false); + $storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface', array(), array(), '', false); $localeResolver = $this->getMock('\Magento\Locale\ResolverInterface', array(), array(), '', false); $urlBuilder = $this->getMock('Magento\UrlInterface', array(), array(), '', false); $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $string = $this->getMock('\Magento\Stdlib\String', array(), array(), '', false); $config = $this->getMock('Magento\Ogone\Model\Config', array(), array(), '', false); $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $loggerFactory = $this->getMock('\Magento\Logger\AdapterFactory', array(), array(), '', false); $object = new \Magento\Ogone\Model\Api( $eventManager, $paymentDataMock, - $coreStoreConfig, + $scopeConfig, $loggerFactory, $storeManager, $localeResolver, diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Block/System/Config/Form/Field/ExportTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Block/System/Config/Form/Field/ExportTest.php index d62f3fe2c03382df70a42a2bdea1e61317400f9c..1a2d50db334c5a49ed3a29d14265f076ec1400e3 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Block/System/Config/Form/Field/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Block/System/Config/Form/Field/ExportTest.php @@ -56,7 +56,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase ); $form = $this->getMock('Magento\Data\Form', array('getLayout'), array(), '', false, false); - $layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false, false); + $layoutMock = $this->getMock('Magento\View\Layout', array(), array(), '', false, false); $buttonMock = $this->getMock('Magento\Backend\Block\Widget\Button', array(), array(), '', false, false); $urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array('getUrl'), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Controller/BlockTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Controller/BlockTest.php index d86c2dcfdc9a0eeda205db7bdf274e268ae1f2b7..fdeab24b2530e704a10836605c3b9b2999d218a5 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Controller/BlockTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Controller/BlockTest.php @@ -58,7 +58,7 @@ class BlockTest extends \PHPUnit_Framework_TestCase protected $controller; /** - * @var \Magento\Core\Model\Layout|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Layout|\PHPUnit_Framework_MockObject_MockObject */ protected $layoutMock; @@ -68,7 +68,7 @@ class BlockTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->layoutMock = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->getMock(); $contextMock = $this->getMockBuilder('Magento\App\Action\Context')->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Model/ConfigTest.php index a3c7d6b358b5e2e323aac44fbbeed0dd8e4b9bad..e5679feee8722fdc815e47e05bc947ab9aaf891b 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Model/ConfigTest.php @@ -33,15 +33,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Store\Config + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Config\ScopeConfigInterface */ protected $_coreConfigMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\ConfigInterface - */ - protected $_configMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Cache\StateInterface */ @@ -52,41 +47,65 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $filesystemMock = $this->getMock('Magento\App\Filesystem', ['getDirectoryRead'], [], '', false); - $this->_coreConfigMock = $this->getMock('Magento\Core\Model\Store\Config', ['getConfig'], [], '', false); - $this->_configMock = $this->getMock('Magento\App\ConfigInterface', [], [], '', false); - $this->_cacheState = $this->getMock('\Magento\App\Cache\State', ['isEnabled'], [], '', false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->_coreConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $this->_cacheState = $this->getMock('\Magento\App\Cache\State', array('isEnabled'), array(), '', false); - $modulesDirectoryMock = $this->getMock('Magento\Filesystem\Directory\Write', [], [], '', false); - $filesystemMock->expects($this->once()) - ->method('getDirectoryRead') - ->with(\Magento\App\Filesystem::MODULES_DIR) - ->will($this->returnValue($modulesDirectoryMock)); - $modulesDirectoryMock->expects($this->any()) - ->method('readFile') - ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/test.vcl'))); - $this->_coreConfigMock->expects($this->any()) - ->method('getConfig') - ->will($this->returnValueMap([ - [\Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_BACKEND_HOST, null, 'example.com'], - [\Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_BACKEND_PORT, null, '8080'], - [\Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_ACCESS_LIST, null, '127.0.0.1, 192.168.0.1'], - [ - \Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX, - null, - serialize([ - [ - 'regexp' => '(?i)pattern', - 'value' => 'value_for_pattern' - ] - ]) - ] - ])); + $modulesDirectoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); + $filesystemMock->expects( + $this->once() + )->method( + 'getDirectoryRead' + )->with( + \Magento\App\Filesystem::MODULES_DIR + )->will( + $this->returnValue($modulesDirectoryMock) + ); + $modulesDirectoryMock->expects( + $this->any() + )->method( + 'readFile' + )->will( + $this->returnValue(file_get_contents(__DIR__ . '/_files/test.vcl')) + ); + $this->_coreConfigMock->expects( + $this->any() + )->method( + 'getValue' + )->will( + $this->returnValueMap( + array( + array( + \Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_BACKEND_HOST, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + 'example.com' + ), + array( + \Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_BACKEND_PORT, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + '8080' + ), + array( + \Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_ACCESS_LIST, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + '127.0.0.1, 192.168.0.1' + ), + array( + \Magento\PageCache\Model\Config::XML_VARNISH_PAGECACHE_DESIGN_THEME_REGEX, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + serialize(array(array('regexp' => '(?i)pattern', 'value' => 'value_for_pattern'))) + ) + ) + ) + ); $this->_model = new \Magento\PageCache\Model\Config( $filesystemMock, $this->_coreConfigMock, - $this->_configMock, $this->_cacheState ); } @@ -102,10 +121,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetTll() { - $this->_configMock->expects($this->once()) - ->method('getValue') - ->with(Config::XML_PAGECACHE_TTL); - + $this->_coreConfigMock->expects($this->once())->method('getValue')->with(Config::XML_PAGECACHE_TTL); $this->_model->getTtl(); } @@ -116,10 +132,15 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->_cacheState->setEnabled(\Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER, true); - $this->_cacheState->expects($this->once()) - ->method('isEnabled') - ->with(\Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER) - ->will($this->returnValue(true)); + $this->_cacheState->expects( + $this->once() + )->method( + 'isEnabled' + )->with( + \Magento\PageCache\Model\Cache\Type::TYPE_IDENTIFIER + )->will( + $this->returnValue(true) + ); $this->_model->isEnabled(); } } diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Model/Layout/LayoutPluginTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Model/Layout/LayoutPluginTest.php index fd332ddcc838eb009c3f6bf3c5f24fa74d2e90eb..c21243d88396c622ec548068f4315d7bcd8a0593 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Model/Layout/LayoutPluginTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Model/Layout/LayoutPluginTest.php @@ -36,28 +36,28 @@ class LayoutPluginTest extends \PHPUnit_Framework_TestCase protected $responseMock; /** - * @var \Magento\Core\Model\Layout|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\View\Layout|\PHPUnit_Framework_MockObject_MockObject */ protected $layoutMock; /** - * @var \Magento\PageCache\Model\Config|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface */ protected $configMock; public function setUp() { $this->layoutMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array(), '', false, true, true, - ['isCacheable', 'getAllBlocks'] + array('isCacheable', 'getAllBlocks') ); - $this->responseMock = $this->getMock('\Magento\App\Response\Http', [], [], '', false); - $this->configMock = $this->getMock('Magento\PageCache\Model\Config', [], [], '', false); + $this->responseMock = $this->getMock('\Magento\App\Response\Http', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\PageCache\Model\Config', array(), array(), '', false); $this->model = new \Magento\PageCache\Model\Layout\LayoutPlugin( $this->layoutMock, @@ -76,20 +76,12 @@ class LayoutPluginTest extends \PHPUnit_Framework_TestCase $maxAge = 180; $result = 'test'; - $this->layoutMock->expects($this->once()) - ->method('isCacheable') - ->will($this->returnValue($layoutIsCacheable)); - $this->configMock->expects($this->any()) - ->method('isEnabled') - ->will($this->returnValue($cacheState)); + $this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue($layoutIsCacheable)); + $this->configMock->expects($this->any())->method('isEnabled')->will($this->returnValue($cacheState)); if ($layoutIsCacheable && $cacheState) { - $this->configMock->expects($this->once()) - ->method('getTtl') - ->will($this->returnValue($maxAge)); - $this->responseMock->expects($this->once()) - ->method('setPublicHeaders') - ->with($maxAge); + $this->configMock->expects($this->once())->method('getTtl')->will($this->returnValue($maxAge)); + $this->responseMock->expects($this->once())->method('setPublicHeaders')->with($maxAge); } else { $this->responseMock->expects($this->never())->method('setPublicHeaders'); } @@ -99,12 +91,12 @@ class LayoutPluginTest extends \PHPUnit_Framework_TestCase public function afterGenerateXmlDataProvider() { - return [ - 'Full_cache state is true, Layout is cache-able' => [true, true], - 'Full_cache state is true, Layout is not cache-able' => [true, false], - 'Full_cache state is false, Layout is not cache-able' => [false, false], - 'Full_cache state is false, Layout is cache-able' => [false, true] - ]; + return array( + 'Full_cache state is true, Layout is cache-able' => array(true, true), + 'Full_cache state is true, Layout is not cache-able' => array(true, false), + 'Full_cache state is false, Layout is not cache-able' => array(false, false), + 'Full_cache state is false, Layout is cache-able' => array(false, true) + ); } /** @@ -118,26 +110,16 @@ class LayoutPluginTest extends \PHPUnit_Framework_TestCase public function testAfterGetOutput($cacheState, $layoutIsCacheable, $expectedTags, $configCacheType, $ttl) { $html = 'html'; - $this->configMock->expects($this->any()) - ->method('isEnabled') - ->will($this->returnValue($cacheState)); + $this->configMock->expects($this->any())->method('isEnabled')->will($this->returnValue($cacheState)); $blockStub = $this->getMock('Magento\PageCache\Block\Controller\StubBlock', null, array(), '', false); $blockStub->setTtl($ttl); - $this->layoutMock->expects($this->once()) - ->method('isCacheable') - ->will($this->returnValue($layoutIsCacheable)); - $this->layoutMock->expects($this->any()) - ->method('getAllBlocks') - ->will($this->returnValue(array($blockStub))); + $this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue($layoutIsCacheable)); + $this->layoutMock->expects($this->any())->method('getAllBlocks')->will($this->returnValue(array($blockStub))); - $this->configMock->expects($this->any()) - ->method('getType') - ->will($this->returnValue($configCacheType)); + $this->configMock->expects($this->any())->method('getType')->will($this->returnValue($configCacheType)); if ($layoutIsCacheable && $cacheState) { - $this->responseMock->expects($this->once()) - ->method('setHeader') - ->with('X-Magento-Tags', $expectedTags); + $this->responseMock->expects($this->once())->method('setHeader')->with('X-Magento-Tags', $expectedTags); } else { $this->responseMock->expects($this->never())->method('setHeader'); } @@ -148,19 +130,39 @@ class LayoutPluginTest extends \PHPUnit_Framework_TestCase public function afterGetOutputDataProvider() { $tags = 'identity1,identity2'; - return [ - 'Cacheable layout, Full_cache state is true' => [true, true, $tags, null, 0], - 'Non-cacheable layout' => [true, false, null, null, 0], - 'Cacheable layout with Varnish' => [true, true, $tags, \Magento\PageCache\Model\Config::VARNISH, 0], - 'Cacheable layout with Varnish, Full_cache state is false' => - [false, true, $tags, \Magento\PageCache\Model\Config::VARNISH, 0], - 'Cacheable layout with Varnish and esi' => - [true, true, null, \Magento\PageCache\Model\Config::VARNISH, 100], - 'Cacheable layout with Builtin' => [true, true, $tags, \Magento\PageCache\Model\Config::BUILT_IN, 0], - 'Cacheable layout with Builtin, Full_cache state is false' => - [false, true, $tags, \Magento\PageCache\Model\Config::BUILT_IN, 0], - 'Cacheable layout with Builtin and esi' => - [true, false, $tags, \Magento\PageCache\Model\Config::BUILT_IN, 100] - ]; + return array( + 'Cacheable layout, Full_cache state is true' => array(true, true, $tags, null, 0), + 'Non-cacheable layout' => array(true, false, null, null, 0), + 'Cacheable layout with Varnish' => array(true, true, $tags, \Magento\PageCache\Model\Config::VARNISH, 0), + 'Cacheable layout with Varnish, Full_cache state is false' => array( + false, + true, + $tags, + \Magento\PageCache\Model\Config::VARNISH, + 0 + ), + 'Cacheable layout with Varnish and esi' => array( + true, + true, + null, + \Magento\PageCache\Model\Config::VARNISH, + 100 + ), + 'Cacheable layout with Builtin' => array(true, true, $tags, \Magento\PageCache\Model\Config::BUILT_IN, 0), + 'Cacheable layout with Builtin, Full_cache state is false' => array( + false, + true, + $tags, + \Magento\PageCache\Model\Config::BUILT_IN, + 0 + ), + 'Cacheable layout with Builtin and esi' => array( + true, + false, + $tags, + \Magento\PageCache\Model\Config::BUILT_IN, + 100 + ) + ); } } diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php index 052ab4ca8f42dbf1753fe30fb026574dd8abc13f..a1c96c021b03dbb7001049ce1b59c8965ffed9c3 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php @@ -39,7 +39,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\View\Element\AbstractBlock */ protected $_blockMock; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout */ + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\View\Layout */ protected $_layoutMock; /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Event\Observer */ @@ -60,7 +60,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\PageCache\FormKey */ protected $_formKey; - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Session */ + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Session\Generic */ protected $_session; /** @@ -68,12 +68,18 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->_configMock = $this->getMock('Magento\PageCache\Model\Config', ['getType', 'isEnabled'], [], '', false); - $this->_cacheMock = $this->getMock('Magento\App\PageCache\Cache', ['clean'], [], '', false); - $this->_helperMock = $this->getMock('Magento\PageCache\Helper\Data', [], [], '', false); - $this->_typeListMock = $this->getMock('Magento\App\Cache\TypeList', [], [], '', false); - $this->_formKey = $this->getMock('Magento\App\PageCache\FormKey', [], [], '', false); - $this->_session = $this->getMock('Magento\Core\Model\Session', ['setData'], [], '', false); + $this->_configMock = $this->getMock( + 'Magento\PageCache\Model\Config', + array('getType', 'isEnabled'), + array(), + '', + false + ); + $this->_cacheMock = $this->getMock('Magento\App\PageCache\Cache', array('clean'), array(), '', false); + $this->_helperMock = $this->getMock('Magento\PageCache\Helper\Data', array(), array(), '', false); + $this->_typeListMock = $this->getMock('Magento\App\Cache\TypeList', array(), array(), '', false); + $this->_formKey = $this->getMock('Magento\App\PageCache\FormKey', array(), array(), '', false); + $this->_session = $this->getMock('Magento\Session\Generic', array('setData'), array(), '', false); $this->_model = new \Magento\PageCache\Model\Observer( $this->_configMock, @@ -85,7 +91,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ); $this->_observerMock = $this->getMock('Magento\Event\Observer', array('getEvent'), array(), '', false); $this->_layoutMock = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('isCacheable', 'getBlock', 'getUpdate', 'getHandles'), array(), '', @@ -100,11 +106,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase true, array('getTtl', 'isScopePrivate', 'getNameInLayout', 'getUrl') ); - $this->_transport = new \Magento\Object([ - 'output' => 'test output html' - ]); - - $this->_observerObject = $this->getMock('\Magento\Core\Model\Store', [], [], '', false); + $this->_transport = new \Magento\Object(array('output' => 'test output html')); + $this->_observerObject = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); } /** @@ -122,55 +125,59 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $blockTtl, $expectedOutput ) { - $eventMock = $this->getMock('Magento\Event', ['getLayout', 'getElementName', 'getTransport'], [], '', false); - $this->_observerMock->expects($this->once()) - ->method('getEvent') - ->will($this->returnValue($eventMock)); - $eventMock->expects($this->once()) - ->method('getLayout') - ->will($this->returnValue($this->_layoutMock)); - $this->_configMock->expects($this->any()) - ->method('isEnabled') - ->will($this->returnValue($cacheState)); + $eventMock = $this->getMock( + 'Magento\Event', + array('getLayout', 'getElementName', 'getTransport'), + array(), + '', + false + ); + $this->_observerMock->expects($this->once())->method('getEvent')->will($this->returnValue($eventMock)); + $eventMock->expects($this->once())->method('getLayout')->will($this->returnValue($this->_layoutMock)); + $this->_configMock->expects($this->any())->method('isEnabled')->will($this->returnValue($cacheState)); if ($cacheState) { - $eventMock->expects($this->once()) - ->method('getElementName') - ->will($this->returnValue('blockName')); - $eventMock->expects($this->once()) - ->method('getTransport') - ->will($this->returnValue($this->_transport)); - $this->_layoutMock->expects($this->once()) - ->method('isCacheable') - ->will($this->returnValue(true)); - - $this->_layoutMock->expects($this->any()) - ->method('getUpdate') - ->will($this->returnSelf()); - $this->_layoutMock->expects($this->any()) - ->method('getHandles') - ->will($this->returnValue([])); - $this->_layoutMock->expects($this->once()) - ->method('getBlock') - ->will($this->returnValue($this->_blockMock)); + $eventMock->expects($this->once())->method('getElementName')->will($this->returnValue('blockName')); + $eventMock->expects($this->once())->method('getTransport')->will($this->returnValue($this->_transport)); + $this->_layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true)); + + $this->_layoutMock->expects($this->any())->method('getUpdate')->will($this->returnSelf()); + $this->_layoutMock->expects($this->any())->method('getHandles')->will($this->returnValue(array())); + $this->_layoutMock->expects( + $this->once() + )->method( + 'getBlock' + )->will( + $this->returnValue($this->_blockMock) + ); if ($varnishIsEnabled) { $this->_blockMock->setTtl($blockTtl); - $this->_blockMock->expects($this->any()) - ->method('getUrl') - ->will($this->returnValue('page_cache/block/wrapesi/with/handles/and/other/stuff')); + $this->_blockMock->expects( + $this->any() + )->method( + 'getUrl' + )->will( + $this->returnValue('page_cache/block/wrapesi/with/handles/and/other/stuff') + ); } if ($scopeIsPrivate) { - $this->_blockMock->expects($this->once()) - ->method('getNameInLayout') - ->will($this->returnValue('testBlockName')); - $this->_blockMock->expects($this->once()) - ->method('isScopePrivate') - ->will($this->returnValue($scopeIsPrivate)); + $this->_blockMock->expects( + $this->once() + )->method( + 'getNameInLayout' + )->will( + $this->returnValue('testBlockName') + ); + $this->_blockMock->expects( + $this->once() + )->method( + 'isScopePrivate' + )->will( + $this->returnValue($scopeIsPrivate) + ); } - $this->_configMock->expects($this->any()) - ->method('getType') - ->will($this->returnValue($varnishIsEnabled)); + $this->_configMock->expects($this->any())->method('getType')->will($this->returnValue($varnishIsEnabled)); } $this->_model->processLayoutRenderElement($this->_observerMock); @@ -184,19 +191,44 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function processLayoutRenderDataProvider() { - return [ - 'full_page type and Varnish enabled, public scope, ttl is set' => - [true, true, false, 360, '<esi:include src="page_cache/block/wrapesi/with/handles/and/other/stuff" />'], - 'full_page type and Varnish enabled, public scope, ttl is not set' => - [true, true, false, null, 'test output html'], - 'full_page type enabled, Varnish disabled, public scope, ttl is set' => - [true, false, false, 360, 'test output html'], - 'full_page type enabled, Varnish disabled, public scope, ttl is not set' => - [true, false, false, null, 'test output html'], - 'full_page type enabled, Varnish disabled, private scope, ttl is not set' => - [true, false, true, null, '<!-- BLOCK testBlockName -->test output html<!-- /BLOCK testBlockName -->'], - 'full_page type is disabled, Varnish enabled' => [false, true, false, null, 'test output html'] - ]; + return array( + 'full_page type and Varnish enabled, public scope, ttl is set' => array( + true, + true, + false, + 360, + '<esi:include src="page_cache/block/wrapesi/with/handles/and/other/stuff" />' + ), + 'full_page type and Varnish enabled, public scope, ttl is not set' => array( + true, + true, + false, + null, + 'test output html' + ), + 'full_page type enabled, Varnish disabled, public scope, ttl is set' => array( + true, + false, + false, + 360, + 'test output html' + ), + 'full_page type enabled, Varnish disabled, public scope, ttl is not set' => array( + true, + false, + false, + null, + 'test output html' + ), + 'full_page type enabled, Varnish disabled, private scope, ttl is not set' => array( + true, + false, + true, + null, + '<!-- BLOCK testBlockName -->test output html<!-- /BLOCK testBlockName -->' + ), + 'full_page type is disabled, Varnish enabled' => array(false, true, false, null, 'test output html') + ); } /** @@ -207,31 +239,25 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testFlushCacheByTags($cacheState) { - $this->_configMock->expects($this->any()) - ->method('isEnabled') - ->will($this->returnValue($cacheState)); + $this->_configMock->expects($this->any())->method('isEnabled')->will($this->returnValue($cacheState)); if ($cacheState) { $tags = array('cache_1', 'cache_group'); $expectedTags = array('cache_1', 'cache_group', 'cache'); - $eventMock = $this->getMock('Magento\Event', ['getObject'], [], '', false); - $eventMock->expects($this->once()) - ->method('getObject') - ->will($this->returnValue($this->_observerObject)); - $this->_observerMock->expects($this->once()) - ->method('getEvent') - ->will($this->returnValue($eventMock)); - $this->_configMock->expects($this->once()) - ->method('getType') - ->will($this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN)); - $this->_observerObject->expects($this->once()) - ->method('getIdentities') - ->will($this->returnValue($tags)); - - $this->_cacheMock->expects($this->once()) - ->method('clean') - ->with($this->equalTo($expectedTags)); + $eventMock = $this->getMock('Magento\Event', array('getObject'), array(), '', false); + $eventMock->expects($this->once())->method('getObject')->will($this->returnValue($this->_observerObject)); + $this->_observerMock->expects($this->once())->method('getEvent')->will($this->returnValue($eventMock)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN) + ); + $this->_observerObject->expects($this->once())->method('getIdentities')->will($this->returnValue($tags)); + + $this->_cacheMock->expects($this->once())->method('clean')->with($this->equalTo($expectedTags)); } $this->_model->flushCacheByTags($this->_observerMock); @@ -239,10 +265,10 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function flushCacheByTagsDataProvider() { - return [ - 'full_page cache type is enabled' => [true], - 'full_page cache type is disabled' => [false] - ]; + return array( + 'full_page cache type is enabled' => array(true), + 'full_page cache type is disabled' => array(false) + ); } /** @@ -250,9 +276,13 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testFlushAllCache() { - $this->_configMock->expects($this->once()) - ->method('getType') - ->will($this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN)); + $this->_configMock->expects( + $this->once() + )->method( + 'getType' + )->will( + $this->returnValue(\Magento\PageCache\Model\Config::BUILT_IN) + ); $this->_cacheMock->expects($this->once())->method('clean'); $this->_model->flushAllCache($this->_observerMock); @@ -264,24 +294,17 @@ class ObserverTest extends \PHPUnit_Framework_TestCase */ public function testInvalidateCache($cacheState) { - $this->_configMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue($cacheState)); + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue($cacheState)); if ($cacheState) { - $this->_typeListMock->expects($this->once()) - ->method('invalidate') - ->with($this->equalTo('full_page')); + $this->_typeListMock->expects($this->once())->method('invalidate')->with($this->equalTo('full_page')); } $this->_model->invalidateCache(); } public function invalidateCacheDataProvider() { - return [ - [true], - [false] - ]; + return array(array(true), array(false)); } public function testRegisterFormKeyFromCookie() @@ -290,15 +313,16 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $formKey = 'asdfaswqrwqe12'; //Verification - $this->_configMock->expects($this->once()) - ->method('isEnabled') - ->will($this->returnValue(true)); - $this->_formKey->expects($this->once()) - ->method('get') - ->will($this->returnValue($formKey)); - $this->_session->expects($this->once()) - ->method('setData') - ->with(\Magento\Data\Form\FormKey::FORM_KEY, $formKey); + $this->_configMock->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); + $this->_formKey->expects($this->once())->method('get')->will($this->returnValue($formKey)); + $this->_session->expects( + $this->once() + )->method( + 'setData' + )->with( + \Magento\Data\Form\FormKey::FORM_KEY, + $formKey + ); $this->_model->registerFormKeyFromCookie($this->_observerMock); } diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/Info/SubstitutionTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/SubstitutionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f15fee76c4207c65bd113b3ba7eb44d0f91c4fac --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/Info/SubstitutionTest.php @@ -0,0 +1,177 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Payment\Block\Info; + +class SubstitutionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $layout; + + /** + * @var \Magento\Payment\Block\Info\Substitution + */ + protected $block; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->layout = $this->getMockBuilder( + 'Magento\View\LayoutInterface' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + + $eventManager = $this->getMockBuilder( + 'Magento\Event\ManagerInterface' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + + $scopeConfig = $this->getMockBuilder( + 'Magento\App\Config\ScopeConfigInterface' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $scopeConfig->expects( + $this->any() + )->method( + 'getValue' + )->with( + $this->stringContains( + 'advanced/modules_disable_output/' + ), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )->will( + $this->returnValue( + false + ) + ); + + $context = $this->getMockBuilder( + 'Magento\View\Element\Template\Context' + )->disableOriginalConstructor()->setMethods( + ['getLayout', 'getEventManager', 'getScopeConfig'] + )->getMock(); + $context->expects( + $this->any() + )->method( + 'getLayout' + )->will( + $this->returnValue( + $this->layout + ) + ); + $context->expects( + $this->any() + )->method( + 'getEventManager' + )->will( + $this->returnValue( + $eventManager + ) + ); + $context->expects( + $this->any() + )->method( + 'getScopeConfig' + )->will( + $this->returnValue( + $scopeConfig + ) + ); + + $this->block = $this->objectManager->getObject( + 'Magento\Payment\Block\Info\Substitution', + [ + 'context' => $context, + 'data' => [ + 'template' => null + ] + ] + ); + } + + public function testBeforeToHtml() + { + $abstractBlock = $this->getMockBuilder( + 'Magento\View\Element\AbstractBlock' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $childAbstractBlock = clone($abstractBlock); + + $abstractBlock->expects($this->any())->method('getParentBlock')->will($this->returnValue($childAbstractBlock)); + + $this->layout->expects($this->any())->method('getParentName')->will($this->returnValue('parentName')); + $this->layout->expects($this->any())->method('getBlock')->will($this->returnValue($abstractBlock)); + + $infoMock = $this->getMockBuilder( + 'Magento\Payment\Model\Info' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $methodMock = $this->getMockBuilder( + 'Magento\Payment\Model\MethodInterface' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + $infoMock->expects($this->once())->method('getMethodInstance')->will($this->returnValue($methodMock)); + $this->block->setInfo($infoMock); + + $fakeBlock = new \StdClass; + $this->layout->expects( + $this->any() + )->method( + 'createBlock' + )->with( + 'Magento\View\Element\Template', + '', + ['data' => ['method' => $methodMock, 'template' => 'Magento_Payment::info/substitution.phtml']] + )->will( + $this->returnValue( + $fakeBlock + ) + ); + + $childAbstractBlock->expects( + $this->any() + )->method( + 'setChild' + )->with( + 'order_payment_additional', + $fakeBlock + ); + + $this->block->toHtml(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php index 55a7907c16a9d40884c63f63e48f016eb348536c..c92df79e387dd3e78c8f81b995a4696ab1fed15a 100644 --- a/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php +++ b/dev/tests/unit/testsuite/Magento/Payment/Block/InfoTest.php @@ -42,7 +42,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_storeManager = $this->getMockBuilder( - '\Magento\Core\Model\StoreManager' + '\Magento\Store\Model\StoreManager' )->setMethods( array('getStore') )->disableOriginalConstructor()->getMock(); @@ -114,7 +114,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase */ protected function _getStoreMock($storeCode) { - $storeMock = $this->getMockBuilder('\Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $storeMock = $this->getMockBuilder('\Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeMock->expects($this->any())->method('getCode')->will($this->returnValue($storeCode)); return $storeMock; } diff --git a/dev/tests/unit/testsuite/Magento/Payment/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Payment/Helper/DataTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bbf4b7191c3dec2afab9bc53c7d9d902daa26a5c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Helper/DataTest.php @@ -0,0 +1,98 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Payment\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Payment\Helper\Data */ + protected $_helper; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_scopeConfig; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_methodFactory; + + protected function setUp() + { + $context = $this->getMock('Magento\App\Helper\Context', [], [], '', false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface', [], [], '', false); + $layout = $this->getMock('Magento\View\LayoutInterface', [], [], '', false); + $this->_methodFactory = $this->getMock('Magento\Payment\Model\Method\Factory', [], [], '', false); + $appEmulation = $this->getMock('Magento\Core\Model\App\Emulation', [], [], '', false); + $paymentConfig = $this->getMock('Magento\Payment\Model\Config', [], [], '', false); + $initialConfig = $this->getMock('Magento\App\Config\Initial', [], [], '', false); + + $this->_helper = new \Magento\Payment\Helper\Data( + $context, + $this->_scopeConfig, + $layout, + $this->_methodFactory, + $appEmulation, + $paymentConfig, + $initialConfig + ); + } + + /** + * @param string $code + * @param string $class + * @param string $methodInstance + * @dataProvider getMethodInstanceDataProvider + */ + public function testGetMethodInstance($code, $class, $methodInstance) + { + $this->_scopeConfig->expects( + $this->once() + )->method( + 'getValue' + )->will( + $this->returnValue( + $class + ) + ); + $this->_methodFactory->expects( + $this->any() + )->method( + 'create' + )->with( + $class + )->will( + $this->returnValue( + $methodInstance + ) + ); + + $this->assertEquals($methodInstance, $this->_helper->getMethodInstance($code)); + } + + public function getMethodInstanceDataProvider() + { + return array( + ['method_code', 'method_class', 'method_instance'], + ['method_code', false, false] + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/SubstitutionTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/SubstitutionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5909fe4c757af120be59536b96a343110b2145e8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/SubstitutionTest.php @@ -0,0 +1,69 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Payment\Model\Method; + +class SubstitutionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\Payment\Model\Method\Substitution + */ + protected $model; + + public function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->model = $this->objectManager->getObject('Magento\Payment\Model\Method\Substitution'); + } + + public function testGetTitle() + { + $infoMock = $this->getMockBuilder( + 'Magento\Payment\Model\Info' + )->disableOriginalConstructor()->setMethods( + [] + )->getMock(); + + $this->model->setInfoInstance($infoMock); + $expectedResult = 'StringTitle'; + $infoMock->expects( + $this->once() + )->method( + 'getAdditionalInformation' + )->with( + \Magento\Payment\Model\Method\Substitution::INFO_KEY_TITLE + )->will( + $this->returnValue( + $expectedResult + ) + ); + + $this->assertEquals($expectedResult, $this->model->getTitle()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e8d5e987d61a5c5f6c23aff5473fe8a81a114f48 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/Express/CheckoutTest.php @@ -0,0 +1,78 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Paypal\Model\Express; + +class CheckoutTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Paypal\Model\Express\Checkout + */ + protected $_checkoutModel; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_quoteMock; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $paypalConfigMock = $this->getMock('Magento\Paypal\Model\Config', [], [], '', false); + $this->_quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->_checkoutModel = $this->_objectManager->getObject( + 'Magento\Paypal\Model\Express\Checkout', + ['params' => ['quote' => $this->_quoteMock, 'config' => $paypalConfigMock]] + ); + parent::setUp(); + } + + public function testSetCustomerData() + { + /** @var \Magento\Customer\Service\V1\Data\Customer $customerDataMock */ + $customerDataMock = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $this->_quoteMock->expects($this->once())->method('assignCustomer')->with($customerDataMock); + $customerDataMock->expects($this->once())->method('getId'); + $this->_checkoutModel->setCustomerData($customerDataMock); + } + + public function testSetCustomerWithAddressChange() + { + /** @var \Magento\Customer\Service\V1\Data\Customer $customerDataMock */ + $customerDataMock = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + /** @var \Magento\Sales\Model\Quote\Address $customerDataMock */ + $quoteAddressMock = $this->getMock('Magento\Sales\Model\Quote\Address', [], [], '', false); + $this->_quoteMock + ->expects($this->once()) + ->method('assignCustomerWithAddressChange') + ->with($customerDataMock, $quoteAddressMock, $quoteAddressMock); + $customerDataMock->expects($this->once())->method('getId'); + $this->_checkoutModel->setCustomerWithAddressChange($customerDataMock, $quoteAddressMock, $quoteAddressMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php index c0f2a215abf5605160556721a708ec1989716fa8..6a1ebbce5e164c8ad20cc2a1248893afe8473849 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php @@ -88,7 +88,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testAddPaypalShortcuts() { $layoutMock = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->setMethods( array('createBlock') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php index 1a4c3a6773ca29e5b1ffdde1b3cd5d5da18ac9bd..daa7744a566f407705f281edfbebc9326edd7235 100644 --- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php +++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/PriceTest.php @@ -32,27 +32,27 @@ namespace Magento\ProductAlert\Block\Product\View; class PriceTest extends \PHPUnit_Framework_TestCase { /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data */ protected $_helper; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product */ protected $_product; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Registry + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Registry */ protected $_registry; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Price + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Price */ protected $_block; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\View\Layout */ protected $_layout; @@ -83,7 +83,7 @@ class PriceTest extends \PHPUnit_Framework_TestCase 'Magento\ProductAlert\Block\Product\View\Price', array('helper' => $this->_helper, 'registry' => $this->_registry) ); - $this->_layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layout = $this->getMock('Magento\View\Layout', array(), array(), '', false); } public function testSetTemplatePriceAlertAllowed() diff --git a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php index 67a9e8cf5554425139ff731bbc109f24f24b25f0..d4db53dc97dba02680992a87cdc5b3d4e9b6cc5b 100644 --- a/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php +++ b/dev/tests/unit/testsuite/Magento/ProductAlert/Block/Product/View/StockTest.php @@ -32,27 +32,27 @@ namespace Magento\ProductAlert\Block\Product\View; class StockTest extends \PHPUnit_Framework_TestCase { /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Helper\Data */ protected $_helper; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product */ protected $_product; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Registry + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Registry */ protected $_registry; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Stock + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ProductAlert\Block\Product\View\Stock */ protected $_block; /** - * @var PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\View\Layout */ protected $_layout; @@ -83,7 +83,7 @@ class StockTest extends \PHPUnit_Framework_TestCase 'Magento\ProductAlert\Block\Product\View\Stock', array('helper' => $this->_helper, 'registry' => $this->_registry) ); - $this->_layout = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->_layout = $this->getMock('Magento\View\Layout', array(), array(), '', false); } public function testSetTemplateStockUrlAllowed() diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Adminhtml/Product/Edit/Tab/Price/RecurringTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Adminhtml/Product/Edit/Tab/Price/RecurringTest.php index cf5f7a1ca1eb61c715f1072604f8c380d8ed1796..ee0a88ab8693fb33f7c7508088cb4b1b8bc9ddba 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Adminhtml/Product/Edit/Tab/Price/RecurringTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Adminhtml/Product/Edit/Tab/Price/RecurringTest.php @@ -51,9 +51,9 @@ class RecurringTest extends \PHPUnit_Framework_TestCase protected $_eventManager; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; protected function setUp() { @@ -70,10 +70,10 @@ class RecurringTest extends \PHPUnit_Framework_TestCase $this->_registry = $this->getMock('Magento\Registry', array(), array(), '', false); $this->_eventManager = $this->getMock('Magento\Event\Manager', array(), array(), '', false); - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_context = $helper->getObject( 'Magento\Backend\Block\Template\Context', - array('eventManager' => $this->_eventManager, 'storeConfig' => $this->_storeConfig) + array('eventManager' => $this->_eventManager, 'scopeConfig' => $this->_scopeConfig) ); $this->_testModel = $helper->getObject( @@ -101,7 +101,7 @@ class RecurringTest extends \PHPUnit_Framework_TestCase array('Magento\Backend\Block\Widget\Form\Element\Dependence', array(), $blockMock) ); $paymentElement = $this->getMock('Magento\Data\Form\Element\AbstractElement', array(), array(), '', false); - $this->_storeConfig->expects($this->any())->method('getConfig')->will($this->returnValue(true)); + $this->_scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(true)); $this->_testModel->render($paymentElement); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/GridTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/GridTest.php index ac9aaa0e41635657553cdc967b6b6419dae70c23..fc4c66cbb711b1688a6f992063fe454eddacc9fd 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/GridTest.php @@ -64,7 +64,7 @@ class GridTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue($customer) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $collectionElement = $this->getMockBuilder( 'Magento\RecurringPayment\Model\Payment' )->disableOriginalConstructor()->setMethods( @@ -107,7 +107,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $payment->expects($this->once())->method('getCollection')->will($this->returnValue($collection)); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/Related/Orders/GridTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/Related/Orders/GridTest.php index 67e00c56a41cb528b738b2fad5d9e007c7a47f18..462d615bec361b14f74fe6044c6d90f0bfe22b00 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/Related/Orders/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/Related/Orders/GridTest.php @@ -46,7 +46,7 @@ class GridTest extends \PHPUnit_Framework_TestCase { $customer = $this->getMock('Magento\Customer\Model\Customer', array(), array(), '', false); $customer->expects($this->once())->method('getId')->will($this->returnValue(1)); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $args = array( 'getIncrementId', 'getCreatedAt', @@ -90,7 +90,7 @@ class GridTest extends \PHPUnit_Framework_TestCase $this->returnValue($customer) ); $payment->expects($this->once())->method('setStore')->with($store)->will($this->returnValue($payment)); - $storeManager = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + $storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store)); $locale = $this->getMock('\Magento\Stdlib\DateTime\TimezoneInterface'); $locale->expects($this->once())->method('formatDate')->will($this->returnValue('11-11-1999')); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/AddressTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/AddressTest.php index 23e62e8c6c290f57a2c013170da8b8617283cfaa..2b223cdaa7f48a007c2904b56e922ed3ffe2312e 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/AddressTest.php @@ -29,17 +29,17 @@ namespace Magento\RecurringPayment\Block\Payment\View; class AddressTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\RecurringPayment\Block\Payment\View\Address + * @var \Magento\RecurringPayment\Block\Payment\View\Address|\PHPUnit_Framework_MockObject_MockObject */ protected $_block; /** - * @var \Magento\RecurringPayment\Model\Payment + * @var \Magento\RecurringPayment\Model\Payment|\PHPUnit_Framework_MockObject_MockObject */ protected $_payment; /** - * @var \Magento\Sales\Model\Order\AddressFactory + * @var \Magento\Sales\Model\Order\AddressFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $_addressFactory; @@ -69,10 +69,10 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -103,7 +103,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase $parentBlock->expects($this->once())->method('unsetChild'); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('getParentName', 'getBlock') )->getMock(); @@ -124,7 +124,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase )->getMock(); $this->_addressFactory->expects($this->once())->method('create')->will($this->returnValue($address)); - $layout = $this->getMockBuilder('Magento\Core\Model\Layout')->disableOriginalConstructor()->getMock(); + $layout = $this->getMockBuilder('Magento\View\Layout')->disableOriginalConstructor()->getMock(); $this->_block->setLayout($layout); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/DataTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/DataTest.php index 0d7fbe955189874a3bcea888c02d28cef0aad73f..aae9f24c6a1d095cbd1a3443b39d4b31f5b92d78 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/DataTest.php @@ -64,10 +64,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -79,7 +79,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('getParentName', 'getBlock') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/FeesTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/FeesTest.php index 0d1c03e36b89b2f09d950ea061e446acf8f7e233..4cca8f578474b9f8b3f39585f181b9130fd1e85c 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/FeesTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/FeesTest.php @@ -64,10 +64,10 @@ class FeesTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -79,7 +79,7 @@ class FeesTest extends \PHPUnit_Framework_TestCase ); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('getParentName', 'getBlock') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ItemTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ItemTest.php index b6a1f201749f0d9b92f45fe2b4e3139d1a8306ef..aa497518842c4c29905647261b42895ee8134e4b 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ItemTest.php @@ -64,10 +64,10 @@ class ItemTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -79,7 +79,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase ); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('helper') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ReferenceTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ReferenceTest.php index b8383cd7dbd134014cb00ad0bf71f0299782a1bb..fe760a332d289216aa6e1337e9e5a49413e27bf6 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ReferenceTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ReferenceTest.php @@ -64,10 +64,10 @@ class ReferenceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -79,7 +79,7 @@ class ReferenceTest extends \PHPUnit_Framework_TestCase ); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('helper') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ScheduleTest.php b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ScheduleTest.php index 92a3a6ca65315ce2ffdf20a5aea6a92104b22c07..2b3a75700cf82950e334f40b5b7df69c213789b2 100644 --- a/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ScheduleTest.php +++ b/dev/tests/unit/testsuite/Magento/RecurringPayment/Block/Payment/View/ScheduleTest.php @@ -64,10 +64,10 @@ class ScheduleTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_payment) ); - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $store = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->setMethods( array('getStore') )->getMock(); @@ -79,7 +79,7 @@ class ScheduleTest extends \PHPUnit_Framework_TestCase ); $layout = $this->getMockBuilder( - 'Magento\Core\Model\Layout' + 'Magento\View\Layout' )->disableOriginalConstructor()->setMethods( array('helper') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Review/Block/Customer/RecentTest.php b/dev/tests/unit/testsuite/Magento/Review/Block/Customer/RecentTest.php index 2169aedbff2c9447311d4598365c606f561412a2..96582cb61a30833c74147caaa8707b31a81390f9 100644 --- a/dev/tests/unit/testsuite/Magento/Review/Block/Customer/RecentTest.php +++ b/dev/tests/unit/testsuite/Magento/Review/Block/Customer/RecentTest.php @@ -45,12 +45,12 @@ class RecentTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Service\V1\CustomerCurrentService|\PHPUnit_Framework_MockObject_MockObject */ protected $currentCustomer; - /** @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $storeManager; protected function setUp() { - $this->storeManager = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->storeManager = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $this->context = $this->getMock('Magento\View\Element\Template\Context', array(), array(), '', false); $this->context->expects( $this->any() @@ -73,28 +73,41 @@ class RecentTest extends \PHPUnit_Framework_TestCase '', false ); - $this->collectionFactory->expects($this->once())->method('create') - ->will($this->returnValue($this->collection)); + $this->collectionFactory->expects( + $this->once() + )->method( + 'create' + )->will( + $this->returnValue($this->collection) + ); $this->currentCustomer = $this->getMock( 'Magento\Customer\Service\V1\CustomerCurrentService', - [], - [], + array(), + array(), '', false ); $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->object = $this->objectManagerHelper->getObject('Magento\Review\Block\Customer\Recent', [ - 'context' => $this->context, - 'collectionFactory' => $this->collectionFactory, - 'currentCustomer' => $this->currentCustomer - ]); + $this->object = $this->objectManagerHelper->getObject( + 'Magento\Review\Block\Customer\Recent', + array( + 'context' => $this->context, + 'collectionFactory' => $this->collectionFactory, + 'currentCustomer' => $this->currentCustomer + ) + ); } public function testGetCollection() { - $this->storeManager->expects($this->any())->method('getStore') - ->will($this->returnValue(new \Magento\Object(['id' => 42]))); + $this->storeManager->expects( + $this->any() + )->method( + 'getStore' + )->will( + $this->returnValue(new \Magento\Object(array('id' => 42))) + ); $this->currentCustomer->expects($this->any())->method('getCustomerId')->will($this->returnValue(4242)); $this->collection->expects( diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php index 91c13e7bdf17e3e7b905a9386ab288253c80e050..c67332e5dc66aaca7282c1ab4721d768d6db0943 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractItemsTest.php @@ -28,7 +28,7 @@ class AbstractItemsTest extends \PHPUnit_Framework_TestCase public function testGetItemRenderer() { $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', 'getGroupChildNames'), array(), '', @@ -86,7 +86,7 @@ class AbstractItemsTest extends \PHPUnit_Framework_TestCase { $renderer = $this->getMock('StdClass'); $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php index 66a022c498c5cbf0a9ae1bd88f9c4a0ef7973a5b..e772d46330dda97b78e5393214129f45aa8638fc 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Items/AbstractTest.php @@ -37,7 +37,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $renderer = $this->getMock('Magento\View\Element\AbstractBlock', array(), array(), '', false); $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', 'getGroupChildNames', '__wakeup'), array(), '', @@ -85,7 +85,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $renderer = $this->getMock('StdClass'); $layout = $this->getMock( - 'Magento\Core\Model\Layout', + 'Magento\View\Layout', array('getChildName', 'getBlock', '__wakeup'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php index 1c389b0dd4db7a477335ba24dafcd3930a5f227e..8d553d434d3f5d78b9334871cfab980fedc2c13c 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Items/GridTest.php @@ -60,7 +60,7 @@ class GridTest extends \PHPUnit_Framework_TestCase )->getMock(); $storeMock = $this->getMockBuilder( - 'Magento\Core\Model\Store' + 'Magento\Store\Model\Store' )->disableOriginalConstructor()->setMethods( array('__wakeup', 'convertPrice') )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Block/Items/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Block/Items/AbstractTest.php index a28adcf77d893ad9c751bacb4223a3878522fa5b..ffb306aea4d664f2ea0515a173e087be3b7a50d4 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Block/Items/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Block/Items/AbstractTest.php @@ -56,7 +56,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->returnValue($renderer) ); - $layout = $this->getMock('Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array('getChildName', 'getBlock'), array(), '', false); $layout->expects($this->once())->method('getChildName')->will($this->returnValue('renderer.list')); @@ -92,7 +92,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function te1stGetItemRendererThrowsExceptionForNonexistentRenderer() { - $layout = $this->getMock('Magento\Core\Model\Layout', array('getChildName', 'getBlock'), array(), '', false); + $layout = $this->getMock('Magento\View\Layout', array('getChildName', 'getBlock'), array(), '', false); $layout->expects($this->once())->method('getChildName')->will($this->returnValue(null)); /** @var $block \Magento\Sales\Block\Items\AbstractItems */ diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php index ac88467775deba9576ad1fd95a223e6922a8cf74..9dc22a5adbc5ef98d84d0333cb9fe775ff541f7c 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/ReaderTest.php @@ -39,7 +39,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function setUp() { $fileResolver = $this->getMockBuilder( - 'Magento\Core\Model\Config\FileResolver' + 'Magento\App\Config\FileResolver' )->disableOriginalConstructor()->getMock(); $converter = $this->getMockBuilder( 'Magento\Sales\Model\Config\Converter' diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Convert/QuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Convert/QuoteTest.php new file mode 100644 index 0000000000000000000000000000000000000000..464426ff9a9e47808969916037880f2832bac17f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Convert/QuoteTest.php @@ -0,0 +1,97 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Sales\Model\Convert; + +use Magento\TestFramework\Helper\ObjectManager; +use Magento\Sales\Model\Quote\Address; + +/** + * Test class for \Magento\Sales\Model\Order + */ +class QuoteTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Sales\Model\Convert\Quote + */ + protected $quote; + + protected function setUp() + { + $orderPaymentMock = $this->getMock( + 'Magento\Sales\Model\Order\Payment', + array('setStoreId', 'setCustomerPaymentId', '__wakeup'), + array(), + '', + false + ); + $orderPaymentMock->expects( + $this->any() + )->method( + 'setStoreId' + )->will( + $this->returnValue( + $orderPaymentMock + ) + ); + $orderPaymentMock->expects( + $this->any() + )->method( + 'setCustomerPaymentId' + )->will( + $this->returnValue( + $orderPaymentMock + ) + ); + $orderPaymentFactoryMock = $this->getMock( + 'Magento\Sales\Model\Order\PaymentFactory', + array('create'), + array(), + '', + false + ); + $orderPaymentFactoryMock->expects($this->any())->method('create')->will($this->returnValue($orderPaymentMock)); + + $objectCopyServiceMock = $this->getMock('Magento\Object\Copy', array(), array(), '', false); + $objectManager = new ObjectManager($this); + $this->quote = $objectManager->getObject( + 'Magento\Sales\Model\Convert\Quote', + array( + 'orderPaymentFactory' => $orderPaymentFactoryMock, + 'objectCopyService' => $objectCopyServiceMock + ) + ); + } + + public function testPaymentToOrderPayment() + { + $payment = $this->getMock('Magento\Sales\Model\Quote\Payment', array(), array(), '', false); + $title = new \Magento\Object(['title' => 'some title']); + $payment->expects($this->any())->method('getMethodInstance')->will($this->returnValue($title)); + $this->assertEquals( + ['method_title' => 'some title'], + $this->quote->paymentToOrderPayment($payment)->getAdditionalInformation() + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php index 468d0213908c1385ff2d74c0a950818d849e4998..d2b77e16da6510e2decf50c97c347b663b32d994 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/VatValidatorTest.php @@ -79,7 +79,7 @@ class VatValidatorTest extends \PHPUnit_Framework_TestCase $this->returnValue('merchantVatNumber') ); - $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->quoteAddressMock = $this->getMock( 'Magento\Sales\Model\Quote\Address', diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/TaxTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/TaxTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1cbb07c517e26626ccd0e349670f44f33f49a3b2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/TaxTest.php @@ -0,0 +1,145 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Order\Invoice\Total; + +class TaxTest extends \PHPUnit_Framework_TestCase +{ + public function testCollect() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var \Magento\Sales\Model\Order\Invoice\Total\Tax $model */ + $model = $objectManager->getObject('Magento\Sales\Model\Order\Invoice\Total\Tax'); + + $collection = $objectManager + ->getCollectionMock('Magento\Sales\Model\Resource\Order\Invoice\Collection', array()); + + $order = $this->getMock( + '\Magento\Sales\Model\Order', + array( + 'getInvoiceCollection', + 'getHiddenTaxAmount', + 'getBaseHiddenTaxAmount', + '__wakeup' + ), + array(), + '', + false + ); + $order->expects($this->atLeastOnce())->method('getInvoiceCollection')->will($this->returnValue($collection)); + $order->expects($this->atLeastOnce())->method('getHiddenTaxAmount')->will($this->returnValue(10)); + $order->expects($this->atLeastOnce())->method('getBaseHiddenTaxAmount')->will($this->returnValue(10)); + + $invoiceItems[] = $this->getInvoiceItem(0, 10); + + $invoice = $this->getMock( + '\Magento\Sales\Model\Order\Invoice', + array( + 'getAllItems', + 'getOrder', + 'getGrandTotal', + 'setGrandTotal', + '__wakeup' + ), + array(), + '', + false + ); + $invoice->expects($this->atLeastOnce())->method('getAllItems')->will($this->returnValue($invoiceItems)); + $invoice->expects($this->atLeastOnce())->method('getOrder')->will($this->returnValue($order)); + $invoice->expects($this->atLeastOnce())->method('getGrandTotal')->will($this->returnValue(0)); + $invoice + ->expects($this->atLeastOnce()) + ->method('setGrandTotal') + ->with($this->equalTo(10)) + ->will($this->returnSelf()); + + $model->collect($invoice); + } + + /** + * @param $taxAmount + * @param $hiddenTaxAmount + * @return \Magento\Sales\Model\Order\Invoice\Item|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getInvoiceItem($taxAmount, $hiddenTaxAmount) + { + $orderItem = $this->getMock( + '\Magento\Sales\Model\Order\Item', + array( + 'getQtyOrdered', + 'getTaxAmount', + 'getBaseTaxAmount', + 'getHiddenTaxAmount', + 'getBaseHiddenTaxAmount', + '__wakeup' + ), + array(), + '', + false + ); + $orderItem->expects($this->atLeastOnce())->method('getQtyOrdered')->will($this->returnValue(1)); + $orderItem->expects($this->atLeastOnce())->method('getTaxAmount')->will($this->returnValue($taxAmount)); + $orderItem->expects($this->atLeastOnce())->method('getBaseTaxAmount')->will($this->returnValue($taxAmount)); + $orderItem + ->expects($this->atLeastOnce()) + ->method('getHiddenTaxAmount') + ->will($this->returnValue($hiddenTaxAmount)); + $orderItem + ->expects($this->atLeastOnce()) + ->method('getBaseHiddenTaxAmount') + ->will($this->returnValue($hiddenTaxAmount)); + + $invoiceItem = $this->getMock( + '\Magento\Sales\Model\Order\Invoice\Item', + array( + 'getOrderItem', + 'isLast', + 'setTaxAmount', + 'setBaseTaxAmount', + 'setHiddenTaxAmount', + 'setBaseHiddenTaxAmount', + '__wakeup' + ), + array(), + '', + false + ); + $invoiceItem->expects($this->atLeastOnce())->method('getOrderItem')->will($this->returnValue($orderItem)); + $invoiceItem->expects($this->atLeastOnce())->method('isLast')->will($this->returnValue(true)); + + $invoiceItem->expects($this->once())->method('setTaxAmount')->with($taxAmount)->will($this->returnSelf()); + $invoiceItem->expects($this->once())->method('setBaseTaxAmount')->with($taxAmount)->will($this->returnSelf()); + $invoiceItem + ->expects($this->once()) + ->method('setHiddenTaxAmount') + ->with($hiddenTaxAmount) + ->will($this->returnSelf()); + $invoiceItem + ->expects($this->once()) + ->method('setBaseHiddenTaxAmount') + ->with($hiddenTaxAmount) + ->will($this->returnSelf()); + return $invoiceItem; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php index 3b7196b1a546a675573cf4ffee250da0d7f81a1c..6151193f94906d98c123d49c3eb2e5a2028e1064 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php @@ -41,7 +41,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Setup most constructor dependencies $paymentData = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $translate = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $pdfItemsFactory = $this->getMock('Magento\Sales\Model\Order\Pdf\ItemsFactory', array(), array(), '', false); @@ -98,20 +98,20 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $model = $this->getMockForAbstractClass( 'Magento\Sales\Model\Order\Pdf\AbstractPdf', array( - $paymentData, - $string, - $coreStoreConfig, + $paymentData, + $string, + $scopeConfig, $filesystem, - $pdfConfig, - $pdfTotalFactory, - $pdfItemsFactory, - $localeMock, + $pdfConfig, + $pdfTotalFactory, + $pdfItemsFactory, + $localeMock, $translate ), - '', - true, - false, - true, + '', + true, + false, + true, array('drawLineBlocks') ); $model->expects($this->once())->method('drawLineBlocks')->will($this->returnValue($page)); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php index 65e5113b75330605c4ae97adb8f0e15eb07c46a9..9b5b11a757c335c0e4fcdcd13c6adddc49d04e2a 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php @@ -37,10 +37,9 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); - $stringMock = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); - $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); - $translateMock = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false, false); + $this->_pdfConfigMock = $this->getMockBuilder('Magento\Sales\Model\Order\Pdf\Config') + ->disableOriginalConstructor() + ->getMock(); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false, false); $directoryMock->expects($this->any())->method('getAbsolutePath')->will( $this->returnCallback( @@ -53,61 +52,13 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $filesystemMock->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($directoryMock)); $filesystemMock->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($directoryMock)); - $this->_pdfConfigMock = $this->getMock( - 'Magento\Sales\Model\Order\Pdf\Config', - array(), - array(), - '', - false, - false - ); - $totalFactoryMock = $this->getMock( - 'Magento\Sales\Model\Order\Pdf\Total\Factory', - array(), - array(), - '', - false, - false - ); - $pdfItemsFactoryMock = $this->getMock( - 'Magento\Sales\Model\Order\Pdf\ItemsFactory', - array(), - array(), - '', - false, - false - ); - $localeDateMock = $this->getMock( - 'Magento\Stdlib\DateTime\TimezoneInterface', - array(), - array(), - '', - false, - false - ); - $storeManagerMock = $this->getMock( - 'Magento\Core\Model\StoreManagerInterface', - array(), - array(), - '', - false, - false - ); - $localeResolverMock = $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false, false); - - $this->_model = new \Magento\Sales\Model\Order\Pdf\Invoice( - $paymentDataMock, - $stringMock, - $storeConfigMock, - $filesystemMock, - $this->_pdfConfigMock, - $totalFactoryMock, - $pdfItemsFactoryMock, - $localeDateMock, - $translateMock, - $storeManagerMock, - $localeResolverMock, - array() + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_model = $helper->getObject( + 'Magento\Sales\Model\Order\Pdf\Invoice', + [ + 'filesystem' => $filesystemMock, + 'pdfConfig' => $this->_pdfConfigMock, + ] ); } diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php index a788b76c82dc3050e2728191635af7da60e42bc5..56eac2ab63009a9f68690b038d41b0901d8d79d2 100644 --- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php +++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php @@ -100,7 +100,7 @@ class CartFixedTest extends \PHPUnit_Framework_TestCase $this->rule->setData(array('id' => 1, 'discount_amount' => 10.0)); $this->address->expects($this->any())->method('getCartFixedRules')->will($this->returnValue(array())); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $store->expects($this->atLeastOnce())->method('convertPrice')->will($this->returnArgument(0)); $store->expects($this->atLeastOnce())->method('roundPrice')->will($this->returnArgument(0)); $this->quote->expects($this->any())->method('getStore')->will($this->returnValue($store)); diff --git a/dev/tests/unit/testsuite/Magento/Service/DataObjectConverterTest.php b/dev/tests/unit/testsuite/Magento/Service/DataObjectConverterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..83ca37420e260f06f5528cb3c526ee0673325200 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Service/DataObjectConverterTest.php @@ -0,0 +1,219 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Service; + +use Magento\Customer\Service\V1\Data\Customer; +use Magento\Customer\Service\V1\Data\RegionBuilder; + +/** + * Class implements tests for DataObjectConverterTest class. + */ +class DataObjectConverterTest extends \PHPUnit_Framework_TestCase +{ + /** @var DataObjectConverter */ + protected $dataObjectConverter; + + const CONFIRMATION = 'a4fg7h893e39d'; + const CREATED_AT = '2013-11-05'; + const CREATED_IN = 'default'; + const STORE_NAME = 'Store Name'; + const DOB = '1970-01-01'; + const GENDER = 'Male'; + const GROUP_ID = 1; + const MIDDLENAME = 'A'; + const PREFIX = 'Mr.'; + const STORE_ID = 1; + const SUFFIX = 'Esq.'; + const TAXVAT = '12'; + const WEBSITE_ID = 1; + const ID = 1; + const FIRSTNAME = 'Jane'; + const LASTNAME = 'Doe'; + const ATTRIBUTE_CODE = 'attribute_code'; + const ATTRIBUTE_VALUE = 'attribute_value'; + const REGION_CODE = 'AL'; + const REGION_ID = '1'; + const REGION = 'Alabama'; + + /** + * Expected street in customer addresses + * + * @var array + */ + private $expectedStreet = [['Green str, 67'], ['Black str, 48', 'Building D']]; + + /** + * Set up helper. + */ + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->dataObjectConverter = $objectManager->getObject('Magento\Service\DataObjectConverter'); + parent::setUp(); + } + + public function testToFlatArray() + { + //Unpack Data Object as an array and convert keys to camelCase to match property names in WSDL + $response = DataObjectConverter::toFlatArray($this->getCustomerDetails()); + //Check if keys are correctly converted to camel case wherever necessary + $this->assertEquals(self::FIRSTNAME, $response['firstname']); + $this->assertEquals(self::GROUP_ID, $response['group_id']); + $this->assertEquals(self::REGION, $response['region']); + $this->assertEquals(self::REGION_CODE, $response['region_code']); + $this->assertEquals(self::REGION_ID, $response['region_id']); + //TODO : FIX toFlatArray since it has issues in converting Street array correctly as it overwrites the data. + } + + public function testConvertKeysToCamelCase() + { + //Unpack as an array and convert keys to camelCase to match property names in WSDL + $response = $this->dataObjectConverter->convertKeysToCamelCase($this->getCustomerDetails()->__toArray()); + //Check if keys are correctly converted to camel case wherever necessary + $this->assertEquals(self::FIRSTNAME, $response['customer']['firstname']); + $this->assertEquals(self::GROUP_ID, $response['customer']['groupId']); + foreach ($response['addresses'] as $key => $address) { + $region = $address['region']; + $this->assertEquals(self::REGION, $region['region']); + $this->assertEquals(self::REGION_CODE, $region['regionCode']); + $this->assertEquals(self::REGION_ID, $region['regionId']); + $this->assertEquals($this->expectedStreet[$key], $address['street']); + } + } + + public function testConvertSoapStdObjectToArray() + { + $stdObject = json_decode(json_encode($this->getCustomerDetails()->__toArray()), FALSE); + $addresses = $stdObject->addresses; + unset($stdObject->addresses); + $stdObject->addresses = new \stdClass(); + $stdObject->addresses->item = $addresses; + $response = $this->dataObjectConverter->convertStdObjectToArray($stdObject); + + //Check array conversion + $this->assertTrue(is_array($response['customer'])); + $this->assertTrue(is_array($response['addresses'])); + $this->assertEquals(2, count($response['addresses']['item'])); + + //Check if data is correct + $this->assertEquals(self::FIRSTNAME, $response['customer']['firstname']); + $this->assertEquals(self::GROUP_ID, $response['customer']['group_id']); + foreach ($response['addresses']['item'] as $key => $address) { + $region = $address['region']; + $this->assertEquals(self::REGION, $region['region']); + $this->assertEquals(self::REGION_CODE, $region['region_code']); + $this->assertEquals(self::REGION_ID, $region['region_id']); + $this->assertEquals($this->expectedStreet[$key], $address['street']); + } + } + + /** + * Get a sample Customer details data object + * + * @return \Magento\Customer\Service\V1\Data\CustomerDetails + */ + private function getCustomerDetails() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder */ + $addressBuilder = $objectManager->getObject('Magento\Customer\Service\V1\Data\AddressBuilder'); + /** @var \Magento\Customer\Service\V1\CustomerMetadataServiceInterface $metadataService */ + $metadataService = $this->getMockBuilder('Magento\Customer\Service\V1\CustomerMetadataService') + ->disableOriginalConstructor() + ->getMock(); + $metadataService->expects($this->any()) + ->method('getCustomCustomerAttributeMetadata') + ->will($this->returnValue([])); + /** @var \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder */ + $customerBuilder = $objectManager->getObject( + 'Magento\Customer\Service\V1\Data\CustomerBuilder', + ['metadataService' => $metadataService] + ); + /** @var \Magento\Customer\Service\V1\Data\CustomerDetailsBuilder $customerDetailsBuilder */ + $customerDetailsBuilder = + $objectManager->getObject('Magento\Customer\Service\V1\Data\CustomerDetailsBuilder'); + + $street1 = ['Green str, 67']; + $street2 = ['Black str, 48', 'Building D']; + $addressBuilder->setId(1) + ->setCountryId('US') + ->setCustomerId(1) + ->setDefaultBilling(true) + ->setDefaultShipping(true) + ->setPostcode('75477') + ->setRegion( + (new RegionBuilder())->setRegionCode(self::REGION_CODE)->setRegion(self::REGION) + ->setRegionId(self::REGION_ID)->create() + ) + ->setStreet($street1) + ->setTelephone('3468676') + ->setCity('CityM') + ->setFirstname('John') + ->setLastname('Smith'); + $address = $addressBuilder->create(); + + $addressBuilder->setId(2) + ->setCountryId('US') + ->setCustomerId(1) + ->setDefaultBilling(false) + ->setDefaultShipping(false) + ->setPostcode('47676') + ->setRegion( + (new RegionBuilder())->setRegionCode(self::REGION_CODE)->setRegion(self::REGION) + ->setRegionId(self::REGION_ID)->create() + ) + ->setStreet($street2) + ->setCity('CityX') + ->setTelephone('3234676') + ->setFirstname('John') + ->setLastname('Smith'); + $address2 = $addressBuilder->create(); + + $customerData = [ + Customer::FIRSTNAME => self::FIRSTNAME, + Customer::LASTNAME => self::LASTNAME, + Customer::EMAIL => 'janedoe@example.com', + Customer::CONFIRMATION => self::CONFIRMATION, + Customer::CREATED_AT => self::CREATED_AT, + Customer::CREATED_IN => self::STORE_NAME, + Customer::DOB => self::DOB, + Customer::GENDER => self::GENDER, + Customer::GROUP_ID => self::GROUP_ID, + Customer::MIDDLENAME => self::MIDDLENAME, + Customer::PREFIX => self::PREFIX, + Customer::STORE_ID => self::STORE_ID, + Customer::SUFFIX => self::SUFFIX, + Customer::TAXVAT => self::TAXVAT, + Customer::WEBSITE_ID => self::WEBSITE_ID + ]; + $customerData = $customerBuilder->populateWithArray($customerData)->create(); + $customerDetails = $customerDetailsBuilder->setAddresses([$address, $address2]) + ->setCustomer($customerData) + ->create(); + + return $customerDetails; + } + +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Session/ConfigTest.php similarity index 90% rename from dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php rename to dev/tests/unit/testsuite/Magento/Session/ConfigTest.php index 2da1a073e9bb3dde9f1f18936a6939da52ade331..9e07ba529dbbbb6574690bbadc2eb1e7da2d119a 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Session/ConfigTest.php @@ -23,27 +23,22 @@ */ /** - * Test class for \Magento\Core\Model\Session\Config + * Test class for \Magento\Session\Config */ -namespace Magento\Core\Model\Session; +namespace Magento\Session; class ConfigTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Session\Config + * @var \Magento\Session\Config */ protected $config; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_configMock; - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManagerMock; - /** * @var \Magento\Stdlib\String */ @@ -66,30 +61,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_configMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); - $this->_storeManagerMock = $this->getMock( - '\Magento\Core\Model\StoreManager', - array('getStore'), - array(), - '', - false, - false - ); - $storeMock = $this->getMock( - '\Magento\Core\Model\Store', - array('isAdmin', '__wakeup'), - array(), - '', - false, - false - ); - $this->_storeManagerMock->expects( - $this->atLeastOnce() - )->method( - 'getStore' - )->will( - $this->returnValue($storeMock) - ); + $this->_configMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_stringHelperMock = $this->getMock('\Magento\Stdlib\String', array(), array(), '', false, false); $this->_requestMock = $this->getMock( @@ -112,13 +84,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_appState->expects($this->atLeastOnce())->method('isInstalled')->will($this->returnValue(true)); $this->_filesystem = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false, false); - $this->config = new \Magento\Core\Model\Session\Config( + $this->config = new \Magento\Session\Config( $this->_configMock, - $this->_storeManagerMock, $this->_stringHelperMock, $this->_requestMock, $this->_appState, $this->_filesystem, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, \Magento\Session\SaveHandlerInterface::DEFAULT_HANDLER, __DIR__ ); @@ -128,7 +100,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->setExpectedException( '\InvalidArgumentException', - 'Parameter provided to Magento\Core\Model\Session\Config::setOptions must be an array or Traversable' + 'Parameter provided to Magento\Session\Config::setOptions must be an array or Traversable' ); $this->config->setOptions(''); } @@ -184,7 +156,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetOptions() { - $appStateProperty = new \ReflectionProperty('Magento\Core\Model\Session\Config', 'options'); + $appStateProperty = new \ReflectionProperty('Magento\Session\Config', 'options'); $appStateProperty->setAccessible(true); $original = $appStateProperty->getValue($this->config); $valueForTest = array('test' => 'test2'); @@ -198,7 +170,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testHasOption() { - $appStateProperty = new \ReflectionProperty('Magento\Core\Model\Session\Config', 'options'); + $appStateProperty = new \ReflectionProperty('Magento\Session\Config', 'options'); $appStateProperty->setAccessible(true); $original = $appStateProperty->getValue($this->config); $valueForTest = array('session.test' => 'test2'); @@ -277,7 +249,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->setExpectedException( '\BadMethodCallException', - 'Method "methodThatNotExist" does not exist in Magento\Core\Model\Session\Config' + 'Method "methodThatNotExist" does not exist in Magento\Session\Config' ); $this->config->methodThatNotExist(); } diff --git a/dev/tests/unit/testsuite/Magento/Shell/CommandRendererBackgroundTest.php b/dev/tests/unit/testsuite/Magento/Shell/CommandRendererBackgroundTest.php new file mode 100644 index 0000000000000000000000000000000000000000..71c9cf1a4bc7c081bc9a3dc79a24652d5ecc2ee4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Shell/CommandRendererBackgroundTest.php @@ -0,0 +1,75 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Shell; + +class CommandRendererBackgroundTest extends \PHPUnit_Framework_TestCase +{ + /** + * Test data for command + * + * @var string + */ + protected $testCommand = 'php -r test.php'; + + /** + * @var \Magento\OsInfo|\PHPUnit_Framework_MockObject_MockObject + */ + protected $osInfo; + + public function setUp() + { + $this->osInfo = $this->getMockBuilder('Magento\OsInfo')->getMock(); + } + + /** + * @dataProvider commandPerOsTypeDataProvider + * @param bool $isWindows + * @param string $expectedResults + */ + public function testRender($isWindows, $expectedResults) + { + $this->osInfo->expects($this->once()) + ->method('isWindows') + ->will($this->returnValue($isWindows)); + + $commandRenderer = new CommandRendererBackground($this->osInfo); + $this->assertEquals( + $expectedResults, + $commandRenderer->render($this->testCommand) + ); + } + + /** + * Data provider for each os type + * + * @return array + */ + public function commandPerOsTypeDataProvider() + { + return array( + 'windows' => array(true, 'start /B "magento background task" ' . $this->testCommand . ' 2>&1'), + 'unix' => array(false, $this->testCommand . ' 2>&1 > /dev/null &'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Shell/CommandRendererTest.php b/dev/tests/unit/testsuite/Magento/Shell/CommandRendererTest.php new file mode 100644 index 0000000000000000000000000000000000000000..be8ff6d6d2cb462b0b4116088f33110d123aa71e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Shell/CommandRendererTest.php @@ -0,0 +1,38 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Shell; + +class CommandRendererTest extends \PHPUnit_Framework_TestCase +{ + public function testRender() + { + $testArgument = 'argument'; + $testArgument2 = 'argument2'; + $commandRenderer = new CommandRenderer(); + $this->assertEquals( + "php -r " . escapeshellarg($testArgument) . " 2>&1 | grep " . escapeshellarg($testArgument2) . " 2>&1", + $commandRenderer->render('php -r %s | grep %s', array($testArgument, $testArgument2)) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/ShellTest.php b/dev/tests/unit/testsuite/Magento/ShellTest.php index 45788fb2110c82b29d7c7e77b4bd98fced694264..335538e1e4c1f246c2f907dd51e4d8c6d594ac41 100644 --- a/dev/tests/unit/testsuite/Magento/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/ShellTest.php @@ -29,13 +29,22 @@ namespace Magento; class ShellTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\OSInfo|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Shell\CommandRendererInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $osInfo; + protected $commandRenderer; + + /** + * @var \Zend_Log|\PHPUnit_Framework_MockObject_MockObject + */ + protected $logger; public function setUp() { - $this->osInfo = $this->getMockBuilder('Magento\OSInfo')->disableOriginalConstructor()->getMock(); + $this->logger = $this->getMockBuilder('Zend_Log') + ->setMethods(array('log')) + ->disableOriginalConstructor() + ->getMock(); + $this->commandRenderer = new \Magento\Shell\CommandRenderer(); } /** @@ -62,7 +71,9 @@ class ShellTest extends \PHPUnit_Framework_TestCase */ public function testExecute($command, $commandArgs, $expectedResult) { - $this->_testExecuteCommand(new \Magento\Shell($this->osInfo), $command, $commandArgs, $expectedResult); + $this->_testExecuteCommand( + new \Magento\Shell($this->commandRenderer, $this->logger), $command, $commandArgs, $expectedResult + ); } /** @@ -76,13 +87,14 @@ class ShellTest extends \PHPUnit_Framework_TestCase { $quoteChar = substr(escapeshellarg(' '), 0, 1); // environment-dependent quote character - $logger = $this->getMock('Zend_Log', array('log')); foreach ($expectedLogRecords as $logRecordIndex => $expectedLogMessage) { $expectedLogMessage = str_replace('`', $quoteChar, $expectedLogMessage); - $logger->expects($this->at($logRecordIndex))->method('log')->with($expectedLogMessage, \Zend_Log::INFO); + $this->logger->expects($this->at($logRecordIndex)) + ->method('log') + ->with($expectedLogMessage, \Zend_Log::INFO); } $this->_testExecuteCommand( - new \Magento\Shell($this->osInfo, $logger), + new \Magento\Shell($this->commandRenderer, $this->logger), $command, $commandArgs, $expectedResult @@ -123,7 +135,7 @@ class ShellTest extends \PHPUnit_Framework_TestCase */ public function testExecuteFailure() { - $shell = new \Magento\Shell($this->osInfo); + $shell = new \Magento\Shell($this->commandRenderer, $this->logger); $shell->execute('non_existing_command'); } diff --git a/dev/tests/unit/testsuite/Magento/Shipping/Helper/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Shipping/Helper/CarrierTest.php index 6921b537e828227cab7b3d22bd87c5b6a5601d90..85dee75b273fba8a3f055535b2380d7b7cb171ee 100644 --- a/dev/tests/unit/testsuite/Magento/Shipping/Helper/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Shipping/Helper/CarrierTest.php @@ -38,18 +38,18 @@ class CarrierTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $storeConfig; + protected $scopeConfig; public function setUp() { - $this->storeConfig = $this->getMock('Magento\Core\Model\Store\ConfigInterface'); + $this->scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->helper = $objectManagerHelper->getObject( 'Magento\Shipping\Helper\Carrier', array( 'context' => $this->getMock('Magento\App\Helper\Context', array(), array(), '', false), 'locale' => $this->getMock('Magento\LocaleInterface'), - 'storeConfig' => $this->storeConfig + 'scopeConfig' => $this->scopeConfig ) ); } @@ -61,12 +61,13 @@ class CarrierTest extends \PHPUnit_Framework_TestCase */ public function testGetOnlineCarrierCodes($result, $carriers) { - $this->storeConfig->expects( + $this->scopeConfig->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( - 'carriers' + 'carriers', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue($carriers) ); @@ -95,12 +96,13 @@ class CarrierTest extends \PHPUnit_Framework_TestCase $carrierCode = 'carrier1'; $configPath = 'title'; $configValue = 'some title'; - $this->storeConfig->expects( + $this->scopeConfig->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( - sprintf('carriers/%s/%s', $carrierCode, $configPath) + sprintf('carriers/%s/%s', $carrierCode, $configPath), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue($configValue) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/StoreCheckTest.php b/dev/tests/unit/testsuite/Magento/Store/App/Action/Plugin/StoreCheckTest.php similarity index 87% rename from dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/StoreCheckTest.php rename to dev/tests/unit/testsuite/Magento/Store/App/Action/Plugin/StoreCheckTest.php index 81287747d8cebd173cff5913c19176e07ad5cb73..3443b34f0dbd793382662857682ff9b5742d822d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/StoreCheckTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/App/Action/Plugin/StoreCheckTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\Action\Plugin; +namespace Magento\Store\App\Action\Plugin; class StoreCheckTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\App\Action\Plugin\StoreCheck + * @var \Magento\Store\App\Action\Plugin\StoreCheck */ protected $_plugin; @@ -57,8 +57,8 @@ class StoreCheckTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); - $this->_storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $this->_storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->any() )->method( @@ -71,7 +71,7 @@ class StoreCheckTest extends \PHPUnit_Framework_TestCase return 'Expected'; }; $this->requestMock = $this->getMock('Magento\App\RequestInterface'); - $this->_plugin = new \Magento\Core\App\Action\Plugin\StoreCheck($this->_storeManagerMock); + $this->_plugin = new \Magento\Store\App\Action\Plugin\StoreCheck($this->_storeManagerMock); } public function testAroundDispatchWhenStoreNotActive() diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php b/dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandlerTest.php similarity index 89% rename from dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php rename to dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandlerTest.php index 4a4ed1bba2ffada5debc5316f03202e5561f2b60..81faddb08796efd6e6078dba8baa4d626c985a1d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/DispatchExceptionHandlerTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\FrontController\Plugin; +namespace Magento\Store\App\FrontController\Plugin; class DispatchExceptionHandlerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\App\FrontController\Plugin\DispatchExceptionHandler + * @var \Magento\Store\App\FrontController\Plugin\DispatchExceptionHandler */ protected $_model; @@ -52,7 +52,7 @@ class DispatchExceptionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_filesystemMock = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false); $this->closureMock = function () { return 'Expected'; diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php b/dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php similarity index 85% rename from dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php rename to dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php index 1e65a56053a660b81e82c46bc0d4f7d9380fd042..56ebeac3538c9c40fd6f5bd817757342afaf53bd 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/RequestPreprocessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/App/FrontController/Plugin/RequestPreprocessorTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\FrontController\Plugin; +namespace Magento\Store\App\FrontController\Plugin; class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\App\FrontController\Plugin\RequestPreprocessor + * @var \Magento\Store\App\FrontController\Plugin\RequestPreprocessor */ protected $_model; @@ -48,7 +48,7 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfigMock; + protected $_scopeConfigMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -72,21 +72,21 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $this->_storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->_requestMock = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); $this->closureMock = function () { return 'Expected'; }; - $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManager', array(), array(), '', false); $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); $this->_urlMock = $this->getMock('\Magento\Url', array(), array(), '', false); - $this->_storeConfigMock = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); + $this->_scopeConfigMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->subjectMock = $this->getMock('Magento\App\FrontController', array(), array(), '', false); - $this->_model = new \Magento\Core\App\FrontController\Plugin\RequestPreprocessor( + $this->_model = new \Magento\Store\App\FrontController\Plugin\RequestPreprocessor( $this->_storeManagerMock, $this->_appStateMock, $this->_urlMock, - $this->_storeConfigMock, + $this->_scopeConfigMock, $this->getMock('\Magento\App\ResponseFactory', array(), array(), '', false) ); } @@ -95,7 +95,7 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); - $this->_storeConfigMock->expects($this->never())->method('getConfig'); + $this->_scopeConfigMock->expects($this->never())->method('getValue'); $this->assertEquals( 'Expected', $this->_model->aroundDispatch($this->subjectMock, $this->closureMock, $this->_requestMock) @@ -106,7 +106,7 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); - $this->_storeConfigMock->expects($this->once())->method('getConfig')->with('web/url/redirect_to_base'); + $this->_scopeConfigMock->expects($this->once())->method('getValue')->with('web/url/redirect_to_base'); $this->_requestMock->expects($this->never())->method('getRequestUri'); $this->assertEquals( 'Expected', @@ -118,10 +118,10 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'web/url/redirect_to_base' )->will( @@ -146,10 +146,10 @@ class RequestPreprocessorTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_requestMock->expects($this->once())->method('setDispatched')->with(false); - $this->_storeConfigMock->expects( + $this->_scopeConfigMock->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->with( 'web/url/redirect_to_base' )->will( diff --git a/dev/tests/unit/testsuite/Magento/Core/App/Area/Request/PathInfoProcessorTest.php b/dev/tests/unit/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php similarity index 87% rename from dev/tests/unit/testsuite/Magento/Core/App/Area/Request/PathInfoProcessorTest.php rename to dev/tests/unit/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php index 2e9b07ee861753d250c8000aed265462fd21285f..76cfde72c29f78d0149fae2794a0a125aa369bb8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/Area/Request/PathInfoProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/App/Request/PathInfoProcessorTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\App\Area\Request; +namespace Magento\Store\App\Request; class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\App\Request\PathInfoProcessor + * @var \Magento\Store\App\Request\PathInfoProcessor */ protected $_model; @@ -58,13 +58,13 @@ class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase 'getParam' ) ); - $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_model = new \Magento\Core\App\Request\PathInfoProcessor($this->_storeManagerMock); + $this->_storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManager', array(), array(), '', false); + $this->_model = new \Magento\Store\App\Request\PathInfoProcessor($this->_storeManagerMock); } public function testProcessIfStoreExistsAndIsNotDirectAcccessToFrontName() { - $store = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( @@ -91,7 +91,7 @@ class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase public function testProcessIfStoreExistsAndDirectAcccessToFrontName() { - $store = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( @@ -119,7 +119,7 @@ class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase public function testProcessIfStoreIsEmpty() { $path = '/0/node_one/'; - $store = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( @@ -146,7 +146,7 @@ class PathInfoProcessorTest extends \PHPUnit_Framework_TestCase public function testProcessIfStoreCodeIsNotExist() { - $store = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $this->_storeManagerMock->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Core/Block/SwitchTest.php b/dev/tests/unit/testsuite/Magento/Store/Block/SwitchTest.php similarity index 85% rename from dev/tests/unit/testsuite/Magento/Core/Block/SwitchTest.php rename to dev/tests/unit/testsuite/Magento/Store/Block/SwitchTest.php index efb31075c3ebb657276f7205017b18981ed9bc94..9d0447f17fa439da14386a2f57d205493eee6dd5 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Block/SwitchTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Block/SwitchTest.php @@ -18,18 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Theme - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Block; +namespace Magento\Store\Block; class SwitchTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Block\Switcher + * @var \Magento\Store\Block\Switcher */ protected $_block; @@ -45,11 +42,11 @@ class SwitchTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManagerInterface'); + $this->_storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_block = $helper->getObject( - 'Magento\Core\Block\Switcher', + 'Magento\Store\Block\Switcher', array('storeManager' => $this->_storeManagerMock) ); } @@ -59,7 +56,7 @@ class SwitchTest extends \PHPUnit_Framework_TestCase */ public function testIsStoreInUrl($isUseStoreInUrl) { - $storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->once())->method('isUseStoreInUrl')->will($this->returnValue($isUseStoreInUrl)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/CookieTest.php b/dev/tests/unit/testsuite/Magento/Store/Helper/CookieTest.php similarity index 75% rename from dev/tests/unit/testsuite/Magento/Core/Helper/CookieTest.php rename to dev/tests/unit/testsuite/Magento/Store/Helper/CookieTest.php index e30bc90001e58bc11d85a2879ad249040b267a61..70404025e3a94d0cf1fd45745be2c5f752bdd0f9 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/CookieTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Helper/CookieTest.php @@ -18,18 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Helper; +namespace Magento\Store\Helper; class CookieTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Helper\Cookie + * @var \Magento\Store\Helper\Cookie */ protected $_object; @@ -51,9 +48,10 @@ class CookieTest extends \PHPUnit_Framework_TestCase $request->expects($this->any())->method('getCookie')->will($this->returnValue(json_encode(array()))); $context = $this->getMock('Magento\App\Helper\Context', array('getRequest'), array(), '', false, false); $context->expects($this->once())->method('getRequest')->will($this->returnValue($request)); - $this->_object = new \Magento\Core\Helper\Cookie( + $this->_object = new \Magento\Store\Helper\Cookie( $context, - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false, false), + $this->_getConfigStub(), array('current_store' => $this->_getStoreStub(), 'website' => $this->_getWebsiteStub()) ); $this->assertTrue($this->_object->isUserNotAllowSaveCookie()); @@ -70,19 +68,21 @@ class CookieTest extends \PHPUnit_Framework_TestCase $this->_request = $this->getMock('\Magento\App\Request\Http', array('getCookie'), array(), '', false, false); $this->_context = $this->getMock('Magento\App\Helper\Context', array('getRequest'), array(), '', false, false); $this->_context->expects($this->once())->method('getRequest')->will($this->returnValue($this->_request)); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $storeStub = $this->_getStoreStub(); - $storeStub->expects( + $scopeConfig->expects( $this->once() )->method( - 'getConfig' + 'getValue' )->will( - $this->returnCallback('Magento\\Core\\Helper\\CookieTest::getConfigMethodStub') + $this->returnCallback(array($this, 'getConfigMethodStub')) )->with( $this->equalTo('web/cookie/cookie_restriction_lifetime') ); - $this->_object = new \Magento\Core\Helper\Cookie( + $this->_object = new \Magento\Store\Helper\Cookie( $this->_context, - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false, false), + $scopeConfig, array('current_store' => $storeStub, 'website' => $this->_getWebsiteStub()) ); $this->assertEquals($this->_object->getCookieRestrictionLifetime(), 60 * 60 * 24 * 365); @@ -93,9 +93,10 @@ class CookieTest extends \PHPUnit_Framework_TestCase $this->_request = $this->getMock('\Magento\App\Request\Http', array('getCookie'), array(), '', false, false); $this->_context = $this->getMock('Magento\App\Helper\Context', array('getRequest'), array(), '', false, false); $this->_context->expects($this->once())->method('getRequest')->will($this->returnValue($this->_request)); - $this->_object = new \Magento\Core\Helper\Cookie( + $this->_object = new \Magento\Store\Helper\Cookie( $this->_context, - $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false, false), + $this->getMock('Magento\Store\Model\StoreManager', array(), array(), '', false, false), + $this->_getConfigStub(), array('current_store' => $this->_getStoreStub(), 'website' => $this->_getWebsiteStub()) ); return $this; @@ -103,21 +104,31 @@ class CookieTest extends \PHPUnit_Framework_TestCase /** * Create store stub - * @return \Magento\Core\Model\Store + * @return \Magento\Store\Model\Store */ protected function _getStoreStub() { - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + return $store; + } - $store->expects( + /** + * Create config stub + * + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function _getConfigStub() + { + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->will( - $this->returnCallback('Magento\\Core\\Helper\\CookieTest::getConfigMethodStub') + $this->returnCallback(array($this, 'getConfigMethodStub')) ); - return $store; + return $scopeConfig; } /** @@ -138,11 +149,11 @@ class CookieTest extends \PHPUnit_Framework_TestCase /** * Create Website Stub - * @return \Magento\Core\Model\Website + * @return \Magento\Store\Model\Website */ protected function _getWebsiteStub() { - $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $websiteMock->expects($this->any())->method('getId')->will($this->returnValue(1)); @@ -156,7 +167,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase * @return string * @throws \InvalidArgumentException */ - public static function getConfigMethodStub($hashName) + public function getConfigMethodStub($hashName) { $defaultConfig = array( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Store/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/ConverterTest.php similarity index 87% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Store/ConverterTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/ConverterTest.php index 7276506b62331f96a35abbcb55122a0c044a6c4a..7da36e08fa3144de2d9ef8865c1ef787ebd2f069 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Store/ConverterTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/ConverterTest.php @@ -21,11 +21,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Store; +namespace Magento\Store\Model\Config; class ConverterTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Core\Model\Config\Scope\Store\Converter */ + /** @var \Magento\Store\Model\Config\Converter */ protected $_model; /** @var \PHPUnit_Framework_MockObject_MockObject */ @@ -34,13 +34,13 @@ class ConverterTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_processorMock = $this->getMock( - 'Magento\Core\Model\Config\Scope\Processor\Placeholder', + 'Magento\Store\Model\Config\Processor\Placeholder', array(), array(), '', false ); - $this->_model = new \Magento\Core\Model\Config\Scope\Store\Converter($this->_processorMock); + $this->_model = new \Magento\Store\Model\Config\Converter($this->_processorMock); } public function testConvert() diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Processor/PlaceholderTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Processor/PlaceholderTest.php similarity index 82% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Processor/PlaceholderTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/Processor/PlaceholderTest.php index 98a6b112efbbc228d22e2146372172b03803676f..b8e46bd7140ff66b2013be6063d3cf8d866a2623 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Processor/PlaceholderTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Processor/PlaceholderTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Processor; +namespace Magento\Store\Model\Config\Processor; class PlaceholderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\Processor\Placeholder + * @var \Magento\Store\Model\Config\Processor\Placeholder */ protected $_model; @@ -45,7 +45,14 @@ class PlaceholderTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('http://localhost/') ); - $this->_model = new \Magento\Core\Model\Config\Scope\Processor\Placeholder($this->_requestMock); + $this->_model = new \Magento\Store\Model\Config\Processor\Placeholder( + $this->_requestMock, + array( + 'unsecureBaseUrl' => \Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, + 'secureBaseUrl' => \Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL + ), + \Magento\Store\Model\Store::BASE_URL_PLACEHOLDER + ); } public function testProcess() diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/DefaultReaderTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/DefaultReaderTest.php similarity index 90% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/DefaultReaderTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/DefaultReaderTest.php index f462e4569053819b7b5b321397140709e21d91fd..0a78e51cbe0f01b0e4dd5e1192bd398ea4ce7c74 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/DefaultReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/DefaultReaderTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class DefaultReaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\Reader\DefaultReader + * @var \Magento\Store\Model\Config\Reader\DefaultReader */ protected $_model; @@ -49,7 +49,7 @@ class DefaultReaderTest extends \PHPUnit_Framework_TestCase { $this->_initialConfigMock = $this->getMock('Magento\App\Config\Initial', array(), array(), '', false); $this->_collectionFactory = $this->getMock( - 'Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory', + 'Magento\Store\Model\Resource\Config\Collection\ScopedFactory', array('create'), array(), '', @@ -57,7 +57,7 @@ class DefaultReaderTest extends \PHPUnit_Framework_TestCase ); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); - $this->_model = new \Magento\Core\Model\Config\Scope\Reader\DefaultReader( + $this->_model = new \Magento\Store\Model\Config\Reader\DefaultReader( $this->_initialConfigMock, new \Magento\App\Config\Scope\Converter(), $this->_collectionFactory, @@ -72,7 +72,7 @@ class DefaultReaderTest extends \PHPUnit_Framework_TestCase )->method( 'getData' )->with( - \Magento\BaseScopeInterface::SCOPE_DEFAULT + \Magento\App\ScopeInterface::SCOPE_DEFAULT )->will( $this->returnValue(array('config' => array('key1' => 'default_value1', 'key2' => 'default_value2'))) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/ReaderPoolTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/ReaderPoolTest.php similarity index 54% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/ReaderPoolTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/ReaderPoolTest.php index e787cd53921451f148eaa3504b91c1210304e15d..a2d0e0319f61bfed40429256c12334dbb6dde903 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/ReaderPoolTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/ReaderPoolTest.php @@ -21,63 +21,51 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope; +namespace Magento\Store\Model\Config\Reader; class ReaderPoolTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\ReaderPool + * @var \Magento\Store\Model\Config\Reader\ReaderPool */ protected $_model; /** - * @var \Magento\Core\Model\Config\Scope\Reader\DefaultReader + * @var \Magento\Store\Model\Config\Reader\DefaultReader */ protected $_defaultReaderMock; /** - * @var \Magento\Core\Model\Config\Scope\Reader\Website + * @var \Magento\Store\Model\Config\Reader\Website */ protected $_websiteReaderMock; /** - * @var \Magento\Core\Model\Config\Scope\Reader\Store + * @var \Magento\Store\Model\Config\Reader\Store */ protected $_storeReaderMock; protected function setUp() { $this->_defaultReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Scope\Reader\DefaultReader', - array(), - array(), - '', - false + 'Magento\Store\Model\Config\Reader\DefaultReader', array(), array(), '', false ); $this->_websiteReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Scope\Reader\Website', - array(), - array(), - '', - false + 'Magento\Store\Model\Config\Reader\Website', array(), array(), '', false ); $this->_storeReaderMock = $this->getMock( - 'Magento\Core\Model\Config\Scope\Reader\Store', - array(), - array(), - '', - false + 'Magento\Store\Model\Config\Reader\Store', array(), array(), '', false ); - $this->_model = new \Magento\Core\Model\Config\Scope\ReaderPool( - $this->_defaultReaderMock, - $this->_websiteReaderMock, - $this->_storeReaderMock - ); + $this->_model = new \Magento\Store\Model\Config\Reader\ReaderPool(array( + 'default' => $this->_defaultReaderMock, + 'website' => $this->_websiteReaderMock, + 'store' => $this->_storeReaderMock, + )); } /** - * @covers \Magento\Core\Model\Config\Scope\ReaderPool::getReader + * @covers \Magento\Store\Model\Config\Reader\ReaderPool::getReader * @dataProvider getReaderDataProvider * @param string $scope * @param string $instanceType @@ -93,11 +81,18 @@ class ReaderPoolTest extends \PHPUnit_Framework_TestCase public function getReaderDataProvider() { return array( - array('scope' => 'default', 'expectedResult' => 'Magento\Core\Model\Config\Scope\Reader\DefaultReader'), - array('scope' => 'website', 'expectedResult' => 'Magento\Core\Model\Config\Scope\Reader\Website'), - array('scope' => 'websites', 'expectedResult' => 'Magento\Core\Model\Config\Scope\Reader\Website'), - array('scope' => 'store', 'expectedResult' => 'Magento\Core\Model\Config\Scope\Reader\Store'), - array('scope' => 'stores', 'expectedResult' => 'Magento\Core\Model\Config\Scope\Reader\Store') + array( + 'scope' => 'default', + 'expectedResult' => 'Magento\Store\Model\Config\Reader\DefaultReader' + ), + array( + 'scope' => 'website', + 'expectedResult' => 'Magento\Store\Model\Config\Reader\Website' + ), + array( + 'scope' => 'store', + 'expectedResult' => 'Magento\Store\Model\Config\Reader\Store' + ), ); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/StoreTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/StoreTest.php similarity index 74% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/StoreTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/StoreTest.php index 0f2f61d25fb0c63029b399022e982aa2bb4704fe..0eebe76f63c7167739d91f3a3fb1aa7536eecb56 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/StoreTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/StoreTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class StoreTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\Reader\Store + * @var \Magento\Store\Model\Config\Reader\Store */ protected $_model; @@ -58,48 +58,54 @@ class StoreTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_scopePullMock = $this->getMock('Magento\App\Config\ScopePool', array(), array(), '', false); + $this->_storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); $this->_initialConfigMock = $this->getMock('Magento\App\Config\Initial', array(), array(), '', false); $this->_collectionFactory = $this->getMock( - 'Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory', + 'Magento\Store\Model\Resource\Config\Collection\ScopedFactory', array('create'), array(), '', false ); - $storeFactoryMock = $this->getMock('Magento\Core\Model\StoreFactory', array('create'), array(), '', false); - $this->_storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $storeFactoryMock = $this->getMock('Magento\Store\Model\StoreFactory', array('create'), array(), '', false); + $this->_storeMock = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $storeFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_storeMock)); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); $placeholderProcessor = $this->getMock( - 'Magento\Core\Model\Config\Scope\Processor\Placeholder', + 'Magento\Store\Model\Config\Processor\Placeholder', array(), array(), '', false ); $placeholderProcessor->expects($this->any())->method('process')->will($this->returnArgument(0)); - $this->_model = new \Magento\Core\Model\Config\Scope\Reader\Store( + $this->_model = new \Magento\Store\Model\Config\Reader\Store( $this->_initialConfigMock, $this->_scopePullMock, - new \Magento\Core\Model\Config\Scope\Store\Converter($placeholderProcessor), + new \Magento\Store\Model\Config\Converter($placeholderProcessor), $this->_collectionFactory, $storeFactoryMock, - $this->_appStateMock + $this->_appStateMock, + $this->_storeManagerMock ); } - public function testRead() + /** + * @dataProvider readDataProvider + * @param string|null $storeCode + * @param PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount $getStoreCount + */ + public function testRead($storeCode, $getStoreExpectsCount) { $websiteCode = 'default'; - $storeCode = 'default'; $storeId = 1; - $websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $websiteMock->expects($this->any())->method('getCode')->will($this->returnValue($websiteCode)); $this->_storeMock->expects($this->any())->method('getWebsite')->will($this->returnValue($websiteMock)); - $this->_storeMock->expects($this->once())->method('load')->with($storeCode); + $this->_storeMock->expects($this->any())->method('load')->with($storeCode); $this->_storeMock->expects($this->any())->method('getId')->will($this->returnValue($storeId)); $dataMock = $this->getMock('Magento\App\Config\Data', array(), array(), '', false); @@ -134,7 +140,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase )->method( 'getData' )->with( - "sotres|{$storeCode}" + "stores|{$storeCode}" )->will( $this->returnValue(array('config' => array('key1' => 'store_value1', 'key2' => 'store_value2'))) ); @@ -152,14 +158,26 @@ class StoreTest extends \PHPUnit_Framework_TestCase ) ) ); + $this->_storeManagerMock->expects( + $getStoreExpectsCount + )->method( + 'getStore' + )->will( + $this->returnValue($this->_storeMock) + ); $expectedData = array( 'config' => array( - 'key0' => 'website_value0', // value from website scope + 'key0' => 'website_value0', 'key1' => 'store_db_value1', - 'key2' => 'store_value2', // value that has not been overridden in DB + 'key2' => 'store_value2', 'key3' => 'store_db_value3' ) ); $this->assertEquals($expectedData, $this->_model->read($storeCode)); } + + public function readDataProvider() + { + return array(array('default', $this->never()), array(null, $this->once())); + } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/WebsiteTest.php similarity index 87% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/WebsiteTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/WebsiteTest.php index e32e440c0b0828bc79f927d174daaeb56f8982a8..65663a36c08aabe5f9da4b49fca214c6855bb479 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Scope/Reader/WebsiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Config/Reader/WebsiteTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Scope\Reader; +namespace Magento\Store\Model\Config\Reader; class WebsiteTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Config\Scope\Reader\Website + * @var \Magento\Store\Model\Config\Reader\Website */ protected $_model; @@ -60,20 +60,26 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $this->_initialConfigMock = $this->getMock('Magento\App\Config\Initial', array(), array(), '', false); $this->_scopePullMock = $this->getMock('Magento\App\Config\ScopePool', array(), array(), '', false); $this->_collectionFactory = $this->getMock( - 'Magento\Core\Model\Resource\Config\Value\Collection\ScopedFactory', + 'Magento\Store\Model\Resource\Config\Collection\ScopedFactory', array('create'), array(), '', false ); - $websiteFactoryMock = $this->getMock('Magento\Core\Model\WebsiteFactory', array('create'), array(), '', false); - $this->_websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $websiteFactoryMock = $this->getMock( + 'Magento\Store\Model\WebsiteFactory', + array('create'), + array(), + '', + false + ); + $this->_websiteMock = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); $websiteFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->_websiteMock)); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); - $this->_model = new \Magento\Core\Model\Config\Scope\Reader\Website( + $this->_model = new \Magento\Store\Model\Config\Reader\Website( $this->_initialConfigMock, $this->_scopePullMock, new \Magento\App\Config\Scope\Converter(), @@ -141,9 +147,9 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase ); $expectedData = array( 'config' => array( - 'key0' => 'default_value0', // value from default section + 'key0' => 'default_value0', 'key1' => 'website_db_value1', - 'key2' => 'website_value2', // value that has not been overridden in DB + 'key2' => 'website_value2', 'key3' => 'website_db_value3' ) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DefaultTest.php similarity index 86% rename from dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/Storage/DefaultTest.php index 53fe5121504061e1bb785c3e26b1e6e3da9537bf..f96dc64bab2ea8e3537fdc62b0b790061c6c63fc 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Store/Storage/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DefaultTest.php @@ -22,10 +22,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store\Storage; +namespace Magento\Store\Model\Storage; /** - * Test class for \Magento\Core\Model\Store\Storage\DefaultStorage + * Test class for \Magento\Store\Model\Storage\DefaultStorage */ class DefaultTest extends \PHPUnit_Framework_TestCase { @@ -67,7 +67,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_websiteMock = $this->getMock( - 'Magento\Core\Model\Website', + 'Magento\Store\Model\Website', array('getCode', 'getId', '__wakeup'), array(), '', @@ -75,7 +75,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase false ); $this->_groupMock = $this->getMock( - 'Magento\Core\Model\Store\Group', + 'Magento\Store\Model\Group', array('getCode', 'getId', '__wakeup'), array(), '', @@ -83,7 +83,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase false ); $this->_storeFactoryMock = $this->getMock( - 'Magento\Core\Model\StoreFactory', + 'Magento\Store\Model\StoreFactory', array('create'), array(), '', @@ -91,7 +91,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase false ); $this->_websiteFactoryMock = $this->getMock( - 'Magento\Core\Model\Website\Factory', + 'Magento\Store\Model\Website\Factory', array('create'), array(), '', @@ -106,7 +106,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_websiteMock) ); $this->_groupFactoryMock = $this->getMock( - 'Magento\Core\Model\Store\Group\Factory', + 'Magento\Store\Model\Group\Factory', array('create'), array(), '', @@ -121,7 +121,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_groupMock) ); $this->_storeMock = $this->getMock( - 'Magento\Core\Model\Store', + 'Magento\Store\Model\Store', array('setId', 'setCode', 'getCode', '__sleep', '__wakeup'), array(), '', @@ -159,7 +159,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase public function testGetStore() { $storeId = 'testStore'; - $this->assertInstanceOf('Magento\Core\Model\Store', $this->_model->getStore($storeId)); + $this->assertInstanceOf('Magento\Store\Model\Store', $this->_model->getStore($storeId)); } public function testGetStores() @@ -172,13 +172,13 @@ class DefaultTest extends \PHPUnit_Framework_TestCase public function testGetWebsite() { $websiteId = 'testWebsite'; - $this->assertInstanceOf('Magento\Core\Model\Website', $this->_model->getWebsite($websiteId)); + $this->assertInstanceOf('Magento\Store\Model\Website', $this->_model->getWebsite($websiteId)); } public function testGetWebsiteEmptyString() { $websiteId = ''; - $this->assertInstanceOf('Magento\Core\Model\Website', $this->_model->getWebsite($websiteId)); + $this->assertInstanceOf('Magento\Store\Model\Website', $this->_model->getWebsite($websiteId)); } public function testGetWebsitesWithDefault() @@ -188,7 +188,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->_websiteMock->expects($this->once())->method('getCode')->will($this->returnValue(0)); $this->_websiteMock->expects($this->never())->method('getId'); $result = $this->_model->getWebsites($withDefault, $codeKey); - $this->assertInstanceOf('Magento\Core\Model\Website', $result[0]); + $this->assertInstanceOf('Magento\Store\Model\Website', $result[0]); } public function testGetWebsitesWithoutDefault() @@ -204,7 +204,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase public function testGetGroup() { $groupId = 'testGroup'; - $this->assertInstanceOf('Magento\Core\Model\Store\Group', $this->_model->getGroup($groupId)); + $this->assertInstanceOf('Magento\Store\Model\Group', $this->_model->getGroup($groupId)); } public function testGetGroupsWithDefault() @@ -214,7 +214,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase $this->_groupMock->expects($this->once())->method('getCode')->will($this->returnValue(0)); $this->_groupMock->expects($this->never())->method('getId'); $result = $this->_model->getGroups($withDefault, $codeKey); - $this->assertInstanceOf('Magento\Core\Model\Store\Group', $result[0]); + $this->assertInstanceOf('Magento\Store\Model\Group', $result[0]); } public function testGetGroupsWithoutDefault() diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/StorageFactoryTest.php similarity index 59% rename from dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/StorageFactoryTest.php index eceb9f6e107c7e3872cf28a0f544e67b6d20c1b3..dbf53b651f32d7139a0367af4128c7ab32d9c318 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Store/StorageFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/StorageFactoryTest.php @@ -1,6 +1,6 @@ <?php /** - * Test class for \Magento\Core\Model\Store\StorageFactory + * Test class for \Magento\Store\Model\StorageFactory * * Magento * @@ -20,18 +20,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Store; +namespace Magento\Store\Model; class StorageFactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Store\StorageFactory + * @var \Magento\Store\Model\StorageFactory */ protected $_model; @@ -60,15 +57,25 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_appStateMock; + /** + * @var \Magento\Stdlib\Cookie + */ + protected $_cookie; + + /** + * @var \Magento\App\Http\Context + */ + protected $_httpContext; + /** * @var string */ - protected $_defaultStorage = 'Magento\Core\Model\Store\Storage\DefaultStorage'; + protected $_defaultStorage = 'Magento\Store\Model\Storage\DefaultStorage'; /** * @var string */ - protected $_dbStorage = 'Magento\Core\Model\Store\Storage\Db'; + protected $_dbStorage = 'Magento\Store\Model\Storage\Db'; /** * @var array @@ -80,22 +87,33 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase */ protected $_storage; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_scopeConfig; + protected function setUp() { - $this->_arguments = array('test' => 'argument'); + $this->_arguments = array('test' => 'argument', 'scopeCode' => '', 'scopeType' => ''); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $this->_logMock = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_sidResolverMock = $this->getMock('\Magento\Session\SidResolverInterface', array(), array(), '', false); $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); - $this->_storage = $this->getMock('Magento\Core\Model\Store\StorageInterface'); + $this->_storage = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $this->_cookie = $this->getMock('Magento\Stdlib\Cookie', array(), array(), '', false); + $this->_httpContext = $this->getMock('Magento\App\Http\Context', array(), array(), '', false); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); - $this->_model = new \Magento\Core\Model\Store\StorageFactory( + $this->_model = new \Magento\Store\Model\StorageFactory( $this->_objectManagerMock, $this->_eventManagerMock, $this->_logMock, $this->_sidResolverMock, $this->_appStateMock, + $this->_cookie, + $this->_httpContext, + $this->_scopeConfig, $this->_defaultStorage, $this->_dbStorage ); @@ -130,26 +148,28 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->exactly(2))->method('isInstalled')->will($this->returnValue(true)); - $store = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_storage->expects($this->exactly(2))->method('getStore')->will($this->returnValue($store)); - $store->expects( + $this->_scopeConfig->expects( $this->at(0) )->method( - 'getConfig' + 'isSetFlag' )->with( - $this->equalTo(\Magento\Core\Model\Session\SidResolver::XML_PATH_USE_FRONTEND_SID) + \Magento\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue(true) ); - $store->expects( + $this->_scopeConfig->expects( $this->at(1) )->method( - 'getConfig' + 'isSetFlag' )->with( - $this->equalTo('dev/log/active') + 'dev/log/active', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE )->will( $this->returnValue(true) ); @@ -171,6 +191,7 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase )->with( 'core_app_init_current_store_after' ); + $this->_logMock->expects($this->once())->method('unsetLoggers'); $this->_logMock->expects($this->exactly(2))->method('addStreamLog'); @@ -190,7 +211,7 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); - $invalidObject = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $invalidObject = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); $this->_objectManagerMock->expects( $this->once() @@ -212,4 +233,43 @@ class StorageFactoryTest extends \PHPUnit_Framework_TestCase /** test read instance from internal cache */ $this->assertEquals($this->_storage, $this->_model->get($this->_arguments)); } + + public function testGetWishStoresReinit() + { + $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); + + $website = $this->getMock('Magento\Store\Model\Website', array(), array(), '', false); + $website->expects($this->once())->method('getCode')->will($this->returnValue('code')); + $website->expects($this->any())->method('getDefaultGroupId')->will($this->returnValue(1)); + + $group = $this->getMock( + 'Magento\Store\Model\Group', + array('getDefaultStoreId', '__sleep', '__wakeup'), + array(), + '', + false + ); + $group->expects($this->any())->method('getDefaultStoreId')->will($this->returnValue(1)); + + $store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $store->expects($this->once())->method('getCode')->will($this->returnValue(1)); + $store->expects($this->once())->method('getId')->will($this->returnValue(1)); + $store->expects($this->once())->method('getIsActive')->will($this->returnValue(true)); + $store->expects($this->any())->method('getConfig')->will($this->returnValue(1)); + + $storage = $this->getMock('Magento\Store\Model\Storage\Db', array(), array(), '', false); + $storage->expects($this->any())->method('getWebsite')->will($this->returnValue($website)); + $storage->expects($this->any())->method('getWebsites')->will($this->returnValue(array('code' => $website))); + $storage->expects($this->any())->method('getGroups')->will($this->returnValue(array('1' => $group))); + $storage->expects($this->any())->method('getStores')->will($this->returnValue(array('1' => $store))); + $storage->expects($this->any())->method('setCurrentStore')->with('1'); + $storage->expects($this->any())->method('getCurrentStore')->will($this->returnValue(1)); + $storage->expects($this->any())->method('getStore')->will($this->returnValue($store)); + + $this->_objectManagerMock->expects($this->once())->method('create')->will($this->returnValue($storage)); + + $this->_cookie->expects($this->any())->method('get')->will($this->returnValue(1)); + + $this->assertEquals($storage, $this->_model->get($this->_arguments)); + } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/StoreManagerTest.php similarity index 72% rename from dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/StoreManagerTest.php index 933a3db8504b9f2afcc54af3036dc81ec18f8140..6a64d1047a23e15338851c55cdcd648fcad0d986 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/StoreManagerTest.php @@ -1,6 +1,6 @@ <?php /** - * Test class for \Magento\Core\Model\StoreManager + * Test class for \Magento\Store\Model\StoreManager * * Magento * @@ -20,18 +20,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; class StoreManagerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\StoreManager + * @var \Magento\Store\Model\StoreManager */ protected $_model; @@ -57,12 +54,12 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_factoryMock = $this->getMock('Magento\Core\Model\Store\StorageFactory', array(), array(), '', false); + $this->_factoryMock = $this->getMock('Magento\Store\Model\StorageFactory', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false); $this->_helperMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $this->_storage = $this->getMock('Magento\Core\Model\Store\StorageInterface'); + $this->_storage = $this->getMock('Magento\Store\Model\StoreManagerInterface'); - $this->_model = new \Magento\Core\Model\StoreManager( + $this->_model = new \Magento\Store\Model\StoreManager( $this->_factoryMock, $this->_requestMock, $this->_helperMock, @@ -183,53 +180,4 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->_model->isSingleStoreMode()); } - - public function testGetSafeStoreWithoutException() - { - $this->_factoryMock->expects($this->any())->method('get')->will($this->returnValue($this->_storage)); - $this->_storage->expects($this->once())->method('getStore')->with(10)->will($this->returnValue('storeObject')); - $this->_requestMock->expects($this->never())->method('setActionName'); - $this->_model->getSafeStore(10); - } - - public function testGetSafeStoreWithExceptionWithCurrentStore() - { - $this->_factoryMock->expects($this->any())->method('get')->will($this->returnValue($this->_storage)); - $this->_storage->expects( - $this->once() - )->method( - 'getStore' - )->with( - 10 - )->will( - $this->throwException(new \Exception('test')) - ); - - $this->_storage->expects($this->once())->method('getCurrentStore')->will($this->returnValue('current')); - $this->_requestMock->expects($this->once())->method('setActionName')->with('noroute'); - - $this->assertInstanceOf('Magento\Object', $this->_model->getSafeStore(10)); - } - - /** - * @expectedException \Magento\Model\Exception - */ - public function testGetSafeStoreWithExceptionAndWithoutCurrentStore() - { - $this->_factoryMock->expects($this->any())->method('get')->will($this->returnValue($this->_storage)); - $this->_storage->expects( - $this->once() - )->method( - 'getStore' - )->with( - 10 - )->will( - $this->throwException(new \Exception('test')) - ); - - $this->_storage->expects($this->once())->method('getCurrentStore')->will($this->returnValue(false)); - $this->_requestMock->expects($this->never())->method('setActionName'); - - $this->_model->getSafeStore(10); - } } diff --git a/dev/tests/unit/testsuite/Magento/Store/Model/StoresConfigTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/StoresConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..dfbb7b0f3450a96a9c86cfbebba9e2c7b4ff98c5 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Store/Model/StoresConfigTest.php @@ -0,0 +1,114 @@ +<?php +/** + * Test class for \Magento\Store\Model\Store\StoresConfig + * + * 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. + * + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Store\Model; + +class StoresConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Store\Model\StoresConfig + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeOne; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_storeTwo; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_config; + + protected function setUp() + { + $this->_storeOne = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->_storeTwo = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->_storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $this->_config = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + + $this->_model = new \Magento\Store\Model\StoresConfig( + $this->_storeManager, + $this->_config + ); + } + + public function testGetStoresConfigByPath() + { + $path = 'config/path'; + + $this->_storeOne + ->expects($this->at(0)) + ->method('getCode') + ->will($this->returnValue('code_0')); + + $this->_storeOne + ->expects($this->at(1)) + ->method('getId') + ->will($this->returnValue(0)); + + $this->_storeTwo + ->expects($this->at(0)) + ->method('getCode') + ->will($this->returnValue('code_1')); + + $this->_storeTwo + ->expects($this->at(1)) + ->method('getId') + ->will($this->returnValue(1)); + + $this->_storeManager + ->expects($this->once()) + ->method('getStores') + ->with(true) + ->will($this->returnValue(array(0 => $this->_storeOne, 1 => $this->_storeTwo))); + + $this->_config + ->expects($this->at(0)) + ->method('getValue') + ->with($path, 'store', 'code_0') + ->will($this->returnValue(0)); + + $this->_config + ->expects($this->at(1)) + ->method('getValue') + ->with($path, 'store', 'code_1') + ->will($this->returnValue(1)); + + $this->assertEquals(array(0 => 0, 1 => 1), $this->_model->getStoresConfigByPath($path)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/WebsiteTest.php similarity index 88% rename from dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php rename to dev/tests/unit/testsuite/Magento/Store/Model/WebsiteTest.php index f14aab593e4f0123be1418690f01a0e9e332ee90..9ae6fa5dd64f4198cb64c5a05df507cd49eb5bcf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/WebsiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/WebsiteTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; class WebsiteTest extends \PHPUnit_Framework_TestCase { @@ -30,7 +30,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $websiteCollection = $this->getMock( - 'Magento\Core\Model\Resource\Website\Collection', + 'Magento\Store\Model\Resource\Website\Collection', array('getSize'), array(), '', @@ -39,7 +39,7 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $websiteCollection->expects($this->any())->method('getSize')->will($this->returnValue(2)); $websiteFactory = $this->getMock( - 'Magento\Core\Model\WebsiteFactory', + 'Magento\Store\Model\WebsiteFactory', array('create', 'getCollection', '__wakeup'), array(), '', @@ -48,9 +48,9 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase $websiteFactory->expects($this->any())->method('create')->will($this->returnValue($websiteFactory)); $websiteFactory->expects($this->any())->method('getCollection')->will($this->returnValue($websiteCollection)); - /** @var \Magento\Core\Model\Website $websiteModel */ + /** @var \Magento\Store\Model\Website $websiteModel */ $websiteModel = $objectManager->getObject( - 'Magento\Core\Model\Website', + 'Magento\Store\Model\Website', array('websiteFactory' => $websiteFactory) ); $websiteModel->setId(2); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/DirectoryScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/DirectoryScannerTest.php index 22b77e6913f3639c545442bcc5147494d09398f7..a2ddd5eae45326d40ed762049f4b91f0b41d8eae 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/DirectoryScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/DirectoryScannerTest.php @@ -64,7 +64,7 @@ class DirectoryScannerTest extends \PHPUnit_Framework_TestCase $this->_testDir . '/app/code/Magento/SomeModule/etc/config.xml' ), 'view' => array($this->_testDir . '/app/code/Magento/SomeModule/view/frontend/default.xml'), - 'design' => array($this->_testDir . '/app/design/adminhtml/magento_backend/layout.xml'), + 'design' => array($this->_testDir . '/app/design/adminhtml/Magento/backend/layout.xml'), 'etc' => array($this->_testDir . '/app/etc/additional.xml', $this->_testDir . '/app/etc/config.xml') ); $this->assertEquals(sort($expected['php']), sort($actual['php']), 'Incorrect php files list'); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml index d9f2dd9f0efb43052f48288b34769973a3199b42..2073ec34b1889104ae7af80f1ea005365a562d82 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml @@ -35,6 +35,6 @@ </arguments> <plugin name="first" type="Magento\Core\Model\Action\Plugin" /> </type> - <virtualType name="customStoreManagerProxy" type="Magento\Core\Model\StoreManager\Proxy" /> - <virtualType name="customLayoutFactory" type="Magento\Core\Model\Layout\Factory" /> + <virtualType name="customStoreManagerProxy" type="Magento\Store\Model\StoreManager\Proxy" /> + <virtualType name="customLayoutFactory" type="Magento\View\Layout\Factory" /> </config> diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/System/Configuration/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/System/Configuration/ReaderTest.php index a5a517abedad8a85b9175f1d858dec9e7ed4f179..dc885fe08ed0e51f1d4ae373b2233702d0acfd0b 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/System/Configuration/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Migration/System/Configuration/ReaderTest.php @@ -91,7 +91,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ); } - public function testGetConfiguration() + public function testgetConfiguration() { $this->_fileManagerMock->expects( $this->once() diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php index c715ab514c8ed05d6bd1baf33b62d16b77139d49..8410a115e6eb6e71184b0aadcde3d287247851a1 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Adminhtml/System/Design/Theme/Tab/CssTest.php @@ -107,15 +107,15 @@ class CssTest extends \PHPUnit_Framework_TestCase { $method = self::getMethod('_getAdditionalElementTypes'); - /** @var $configModel \Magento\App\ConfigInterface */ - $configModel = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); + /** @var $configModel \Magento\App\Config\ScopeConfigInterface */ + $configModel = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_objectManager->expects( $this->any() )->method( 'get' )->with( - 'Magento\App\ConfigInterface' + 'Magento\App\Config\ScopeConfigInterface' )->will( $this->returnValue($configModel) ); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/FooterTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/FooterTest.php index eebaa27f9631a4984bb84c2549faebc51c7d40af..12020a5a4a11d399a25146f652927827818e95f7 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/FooterTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/FooterTest.php @@ -44,7 +44,7 @@ class FooterTest extends \PHPUnit_Framework_TestCase public function testGetIdentities() { $this->assertEquals( - array(\Magento\Core\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG), + array(\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG), $this->block->getIdentities() ); } diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeadTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeadTest.php index f8ce03424849971c9f48625bc4f7c275975a994e..8111dbd475e511e1c01362b55c335c0c92466c89 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeadTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeadTest.php @@ -90,7 +90,7 @@ class HeadTest extends \PHPUnit_Framework_TestCase public function testGetFaviconFile() { - $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + $storeMock = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); $storeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue('baseUrl/')); $this->_context->getStoreManager()->expects( $this->any() @@ -100,12 +100,12 @@ class HeadTest extends \PHPUnit_Framework_TestCase $this->returnValue($storeMock) ); - $this->_context->getStoreConfig()->expects( + $this->_context->getScopeConfig()->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->will( - $this->returnValue('storeConfig') + $this->returnValue('scopeConfig') ); $mediaDirMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); @@ -114,7 +114,7 @@ class HeadTest extends \PHPUnit_Framework_TestCase )->method( 'isFile' )->with( - 'favicon/storeConfig' + 'favicon/scopeConfig' )->will( $this->returnValue(true) ); @@ -126,6 +126,6 @@ class HeadTest extends \PHPUnit_Framework_TestCase $this->returnValue($mediaDirMock) ); - $this->assertEquals('baseUrl/favicon/storeConfig', $this->_block->getFaviconFile()); + $this->assertEquals('baseUrl/favicon/scopeConfig', $this->_block->getFaviconFile()); } } diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php index 6b38dd37a370a891109b8e3c6eceae0763e907a7..a7e2a1c1db43ccd99f3bae3caf22a546a907e828 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php @@ -35,11 +35,11 @@ class HeaderTest extends \PHPUnit_Framework_TestCase { $filesystem = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false); $mediaDirectory = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); - $storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array('getConfig'), array(), '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $urlBuilder = $this->getMock('Magento\UrlInterface'); - $storeConfig->expects($this->once())->method('getConfig')->will($this->returnValue('default/image.gif')); + $scopeConfig->expects($this->once())->method('getValue')->will($this->returnValue('default/image.gif')); $urlBuilder->expects( $this->once() )->method( @@ -63,7 +63,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $arguments = array( - 'storeConfig' => $storeConfig, + 'scopeConfig' => $scopeConfig, 'urlBuilder' => $urlBuilder, 'fileStorageHelper' => $helper, 'filesystem' => $filesystem diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/Config/CustomizationTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/Config/CustomizationTest.php index eaf77f376e986f21241e10fe89a8c2a183d71672..c2c293025bae76f3d4c0b8e51f6a5dbf1bd3a6d7 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Config/CustomizationTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Config/CustomizationTest.php @@ -33,7 +33,7 @@ namespace Magento\Theme\Model\Config; class CustomizationTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -60,7 +60,7 @@ class CustomizationTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_storeManager = $this->getMockForAbstractClass( - 'Magento\Core\Model\StoreManagerInterface', + 'Magento\Store\Model\StoreManagerInterface', array(), '', true, @@ -270,7 +270,7 @@ class CustomizationTest extends \PHPUnit_Framework_TestCase */ protected function _getAssignedTheme() { - return new \Magento\Object(array('id' => 1, 'theme_path' => 'magento_plushe')); + return new \Magento\Object(array('id' => 1, 'theme_path' => 'Magento/plushe')); } /** @@ -278,7 +278,7 @@ class CustomizationTest extends \PHPUnit_Framework_TestCase */ protected function _getUnassignedTheme() { - return new \Magento\Object(array('id' => 2, 'theme_path' => 'magento_blank')); + return new \Magento\Object(array('id' => 2, 'theme_path' => 'Magento/blank')); } /** diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php index 121babc45058a5e2938f1902c1912ce5b081d986..1dcf9115c7faa63425f87d026e96c72882f5c235 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php @@ -60,7 +60,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\App\Config\Storage\WriterInterface */ - protected $_storeConfigWriter; + protected $_scopeConfigWriter; /** * @var \Magento\Theme\Model\Config @@ -72,7 +72,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** @var $this->_themeMock \Magento\Core\Model\Theme */ $this->_themeMock = $this->getMock('Magento\Core\Model\Theme', array(), array(), '', false); $this->_storeManagerMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\StoreManagerInterface', + 'Magento\Store\Model\StoreManagerInterface', array(), '', true, @@ -81,7 +81,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase array('getStores', 'isSingleStoreMode') ); $this->_configData = $this->getMock( - 'Magento\Core\Model\Config\Value', + 'Magento\App\Config\Value', array('getCollection', 'addFieldToFilter', '__wakeup'), array(), '', @@ -90,14 +90,14 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_configCacheMock = $this->getMockForAbstractClass('Magento\Cache\FrontendInterface'); $this->_layoutCacheMock = $this->getMockForAbstractClass('Magento\Cache\FrontendInterface'); - $this->_storeConfigWriter = $this->getMock( + $this->_scopeConfigWriter = $this->getMock( 'Magento\App\Config\Storage\WriterInterface', array('save', 'delete') ); $this->_model = new \Magento\Theme\Model\Config( $this->_configData, - $this->_storeConfigWriter, + $this->_scopeConfigWriter, $this->_storeManagerMock, $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->_configCacheMock, @@ -122,7 +122,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(true)); - $themePath = 'magento_blank'; + $themePath = 'Magento/blank'; /** Unassign themes from store */ $configEntity = new \Magento\Object(array('value' => 6, 'scope_id' => 8)); @@ -140,7 +140,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'addFieldToFilter' )->with( 'scope', - \Magento\Core\Model\ScopeInterface::SCOPE_STORES + \Magento\Store\Model\ScopeInterface::SCOPE_STORES )->will( $this->returnValue($this->_configData) ); @@ -159,9 +159,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_themeMock->expects($this->any())->method('getId')->will($this->returnValue(6)); $this->_themeMock->expects($this->any())->method('getThemePath')->will($this->returnValue($themePath)); - $this->_storeConfigWriter->expects($this->once())->method('delete'); + $this->_scopeConfigWriter->expects($this->once())->method('delete'); - $this->_storeConfigWriter->expects($this->once())->method('save'); + $this->_scopeConfigWriter->expects($this->once())->method('save'); $this->_model->assignToStore($this->_themeMock, array(2, 3, 5)); } @@ -173,7 +173,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(false)); - $themePath = 'magento_blank'; + $themePath = 'Magento/blank'; /** Unassign themes from store */ $configEntity = new \Magento\Object(array('value' => 6, 'scope_id' => 8)); @@ -191,7 +191,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'addFieldToFilter' )->with( 'scope', - \Magento\Core\Model\ScopeInterface::SCOPE_STORES + \Magento\Store\Model\ScopeInterface::SCOPE_STORES )->will( $this->returnValue($this->_configData) ); @@ -210,9 +210,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_themeMock->expects($this->any())->method('getId')->will($this->returnValue(6)); $this->_themeMock->expects($this->any())->method('getThemePath')->will($this->returnValue($themePath)); - $this->_storeConfigWriter->expects($this->once())->method('delete'); + $this->_scopeConfigWriter->expects($this->once())->method('delete'); - $this->_storeConfigWriter->expects($this->exactly(3))->method('save'); + $this->_scopeConfigWriter->expects($this->exactly(3))->method('save'); $this->_model->assignToStore($this->_themeMock, array(2, 3, 5)); } diff --git a/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php index dbc47938fa916235ff61da3f2dc373aa0fdcf7a1..292d18fecfd71671f79ac5db53e4fd9f5dc3f974 100644 --- a/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php +++ b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php @@ -26,7 +26,7 @@ namespace Magento\Translate; class InlineTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\BaseScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\ScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $scopeResolverMock; @@ -57,7 +57,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->scopeResolverMock = $this->getMock('Magento\BaseScopeResolverInterface', array(), array(), '', false); + $this->scopeResolverMock = $this->getMock('Magento\App\ScopeResolverInterface', array(), array(), '', false); $this->urlMock = $this->getMock('Magento\UrlInterface', array(), array(), '', false); $this->layoutMock = $this->getMock('Magento\View\LayoutInterface', array(), array(), '', false); $this->configMock = $this->getMock('Magento\Translate\Inline\ConfigInterface', array(), array(), '', false); @@ -287,7 +287,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ protected function prepareIsAllowed($isEnabled, $isActive, $isDevAllowed, $scope = null) { - $scopeMock = $this->getMock('Magento\BaseScopeInterface', array(), array(), '', false); + $scopeMock = $this->getMock('Magento\App\Config\ScopeConfigInterface', array(), array(), '', false); $this->stateMock->expects($this->any())->method('isEnabled')->will($this->returnValue($isEnabled)); $this->scopeResolverMock->expects( $this->once() diff --git a/dev/tests/unit/testsuite/Magento/TranslateTest.php b/dev/tests/unit/testsuite/Magento/TranslateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c902e2afa1f7375017e09e4af3da49e02aeb4316 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/TranslateTest.php @@ -0,0 +1,235 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento; + +use Magento\TestFramework\Matcher\MethodInvokedAtIndex; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * + */ +class TranslateTest extends \PHPUnit_Framework_TestCase +{ + /** @var Translate */ + protected $_translate; + + /** @var \Magento\View\DesignInterface */ + protected $_viewDesign; + + /** @var \Magento\Locale\Hierarchy\Config */ + protected $_config; + + /** @var \Magento\Cache\FrontendInterface */ + protected $_cache; + + /** @var \Magento\View\FileSystem */ + protected $_viewFileSystem; + + /** @var \Magento\Module\ModuleList */ + protected $_moduleList; + + /** @var \Magento\Module\Dir\Reader */ + protected $_modulesReader; + + /** @var \Magento\App\ScopeResolverInterface */ + protected $_scopeResolver; + + /** @var \Magento\Translate\ResourceInterface */ + protected $_resource; + + /** @var \Magento\Locale\ResolverInterface */ + protected $_locale; + + /** @var \Magento\App\State */ + protected $_appState; + + /** @var \Magento\App\Filesystem */ + protected $_filesystem; + + /** @var \Magento\App\RequestInterface */ + protected $_request; + + /** @var \Magento\File\Csv */ + protected $_csvParser; + + /** @var \Magento\Filesystem\Directory\ReadInterface */ + protected $_directory; + + public function setUp() + { + $this->_viewDesign = $this->getMock('\Magento\View\DesignInterface', [], [], '', false); + $this->_config = $this->getMock('\Magento\Locale\Hierarchy\Config', [], [], '', false); + $this->_cache = $this->getMock('\Magento\Cache\FrontendInterface', [], [], '', false); + $this->_viewFileSystem = $this->getMock('\Magento\View\FileSystem', [], [], '', false); + $this->_moduleList = $this->getMock('\Magento\Module\ModuleList', [], [], '', false); + $this->_modulesReader = $this->getMock('\Magento\Module\Dir\Reader', [], [], '', false); + $this->_scopeResolver = $this->getMock('\Magento\App\ScopeResolverInterface', [], [], '', false); + $this->_resource = $this->getMock('\Magento\Translate\ResourceInterface', [], [], '', false); + $this->_locale = $this->getMock('\Magento\Locale\ResolverInterface', [], [], '', false); + $this->_appState = $this->getMock('\Magento\App\State', [], [], '', false); + $this->_request = $this->getMock('\Magento\App\RequestInterface', [], [], '', false); + $this->_csvParser = $this->getMock('\Magento\File\Csv', [], [], '', false); + + $this->_directory = $this->getMock('\Magento\Filesystem\Directory\ReadInterface', [], [], '', false); + $filesystem = $this->getMock('\Magento\App\Filesystem', [], [], '', false); + $filesystem->expects($this->once())->method('getDirectoryRead')->will($this->returnValue($this->_directory)); + + $this->_translate = new Translate( + $this->_viewDesign, + $this->_config, + $this->_cache, + $this->_viewFileSystem, + $this->_moduleList, + $this->_modulesReader, + $this->_scopeResolver, + $this->_resource, + $this->_locale, + $this->_appState, + $filesystem, + $this->_request, + $this->_csvParser + ); + } + + /** + * @param string $area + * @param bool $forceReload + * @param array $cachedData + * @dataProvider dataProviderForTestLoadData + */ + public function testLoadData($area, $forceReload, $cachedData) + { + $this->_expectsSetConfig(); + + $this->_cache->expects($this->exactly($forceReload ? 0 : 1)) + ->method('load') + ->will($this->returnValue(serialize($cachedData))); + + if (!$forceReload && $cachedData !== false) { + $this->_translate->loadData($area, $forceReload); + $this->assertEquals($cachedData, $this->_translate->getData()); + return; + } + + $this->_directory->expects($this->any())->method('isExist')->will($this->returnValue(true)); + + // _loadModuleTranslation() + $modules = [['name' => 'module']]; + $this->_moduleList->expects($this->once())->method('getModules')->will($this->returnValue($modules)); + $moduleData = ['module original' => 'module translated']; + $this->_modulesReader->expects($this->any())->method('getModuleDir')->will($this->returnValue('/app/module')); + $this->_csvParser->expects(new MethodInvokedAtIndex(0)) + ->method('getDataPairs') + ->with('/app/module/en_US.csv') + ->will($this->returnValue($moduleData)); + + // _loadThemeTranslation() + $themeData = ['theme original' => 'theme translated']; + $this->_viewFileSystem->expects($this->once())->method('getFilename')->will($this->returnValue('/theme.csv')); + $this->_csvParser->expects(new MethodInvokedAtIndex(1)) + ->method('getDataPairs') + ->with('/theme.csv') + ->will($this->returnValue($themeData)); + + // _loadDbTranslation() + $dbData = ['db original' => 'db translated']; + $this->_resource->expects($this->any())->method('getTranslationArray')->will($this->returnValue($dbData)); + + $this->_cache->expects($this->exactly($forceReload ? 0 : 1)) + ->method('save'); + + $this->_translate->loadData($area, $forceReload); + + $expected = $moduleData + $themeData + $dbData; + $this->assertEquals($expected, $this->_translate->getData()); + } + + public function dataProviderForTestLoadData() + { + $cachedData = ['cached 1' => 'translated 1', 'cached 2' => 'translated 2']; + return [ + ['adminhtml', true, false], + ['adminhtml', false, $cachedData], + ['frontend', true, false], + ['frontend', false, $cachedData], + [null, true, false], + [null, false, $cachedData] + ]; + } + + public function testGetData() + { + $data = array('original 1' => 'translated 1', 'original 2' => 'translated 2'); + $this->_cache->expects($this->once()) + ->method('load') + ->will($this->returnValue(serialize($data))); + $this->_expectsSetConfig(); + $this->_translate->loadData('frontend'); + $this->assertEquals($data, $this->_translate->getData()); + } + + public function testGetLocale() + { + $this->_locale->expects($this->once())->method('getLocaleCode')->will($this->returnValue('en_US')); + $this->assertEquals('en_US', $this->_translate->getLocale()); + + $this->_locale->expects($this->never())->method('getLocaleCode'); + $this->assertEquals('en_US', $this->_translate->getLocale()); + + $this->_locale->expects($this->never())->method('getLocaleCode'); + $this->_translate->setLocale('en_GB'); + $this->assertEquals('en_GB', $this->_translate->getLocale()); + } + + public function testSetLocale() + { + $this->_translate->setLocale('en_GB'); + $this->_locale->expects($this->never())->method('getLocaleCode'); + $this->assertEquals('en_GB', $this->_translate->getLocale()); + } + + public function testGetTheme() + { + $this->_request->expects($this->at(0))->method('getParam')->with('theme')->will($this->returnValue('')); + + $requestTheme = array('theme_title' => 'Theme Title'); + $this->_request->expects($this->at(1))->method('getParam')->with('theme') + ->will($this->returnValue($requestTheme)); + + $this->assertEquals('theme', $this->_translate->getTheme()); + $this->assertEquals('themeTheme Title', $this->_translate->getTheme()); + } + + /** + * Declare calls expectation for setConfig() method + */ + protected function _expectsSetConfig() + { + $this->_locale->expects($this->any())->method('getLocaleCode')->will($this->returnValue('en_US')); + $scope = new \Magento\Object(); + $this->_scopeResolver->expects($this->any())->method('getScope')->will($this->returnValue($scope)); + $designTheme = new \Magento\Object(['id' => 'themeId']); + $this->_viewDesign->expects($this->any())->method('getDesignTheme')->will($this->returnValue($designTheme)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php index 466850e73c4bc2a98278721784e81dcaf48ee4af..51d136d193d68eb17a97b746b235e1424c829828 100644 --- a/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php @@ -31,9 +31,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $model; /** - * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $storeConfigMock; + protected $scopeConfigMock; /** * @var \Magento\Core\Helper\Data|\PHPUnit_Framework_MockObject_MockObject @@ -42,16 +42,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->storeConfigMock = $this->getMock( - 'Magento\Core\Model\Store\Config', - array('getConfigFlag'), - array(), - '', - false - ); + $this->scopeConfigMock = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->helperMock = $this->getMock('Magento\Core\Helper\Data', array('isDevAllowed'), array(), '', false); $this->model = new Config( - $this->storeConfigMock, + $this->scopeConfigMock, $this->helperMock ); } @@ -60,19 +54,24 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $store = 'some store'; $result = 'result'; - - $this->storeConfigMock->expects( + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + $scopeConfig->expects( $this->once() )->method( - 'getConfigFlag' + 'isSetFlag' )->with( $this->equalTo('dev/translate_inline/active'), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->equalTo($store) )->will( $this->returnValue($result) ); - - $this->assertEquals($result, $this->model->isActive($store)); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $config = $objectManager->getObject( + '\Magento\Translation\Model\Inline\Config', + array('scopeConfig' => $scopeConfig) + ); + $this->assertEquals($result, $config->isActive($store)); } public function testIsDevAllowed() diff --git a/dev/tests/unit/testsuite/Magento/UrlRewrite/App/Request/RewriteServiceTest.php b/dev/tests/unit/testsuite/Magento/UrlRewrite/App/Request/RewriteServiceTest.php index d3b2ccaccea93b227c342e63fc7f1e57e15db0c1..5a344773d1375636d52f2f4db9694c107be0abae 100644 --- a/dev/tests/unit/testsuite/Magento/UrlRewrite/App/Request/RewriteServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/UrlRewrite/App/Request/RewriteServiceTest.php @@ -53,7 +53,7 @@ class RewriteServiceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_routerListMock = $this->getMock('\Magento\App\RouterList', array(), array(), '', false); - $this->_configMock = $this->getMock('\Magento\App\ConfigInterface', array(), array(), '', false); + $this->_configMock = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); $this->_requestMock = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); $this->_rewriteFactoryMock = $this->getMock( '\Magento\UrlRewrite\Model\UrlRewriteFactory', diff --git a/dev/tests/unit/testsuite/Magento/UrlTest.php b/dev/tests/unit/testsuite/Magento/UrlTest.php index 7299071825ef7f4581c63a339e36e6b157e57ff8..22d768817fb76f30bd51237295ae1b644f5f83bc 100644 --- a/dev/tests/unit/testsuite/Magento/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/UrlTest.php @@ -26,6 +26,7 @@ namespace Magento; /** * Test class for Magento\Url + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class UrlTest extends \PHPUnit_Framework_TestCase { @@ -59,6 +60,11 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected $sessionMock; + /** + * @var \Magento\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + protected function setUp() { $this->routeParamsResolverMock = $this->getMock('Magento\Core\Model\Url\RouteParamsResolver', @@ -68,6 +74,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->queryParamsResolverMock = $this->getMock('Magento\Url\QueryParamsResolverInterface', [], [], '', false); $this->sidResolverMock = $this->getMock('Magento\Session\SidResolverInterface'); $this->sessionMock = $this->getMock('Magento\Session\Generic', [], [], '', false); + $this->scopeConfig = $this->getMock('\Magento\App\Config\ScopeConfigInterface'); } /** @@ -97,6 +104,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ protected function getUrlModel($arguments = []) { + $arguments = array_merge($arguments, ['scopeType' => \Magento\Store\Model\ScopeInterface::SCOPE_STORE]); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); return $objectManager->getObject('Magento\Url', $arguments); } @@ -462,8 +470,13 @@ class UrlTest extends \PHPUnit_Framework_TestCase 'urlSecurityInfo' => $urlSecurityInfoMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), 'scopeResolver' => $this->scopeResolverMock, + 'scopeConfig' => $this->scopeConfig ]); + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->with($this->equalTo($configPath), \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->scopeMock) + ->will($this->returnValue('http://localhost/')); $this->routeParamsResolverMock->expects($this->at(0))->method('hasData')->with('secure_is_forced') ->will($this->returnValue(false)); $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); @@ -473,8 +486,6 @@ class UrlTest extends \PHPUnit_Framework_TestCase $this->routeParamsResolverMock->expects($this->any())->method('getType') ->will($this->returnValue($urlType)); $this->routeParamsResolverMock->expects($this->once())->method('getData')->will($this->returnValue($isSecure)); - $this->scopeMock->expects($this->once())->method('getConfig')->with($configPath) - ->will($this->returnValue('http://localhost/')); $urlSecurityInfoMock->expects($this->exactly($isSecureCallCount))->method('isSecure') ->will($this->returnValue(false)); @@ -496,17 +507,21 @@ class UrlTest extends \PHPUnit_Framework_TestCase $model = $this->getUrlModel([ 'routeParamsResolver' => $this->getRouteParamsResolver(), 'scopeResolver' => $this->scopeResolverMock, + 'scopeConfig' => $this->scopeConfig ]); + $this->scopeConfig->expects($this->any()) + ->method('getValue') + ->with( + 'web/secure/base_url_secure_forced', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->scopeMock + ) + ->will($this->returnValue('http://localhost/')); $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') ->will($this->returnValue(true)); $this->routeParamsResolverMock->expects($this->once())->method('getData')->with('secure') ->will($this->returnValue(true)); $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); - $this->scopeMock->expects($this->once())->method('getConfig')->with('web/secure/base_url_secure_forced') - ->will($this->returnValue('http://localhost/')); - $this->assertEquals('http://localhost/', $model->getConfigData('base_url_secure_forced')); } diff --git a/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php b/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php index 427634f1488ddc3dcd94bfc8086725fc7d9ff7e0..468a2e82c5f3399a7b97118c1f429d7d580abc11 100644 --- a/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/unit/testsuite/Magento/User/Model/UserTest.php @@ -55,10 +55,10 @@ class UserTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Mail\TransportInterface|PHPUnit_Framework_MockObject_MockObject */ protected $_transportMock; - /** @var \Magento\Core\Model\StoreManagerInterface|PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\StoreManagerInterface|PHPUnit_Framework_MockObject_MockObject */ protected $_storeManagerMock; - /** @var \Magento\Core\Model\Store|PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Store\Model\Store|PHPUnit_Framework_MockObject_MockObject */ protected $_storetMock; /** @var \Magento\Backend\App\ConfigInterface */ @@ -125,12 +125,12 @@ class UserTest extends \PHPUnit_Framework_TestCase array() )->getMock(); $this->_storetMock = $this->getMockBuilder( - '\Magento\Core\Model\Store' + '\Magento\Store\Model\Store' )->disableOriginalConstructor()->setMethods( array() )->getMock(); $this->_storeManagerMock = $this->getMockBuilder( - '\Magento\Core\Model\StoreManagerInterface' + '\Magento\Store\Model\StoreManagerInterface' )->disableOriginalConstructor()->setMethods( array() )->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php index cd0198b0d36e73e0b81dfe819f7309a8790539fe..80251399ad75c3e8046095dd1c49a6fc86bb68f0 100644 --- a/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php @@ -47,18 +47,18 @@ class CarrierTest extends \PHPUnit_Framework_TestCase { $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $coreStoreConfig = $this->getMockBuilder( - '\Magento\Core\Model\Store\Config' + $scopeConfig = $this->getMockBuilder( + '\Magento\App\Config\ScopeConfigInterface' )->setMethods( - array('getConfigFlag', 'getConfig') + array('isSetFlag', 'getValue') )->disableOriginalConstructor()->getMock(); - $coreStoreConfig->expects($this->any())->method('getConfigFlag')->will($this->returnValue(true)); - $coreStoreConfig->expects( + $scopeConfig->expects($this->any())->method('isSetFlag')->will($this->returnValue(true)); + $scopeConfig->expects( $this->any() )->method( - 'getConfig' + 'getValue' )->will( - $this->returnCallback(array($this, 'coreStoreConfigGetConfig')) + $this->returnCallback(array($this, 'scopeConfiggetValue')) ); // xml element factory @@ -131,7 +131,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase $data = array('id' => 'usps', 'store' => '1'); $arguments = array( - 'coreStoreConfig' => $coreStoreConfig, + 'scopeConfig' => $scopeConfig, 'xmlElFactory' => $xmlElFactory, 'rateFactory' => $rateFactory, 'rateMethodFactory' => $rateMethodFactory, @@ -186,11 +186,11 @@ class CarrierTest extends \PHPUnit_Framework_TestCase } /** - * Callback function, emulates getConfig function + * Callback function, emulates getValue function * @param $path * @return null|string */ - public function coreStoreConfigGetConfig($path) + public function scopeConfiggetValue($path) { switch ($path) { case 'carriers/usps/allowed_methods': diff --git a/dev/tests/unit/testsuite/Magento/Validator/Constraint/Option/CallbackTest.php b/dev/tests/unit/testsuite/Magento/Validator/Constraint/Option/CallbackTest.php index 86c7ebf791b2ada1ea4f113733f81b6f9a201360..9132232863b5ee504099e1cc1fdcd4702dd3ba8b 100644 --- a/dev/tests/unit/testsuite/Magento/Validator/Constraint/Option/CallbackTest.php +++ b/dev/tests/unit/testsuite/Magento/Validator/Constraint/Option/CallbackTest.php @@ -40,7 +40,7 @@ class CallbackTest extends \PHPUnit_Framework_TestCase /** * Test getValue method * - * @dataProvider getValueDataProvider + * @dataProvider getConfigDataProvider * * @param callable $callback * @param mixed $expectedResult @@ -56,7 +56,7 @@ class CallbackTest extends \PHPUnit_Framework_TestCase /** * Data provider for testGetValue */ - public function getValueDataProvider() + public function getConfigDataProvider() { $functionName = create_function('', 'return "Value from function";'); $closure = function () { diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Theme/FlyweightFactoryTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Theme/FlyweightFactoryTest.php index 73c25826bd02b4eb16aa8b65c7896c3336940d98..f571f7172cc9adcf3f9e76a24c1634d12c812963 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/FlyweightFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/FlyweightFactoryTest.php @@ -70,7 +70,7 @@ class FlyweightFactoryTest extends \PHPUnit_Framework_TestCase */ public function testCreateByPath() { - $path = 'frontend/magento_plushe'; + $path = 'frontend/Magento/plushe'; $themeId = 7; $theme = $this->getMock('Magento\Core\Model\Theme', array(), array(), '', false); $theme->expects($this->exactly(3))->method('getId')->will($this->returnValue($themeId)); @@ -82,7 +82,7 @@ class FlyweightFactoryTest extends \PHPUnit_Framework_TestCase )->method( 'getThemeByFullPath' )->with( - 'frontend/frontend/magento_plushe' + 'frontend/frontend/Magento/plushe' )->will( $this->returnValue($theme) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/ScheduledStructureTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/ScheduledStructureTest.php similarity index 83% rename from dev/tests/unit/testsuite/Magento/Core/Model/Layout/ScheduledStructureTest.php rename to dev/tests/unit/testsuite/Magento/View/Layout/ScheduledStructureTest.php index 44678c9a656f6492d6e46df75b9940da13f22e7e..ce0b50b578e1184e4ad7f8c8425e720a0cba37d7 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/ScheduledStructureTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/ScheduledStructureTest.php @@ -18,22 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\View\Layout; /** - * Test class for \Magento\Core\Model\Layout\ScheduledStructure + * Test class for \Magento\View\Layout\ScheduledStructure */ -namespace Magento\Core\Model\Layout; - class ScheduledStructureTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Layout\ScheduledStructure + * @var \Magento\View\Layout\ScheduledStructure */ protected $_model; @@ -77,11 +73,11 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase 'path4' => 'path 4' ) ); - $this->_model = new \Magento\Core\Model\Layout\ScheduledStructure($this->_scheduledData); + $this->_model = new \Magento\View\Layout\ScheduledStructure($this->_scheduledData); } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getListToMove + * @covers \Magento\View\Layout\ScheduledStructure::getListToMove */ public function testGetListToMove() { @@ -93,7 +89,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getListToRemove + * @covers \Magento\View\Layout\ScheduledStructure::getListToRemove */ public function testGetListToRemove() { @@ -105,7 +101,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getElements + * @covers \Magento\View\Layout\ScheduledStructure::getElements */ public function testGetElements() { @@ -113,7 +109,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getElement + * @covers \Magento\View\Layout\ScheduledStructure::getElement */ public function testGetElement() { @@ -125,7 +121,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::isElementsEmpty + * @covers \Magento\View\Layout\ScheduledStructure::isElementsEmpty */ public function testIsElementsEmpty() { @@ -135,7 +131,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::setElement + * @covers \Magento\View\Layout\ScheduledStructure::setElement */ public function testSetElement() { @@ -153,7 +149,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::hasElement + * @covers \Magento\View\Layout\ScheduledStructure::hasElement */ public function testHasElement() { @@ -162,7 +158,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::unsetElement + * @covers \Magento\View\Layout\ScheduledStructure::unsetElement */ public function testUnsetElement() { @@ -172,7 +168,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getElementToMove + * @covers \Magento\View\Layout\ScheduledStructure::getElementToMove */ public function testGetElementToMove() { @@ -185,7 +181,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::setElementToMove + * @covers \Magento\View\Layout\ScheduledStructure::setElementToMove */ public function testSetElementToMove() { @@ -203,7 +199,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::unsetElementFromListToRemove + * @covers \Magento\View\Layout\ScheduledStructure::unsetElementFromListToRemove */ public function testUnsetElementFromListToRemove() { @@ -213,7 +209,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::setElementToRemoveList + * @covers \Magento\View\Layout\ScheduledStructure::setElementToRemoveList */ public function testSetElementToRemoveList() { @@ -223,7 +219,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getStructure + * @covers \Magento\View\Layout\ScheduledStructure::getStructure */ public function testGetStructure() { @@ -231,7 +227,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getStructureElement + * @covers \Magento\View\Layout\ScheduledStructure::getStructureElement */ public function testGetStructureElement() { @@ -243,7 +239,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::isStructureEmpty + * @covers \Magento\View\Layout\ScheduledStructure::isStructureEmpty */ public function testIsStructureEmpty() { @@ -253,7 +249,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::hasStructureElement + * @covers \Magento\View\Layout\ScheduledStructure::hasStructureElement */ public function testHasStructureElement() { @@ -262,7 +258,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::setStructureElement + * @covers \Magento\View\Layout\ScheduledStructure::setStructureElement */ public function testSetStructureElement() { @@ -280,7 +276,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::unsetStructureElement + * @covers \Magento\View\Layout\ScheduledStructure::unsetStructureElement */ public function testUnsetStructureElement() { @@ -290,7 +286,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getPaths + * @covers \Magento\View\Layout\ScheduledStructure::getPaths */ public function testGetPaths() { @@ -298,7 +294,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::getPath + * @covers \Magento\View\Layout\ScheduledStructure::getPath */ public function testGetPath() { @@ -308,7 +304,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::hasPath + * @covers \Magento\View\Layout\ScheduledStructure::hasPath */ public function testHasPath() { @@ -317,7 +313,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::setPathElement + * @covers \Magento\View\Layout\ScheduledStructure::setPathElement */ public function testSetPathElement() { @@ -335,7 +331,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::unsetPathElement + * @covers \Magento\View\Layout\ScheduledStructure::unsetPathElement */ public function testUnsetPathElement() { @@ -345,7 +341,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::flushPaths + * @covers \Magento\View\Layout\ScheduledStructure::flushPaths */ public function testFlushPaths() { @@ -355,7 +351,7 @@ class ScheduledStructureTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Layout\ScheduledStructure::flushScheduledStructure + * @covers \Magento\View\Layout\ScheduledStructure::flushScheduledStructure */ public function testFlushScheduledStructure() { diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/unit/testsuite/Magento/View/LayoutTest.php similarity index 52% rename from dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php rename to dev/tests/unit/testsuite/Magento/View/LayoutTest.php index ea1ba62a6d85a77e4793e459f703d9cf7b8033a9..d70dfda352a6a014bfb0b1c95d1930af2f00913b 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/unit/testsuite/Magento/View/LayoutTest.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; class LayoutTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Layout + * @var \Magento\View\Layout */ protected $_model; @@ -40,6 +40,26 @@ class LayoutTest extends \PHPUnit_Framework_TestCase */ protected $_blockFactoryMock; + /** + * @var \Magento\View\Layout\ProcessorFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $processorFactoryMock; + + /** + * @var \Magento\App\State|\PHPUnit_Framework_MockObject_MockObject + */ + protected $appStateMock; + + /** + * @var \Magento\View\Design\Theme\ResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $themeResolverMock; + + /** + * @var \Magento\Core\Model\Layout\Merge|\PHPUnit_Framework_MockObject_MockObject + */ + protected $processorMock; + protected function setUp() { $this->_structureMock = $this->getMockBuilder( @@ -52,11 +72,39 @@ class LayoutTest extends \PHPUnit_Framework_TestCase )->setMethods( array('createBlock') )->disableOriginalConstructor()->getMock(); + $this->processorFactoryMock = $this->getMock( + 'Magento\View\Layout\ProcessorFactory', + ['create'], + [], + '', + false + ); + $this->appStateMock = $this->getMock( + 'Magento\App\State', + [], + [], + '', + false + ); + $this->themeResolverMock = $this->getMockForAbstractClass('Magento\View\Design\Theme\ResolverInterface'); + $this->processorMock = $this->getMock( + 'Magento\Core\Model\Layout\Merge', + ['__destruct'], + [], + '', + false + ); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $objectManagerHelper->getObject( - 'Magento\Core\Model\Layout', - array('structure' => $this->_structureMock, 'blockFactory' => $this->_blockFactoryMock) + 'Magento\View\Layout', + array( + 'structure' => $this->_structureMock, + 'blockFactory' => $this->_blockFactoryMock, + 'themeResolver' => $this->themeResolverMock, + 'processorFactory' => $this->processorFactoryMock, + 'appState' => $this->appStateMock, + ) ); } @@ -78,4 +126,30 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $this->_model->createBlock('type', 'blockname', array()); $this->assertInstanceOf('Magento\View\Element\AbstractBlock', $this->_model->getBlock('blockname')); } + + public function testGetUpdate() + { + $themeMock = $this->getMockForAbstractClass('Magento\View\Design\ThemeInterface'); + + $this->themeResolverMock->expects( + $this->once() + )->method( + 'get' + )->will( + $this->returnValue($themeMock) + ); + + $this->processorFactoryMock->expects( + $this->once() + )->method( + 'create' + )->with( + array('theme' => $themeMock) + )->will( + $this->returnValue($this->processorMock) + ); + + $this->assertEquals($this->processorMock, $this->_model->getUpdate()); + $this->assertEquals($this->processorMock, $this->_model->getUpdate()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index caa8a15dd3b4663d91f1469332a6902b18a22463..32d3c82baf10ea6533b1cd17c1f9c13f09d38f57 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -25,9 +25,14 @@ */ namespace Magento\Webapi\Controller; +use Magento\Webapi\Exception as WebapiException; +use Magento\Webapi\ServiceResourceNotFoundException; +use Magento\Webapi\ServiceAuthorizationException; +use Magento\Webapi\ServiceException; + class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Webapi\Controller\ErrorProcessor */ + /** @var ErrorProcessor */ protected $_errorProcessor; /** @var \Magento\Core\Helper\Data */ @@ -55,7 +60,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase $filesystemMock = $this->getMockBuilder('\Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); /** Initialize SUT. */ - $this->_errorProcessor = new \Magento\Webapi\Controller\ErrorProcessor( + $this->_errorProcessor = new ErrorProcessor( $this->_helperMock, $this->_appStateMock, $this->_loggerMock, @@ -193,7 +198,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** Init Logical exception. */ $errorMessage = 'Error Message'; $logicalException = new \LogicException($errorMessage); - /** Assert that Logic exception is converted to \Magento\Webapi\Exception without message obfuscation. */ + /** Assert that Logic exception is converted to WebapiException without message obfuscation. */ $maskedException = $this->_errorProcessor->maskException($logicalException); $this->assertInstanceOf('Magento\Webapi\Exception', $maskedException); $this->assertEquals( @@ -226,7 +231,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { return array( 'Magento\Service\ResourceNotFoundException' => array( - new \Magento\Service\ResourceNotFoundException( + new ServiceResourceNotFoundException( 'Resource not found', 2345, null, @@ -234,13 +239,13 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 'resourceNotFound', 'resource10' ), - \Magento\Webapi\Exception::HTTP_NOT_FOUND, + WebapiException::HTTP_NOT_FOUND, 'Resource not found', 2345, array('datail1' => 'value1', 'resource_id' => 'resource10') ), 'Magento_Service_ResourceNotFoundException (Empty message)' => array( - new \Magento\Service\ResourceNotFoundException( + new ServiceResourceNotFoundException( '', 2345, null, @@ -248,13 +253,13 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 'resourceNotFound', 'resource10' ), - \Magento\Webapi\Exception::HTTP_NOT_FOUND, + WebapiException::HTTP_NOT_FOUND, "Resource with ID 'resource10' not found.", 2345, array('datail1' => 'value1', 'resource_id' => 'resource10') ), - 'Magento\Service\AuthorizationException' => array( - new \Magento\Service\AuthorizationException( + 'Magento\Webapi\ServiceAuthorizationException' => array( + new ServiceAuthorizationException( 'Service authorization exception', 345, null, @@ -263,35 +268,35 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 3, 4 ), - \Magento\Webapi\Exception::HTTP_UNAUTHORIZED, + WebapiException::HTTP_UNAUTHORIZED, 'Service authorization exception', 345, array('user_id' => 3, 'resource_id' => 4) ), - 'Magento\Service\AuthorizationException (Empty message)' => array( - new \Magento\Service\AuthorizationException('', 345, null, array(), 'authorization', 3, 4), - \Magento\Webapi\Exception::HTTP_UNAUTHORIZED, + 'Magento\Webapi\ServiceAuthorizationException (Empty message)' => array( + new ServiceAuthorizationException('', 345, null, array(), 'authorization', 3, 4), + WebapiException::HTTP_UNAUTHORIZED, "User with ID '3' is not authorized to access resource with ID '4'.", 345, array('user_id' => 3, 'resource_id' => 4) ), - 'Magento\Service\Exception' => array( - new \Magento\Service\Exception('Generic service exception', 4567), - \Magento\Webapi\Exception::HTTP_BAD_REQUEST, + 'Magento\Webapi\ServiceException' => array( + new ServiceException('Generic service exception', 4567), + WebapiException::HTTP_BAD_REQUEST, 'Generic service exception', 4567, array() ), - 'Magento\Service\Exception\With\Parameters' => array( - new \Magento\Service\Exception('Parameterized service exception', 1234, null, array("P1", "P2")), - \Magento\Webapi\Exception::HTTP_BAD_REQUEST, + 'Magento\Webapi\ServiceException\With\Parameters' => array( + new ServiceException('Parameterized service exception', 1234, null, array("P1", "P2")), + WebapiException::HTTP_BAD_REQUEST, 'Parameterized service exception', 1234, array("P1", "P2") ), 'Exception' => array( new \Exception('Non service exception', 5678), - \Magento\Webapi\Exception::HTTP_INTERNAL_ERROR, + WebapiException::HTTP_INTERNAL_ERROR, 'Internal Error. Details are available in Magento log file. Report ID: webapi-', 0, array() @@ -315,7 +320,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase $expectedCode, $expectedDetails ) { - /** All masked exceptions must be \Magento\Webapi\Exception */ + /** All masked exceptions must be WebapiException */ $expectedType = 'Magento\Webapi\Exception'; $this->assertInstanceOf( $expectedType, @@ -324,7 +329,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase $maskedException ) . "'." ); - /** @var $maskedException \Magento\Webapi\Exception */ + /** @var $maskedException WebapiException */ $this->assertEquals( $expectedHttpCode, $maskedException->getHttpCode(), diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/XmlTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/XmlTest.php index 710d94ce69a8ca8cb9edfbf56a574e1a02bd2b2b..f9c52c350e40a6205bcc837125595755c38a4af1 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/XmlTest.php @@ -96,7 +96,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase ), array( array('.key' => 'value'), - '<?xml version="1.0"?><response><item_.key>value</item_.key></response>', + '<?xml version="1.0"?><response><item_key>value</item_key></response>', 'Invalid XML render with "." symbol in data index.' ), array( diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php index f9e5b391955efcb105e9855883eeafa28b27a8b0..a8a29bdf0fb4f3c492b3c20b8eaba498c550b795 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/Request/HandlerTest.php @@ -23,6 +23,9 @@ */ namespace Magento\Webapi\Controller\Soap\Request; +use Magento\Service\DataObjectConverter; +use Magento\Webapi\Model\Soap\Config as SoapConfig; + /** * Test for \Magento\Webapi\Controller\Soap\Request\Handler. */ @@ -43,8 +46,8 @@ class HandlerTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_authzServiceMock; - /** @var \Magento\Webapi\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ - protected $_helperMock; + /** @var DataObjectConverter|\PHPUnit_Framework_MockObject_MockObject */ + protected $_dataObjectConverter; /** @var \Magento\Webapi\Helper\Data|\PHPUnit_Framework_MockObject_MockObject */ protected $_serializerMock; @@ -55,35 +58,26 @@ class HandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { /** Prepare mocks for SUT constructor. */ - $this->_apiConfigMock = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\Config' - )->setMethods( - array('getServiceMethodInfo') - )->disableOriginalConstructor()->getMock(); - $this->_requestMock = $this->getMock('Magento\Webapi\Controller\Soap\Request', array(), array(), '', false); - $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false); - $this->_authzServiceMock = $this->getMock( - 'Magento\Authz\Service\AuthorizationV1Interface', - array(), - array(), - '', - false - ); - $this->_helperMock = $this->getMock('Magento\Webapi\Helper\Data', array(), array(), '', false); - $this->_serializerMock = $this->getMock( - 'Magento\Webapi\Controller\ServiceArgsSerializer', - array(), - array(), + $this->_apiConfigMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Config') + ->setMethods(array('getServiceMethodInfo'))->disableOriginalConstructor()->getMock(); + $this->_requestMock = $this->getMock('Magento\Webapi\Controller\Soap\Request', [], [], '', false); + $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', [], [], '', false); + $this->_authzServiceMock = $this->getMock('Magento\Authz\Service\AuthorizationV1Interface', [], [], '', false); + $this->_dataObjectConverter = $this->getMock( + 'Magento\Service\DataObjectConverter', + ['convertStdObjectToArray'], + [], '', false ); + $this->_serializerMock = $this->getMock('Magento\Webapi\Controller\ServiceArgsSerializer', [], [], '', false); /** Initialize SUT. */ $this->_handler = new \Magento\Webapi\Controller\Soap\Request\Handler( $this->_requestMock, $this->_objectManagerMock, $this->_apiConfigMock, $this->_authzServiceMock, - $this->_helperMock, + $this->_dataObjectConverter, $this->_serializerMock ); parent::setUp(); @@ -92,54 +86,41 @@ class HandlerTest extends \PHPUnit_Framework_TestCase public function testCall() { $requestedServices = array('requestedServices'); - $this->_requestMock->expects( - $this->once() - )->method( - 'getRequestedServices' - )->will( - $this->returnValue($requestedServices) - ); + $this->_requestMock->expects($this->once()) + ->method('getRequestedServices') + ->will($this->returnValue($requestedServices)); + $this->_dataObjectConverter->expects($this->once()) + ->method('convertStdObjectToArray') + ->will($this->returnValue(['field' => 1])); $operationName = 'soapOperation'; $className = 'Magento\Object'; $methodName = 'testMethod'; $isSecure = false; $aclResources = array('Magento_TestModule::resourceA'); - $this->_apiConfigMock->expects( - $this->once() - )->method( - 'getServiceMethodInfo' - )->with( - $operationName, - $requestedServices - )->will( - $this->returnValue( - array( - \Magento\Webapi\Model\Soap\Config::KEY_CLASS => $className, - \Magento\Webapi\Model\Soap\Config::KEY_METHOD => $methodName, - \Magento\Webapi\Model\Soap\Config::KEY_IS_SECURE => $isSecure, - \Magento\Webapi\Model\Soap\Config::KEY_ACL_RESOURCES => $aclResources + $this->_apiConfigMock->expects($this->once()) + ->method('getServiceMethodInfo') + ->with($operationName, $requestedServices) + ->will( + $this->returnValue( + array( + SoapConfig::KEY_CLASS => $className, + SoapConfig::KEY_METHOD => $methodName, + SoapConfig::KEY_IS_SECURE => $isSecure, + SoapConfig::KEY_ACL_RESOURCES => $aclResources + ) ) - ) - ); + ); $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true)); - $serviceMock = $this->getMockBuilder( - $className - )->disableOriginalConstructor()->setMethods( - array($methodName) - )->getMock(); + $serviceMock = $this->getMockBuilder($className) + ->disableOriginalConstructor() + ->setMethods(array($methodName)) + ->getMock(); $serviceResponse = array('foo' => 'bar'); $serviceMock->expects($this->once())->method($methodName)->will($this->returnValue($serviceResponse)); - $this->_objectManagerMock->expects( - $this->once() - )->method( - 'get' - )->with( - $className - )->will( - $this->returnValue($serviceMock) - ); + $this->_objectManagerMock->expects($this->once())->method('get')->with($className) + ->will($this->returnValue($serviceMock)); $this->_serializerMock->expects($this->once())->method('getInputData')->will($this->returnArgument(2)); /** Execute SUT. */ diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Helper/DataTest.php index 624f654b4885bdfb8d7c2b669cf7a7141fbc4e5a..e28c952ac039eb806a02c0a2f0c8a917d481b2d8 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Helper/DataTest.php @@ -91,16 +91,6 @@ class DataTest extends \PHPUnit_Framework_TestCase array('Foo\\BarV1Interface') // Module and 'Service' missed ); } - - public function testDataGetterNameToFieldName() - { - $this->assertEquals('id', $this->_helper->dataObjectGetterNameToFieldName('getId')); - } - - public function testDataFieldNameToSetterName() - { - $this->assertEquals('setId', $this->_helper->dataObjectFieldNameToSetterName('id')); - } } require_once realpath(__DIR__ . '/../_files/test_interfaces.php'); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php index 2a55c3f49b8cf58a411ad9df1ff2e70c528ceab4..f544fbddb637c56f958e68bb581b72491ca47867 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php @@ -124,7 +124,6 @@ class FaultTest extends \PHPUnit_Framework_TestCase <m:value>2</m:value> </m:GenericFaultParameter> </m:Parameters> - <m:Code>111</m:Code> </m:GenericFault> </env:Detail> </env:Fault> @@ -185,7 +184,6 @@ XML; 'Sender', array( Fault::NODE_DETAIL_PARAMETERS => array('key1' => 'value1', 'key2' => 'value2', 'value3'), - Fault::NODE_DETAIL_CODE => 333, Fault::NODE_DETAIL_TRACE => 'Trace', 'Invalid' => 'This node should be skipped' ), @@ -266,7 +264,6 @@ XML; <m:value>2</m:value> </m:GenericFaultParameter> </m:Parameters> - <m:Code>{$code}</m:Code> </m:GenericFault> </env:Detail> </env:Fault> diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php index d1c4c1dcfe3b0cbd23a027b766fcf812fe99779a..e04ddf7aadb7aed49cffd943b9a953fa3431e6cf 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php @@ -30,7 +30,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Soap\Server */ protected $_soapServer; - /** @var \Magento\Core\Model\Store */ + /** @var \Magento\Store\Model\Store */ protected $_storeMock; /** @var \Magento\Webapi\Controller\Soap\Request */ @@ -39,7 +39,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\DomDocument\Factory */ protected $_domDocumentFactory; - /** @var \Magento\Core\Model\StoreManagerInterface */ + /** @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManagerMock; /** @var \Magento\Webapi\Model\Soap\Server\Factory */ @@ -48,13 +48,18 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Config\ClassReflector\TypeProcessor|\PHPUnit_Framework_MockObject_MockObject */ protected $_typeProcessor; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_scopeConfig; + protected function setUp() { $this->_storeManagerMock = $this->getMockBuilder( - 'Magento\Core\Model\StoreManager' + 'Magento\Store\Model\StoreManager' )->disableOriginalConstructor()->getMock(); - $this->_storeMock = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); + $this->_storeMock = $this->getMockBuilder( + 'Magento\Store\Model\Store' + )->disableOriginalConstructor()->getMock(); $this->_storeMock->expects( $this->any() )->method( @@ -95,6 +100,8 @@ class ServerTest extends \PHPUnit_Framework_TestCase false ); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); + /** Init SUT. */ $this->_soapServer = new \Magento\Webapi\Model\Soap\Server( $areaListMock, @@ -103,7 +110,8 @@ class ServerTest extends \PHPUnit_Framework_TestCase $this->_domDocumentFactory, $this->_storeManagerMock, $this->_soapServerFactory, - $this->_typeProcessor + $this->_typeProcessor, + $this->_scopeConfig ); parent::setUp(); @@ -125,7 +133,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase */ public function testGetApiCharset() { - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue('Windows-1251')); + $this->_scopeConfig->expects($this->once())->method('getValue')->will($this->returnValue('Windows-1251')); $this->assertEquals( 'Windows-1251', $this->_soapServer->getApiCharset(), @@ -138,7 +146,7 @@ class ServerTest extends \PHPUnit_Framework_TestCase */ public function testGetApiCharsetDefaultEncoding() { - $this->_storeMock->expects($this->once())->method('getConfig')->will($this->returnValue(null)); + $this->_scopeConfig->expects($this->once())->method('getValue')->will($this->returnValue(null)); $this->assertEquals( \Magento\Webapi\Model\Soap\Server::SOAP_DEFAULT_ENCODING, $this->_soapServer->getApiCharset(), diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiObjectManager.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiObjectManager.php index a8acf2ae19cced34d119ca51920fc4e575568a45..900bcd27938a232d4a9a2580bd68eeb0a98758d6 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiObjectManager.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiObjectManager.php @@ -25,6 +25,11 @@ namespace Magento\Webapi\Service\Entity; class WebapiObjectManager implements \Magento\ObjectManager { + /** + * @var array + */ + private $configuration; + /** * Create new object instance * @@ -56,6 +61,6 @@ class WebapiObjectManager implements \Magento\ObjectManager */ public function configure(array $configuration) { - return $configuration; + $this->configuration = $configuration; } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php b/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php index bfbce64c2becc5d8d480de87516cae8645a325ff..c040b7aa079e604a4d959056347221681c6013dd 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/_files/soap_fault/soap_fault_expected_xmls.php @@ -46,7 +46,6 @@ return array( <m:value>value2</m:value> </m:GenericFaultParameter> </m:Parameters> - <m:Code>333</m:Code> <m:Trace>Trace</m:Trace> </m:GenericFault> </env:Detail> diff --git a/dev/tests/unit/testsuite/Magento/Weee/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Weee/Helper/DataTest.php new file mode 100644 index 0000000000000000000000000000000000000000..371faa7f250e2482c2a9ea8bbb47bbb3b14c228d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Weee/Helper/DataTest.php @@ -0,0 +1,57 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Weee\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product + */ + protected $_product; + + /** + * @var \Magento\Weee\Helper\Data + */ + protected $_helperData; + + protected function setUp() + { + $this->_product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface', [], [], '', false); + $scopeConfig->expects($this->any())->method('getValue')->will($this->returnValue(true)); + $weeeTax = $this->getMock('Magento\Weee\Model\Tax', [], [], '', false); + $weeeTax->expects($this->any())->method('getWeeeAmount')->will($this->returnValue('11.26')); + $arguments = array( + 'scopeConfig' => $scopeConfig, + 'weeeTax' => $weeeTax + ); + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_helperData = $helper->getObject('Magento\Weee\Helper\Data', $arguments); + } + + public function testGetAmount() + { + $this->assertEquals('11.26', $this->_helperData->getAmount($this->_product)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ConfigTest.php index 3964388c68cdcd06a2e93962ce4d9297c582e6aa..0f00661058842be248e796e1408313b0783f09de 100644 --- a/dev/tests/unit/testsuite/Magento/Wishlist/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ConfigTest.php @@ -33,7 +33,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -47,7 +47,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_storeConfig = $this->getMock('Magento\Core\Model\Store\ConfigInterface'); + $this->_scopeConfig = $this->getMock('Magento\App\Config\ScopeConfigInterface'); $this->_catalogConfig = $this->getMock('Magento\Catalog\Model\Config', array(), array(), '', false); $this->_attributeConfig = $this->getMock( 'Magento\Catalog\Model\Attribute\Config', @@ -57,7 +57,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase false ); $this->_model = new \Magento\Wishlist\Model\Config( - $this->_storeConfig, + $this->_scopeConfig, $this->_catalogConfig, $this->_attributeConfig ); diff --git a/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log b/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log index e2d180edbb129fb9d913db0d1a1621ca0e6b6d68..c3479226d7d6735b9a939c3152260e0e6059bf45 100644 --- a/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log +++ b/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log @@ -1 +1 @@ -{"config\/acl\/resources\/admin\/cms\/magento_banner":"Magento_Banner::magento_banner","config\/acl\/resources\/admin\/catalog\/events":"Magento_CatalogEvent::events","config\/acl\/resources\/admin\/system\/config\/magento_catalogpermissions":"Magento_CatalogPermissions::magento_catalogpermissions","config\/acl\/resources\/admin\/catalog\/magento_catalogpermissions":"Magento_CatalogPermissions::catalog_magento_catalogpermissions","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout":"Magento_AdvancedCheckout::magento_advancedcheckout","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/view":"Magento_AdvancedCheckout::view","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/update":"Magento_AdvancedCheckout::update","config\/acl\/resources\/admin\/cms\/page\/save_revision":"Magento_VersionsCms::save_revision","config\/acl\/resources\/admin\/cms\/page\/delete_revision":"Magento_VersionsCms::delete_revision","config\/acl\/resources\/admin\/cms\/page\/publish_revision":"Magento_VersionsCms::publish_revision","config\/acl\/resources\/admin\/cms\/hierarchy":"Magento_VersionsCms::hierarchy","config\/acl\/resources\/admin\/customer\/customersegment":"Magento_CustomerSegment::customersegment","config\/acl\/resources\/admin\/report\/customers\/segment":"Magento_CustomerSegment::segment","config\/acl\/resources\/admin\/customer\/attributes":"Magento_CustomerCustomAttributes::attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_attributes":"Magento_CustomerCustomAttributes::customer_attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_address_attributes":"Magento_CustomerCustomAttributes::customer_address_attributes","config\/acl\/resources\/admin\/system\/config\/giftcardaccount":"Magento_GiftCardAccount::giftcardaccount","config\/acl\/resources\/admin\/customer\/giftcardaccount":"Magento_GiftCardAccount::customer_giftcardaccount","config\/acl\/resources\/admin\/system\/config\/giftcard":"Magento_GiftCard::giftcard","config\/acl\/resources\/admin\/system\/config\/magento_giftregistry":"Magento_GiftRegistry::magento_giftregistry","config\/acl\/resources\/admin\/customer\/magento_giftregistry":"Magento_GiftRegistry::customer_magento_giftregistry","config\/acl\/resources\/admin\/sales\/magento_giftwrapping":"Magento_GiftWrapping::magento_giftwrapping","config\/acl\/resources\/admin\/system\/convert\/enterprise_scheduled_operation":"Magento_ScheduledImportExport::enterprise_scheduled_operation","config\/acl\/resources\/admin\/customer\/magento_invitation":"Magento_Invitation::magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation":"Magento_Invitation::report_magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation\/general":"Magento_Invitation::general","config\/acl\/resources\/admin\/report\/magento_invitation\/customer":"Magento_Invitation::magento_invitation_customer","config\/acl\/resources\/admin\/report\/magento_invitation\/order":"Magento_Invitation::order","config\/acl\/resources\/admin\/system\/config\/magento_invitation":"Magento_Invitation::config_magento_invitation","config\/acl\/resources\/admin\/system\/config\/logging":"Magento_Logging::logging","config\/acl\/resources\/admin\/system\/magento_logging":"Magento_Logging::magento_logging","config\/acl\/resources\/admin\/system\/magento_logging\/events":"Magento_Logging::magento_logging_events","config\/acl\/resources\/admin\/system\/magento_logging\/backups":"Magento_Logging::backups","config\/acl\/resources\/admin\/system\/crypt_key":"Magento_Pci::crypt_key","config\/acl\/resources\/admin\/system\/acl\/locks":"Magento_Pci::locks","config\/acl\/resources\/admin\/catalog\/products\/read_product_price":"Magento_PricePermissions::read_product_price","config\/acl\/resources\/admin\/catalog\/products\/read_product_price\/edit_product_price":"Magento_PricePermissions::edit_product_price","config\/acl\/resources\/admin\/catalog\/products\/edit_product_status":"Magento_PricePermissions::edit_product_status","config\/acl\/resources\/admin\/promo\/catalog\/edit":"Magento_PromotionPermissions::edit","config\/acl\/resources\/admin\/promo\/quote\/edit":"Magento_PromotionPermissions::quote_edit","config\/acl\/resources\/admin\/promo\/magento_reminder\/edit":"Magento_PromotionPermissions::magento_reminder_edit","config\/acl\/resources\/admin\/promo\/magento_reminder":"Magento_Reminder::magento_reminder","config\/acl\/resources\/admin\/system\/config\/promo":"Magento_SalesRule::config_promo","config\/acl\/resources\/admin\/customer\/manage\/reward_balance":"Magento_Reward::reward_balance","config\/acl\/resources\/admin\/sales\/order\/actions\/create\/reward_spend":"Magento_Reward::reward_spend","config\/acl\/resources\/admin\/customer\/rates":"Magento_Reward::rates","config\/acl\/resources\/admin\/system\/config\/magento_reward":"Magento_Reward::magento_reward","config\/acl\/resources\/admin\/sales\/magento_rma":"Magento_Rma::magento_rma","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_manage":"Magento_Rma::rma_manage","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_attribute":"Magento_Rma::rma_attribute","config\/acl\/resources\/admin\/sales\/archive":"Magento_SalesArchive::archive","config\/acl\/resources\/admin\/sales\/archive\/orders":"Magento_SalesArchive::orders","config\/acl\/resources\/admin\/sales\/archive\/orders\/add":"Magento_SalesArchive::add","config\/acl\/resources\/admin\/sales\/archive\/orders\/remove":"Magento_SalesArchive::remove","config\/acl\/resources\/admin\/sales\/archive\/invoices":"Magento_SalesArchive::invoices","config\/acl\/resources\/admin\/sales\/archive\/shipments":"Magento_SalesArchive::shipments","config\/acl\/resources\/admin\/sales\/archive\/creditmemos":"Magento_SalesArchive::creditmemos","config\/acl\/resources\/admin\/catalog\/targetrule":"Magento_TargetRule::targetrule","config\/acl\/resources\/admin\/report\/customers\/wishlist":"Magento_MultipleWishlist::wishlist","config\/acl\/resources\/admin\/system\/adminnotification":"Magento_AdminNotification::adminnotification","config\/acl\/resources\/admin\/system\/adminnotification\/show_toolbar":"Magento_AdminNotification::show_toolbar","config\/acl\/resources\/admin\/system\/adminnotification\/show_list":"Magento_AdminNotification::show_list","config\/acl\/resources\/admin\/system\/adminnotification\/mark_as_read":"Magento_AdminNotification::mark_as_read","config\/acl\/resources\/admin\/system\/adminnotification\/remove":"Magento_AdminNotification::adminnotification_remove","config\/acl\/resources\/all":"Magento_Adminhtml::all","config\/acl\/resources\/admin":"Magento_Adminhtml::admin","config\/acl\/resources\/admin\/dashboard":"Magento_Adminhtml::dashboard","config\/acl\/resources\/admin\/system":"Magento_Adminhtml::system","config\/acl\/resources\/admin\/system\/store":"Magento_Adminhtml::store","config\/acl\/resources\/admin\/system\/design":"Magento_Adminhtml::design","config\/acl\/resources\/admin\/system\/design\/schedule":"Magento_Adminhtml::schedule","config\/acl\/resources\/admin\/system\/config":"Magento_Adminhtml::config","config\/acl\/resources\/admin\/system\/config\/general":"Magento_Adminhtml::config_general","config\/acl\/resources\/admin\/system\/config\/web":"Magento_Adminhtml::web","config\/acl\/resources\/admin\/system\/config\/design":"Magento_Adminhtml::config_design","config\/acl\/resources\/admin\/system\/config\/system":"Magento_Adminhtml::config_system","config\/acl\/resources\/admin\/system\/config\/advanced":"Magento_Adminhtml::advanced","config\/acl\/resources\/admin\/system\/config\/trans_email":"Magento_Adminhtml::trans_email","config\/acl\/resources\/admin\/system\/config\/dev":"Magento_Adminhtml::dev","config\/acl\/resources\/admin\/system\/config\/currency":"Magento_Adminhtml::currency","config\/acl\/resources\/admin\/system\/config\/sendfriend":"Magento_Adminhtml::sendfriend","config\/acl\/resources\/admin\/system\/config\/admin":"Magento_Adminhtml::config_admin","config\/acl\/resources\/admin\/system\/currency":"Magento_CurrencySymbol::system_currency","config\/acl\/resources\/admin\/system\/email_template":"Magento_Email::template","config\/acl\/resources\/admin\/system\/variable":"Magento_Adminhtml::variable","config\/acl\/resources\/admin\/system\/myaccount":"Magento_Adminhtml::myaccount","config\/acl\/resources\/admin\/system\/tools":"Magento_Adminhtml::tools","config\/acl\/resources\/admin\/system\/convert":"Magento_Adminhtml::convert","config\/acl\/resources\/admin\/system\/cache":"Magento_Adminhtml::cache","config\/acl\/resources\/admin\/system\/extensions":"Magento_Adminhtml::extensions","config\/acl\/resources\/admin\/system\/extensions\/local":"Magento_Adminhtml::local","config\/acl\/resources\/admin\/system\/extensions\/custom":"Magento_Adminhtml::custom","config\/acl\/resources\/admin\/global_search":"Magento_Adminhtml::global_search","config\/acl\/resources\/admin\/system\/tools\/backup":"Magento_Backup::backup","config\/acl\/resources\/admin\/system\/tools\/backup\/rollback":"Magento_Backup::rollback","config\/acl\/resources\/admin\/system\/config\/cataloginventory":"Magento_CatalogInventory::cataloginventory","config\/acl\/resources\/admin\/promo":"Magento_CatalogRule::promo","config\/acl\/resources\/admin\/promo\/catalog":"Magento_CatalogRule::promo_catalog","config\/acl\/resources\/admin\/catalog\/search":"Magento_CatalogSearch::search","config\/acl\/resources\/admin\/system\/config\/catalog":"Magento_Catalog::config_catalog","config\/acl\/resources\/admin\/catalog":"Magento_Catalog::catalog","config\/acl\/resources\/admin\/catalog\/attributes":"Magento_Catalog::catalog_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/attributes":"Magento_Catalog::attributes_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/sets":"Magento_Catalog::sets","config\/acl\/resources\/admin\/catalog\/categories":"Magento_Catalog::categories","config\/acl\/resources\/admin\/catalog\/products":"Magento_Catalog::products","config\/acl\/resources\/admin\/catalog\/update_attributes":"Magento_Catalog::update_attributes","config\/acl\/resources\/admin\/catalog\/urlrewrite":"Magento_Catalog::urlrewrite","config\/acl\/resources\/admin\/sales\/checkoutagreement":"Magento_Checkout::checkoutagreement","config\/acl\/resources\/admin\/system\/config\/checkout":"Magento_Checkout::checkout","config\/acl\/resources\/admin\/cms":"Magento_Cms::cms","config\/acl\/resources\/admin\/cms\/block":"Magento_Cms::block","config\/acl\/resources\/admin\/cms\/page":"Magento_Cms::page","config\/acl\/resources\/admin\/cms\/page\/save":"Magento_Cms::save","config\/acl\/resources\/admin\/cms\/page\/delete":"Magento_Cms::page_delete","config\/acl\/resources\/admin\/cms\/media_gallery":"Magento_Cms::media_gallery","config\/acl\/resources\/admin\/system\/config\/cms":"Magento_Cms::config_cms","config\/acl\/resources\/admin\/system\/config\/contacts":"Magento_Contacts::contacts","config\/acl\/resources\/admin\/system\/currency\/rates":"Magento_CurrencySymbol::currency_rates","config\/acl\/resources\/admin\/system\/currency\/symbols":"Magento_CurrencySymbol::symbols","config\/acl\/resources\/admin\/customer":"Magento_Customer::customer","config\/acl\/resources\/admin\/customer\/group":"Magento_Customer::group","config\/acl\/resources\/admin\/customer\/manage":"Magento_Customer::manage","config\/acl\/resources\/admin\/customer\/online":"Magento_Customer::online","config\/acl\/resources\/admin\/system\/config\/customer":"Magento_Customer::config_customer","config\/acl\/resources\/admin\/system\/design\/editor":"Magento_DesignEditor::editor","config\/acl\/resources\/admin\/system\/config\/downloadable":"Magento_Downloadable::downloadable","config\/acl\/resources\/admin\/system\/config\/google":"Magento_GoogleAnalytics::google","config\/acl\/resources\/admin\/catalog\/googleshopping":"Magento_GoogleShopping::googleshopping","config\/acl\/resources\/admin\/catalog\/googleshopping\/types":"Magento_GoogleShopping::types","config\/acl\/resources\/admin\/catalog\/googleshopping\/items":"Magento_GoogleShopping::items","config\/acl\/resources\/admin\/system\/convert\/import":"Magento_ImportExport::import","config\/acl\/resources\/admin\/system\/convert\/export":"Magento_ImportExport::export","config\/acl\/resources\/admin\/system\/index":"Magento_Index::index","config\/acl\/resources\/admin\/system\/config\/newsletter":"Magento_Newsletter::newsletter","config\/acl\/resources\/admin\/newsletter":"Magento_Newsletter::admin_newsletter","config\/acl\/resources\/admin\/newsletter\/problem":"Magento_Newsletter::problem","config\/acl\/resources\/admin\/newsletter\/queue":"Magento_Newsletter::queue","config\/acl\/resources\/admin\/newsletter\/subscriber":"Magento_Newsletter::subscriber","config\/acl\/resources\/admin\/newsletter\/template":"Magento_Newsletter::template","config\/acl\/resources\/admin\/system\/config\/oauth":"Magento_Oauth::oauth","config\/acl\/resources\/admin\/system\/config\/payment":"Magento_Payment::payment","config\/acl\/resources\/admin\/system\/config\/payment_services":"Magento_Payment::payment_services","config\/acl\/resources\/admin\/system\/config\/paypal":"Magento_Paypal::paypal","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports":"Magento_Paypal::paypal_settlement_reports","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/view":"Magento_Paypal::paypal_settlement_reports_view","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/fetch":"Magento_Paypal::fetch","config\/acl\/resources\/admin\/system\/config\/persistent":"Magento_Persistent::persistent","config\/acl\/resources\/admin\/cms\/poll":"Magento_Poll::poll","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/ratings":"Magento_Rating::ratings","config\/acl\/resources\/admin\/report":"Magento_Reports::report","config\/acl\/resources\/admin\/report\/salesroot":"Magento_Reports::salesroot","config\/acl\/resources\/admin\/report\/salesroot\/sales":"Magento_Reports::salesroot_sales","config\/acl\/resources\/admin\/report\/salesroot\/tax":"Magento_Reports::tax","config\/acl\/resources\/admin\/report\/salesroot\/shipping":"Magento_Reports::shipping","config\/acl\/resources\/admin\/report\/salesroot\/invoiced":"Magento_Reports::invoiced","config\/acl\/resources\/admin\/report\/salesroot\/refunded":"Magento_Reports::refunded","config\/acl\/resources\/admin\/report\/salesroot\/coupons":"Magento_Reports::coupons","config\/acl\/resources\/admin\/report\/shopcart":"Magento_Reports::shopcart","config\/acl\/resources\/admin\/report\/shopcart\/product":"Magento_Reports::product","config\/acl\/resources\/admin\/report\/shopcart\/abandoned":"Magento_Reports::abandoned","config\/acl\/resources\/admin\/report\/products":"Magento_Reports::report_products","config\/acl\/resources\/admin\/report\/products\/bestsellers":"Magento_Reports::bestsellers","config\/acl\/resources\/admin\/report\/products\/sold":"Magento_Reports::sold","config\/acl\/resources\/admin\/report\/products\/viewed":"Magento_Reports::viewed","config\/acl\/resources\/admin\/report\/products\/lowstock":"Magento_Reports::lowstock","config\/acl\/resources\/admin\/report\/products\/downloads":"Magento_Reports::downloads","config\/acl\/resources\/admin\/report\/customers":"Magento_Reports::customers","config\/acl\/resources\/admin\/report\/customers\/accounts":"Magento_Reports::accounts","config\/acl\/resources\/admin\/report\/customers\/totals":"Magento_Reports::totals","config\/acl\/resources\/admin\/report\/customers\/orders":"Magento_Reports::customers_orders","config\/acl\/resources\/admin\/report\/review":"Magento_Reports::review","config\/acl\/resources\/admin\/report\/review\/customer":"Magento_Reports::review_customer","config\/acl\/resources\/admin\/report\/review\/product":"Magento_Reports::review_product","config\/acl\/resources\/admin\/report\/tags":"Magento_Reports::tags","config\/acl\/resources\/admin\/report\/tags\/customer":"Magento_Reports::tags_customer","config\/acl\/resources\/admin\/report\/tags\/popular":"Magento_Reports::popular","config\/acl\/resources\/admin\/report\/tags\/product":"Magento_Reports::tags_product","config\/acl\/resources\/admin\/report\/search":"Magento_Reports::report_search","config\/acl\/resources\/admin\/report\/statistics":"Magento_Reports::statistics","config\/acl\/resources\/admin\/system\/config\/reports":"Magento_Reports::reports","config\/acl\/resources\/admin\/catalog\/reviews_ratings":"Magento_Review::reviews_ratings","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews":"Magento_Review::reviews","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/all":"Magento_Review::reviews_all","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/pending":"Magento_Review::pending","config\/acl\/resources\/admin\/system\/config\/rss":"Magento_Rss::rss","config\/acl\/resources\/admin\/promo\/quote":"Magento_SalesRule::quote","config\/acl\/resources\/admin\/sales":"Magento_Sales::sales","config\/acl\/resources\/admin\/sales\/order":"Magento_Sales::sales_order","config\/acl\/resources\/admin\/sales\/order\/actions":"Magento_Sales::actions","config\/acl\/resources\/admin\/sales\/order\/actions\/create":"Magento_Sales::create","config\/acl\/resources\/admin\/sales\/order\/actions\/view":"Magento_Sales::actions_view","config\/acl\/resources\/admin\/sales\/order\/actions\/email":"Magento_Sales::email","config\/acl\/resources\/admin\/sales\/order\/actions\/reorder":"Magento_Sales::reorder","config\/acl\/resources\/admin\/sales\/order\/actions\/edit":"Magento_Sales::actions_edit","config\/acl\/resources\/admin\/sales\/order\/actions\/cancel":"Magento_Sales::cancel","config\/acl\/resources\/admin\/sales\/order\/actions\/review_payment":"Magento_Sales::review_payment","config\/acl\/resources\/admin\/sales\/order\/actions\/capture":"Magento_Sales::capture","config\/acl\/resources\/admin\/sales\/order\/actions\/invoice":"Magento_Sales::invoice","config\/acl\/resources\/admin\/sales\/order\/actions\/creditmemo":"Magento_Sales::creditmemo","config\/acl\/resources\/admin\/sales\/order\/actions\/hold":"Magento_Sales::hold","config\/acl\/resources\/admin\/sales\/order\/actions\/unhold":"Magento_Sales::unhold","config\/acl\/resources\/admin\/sales\/order\/actions\/ship":"Magento_Sales::ship","config\/acl\/resources\/admin\/sales\/order\/actions\/comment":"Magento_Sales::comment","config\/acl\/resources\/admin\/sales\/order\/actions\/emails":"Magento_Sales::emails","config\/acl\/resources\/admin\/sales\/invoice":"Magento_Sales::sales_invoice","config\/acl\/resources\/admin\/sales\/shipment":"Magento_Sales::shipment","config\/acl\/resources\/admin\/sales\/creditmemo":"Magento_Sales::sales_creditmemo","config\/acl\/resources\/admin\/sales\/transactions":"Magento_Sales::transactions","config\/acl\/resources\/admin\/sales\/transactions\/fetch":"Magento_Sales::transactions_fetch","config\/acl\/resources\/admin\/sales\/recurring_payment":"Magento_Sales::recurring_payment","config\/acl\/resources\/admin\/sales\/billing_agreement":"Magento_Sales::billing_agreement","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions":"Magento_Sales::billing_agreement_actions","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/view":"Magento_Sales::billing_agreement_actions_view","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/manage":"Magento_Sales::actions_manage","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/use":"Magento_Sales::use","config\/acl\/resources\/admin\/system\/order_statuses":"Magento_Sales::order_statuses","config\/acl\/resources\/admin\/system\/config\/sales":"Magento_Sales::config_sales","config\/acl\/resources\/admin\/system\/config\/sales_email":"Magento_Sales::sales_email","config\/acl\/resources\/admin\/system\/config\/sales_pdf":"Magento_Sales::sales_pdf","config\/acl\/resources\/admin\/system\/config\/shipping":"Magento_Shipping::config_shipping","config\/acl\/resources\/admin\/system\/config\/carriers":"Magento_Shipping::carriers","config\/acl\/resources\/admin\/catalog\/sitemap":"Magento_Sitemap::sitemap","config\/acl\/resources\/admin\/system\/config\/sitemap":"Magento_Sitemap::config_sitemap","config\/acl\/resources\/admin\/sales\/tax":"Magento_Tax::sales_tax","config\/acl\/resources\/admin\/sales\/tax\/classes_customer":"Magento_Tax::classes_customer","config\/acl\/resources\/admin\/sales\/tax\/classes_product":"Magento_Tax::classes_product","config\/acl\/resources\/admin\/sales\/tax\/import_export":"Magento_Tax::import_export","config\/acl\/resources\/admin\/sales\/tax\/rates":"Magento_Tax::tax_rates","config\/acl\/resources\/admin\/sales\/tax\/rules":"Magento_Tax::rules","config\/acl\/resources\/admin\/system\/config\/tax":"Magento_Tax::config_tax","config\/acl\/resources\/admin\/system\/acl":"Magento_User::acl","config\/acl\/resources\/admin\/system\/acl\/roles":"Magento_User::acl_roles","config\/acl\/resources\/admin\/system\/acl\/users":"Magento_User::acl_users","config\/acl\/resources\/admin\/cms\/widget_instance":"Magento_Widget::widget_instance","config\/acl\/resources\/admin\/system\/config\/wishlist":"Magento_Wishlist::config_wishlist"} +{"config\/acl\/resources\/admin\/cms\/magento_banner":"Magento_Banner::magento_banner","config\/acl\/resources\/admin\/catalog\/events":"Magento_CatalogEvent::events","config\/acl\/resources\/admin\/system\/config\/magento_catalogpermissions":"Magento_CatalogPermissions::magento_catalogpermissions","config\/acl\/resources\/admin\/catalog\/magento_catalogpermissions":"Magento_CatalogPermissions::catalog_magento_catalogpermissions","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout":"Magento_AdvancedCheckout::magento_advancedcheckout","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/view":"Magento_AdvancedCheckout::view","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/update":"Magento_AdvancedCheckout::update","config\/acl\/resources\/admin\/cms\/page\/save_revision":"Magento_VersionsCms::save_revision","config\/acl\/resources\/admin\/cms\/page\/delete_revision":"Magento_VersionsCms::delete_revision","config\/acl\/resources\/admin\/cms\/page\/publish_revision":"Magento_VersionsCms::publish_revision","config\/acl\/resources\/admin\/cms\/hierarchy":"Magento_VersionsCms::hierarchy","config\/acl\/resources\/admin\/customer\/customersegment":"Magento_CustomerSegment::customersegment","config\/acl\/resources\/admin\/report\/customers\/segment":"Magento_CustomerSegment::segment","config\/acl\/resources\/admin\/customer\/attributes":"Magento_CustomerCustomAttributes::attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_attributes":"Magento_CustomerCustomAttributes::customer_attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_address_attributes":"Magento_CustomerCustomAttributes::customer_address_attributes","config\/acl\/resources\/admin\/system\/config\/giftcardaccount":"Magento_GiftCardAccount::giftcardaccount","config\/acl\/resources\/admin\/customer\/giftcardaccount":"Magento_GiftCardAccount::customer_giftcardaccount","config\/acl\/resources\/admin\/system\/config\/giftcard":"Magento_GiftCard::giftcard","config\/acl\/resources\/admin\/system\/config\/magento_giftregistry":"Magento_GiftRegistry::magento_giftregistry","config\/acl\/resources\/admin\/customer\/magento_giftregistry":"Magento_GiftRegistry::customer_magento_giftregistry","config\/acl\/resources\/admin\/sales\/magento_giftwrapping":"Magento_GiftWrapping::magento_giftwrapping","config\/acl\/resources\/admin\/system\/convert\/enterprise_scheduled_operation":"Magento_ScheduledImportExport::enterprise_scheduled_operation","config\/acl\/resources\/admin\/customer\/magento_invitation":"Magento_Invitation::magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation":"Magento_Invitation::report_magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation\/general":"Magento_Invitation::general","config\/acl\/resources\/admin\/report\/magento_invitation\/customer":"Magento_Invitation::magento_invitation_customer","config\/acl\/resources\/admin\/report\/magento_invitation\/order":"Magento_Invitation::order","config\/acl\/resources\/admin\/system\/config\/magento_invitation":"Magento_Invitation::config_magento_invitation","config\/acl\/resources\/admin\/system\/config\/logging":"Magento_Logging::logging","config\/acl\/resources\/admin\/system\/magento_logging":"Magento_Logging::magento_logging","config\/acl\/resources\/admin\/system\/magento_logging\/events":"Magento_Logging::magento_logging_events","config\/acl\/resources\/admin\/system\/magento_logging\/backups":"Magento_Logging::backups","config\/acl\/resources\/admin\/system\/crypt_key":"Magento_Pci::crypt_key","config\/acl\/resources\/admin\/system\/acl\/locks":"Magento_Pci::locks","config\/acl\/resources\/admin\/catalog\/products\/read_product_price":"Magento_PricePermissions::read_product_price","config\/acl\/resources\/admin\/catalog\/products\/read_product_price\/edit_product_price":"Magento_PricePermissions::edit_product_price","config\/acl\/resources\/admin\/catalog\/products\/edit_product_status":"Magento_PricePermissions::edit_product_status","config\/acl\/resources\/admin\/promo\/catalog\/edit":"Magento_PromotionPermissions::edit","config\/acl\/resources\/admin\/promo\/quote\/edit":"Magento_PromotionPermissions::quote_edit","config\/acl\/resources\/admin\/promo\/magento_reminder\/edit":"Magento_PromotionPermissions::magento_reminder_edit","config\/acl\/resources\/admin\/promo\/magento_reminder":"Magento_Reminder::magento_reminder","config\/acl\/resources\/admin\/system\/config\/promo":"Magento_SalesRule::config_promo","config\/acl\/resources\/admin\/customer\/manage\/reward_balance":"Magento_Reward::reward_balance","config\/acl\/resources\/admin\/sales\/order\/actions\/create\/reward_spend":"Magento_Reward::reward_spend","config\/acl\/resources\/admin\/customer\/rates":"Magento_Reward::rates","config\/acl\/resources\/admin\/system\/config\/magento_reward":"Magento_Reward::magento_reward","config\/acl\/resources\/admin\/sales\/magento_rma":"Magento_Rma::magento_rma","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_manage":"Magento_Rma::rma_manage","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_attribute":"Magento_Rma::rma_attribute","config\/acl\/resources\/admin\/sales\/archive":"Magento_SalesArchive::archive","config\/acl\/resources\/admin\/sales\/archive\/orders":"Magento_SalesArchive::orders","config\/acl\/resources\/admin\/sales\/archive\/orders\/add":"Magento_SalesArchive::add","config\/acl\/resources\/admin\/sales\/archive\/orders\/remove":"Magento_SalesArchive::remove","config\/acl\/resources\/admin\/sales\/archive\/invoices":"Magento_SalesArchive::invoices","config\/acl\/resources\/admin\/sales\/archive\/shipments":"Magento_SalesArchive::shipments","config\/acl\/resources\/admin\/sales\/archive\/creditmemos":"Magento_SalesArchive::creditmemos","config\/acl\/resources\/admin\/catalog\/targetrule":"Magento_TargetRule::targetrule","config\/acl\/resources\/admin\/report\/customers\/wishlist":"Magento_MultipleWishlist::wishlist","config\/acl\/resources\/admin\/system\/adminnotification":"Magento_AdminNotification::adminnotification","config\/acl\/resources\/admin\/system\/adminnotification\/show_toolbar":"Magento_AdminNotification::show_toolbar","config\/acl\/resources\/admin\/system\/adminnotification\/show_list":"Magento_AdminNotification::show_list","config\/acl\/resources\/admin\/system\/adminnotification\/mark_as_read":"Magento_AdminNotification::mark_as_read","config\/acl\/resources\/admin\/system\/adminnotification\/remove":"Magento_AdminNotification::adminnotification_remove","config\/acl\/resources\/all":"Magento_Adminhtml::all","config\/acl\/resources\/admin":"Magento_Adminhtml::admin","config\/acl\/resources\/admin\/dashboard":"Magento_Adminhtml::dashboard","config\/acl\/resources\/admin\/system":"Magento_Adminhtml::system","config\/acl\/resources\/admin\/system\/store":"Magento_Adminhtml::store","config\/acl\/resources\/admin\/system\/design":"Magento_Adminhtml::design","config\/acl\/resources\/admin\/system\/design\/schedule":"Magento_Adminhtml::schedule","config\/acl\/resources\/admin\/system\/config":"Magento_Adminhtml::config","config\/acl\/resources\/admin\/system\/config\/general":"Magento_Adminhtml::config_general","config\/acl\/resources\/admin\/system\/config\/web":"Magento_Adminhtml::web","config\/acl\/resources\/admin\/system\/config\/design":"Magento_Adminhtml::config_design","config\/acl\/resources\/admin\/system\/config\/system":"Magento_Adminhtml::config_system","config\/acl\/resources\/admin\/system\/config\/advanced":"Magento_Adminhtml::advanced","config\/acl\/resources\/admin\/system\/config\/trans_email":"Magento_Adminhtml::trans_email","config\/acl\/resources\/admin\/system\/config\/dev":"Magento_Adminhtml::dev","config\/acl\/resources\/admin\/system\/config\/currency":"Magento_Adminhtml::currency","config\/acl\/resources\/admin\/system\/config\/sendfriend":"Magento_Adminhtml::sendfriend","config\/acl\/resources\/admin\/system\/config\/admin":"Magento_Adminhtml::config_admin","config\/acl\/resources\/admin\/system\/currency":"Magento_CurrencySymbol::system_currency","config\/acl\/resources\/admin\/system\/email_template":"Magento_Email::template","config\/acl\/resources\/admin\/system\/variable":"Magento_Adminhtml::variable","config\/acl\/resources\/admin\/system\/myaccount":"Magento_Adminhtml::myaccount","config\/acl\/resources\/admin\/system\/tools":"Magento_Adminhtml::tools","config\/acl\/resources\/admin\/system\/convert":"Magento_Adminhtml::convert","config\/acl\/resources\/admin\/system\/cache":"Magento_Adminhtml::cache","config\/acl\/resources\/admin\/system\/extensions":"Magento_Adminhtml::extensions","config\/acl\/resources\/admin\/system\/extensions\/local":"Magento_Adminhtml::local","config\/acl\/resources\/admin\/system\/extensions\/custom":"Magento_Adminhtml::custom","config\/acl\/resources\/admin\/global_search":"Magento_Adminhtml::global_search","config\/acl\/resources\/admin\/system\/tools\/backup":"Magento_Backup::backup","config\/acl\/resources\/admin\/system\/tools\/backup\/rollback":"Magento_Backup::rollback","config\/acl\/resources\/admin\/system\/config\/cataloginventory":"Magento_CatalogInventory::cataloginventory","config\/acl\/resources\/admin\/promo":"Magento_CatalogRule::promo","config\/acl\/resources\/admin\/promo\/catalog":"Magento_CatalogRule::promo_catalog","config\/acl\/resources\/admin\/catalog\/search":"Magento_CatalogSearch::search","config\/acl\/resources\/admin\/system\/config\/catalog":"Magento_Catalog::config_catalog","config\/acl\/resources\/admin\/catalog":"Magento_Catalog::catalog","config\/acl\/resources\/admin\/catalog\/attributes":"Magento_Catalog::catalog_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/attributes":"Magento_Catalog::attributes_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/sets":"Magento_Catalog::sets","config\/acl\/resources\/admin\/catalog\/categories":"Magento_Catalog::categories","config\/acl\/resources\/admin\/catalog\/products":"Magento_Catalog::products","config\/acl\/resources\/admin\/catalog\/update_attributes":"Magento_Catalog::update_attributes","config\/acl\/resources\/admin\/catalog\/urlrewrite":"Magento_Catalog::urlrewrite","config\/acl\/resources\/admin\/sales\/checkoutagreement":"Magento_Checkout::checkoutagreement","config\/acl\/resources\/admin\/system\/config\/checkout":"Magento_Checkout::checkout","config\/acl\/resources\/admin\/cms":"Magento_Cms::cms","config\/acl\/resources\/admin\/cms\/block":"Magento_Cms::block","config\/acl\/resources\/admin\/cms\/page":"Magento_Cms::page","config\/acl\/resources\/admin\/cms\/page\/save":"Magento_Cms::save","config\/acl\/resources\/admin\/cms\/page\/delete":"Magento_Cms::page_delete","config\/acl\/resources\/admin\/cms\/media_gallery":"Magento_Cms::media_gallery","config\/acl\/resources\/admin\/system\/config\/cms":"Magento_Cms::config_cms","config\/acl\/resources\/admin\/system\/config\/contacts":"Magento_Contact::contact","config\/acl\/resources\/admin\/system\/currency\/rates":"Magento_CurrencySymbol::currency_rates","config\/acl\/resources\/admin\/system\/currency\/symbols":"Magento_CurrencySymbol::symbols","config\/acl\/resources\/admin\/customer":"Magento_Customer::customer","config\/acl\/resources\/admin\/customer\/group":"Magento_Customer::group","config\/acl\/resources\/admin\/customer\/manage":"Magento_Customer::manage","config\/acl\/resources\/admin\/customer\/online":"Magento_Customer::online","config\/acl\/resources\/admin\/system\/config\/customer":"Magento_Customer::config_customer","config\/acl\/resources\/admin\/system\/design\/editor":"Magento_DesignEditor::editor","config\/acl\/resources\/admin\/system\/config\/downloadable":"Magento_Downloadable::downloadable","config\/acl\/resources\/admin\/system\/config\/google":"Magento_GoogleAnalytics::google","config\/acl\/resources\/admin\/catalog\/googleshopping":"Magento_GoogleShopping::googleshopping","config\/acl\/resources\/admin\/catalog\/googleshopping\/types":"Magento_GoogleShopping::types","config\/acl\/resources\/admin\/catalog\/googleshopping\/items":"Magento_GoogleShopping::items","config\/acl\/resources\/admin\/system\/convert\/import":"Magento_ImportExport::import","config\/acl\/resources\/admin\/system\/convert\/export":"Magento_ImportExport::export","config\/acl\/resources\/admin\/system\/index":"Magento_Index::index","config\/acl\/resources\/admin\/system\/config\/newsletter":"Magento_Newsletter::newsletter","config\/acl\/resources\/admin\/newsletter":"Magento_Newsletter::admin_newsletter","config\/acl\/resources\/admin\/newsletter\/problem":"Magento_Newsletter::problem","config\/acl\/resources\/admin\/newsletter\/queue":"Magento_Newsletter::queue","config\/acl\/resources\/admin\/newsletter\/subscriber":"Magento_Newsletter::subscriber","config\/acl\/resources\/admin\/newsletter\/template":"Magento_Newsletter::template","config\/acl\/resources\/admin\/system\/config\/oauth":"Magento_Oauth::oauth","config\/acl\/resources\/admin\/system\/config\/payment":"Magento_Payment::payment","config\/acl\/resources\/admin\/system\/config\/payment_services":"Magento_Payment::payment_services","config\/acl\/resources\/admin\/system\/config\/paypal":"Magento_Paypal::paypal","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports":"Magento_Paypal::paypal_settlement_reports","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/view":"Magento_Paypal::paypal_settlement_reports_view","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/fetch":"Magento_Paypal::fetch","config\/acl\/resources\/admin\/system\/config\/persistent":"Magento_Persistent::persistent","config\/acl\/resources\/admin\/cms\/poll":"Magento_Poll::poll","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/ratings":"Magento_Rating::ratings","config\/acl\/resources\/admin\/report":"Magento_Reports::report","config\/acl\/resources\/admin\/report\/salesroot":"Magento_Reports::salesroot","config\/acl\/resources\/admin\/report\/salesroot\/sales":"Magento_Reports::salesroot_sales","config\/acl\/resources\/admin\/report\/salesroot\/tax":"Magento_Reports::tax","config\/acl\/resources\/admin\/report\/salesroot\/shipping":"Magento_Reports::shipping","config\/acl\/resources\/admin\/report\/salesroot\/invoiced":"Magento_Reports::invoiced","config\/acl\/resources\/admin\/report\/salesroot\/refunded":"Magento_Reports::refunded","config\/acl\/resources\/admin\/report\/salesroot\/coupons":"Magento_Reports::coupons","config\/acl\/resources\/admin\/report\/shopcart":"Magento_Reports::shopcart","config\/acl\/resources\/admin\/report\/shopcart\/product":"Magento_Reports::product","config\/acl\/resources\/admin\/report\/shopcart\/abandoned":"Magento_Reports::abandoned","config\/acl\/resources\/admin\/report\/products":"Magento_Reports::report_products","config\/acl\/resources\/admin\/report\/products\/bestsellers":"Magento_Reports::bestsellers","config\/acl\/resources\/admin\/report\/products\/sold":"Magento_Reports::sold","config\/acl\/resources\/admin\/report\/products\/viewed":"Magento_Reports::viewed","config\/acl\/resources\/admin\/report\/products\/lowstock":"Magento_Reports::lowstock","config\/acl\/resources\/admin\/report\/products\/downloads":"Magento_Reports::downloads","config\/acl\/resources\/admin\/report\/customers":"Magento_Reports::customers","config\/acl\/resources\/admin\/report\/customers\/accounts":"Magento_Reports::accounts","config\/acl\/resources\/admin\/report\/customers\/totals":"Magento_Reports::totals","config\/acl\/resources\/admin\/report\/customers\/orders":"Magento_Reports::customers_orders","config\/acl\/resources\/admin\/report\/review":"Magento_Reports::review","config\/acl\/resources\/admin\/report\/review\/customer":"Magento_Reports::review_customer","config\/acl\/resources\/admin\/report\/review\/product":"Magento_Reports::review_product","config\/acl\/resources\/admin\/report\/tags":"Magento_Reports::tags","config\/acl\/resources\/admin\/report\/tags\/customer":"Magento_Reports::tags_customer","config\/acl\/resources\/admin\/report\/tags\/popular":"Magento_Reports::popular","config\/acl\/resources\/admin\/report\/tags\/product":"Magento_Reports::tags_product","config\/acl\/resources\/admin\/report\/search":"Magento_Reports::report_search","config\/acl\/resources\/admin\/report\/statistics":"Magento_Reports::statistics","config\/acl\/resources\/admin\/system\/config\/reports":"Magento_Reports::reports","config\/acl\/resources\/admin\/catalog\/reviews_ratings":"Magento_Review::reviews_ratings","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews":"Magento_Review::reviews","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/all":"Magento_Review::reviews_all","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/pending":"Magento_Review::pending","config\/acl\/resources\/admin\/system\/config\/rss":"Magento_Rss::rss","config\/acl\/resources\/admin\/promo\/quote":"Magento_SalesRule::quote","config\/acl\/resources\/admin\/sales":"Magento_Sales::sales","config\/acl\/resources\/admin\/sales\/order":"Magento_Sales::sales_order","config\/acl\/resources\/admin\/sales\/order\/actions":"Magento_Sales::actions","config\/acl\/resources\/admin\/sales\/order\/actions\/create":"Magento_Sales::create","config\/acl\/resources\/admin\/sales\/order\/actions\/view":"Magento_Sales::actions_view","config\/acl\/resources\/admin\/sales\/order\/actions\/email":"Magento_Sales::email","config\/acl\/resources\/admin\/sales\/order\/actions\/reorder":"Magento_Sales::reorder","config\/acl\/resources\/admin\/sales\/order\/actions\/edit":"Magento_Sales::actions_edit","config\/acl\/resources\/admin\/sales\/order\/actions\/cancel":"Magento_Sales::cancel","config\/acl\/resources\/admin\/sales\/order\/actions\/review_payment":"Magento_Sales::review_payment","config\/acl\/resources\/admin\/sales\/order\/actions\/capture":"Magento_Sales::capture","config\/acl\/resources\/admin\/sales\/order\/actions\/invoice":"Magento_Sales::invoice","config\/acl\/resources\/admin\/sales\/order\/actions\/creditmemo":"Magento_Sales::creditmemo","config\/acl\/resources\/admin\/sales\/order\/actions\/hold":"Magento_Sales::hold","config\/acl\/resources\/admin\/sales\/order\/actions\/unhold":"Magento_Sales::unhold","config\/acl\/resources\/admin\/sales\/order\/actions\/ship":"Magento_Sales::ship","config\/acl\/resources\/admin\/sales\/order\/actions\/comment":"Magento_Sales::comment","config\/acl\/resources\/admin\/sales\/order\/actions\/emails":"Magento_Sales::emails","config\/acl\/resources\/admin\/sales\/invoice":"Magento_Sales::sales_invoice","config\/acl\/resources\/admin\/sales\/shipment":"Magento_Sales::shipment","config\/acl\/resources\/admin\/sales\/creditmemo":"Magento_Sales::sales_creditmemo","config\/acl\/resources\/admin\/sales\/transactions":"Magento_Sales::transactions","config\/acl\/resources\/admin\/sales\/transactions\/fetch":"Magento_Sales::transactions_fetch","config\/acl\/resources\/admin\/sales\/recurring_payment":"Magento_Sales::recurring_payment","config\/acl\/resources\/admin\/sales\/billing_agreement":"Magento_Sales::billing_agreement","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions":"Magento_Sales::billing_agreement_actions","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/view":"Magento_Sales::billing_agreement_actions_view","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/manage":"Magento_Sales::actions_manage","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/use":"Magento_Sales::use","config\/acl\/resources\/admin\/system\/order_statuses":"Magento_Sales::order_statuses","config\/acl\/resources\/admin\/system\/config\/sales":"Magento_Sales::config_sales","config\/acl\/resources\/admin\/system\/config\/sales_email":"Magento_Sales::sales_email","config\/acl\/resources\/admin\/system\/config\/sales_pdf":"Magento_Sales::sales_pdf","config\/acl\/resources\/admin\/system\/config\/shipping":"Magento_Shipping::config_shipping","config\/acl\/resources\/admin\/system\/config\/carriers":"Magento_Shipping::carriers","config\/acl\/resources\/admin\/catalog\/sitemap":"Magento_Sitemap::sitemap","config\/acl\/resources\/admin\/system\/config\/sitemap":"Magento_Sitemap::config_sitemap","config\/acl\/resources\/admin\/sales\/tax":"Magento_Tax::sales_tax","config\/acl\/resources\/admin\/sales\/tax\/classes_customer":"Magento_Tax::classes_customer","config\/acl\/resources\/admin\/sales\/tax\/classes_product":"Magento_Tax::classes_product","config\/acl\/resources\/admin\/sales\/tax\/import_export":"Magento_Tax::import_export","config\/acl\/resources\/admin\/sales\/tax\/rates":"Magento_Tax::tax_rates","config\/acl\/resources\/admin\/sales\/tax\/rules":"Magento_Tax::rules","config\/acl\/resources\/admin\/system\/config\/tax":"Magento_Tax::config_tax","config\/acl\/resources\/admin\/system\/acl":"Magento_User::acl","config\/acl\/resources\/admin\/system\/acl\/roles":"Magento_User::acl_roles","config\/acl\/resources\/admin\/system\/acl\/users":"Magento_User::acl_users","config\/acl\/resources\/admin\/cms\/widget_instance":"Magento_Widget::widget_instance","config\/acl\/resources\/admin\/system\/config\/wishlist":"Magento_Wishlist::config_wishlist"} diff --git a/dev/tools/Magento/Tools/Migration/aliases_map/composite_modules_ce.php b/dev/tools/Magento/Tools/Migration/aliases_map/composite_modules_ce.php index 6676a8a38b58fdcc37d3479775af85e38fbd2253..63ff29f38e12bff76d3c2f74ac32f4cb6303e2e2 100644 --- a/dev/tools/Magento/Tools/Migration/aliases_map/composite_modules_ce.php +++ b/dev/tools/Magento/Tools/Migration/aliases_map/composite_modules_ce.php @@ -27,6 +27,7 @@ /** * List on composite module names for Magento CE */ +require_once __DIR__ . '/../../../../../../app/bootstrap.php'; require_once realpath( dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) ) . '/app/code/Magento/Core/Model/Resource/SetupInterface.php'; @@ -37,4 +38,5 @@ require_once realpath( dirname(dirname(dirname(dirname(dirname(dirname(__DIR__)))))) ) . '/app/code/Magento/Core/Model/Resource/Setup/Migration.php'; -return \Magento\Core\Model\Resource\Setup\Migration::getCompositeModules(); +$objectManager = new \Magento\App\ObjectManager(); +return $objectManager->create('\Magento\Module\Setup\Migration')->getCompositeModules(); diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php index 795fc532b9e01e6d2199bb9d1085c8be895189c3..cabfa6c3fa136c89855301f9334d039f33823047 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php @@ -157,14 +157,14 @@ return array( 'core/layout_update' => 'core_layout_update', 'core/resource' => 'core_resource', 'core/session' => 'core_session', - 'core/store' => 'core_store', - 'core/store_group' => 'core_store_group', + 'core/store' => 'store', + 'core/store_group' => 'store_group', 'core/translate' => 'core_translate', 'core/url_rewrite' => 'core_url_rewrite', 'core/url_rewrite_tag' => 'core_url_rewrite_tag', 'core/variable' => 'core_variable', 'core/variable_value' => 'core_variable_value', - 'core/website' => 'core_website', + 'core/website' => 'store_website', 'cron/schedule' => 'cron_schedule', 'customer/address_entity' => 'customer_address_entity', 'customer/customer_group' => 'customer_group', diff --git a/dev/tools/Magento/Tools/Migration/themes_view.php b/dev/tools/Magento/Tools/Migration/themes_view.php index 4979e5901aaef7a81999d4863a8e6db16cf96160..d12aeda9985f31444511b61c811f1fb2e2aa0af7 100644 --- a/dev/tools/Magento/Tools/Migration/themes_view.php +++ b/dev/tools/Magento/Tools/Migration/themes_view.php @@ -29,8 +29,8 @@ try { $entryPoint = new \Magento\App\EntryPoint\EntryPoint($rootDir, array()); $objectManager = new \Magento\App\ObjectManager(); - /** @var $configModel \Magento\App\ReinitableConfigInterface */ - $configModel = $objectManager->get('Magento\App\ReinitableConfigInterface'); + /** @var $configModel \Magento\App\Config\ReinitableConfigInterface */ + $configModel = $objectManager->get('Magento\App\Config\ReinitableConfigInterface'); $configModel->reinit(); $config = array(); @@ -56,8 +56,8 @@ try { */ function updateFieldForTable($objectManager, $table, $col) { - /** @var $installer \Magento\Core\Model\Resource\Setup */ - $installer = $objectManager->create('Magento\Core\Model\Resource\Setup', array('resourceName' => 'core_setup')); + /** @var $installer \Magento\Module\Setup */ + $installer = $objectManager->create('Magento\Module\Setup'); $installer->startSetup(); $table = $installer->getTable($table); diff --git a/lib/3Dsecure/CentinelClient.php b/lib/CardinalCommerce/CentinelClient.php similarity index 100% rename from lib/3Dsecure/CentinelClient.php rename to lib/CardinalCommerce/CentinelClient.php diff --git a/lib/3Dsecure/CentinelErrors.php b/lib/CardinalCommerce/CentinelErrors.php similarity index 100% rename from lib/3Dsecure/CentinelErrors.php rename to lib/CardinalCommerce/CentinelErrors.php diff --git a/lib/3Dsecure/XMLParser.php b/lib/CardinalCommerce/XMLParser.php similarity index 100% rename from lib/3Dsecure/XMLParser.php rename to lib/CardinalCommerce/XMLParser.php diff --git a/lib/Magento/App/Config.php b/lib/Magento/App/Config.php index 2fcf0d97b7a5e6f8bb60b385a3ff923d2472472f..09251e374377b6a6e340e80278ba779ec5ef893e 100644 --- a/lib/Magento/App/Config.php +++ b/lib/Magento/App/Config.php @@ -25,7 +25,7 @@ */ namespace Magento\App; -class Config implements ConfigInterface +class Config implements \Magento\App\Config\ScopeConfigInterface { /** * Config cache tag @@ -50,28 +50,14 @@ class Config implements ConfigInterface * * @param string $path * @param string $scope - * @param string $scopeCode + * @param null|string $scopeCode * @return mixed */ - public function getValue($path = null, $scope = \Magento\BaseScopeInterface::SCOPE_DEFAULT, $scopeCode = null) + public function getValue($path = null, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null) { return $this->_scopePool->getScope($scope, $scopeCode)->getValue($path); } - /** - * Set config value in the corresponding config scope - * - * @param string $path - * @param mixed $value - * @param string $scope - * @param null|string $scopeCode - * @return void - */ - public function setValue($path, $value, $scope = \Magento\BaseScopeInterface::SCOPE_DEFAULT, $scopeCode = null) - { - $this->_scopePool->getScope($scope, $scopeCode)->setValue($path, $value); - } - /** * Retrieve config flag * @@ -80,7 +66,7 @@ class Config implements ConfigInterface * @param null|string $scopeCode * @return bool */ - public function isSetFlag($path, $scope = \Magento\BaseScopeInterface::SCOPE_DEFAULT, $scopeCode = null) + public function isSetFlag($path, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null) { return (bool)$this->getValue($path, $scope, $scopeCode); } diff --git a/app/code/Magento/Core/Model/Config/Base.php b/lib/Magento/App/Config/Base.php similarity index 91% rename from app/code/Magento/Core/Model/Config/Base.php rename to lib/Magento/App/Config/Base.php index 53f3c574f7e3920aa594fa5d4bb160296cd6bf0f..bf7eb2a8c3320549932657f0fa51267ff61b9bf5 100644 --- a/app/code/Magento/Core/Model/Config/Base.php +++ b/lib/Magento/App/Config/Base.php @@ -21,12 +21,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class Base extends \Magento\Simplexml\Config { @@ -42,7 +40,7 @@ class Base extends \Magento\Simplexml\Config */ public function __construct($sourceData = null) { - $this->_elementClass = 'Magento\Core\Model\Config\Element'; + $this->_elementClass = 'Magento\App\Config\Element'; parent::__construct($sourceData); self::$instances[] = $this; } diff --git a/app/code/Magento/Core/Model/Config/BaseFactory.php b/lib/Magento/App/Config/BaseFactory.php similarity index 87% rename from app/code/Magento/Core/Model/Config/BaseFactory.php rename to lib/Magento/App/Config/BaseFactory.php index 2b4495bd5b4ceffb8807eda575bedbed6b9b9065..cdae17950c29bab1e325e0f2e009487f998bc76b 100644 --- a/app/code/Magento/Core/Model/Config/BaseFactory.php +++ b/lib/Magento/App/Config/BaseFactory.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class BaseFactory { @@ -44,10 +44,10 @@ class BaseFactory * Create config model * * @param string|\Magento\Simplexml\Element $sourceData - * @return \Magento\Core\Model\Config\Base + * @return \Magento\App\Config\Base */ public function create($sourceData = null) { - return $this->_objectManager->create('Magento\Core\Model\Config\Base', array('sourceData' => $sourceData)); + return $this->_objectManager->create('Magento\App\Config\Base', array('sourceData' => $sourceData)); } } diff --git a/lib/Magento/App/Config/Data.php b/lib/Magento/App/Config/Data.php index 82fad26a553867e7453990d1cfb3094a8bf8e4dd..8c6269c191ae3fb4b3cec43eada9412b36d9389b 100644 --- a/lib/Magento/App/Config/Data.php +++ b/lib/Magento/App/Config/Data.php @@ -76,7 +76,7 @@ class Data implements DataInterface if (is_array($data) && array_key_exists($key, $data)) { $data = $data[$key]; } else { - return false; + return null; } } return $data; diff --git a/app/code/Magento/Core/Model/Config/Element.php b/lib/Magento/App/Config/Element.php similarity index 92% rename from app/code/Magento/Core/Model/Config/Element.php rename to lib/Magento/App/Config/Element.php index 18f04b0a6acbba214f19668b957687be3b811323..af7e52397aec49fd4450d6fd1ecdad2684fa774b 100644 --- a/app/code/Magento/Core/Model/Config/Element.php +++ b/lib/Magento/App/Config/Element.php @@ -18,20 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Config element model - * - * @category Magento - * @package Magento_Core */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class Element extends \Magento\Simplexml\Element { diff --git a/app/code/Magento/Core/Model/Config/FileResolver.php b/lib/Magento/App/Config/FileResolver.php similarity index 98% rename from app/code/Magento/Core/Model/Config/FileResolver.php rename to lib/Magento/App/Config/FileResolver.php index 5c97f1c35075dc99a4004cc151e50c78cbf9a3d7..b5ba6db4cf70f1c3b0b2ec37c18d64518df00517 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver.php +++ b/lib/Magento/App/Config/FileResolver.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; class FileResolver implements \Magento\Config\FileResolverInterface { diff --git a/lib/Magento/App/Config/Initial.php b/lib/Magento/App/Config/Initial.php index e43a81a8a4ad448a430726c6cd342c00528eb996..87c9b00a541b7c8a603e76e671b1e1444316ba45 100644 --- a/lib/Magento/App/Config/Initial.php +++ b/lib/Magento/App/Config/Initial.php @@ -73,7 +73,7 @@ class Initial { list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null); - if (\Magento\BaseScopeInterface::SCOPE_DEFAULT == $scopeType) { + if (\Magento\App\ScopeInterface::SCOPE_DEFAULT == $scopeType) { return isset($this->_data[$scopeType]) ? $this->_data[$scopeType] : array(); } elseif ($scopeCode) { return isset($this->_data[$scopeType][$scopeCode]) ? $this->_data[$scopeType][$scopeCode] : array(); diff --git a/lib/Magento/App/ConfigInterface.php b/lib/Magento/App/Config/MutableScopeConfigInterface.php similarity index 72% rename from lib/Magento/App/ConfigInterface.php rename to lib/Magento/App/Config/MutableScopeConfigInterface.php index a2b3d0495cae24f4b6af68bda3e5a6e59cabcb60..59d2f023c9a2a55d4702b3d567492a55bcd0430d 100644 --- a/lib/Magento/App/ConfigInterface.php +++ b/lib/Magento/App/Config/MutableScopeConfigInterface.php @@ -23,32 +23,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; -interface ConfigInterface -{ - /** - * Retrieve config value by path - * - * @param string $path - * @return mixed - */ - public function getValue($path = null); +namespace Magento\App\Config; +interface MutableScopeConfigInterface extends \Magento\App\Config\ScopeConfigInterface +{ /** - * Set config value + * Set config value in the corresponding config scope * * @param string $path * @param mixed $value + * @param string $scope + * @param null|string $scopeCode * @return void */ - public function setValue($path, $value); - - /** - * Retrieve config flag - * - * @param string $path - * @return bool - */ - public function isSetFlag($path); + public function setValue($path, $value, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null); } diff --git a/lib/Magento/App/ReinitableConfigInterface.php b/lib/Magento/App/Config/ReinitableConfigInterface.php similarity index 85% rename from lib/Magento/App/ReinitableConfigInterface.php rename to lib/Magento/App/Config/ReinitableConfigInterface.php index a00c0b618e350333c40a85a5222e2d2baa7284e1..907f2fed60b9154b47032556b3faa222498864f9 100644 --- a/lib/Magento/App/ReinitableConfigInterface.php +++ b/lib/Magento/App/Config/ReinitableConfigInterface.php @@ -23,14 +23,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\App; -interface ReinitableConfigInterface extends ConfigInterface +namespace Magento\App\Config; + +interface ReinitableConfigInterface extends \Magento\App\Config\MutableScopeConfigInterface { /** * Reinitialize config object * - * @return $this + * @return \Magento\App\Config\ReinitableConfigInterface */ public function reinit(); } diff --git a/lib/Magento/Locale/ScopeConfigInterface.php b/lib/Magento/App/Config/Resource/ConfigInterface.php similarity index 69% rename from lib/Magento/Locale/ScopeConfigInterface.php rename to lib/Magento/App/Config/Resource/ConfigInterface.php index bf9a103d64599d344fe83df8bca6b673c4752d03..bec53622a691540dae3547426f42b6810728dafe 100644 --- a/lib/Magento/Locale/ScopeConfigInterface.php +++ b/lib/Magento/App/Config/Resource/ConfigInterface.php @@ -21,25 +21,31 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Locale; +namespace Magento\App\Config\Resource; -interface ScopeConfigInterface +/** + * Resource Config Interface + */ +interface ConfigInterface { /** - * Retrieve scope config value + * Save config value * * @param string $path - * @param mixed $scope - * @return mixed + * @param string $value + * @param string $scope + * @param int $scopeId + * @return $this */ - public function getConfig($path, $scope = null); + public function saveConfig($path, $value, $scope, $scopeId); /** - * Retrieve scope config flag + * Delete config value * * @param string $path - * @param mixed $scope - * @return bool + * @param string $scope + * @param int $scopeId + * @return $this */ - public function getConfigFlag($path, $scope = null); + public function deleteConfig($path, $scope, $scopeId); } diff --git a/app/code/Magento/Customer/Service/V1/Data/Search/FilterGroupInterface.php b/lib/Magento/App/Config/ScopeConfigInterface.php similarity index 60% rename from app/code/Magento/Customer/Service/V1/Data/Search/FilterGroupInterface.php rename to lib/Magento/App/Config/ScopeConfigInterface.php index a10550099de0bf8cfb3605b51edf671cb3c1ab9d..5932ea649dc8903de524462edeb024d73630722e 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Search/FilterGroupInterface.php +++ b/lib/Magento/App/Config/ScopeConfigInterface.php @@ -1,5 +1,7 @@ <?php /** + * Configuration interface + * * Magento * * NOTICE OF LICENSE @@ -21,31 +23,28 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Service\V1\Data\Search; -/** - * Groups two or more filters together using a logical group type - */ -interface FilterGroupInterface -{ - /** - * Returns a list of filters in this group - * - * @return \Magento\Customer\Service\V1\Data\Filter[] - */ - public function getFilters(); +namespace Magento\App\Config; +interface ScopeConfigInterface +{ /** - * Returns a list of filter groups in this group + * Retrieve config value by path and scope * - * @return \Magento\Customer\Service\V1\Data\Search\FilterGroupInterface[] + * @param string $path + * @param string $scope + * @param null|string $scopeCode + * @return mixed */ - public function getGroups(); + public function getValue($path, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null); /** - * Returns the grouping type such as 'OR' or 'AND'. + * Retrieve config flag by path and scope * - * @return string + * @param string $path + * @param string $scope + * @param null|string $scopeCode + * @return bool */ - public function getGroupType(); + public function isSetFlag($path, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null); } diff --git a/lib/Magento/App/Config/ScopePool.php b/lib/Magento/App/Config/ScopePool.php index 24e60cf0bafcd4fd6cf788da4dba26732d0cc91d..ddf3538a75c258e8d5adc79c4e05f8ea70ca8d1c 100644 --- a/lib/Magento/App/Config/ScopePool.php +++ b/lib/Magento/App/Config/ScopePool.php @@ -52,33 +52,42 @@ class ScopePool */ protected $_scopes = array(); + /** + * @var \Magento\App\ScopeResolverPool + */ + protected $_scopeResolverPool; + /** * @param \Magento\App\Config\Scope\ReaderPoolInterface $readerPool * @param DataFactory $dataFactory * @param \Magento\Cache\FrontendInterface $cache + * @param \Magento\App\ScopeResolverPool $scopeResolverPool * @param string $cacheId */ public function __construct( \Magento\App\Config\Scope\ReaderPoolInterface $readerPool, DataFactory $dataFactory, \Magento\Cache\FrontendInterface $cache, + \Magento\App\ScopeResolverPool $scopeResolverPool, $cacheId = 'default_config_cache' ) { $this->_readerPool = $readerPool; $this->_dataFactory = $dataFactory; $this->_cache = $cache; $this->_cacheId = $cacheId; + $this->_scopeResolverPool = $scopeResolverPool; } /** * Retrieve config section * * @param string $scopeType - * @param string $scopeCode - * @return Data + * @param string|\Magento\Object|null $scopeCode + * @return \Magento\App\Config\DataInterface */ public function getScope($scopeType, $scopeCode = null) { + $scopeCode = $this->_getScopeCode($scopeType, $scopeCode); $code = $scopeType . '|' . $scopeCode; if (!isset($this->_scopes[$code])) { $cacheKey = $this->_cacheId . '|' . $code; @@ -87,7 +96,7 @@ class ScopePool $data = unserialize($data); } else { $reader = $this->_readerPool->getReader($scopeType); - if ($scopeType === \Magento\BaseScopeInterface::SCOPE_DEFAULT) { + if ($scopeType === \Magento\App\ScopeInterface::SCOPE_DEFAULT) { $data = $reader->read(); } else { $data = $reader->read($scopeCode); @@ -109,4 +118,27 @@ class ScopePool $this->_scopes = array(); $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(self::CACHE_TAG)); } + + /** + * Retrieve scope code value + * + * @param string $scopeType + * @param string|\Magento\Object|null $scopeCode + * @return string + */ + protected function _getScopeCode($scopeType, $scopeCode) + { + if ((is_null($scopeCode) || is_numeric($scopeCode)) + && $scopeType !== \Magento\App\ScopeInterface::SCOPE_DEFAULT + ) { + $scopeResolver = $this->_scopeResolverPool->get($scopeType); + $scopeCode = $scopeResolver->getScope($scopeCode); + } + + if ($scopeCode instanceof \Magento\App\ScopeInterface) { + $scopeCode = $scopeCode->getCode(); + } + + return $scopeCode; + } } diff --git a/app/code/Magento/Core/Model/Config/Storage/Db.php b/lib/Magento/App/Config/Storage/Writer.php similarity index 74% rename from app/code/Magento/Core/Model/Config/Storage/Db.php rename to lib/Magento/App/Config/Storage/Writer.php index aee79c7305e19a9c30c2db34cab4a9666a8af316..513b230c9f974f589d77ae13e74f44ae92c28dbc 100644 --- a/app/code/Magento/Core/Model/Config/Storage/Db.php +++ b/lib/Magento/App/Config/Storage/Writer.php @@ -1,6 +1,6 @@ <?php /** - * Application config db storage writer + * Application config storage writer * * Magento * @@ -23,21 +23,21 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config\Storage; +namespace Magento\App\Config\Storage; -class Db implements \Magento\App\Config\Storage\WriterInterface +class Writer implements \Magento\App\Config\Storage\WriterInterface { /** * Resource model of config data * - * @var \Magento\Core\Model\Resource\Config + * @var \Magento\App\Config\Resource\ConfigInterface */ protected $_resource; /** - * @param \Magento\Core\Model\Resource\Config $resource + * @param \Magento\App\Config\Resource\ConfigInterface $resource */ - public function __construct(\Magento\Core\Model\Resource\Config $resource) + public function __construct(\Magento\App\Config\Resource\ConfigInterface $resource) { $this->_resource = $resource; } @@ -50,7 +50,7 @@ class Db implements \Magento\App\Config\Storage\WriterInterface * @param int $scopeId * @return void */ - public function delete($path, $scope = \Magento\Core\Model\Store::DEFAULT_CODE, $scopeId = 0) + public function delete($path, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeId = 0) { $this->_resource->deleteConfig(rtrim($path, '/'), $scope, $scopeId); } @@ -64,7 +64,7 @@ class Db implements \Magento\App\Config\Storage\WriterInterface * @param int $scopeId * @return void */ - public function save($path, $value, $scope = \Magento\Core\Model\Store::DEFAULT_CODE, $scopeId = 0) + public function save($path, $value, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeId = 0) { $this->_resource->saveConfig(rtrim($path, '/'), $value, $scope, $scopeId); } diff --git a/lib/Magento/App/Config/Storage/WriterInterface.php b/lib/Magento/App/Config/Storage/WriterInterface.php index 369f3e5aed7a3f74be8a733513b7affa1dcb9fad..62ddee7f7429a0a65d2e028adc0bad1088cb3db0 100644 --- a/lib/Magento/App/Config/Storage/WriterInterface.php +++ b/lib/Magento/App/Config/Storage/WriterInterface.php @@ -35,7 +35,7 @@ interface WriterInterface * @param int $scopeId * @return void */ - public function delete($path, $scope = \Magento\BaseScopeInterface::SCOPE_DEFAULT, $scopeId = 0); + public function delete($path, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeId = 0); /** * Save config value to storage @@ -46,5 +46,5 @@ interface WriterInterface * @param int $scopeId * @return void */ - public function save($path, $value, $scope = \Magento\BaseScopeInterface::SCOPE_DEFAULT, $scopeId = 0); + public function save($path, $value, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeId = 0); } diff --git a/app/code/Magento/Core/Model/Config/Value.php b/lib/Magento/App/Config/Value.php similarity index 70% rename from app/code/Magento/Core/Model/Config/Value.php rename to lib/Magento/App/Config/Value.php index fd8a6dd9b386ab0d9b057575157de7bf0c15af78..f417bbe0dfdf4b9fff04b203cabd1d14606e4a38 100644 --- a/app/code/Magento/Core/Model/Config/Value.php +++ b/lib/Magento/App/Config/Value.php @@ -18,25 +18,21 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; /** * Config data model * - * @method \Magento\Core\Model\Resource\Config\Data _getResource() - * @method \Magento\Core\Model\Resource\Config\Data getResource() + * @method \Magento\Model\Resource\Db\AbstractDb getResource() * @method string getScope() * @method \Magento\App\Config\ValueInterface setScope(string $value) * @method int getScopeId() * @method \Magento\App\Config\ValueInterface setScopeId(int $value) * @method string getPath() * @method \Magento\App\Config\ValueInterface setPath(string $value) - * @method string getValue() * @method \Magento\App\Config\ValueInterface setValue(string $value) * * @SuppressWarnings(PHPMD.NumberOfChildren) @@ -48,7 +44,7 @@ class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ * * @var string */ - protected $_eventPrefix = 'core_config_data'; + protected $_eventPrefix = 'config_data'; /** * Parameter name in event @@ -60,20 +56,14 @@ class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ protected $_eventObject = 'config_data'; /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_config; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -81,27 +71,15 @@ class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, + \Magento\App\Config\ScopeConfigInterface $config, \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_storeManager = $storeManager; $this->_config = $config; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } - /** - * Magento model constructor - * - * @return void - */ - protected function _construct() - { - $this->_init('Magento\Core\Model\Resource\Config\Data'); - } - /** * Add availability call after load as public * @@ -129,17 +107,11 @@ class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ */ public function getOldValue() { - $storeCode = $this->getStoreCode(); - $websiteCode = $this->getWebsiteCode(); - $path = $this->getPath(); - - if ($storeCode) { - return $this->_storeManager->getStore($storeCode)->getConfig($path); - } - if ($websiteCode) { - return $this->_storeManager->getWebsite($websiteCode)->getConfig($path); - } - return (string)$this->_config->getValue($path, \Magento\BaseScopeInterface::SCOPE_DEFAULT); + return (string)$this->_config->getValue( + $this->getPath(), + $this->getScope() ?: \Magento\App\ScopeInterface::SCOPE_DEFAULT, + $this->getScopeCode() + ); } /** diff --git a/app/code/Magento/Core/Model/Config/ValueFactory.php b/lib/Magento/App/Config/ValueFactory.php similarity index 98% rename from app/code/Magento/Core/Model/Config/ValueFactory.php rename to lib/Magento/App/Config/ValueFactory.php index 373ec0aac90a9e81264e546c04563aa0b873f850..d7ae0128b01d40563a1e06c270c8780ae609d8af 100644 --- a/app/code/Magento/Core/Model/Config/ValueFactory.php +++ b/lib/Magento/App/Config/ValueFactory.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Config; +namespace Magento\App\Config; /** * Factory class diff --git a/lib/Magento/App/Config/ValueInterface.php b/lib/Magento/App/Config/ValueInterface.php index 4866802b6bfa415fc379d64e468511291bc690e4..56905071070469787ce3fd5ef7e75cd8a76e8231 100644 --- a/lib/Magento/App/Config/ValueInterface.php +++ b/lib/Magento/App/Config/ValueInterface.php @@ -30,11 +30,11 @@ interface ValueInterface /** * Table name */ - const ENTITY = 'core_config_data'; + const ENTITY = 'config_data'; /** * Check if config data value was changed - * + * @todo this method should be make as protected * @return bool */ public function isValueChanged(); diff --git a/lib/Magento/App/Filesystem/DirectoryList/Configuration.php b/lib/Magento/App/Filesystem/DirectoryList/Configuration.php index 676ad2978c30efdfe37b46718dfeee7abe474480..1199ae5032e6679f850603a77496d849ae0dee15 100644 --- a/lib/Magento/App/Filesystem/DirectoryList/Configuration.php +++ b/lib/Magento/App/Filesystem/DirectoryList/Configuration.php @@ -61,9 +61,9 @@ class Configuration /** * Store directory configuration * - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ - public function __construct(\Magento\App\ConfigInterface $config) + public function __construct(\Magento\App\Config\ScopeConfigInterface $config) { $this->directories = $config->getValue(self::XML_FILESYSTEM_DIRECTORY_PATH) ?: array(); $this->protocols = $config->getValue(self::XML_FILESYSTEM_WRAPPER_PATH) ?: array(); diff --git a/lib/Magento/App/MutableScopeConfig.php b/lib/Magento/App/MutableScopeConfig.php new file mode 100644 index 0000000000000000000000000000000000000000..fdd2b085b985d8b5fd91c4140ae471cfbc77d43e --- /dev/null +++ b/lib/Magento/App/MutableScopeConfig.php @@ -0,0 +1,47 @@ +<?php +/** + * Application configuration object. Used to access configuration when application is installed. + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +class MutableScopeConfig extends \Magento\App\Config implements \Magento\App\Config\MutableScopeConfigInterface +{ + /** + * Set config value in the corresponding config scope + * + * @param string $path + * @param mixed $value + * @param string $scope + * @param null|string $scopeCode + * @return void + */ + public function setValue($path, $value, $scope = \Magento\App\ScopeInterface::SCOPE_DEFAULT, $scopeCode = null) + { + if (empty($scopeCode)) { + $scopeCode = null; + } + $this->_scopePool->getScope($scope, $scopeCode)->setValue($path, $value); + } +} diff --git a/lib/Magento/App/ReinitableConfig.php b/lib/Magento/App/ReinitableConfig.php index c81741c0e90c06ab119047acf94556ae5c50b4ab..4a97d8f1f03f6cd95e911d76e04c2585c35e1c1f 100644 --- a/lib/Magento/App/ReinitableConfig.php +++ b/lib/Magento/App/ReinitableConfig.php @@ -23,7 +23,7 @@ */ namespace Magento\App; -class ReinitableConfig extends Config implements ReinitableConfigInterface +class ReinitableConfig extends \Magento\App\MutableScopeConfig implements \Magento\App\Config\ReinitableConfigInterface { /** * {@inheritdoc} diff --git a/lib/Magento/BaseScopeInterface.php b/lib/Magento/App/ScopeInterface.php similarity index 95% rename from lib/Magento/BaseScopeInterface.php rename to lib/Magento/App/ScopeInterface.php index 22772a6c375f22e2c60e5a13cad320422dc18305..8a02f47896840fa6f33fe28083831e0b306edc24 100644 --- a/lib/Magento/BaseScopeInterface.php +++ b/lib/Magento/App/ScopeInterface.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento; +namespace Magento\App; -interface BaseScopeInterface +interface ScopeInterface { /** * Default scope type diff --git a/lib/Magento/BaseScopeResolverInterface.php b/lib/Magento/App/ScopeResolverInterface.php similarity index 91% rename from lib/Magento/BaseScopeResolverInterface.php rename to lib/Magento/App/ScopeResolverInterface.php index ca6007ff5df250662cff7a9ac8d06e53147adc45..a1f9e887732659b5977df30a36f59cb5dd6ca15d 100644 --- a/lib/Magento/BaseScopeResolverInterface.php +++ b/lib/Magento/App/ScopeResolverInterface.php @@ -21,15 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento; +namespace Magento\App; -interface BaseScopeResolverInterface +interface ScopeResolverInterface { /** * Retrieve application scope object * * @param null|int $scopeId - * @return \Magento\BaseScopeInterface + * @return \Magento\App\ScopeInterface */ public function getScope($scopeId = null); } diff --git a/lib/Magento/App/ScopeResolverPool.php b/lib/Magento/App/ScopeResolverPool.php new file mode 100644 index 0000000000000000000000000000000000000000..33bddfebc202b4248c8436b4430ca8d537c52665 --- /dev/null +++ b/lib/Magento/App/ScopeResolverPool.php @@ -0,0 +1,59 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App; + +class ScopeResolverPool +{ + /** + * @var array + */ + protected $_scopeResolvers = array(); + + /** + * @param \Magento\App\ScopeResolverInterface[] $scopeResolvers + */ + public function __construct( + array $scopeResolvers + ) { + $this->_scopeResolvers = $scopeResolvers; + } + + /** + * Retrieve reader by scope type + * + * @param string $scopeType + * @throws \InvalidArgumentException + * @return \Magento\App\ScopeResolverInterface + */ + public function get($scopeType) + { + if (!isset($this->_scopeResolvers[$scopeType]) || + !($this->_scopeResolvers[$scopeType] instanceof \Magento\App\ScopeResolverInterface) + ) { + throw new \InvalidArgumentException("Invalid scope type '{$scopeType}'"); + } + return $this->_scopeResolvers[$scopeType]; + } +} diff --git a/lib/Magento/App/View.php b/lib/Magento/App/View.php index f5f040588102105a6eee87b0a85f41abe84c8c5f..1c973a5cbaf56e9ae9cd8f2ae54240efff274159 100644 --- a/lib/Magento/App/View.php +++ b/lib/Magento/App/View.php @@ -99,7 +99,6 @@ class View implements ViewInterface */ public function getLayout() { - $this->_layout->setArea($this->_configScope->getCurrentScope()); return $this->_layout; } diff --git a/lib/Magento/AppInterface.php b/lib/Magento/AppInterface.php index b5c09bccfe4afb8c21b868fab32d6c0c66c17373..4822e8e0f1d20b44c98047ce4cf0d7c211583d2a 100644 --- a/lib/Magento/AppInterface.php +++ b/lib/Magento/AppInterface.php @@ -35,7 +35,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev72'; + const VERSION = '2.0.0.0-dev73'; /** * Launch application diff --git a/lib/Magento/Code/Minifier.php b/lib/Magento/Code/Minifier.php index bd36529aa1479364bbc6c5d11d47e72de2693ece..745f6435379ef73b998fb4a40d9b146aeb902055 100644 --- a/lib/Magento/Code/Minifier.php +++ b/lib/Magento/Code/Minifier.php @@ -76,13 +76,13 @@ class Minifier } $originalFileRelative = $this->rootDirectory->getRelativePath($originalFile); $minifiedFile = $this->_findOriginalMinifiedFile($originalFileRelative); - if (!$minifiedFile) { - $minifiedFile = $this->directoryName . '/' . $this->_generateMinifiedFileName($originalFile); - $this->_strategy->minifyFile($originalFileRelative, $minifiedFile); + if ($minifiedFile) { + return $this->rootDirectory->getAbsolutePath($minifiedFile); } + $minifiedFile = $this->directoryName . '/' . $this->_generateMinifiedFileName($originalFile); + $this->_strategy->minifyFile($originalFileRelative, $minifiedFile); - $minifiedFile = $this->pubViewCacheDir->getRelativePath($minifiedFile); - return $this->pubViewCacheDir->getAbsolutePath($minifiedFile); + return $minifiedFile; } /** diff --git a/lib/Magento/Exception/Exception.php b/lib/Magento/Exception/Exception.php index 5903af02d1704d890719dbabaff8b904b3a42882..68097f459657aa81db60ddce2f2975b26656c50e 100644 --- a/lib/Magento/Exception/Exception.php +++ b/lib/Magento/Exception/Exception.php @@ -25,7 +25,7 @@ */ namespace Magento\Exception; -abstract class Exception extends \Magento\Service\Exception +abstract class Exception extends \Magento\Webapi\ServiceException { /** * @var array diff --git a/lib/Magento/Filter/Translit.php b/lib/Magento/Filter/Translit.php index 981a66204366f56347f8e15998dfb4c6dbb9883b..27184e85fb560b5d0c863db880be5bf1116df550 100644 --- a/lib/Magento/Filter/Translit.php +++ b/lib/Magento/Filter/Translit.php @@ -356,9 +356,9 @@ class Translit implements \Zend_Filter_Interface ); /** - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ - public function __construct(\Magento\App\ConfigInterface $config) + public function __construct(\Magento\App\Config\ScopeConfigInterface $config) { $convertConfig = $config->getValue('url/convert', 'default'); if ($convertConfig) { diff --git a/lib/Magento/Image/Adapter/Config.php b/lib/Magento/Image/Adapter/Config.php index 5150ba8513ad639e48b88a342644a88131771e90..8bbe3f5b524f37b12811c56d4d00333e0a8931d0 100644 --- a/lib/Magento/Image/Adapter/Config.php +++ b/lib/Magento/Image/Adapter/Config.php @@ -30,14 +30,14 @@ class Config implements \Magento\Image\Adapter\ConfigInterface const XML_PATH_IMAGE_ADAPTERS = 'dev/image/adapters'; /** - * @var \Magento\App\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $config; /** - * @param \Magento\App\ConfigInterface $config + * @param \Magento\App\Config\ScopeConfigInterface $config */ - public function __construct(\Magento\App\ConfigInterface $config) + public function __construct(\Magento\App\Config\ScopeConfigInterface $config) { $this->config = $config; } diff --git a/lib/Magento/Image/Adapter/Gd2.php b/lib/Magento/Image/Adapter/Gd2.php index 3fdea12940e8b9ec1ef5591ac31758f7c82e642f..69214de7ac08a2a59a9e2d9e92e84608fcaaf555 100644 --- a/lib/Magento/Image/Adapter/Gd2.php +++ b/lib/Magento/Image/Adapter/Gd2.php @@ -79,9 +79,14 @@ class Gd2 extends \Magento\Image\Adapter\AbstractAdapter */ protected function _isMemoryLimitReached() { - $limit = $this->_convertToByte(ini_get('memory_limit')); - $requiredMemory = $this->_getImageNeedMemorySize($this->_fileName); - return memory_get_usage(true) + $requiredMemory > $limit; + $memory_limit = ini_get('memory_limit'); + if ($memory_limit == -1) { + return false; + } else { + $limit = $this->_convertToByte($memory_limit); + $requiredMemory = $this->_getImageNeedMemorySize($this->_fileName); + return (memory_get_usage(true) + $requiredMemory) > $limit; + } } /** @@ -111,7 +116,7 @@ class Gd2 extends \Magento\Image\Adapter\AbstractAdapter } /** - * Converts memory value (e.g. 64M, 129KB) to bytes. + * Converts memory value (e.g. 64M, 129K) to bytes. * Case insensitive value might be used. * * @param string $memoryValue @@ -123,7 +128,7 @@ class Gd2 extends \Magento\Image\Adapter\AbstractAdapter return (int)$memoryValue * pow(1024, 3); } elseif (stripos($memoryValue, 'M') !== false) { return (int)$memoryValue * 1024 * 1024; - } elseif (stripos($memoryValue, 'KB') !== false) { + } elseif (stripos($memoryValue, 'K') !== false) { return (int)$memoryValue * 1024; } diff --git a/lib/Magento/Locale/Format.php b/lib/Magento/Locale/Format.php index de2a52d52d950a3a8c33513b5bea49e53f18f0ee..8dff5335f334ff62373d293e3a13b955a44152a6 100644 --- a/lib/Magento/Locale/Format.php +++ b/lib/Magento/Locale/Format.php @@ -26,7 +26,7 @@ namespace Magento\Locale; class Format implements \Magento\Locale\FormatInterface { /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $_scopeResolver; @@ -36,11 +36,11 @@ class Format implements \Magento\Locale\FormatInterface protected $_localeResolver; /** - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param ResolverInterface $localeResolver */ public function __construct( - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\Locale\ResolverInterface $localeResolver ) { $this->_scopeResolver = $scopeResolver; diff --git a/lib/Magento/Locale/Hierarchy/Config/Converter.php b/lib/Magento/Locale/Hierarchy/Config/Converter.php index 56e2dd7a92c07cab560778aa3277dae5579b9531..e17ef62ffd1c80b2edfbb5977b3940fbee7a3a21 100644 --- a/lib/Magento/Locale/Hierarchy/Config/Converter.php +++ b/lib/Magento/Locale/Hierarchy/Config/Converter.php @@ -48,7 +48,7 @@ class Converter implements \Magento\Config\ConverterInterface array_unshift($localeParents, $localeConfig[$localeParent]); $localeParent = $localeConfig[$localeParent]; } - // store hierarchy for current locale + // scope hierarchy for current locale $localeHierarchy[$locale] = $localeParents; } return $localeHierarchy; diff --git a/lib/Magento/Locale/Lists.php b/lib/Magento/Locale/Lists.php index f41e56b38b7652f315dd3034e2a725cec4887db2..2b47ff76c516d462d5299ddc54798c794dfb2a00 100644 --- a/lib/Magento/Locale/Lists.php +++ b/lib/Magento/Locale/Lists.php @@ -31,7 +31,7 @@ class Lists implements \Magento\Locale\ListsInterface protected $_appState; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $_scopeResolver; @@ -52,7 +52,7 @@ class Lists implements \Magento\Locale\ListsInterface /** * @param \Magento\App\State $appState - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param \Magento\Locale\ConfigInterface $config * @param \Magento\Locale\ResolverInterface $localeResolver * @param string $currencyInstalled @@ -60,7 +60,7 @@ class Lists implements \Magento\Locale\ListsInterface */ public function __construct( \Magento\App\State $appState, - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\Locale\ConfigInterface $config, \Magento\Locale\ResolverInterface $localeResolver, $currencyInstalled, diff --git a/lib/Magento/Locale/Resolver.php b/lib/Magento/Locale/Resolver.php index 793d4fc1dd75b5c1dd18678d21490ddee4e6dbf4..69acaeb75704e1af2aaafda6cbb4505db7a46a29 100644 --- a/lib/Magento/Locale/Resolver.php +++ b/lib/Magento/Locale/Resolver.php @@ -32,6 +32,13 @@ class Resolver implements \Magento\Locale\ResolverInterface */ protected $_defaultLocale; + /** + * Scope type + * + * @var string + */ + protected $_scopeType; + /** * Locale object * @@ -47,7 +54,7 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_localeCode; /** - * @var \Magento\Locale\ScopeConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ protected $_scopeConfig; @@ -69,23 +76,26 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_localeFactory; /** - * @param ScopeConfigInterface $scopeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath - * @param null $locale + * @param string $scopeType + * @param mixed $locale */ public function __construct( - \Magento\Locale\ScopeConfigInterface $scopeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, + $scopeType, $locale = null ) { $this->_cache = $cache; $this->_scopeConfig = $scopeConfig; $this->_localeFactory = $localeFactory; $this->_defaultLocalePath = $defaultLocalePath; + $this->_scopeType = $scopeType; $this->setLocale($locale); } @@ -112,7 +122,7 @@ class Resolver implements \Magento\Locale\ResolverInterface public function getDefaultLocale() { if (!$this->_defaultLocale) { - $locale = $this->_scopeConfig->getConfig($this->getDefaultLocalePath()); + $locale = $this->_scopeConfig->getValue($this->getDefaultLocalePath(), $this->_scopeType); if (!$locale) { $locale = \Magento\Locale\ResolverInterface::DEFAULT_LOCALE; } @@ -179,7 +189,13 @@ class Resolver implements \Magento\Locale\ResolverInterface if ($scopeId) { $this->_emulatedLocales[] = clone $this->getLocale(); $this->_locale = $this->_localeFactory->create( - array('locale' => $this->_scopeConfig->getConfig($this->getDefaultLocalePath(), $scopeId)) + array( + 'locale' => $this->_scopeConfig->getValue( + $this->getDefaultLocalePath(), + $this->_scopeType, + $scopeId + ) + ) ); $this->_localeCode = $this->_locale->toString(); $result = $this->_localeCode; diff --git a/lib/Magento/Locale/ResolverInterface.php b/lib/Magento/Locale/ResolverInterface.php index 0b4afd03f33239dbefcb04da1cdf33b023baf593..b20c9eac9808535205714a64a0c2252bfc9b8fc1 100644 --- a/lib/Magento/Locale/ResolverInterface.php +++ b/lib/Magento/Locale/ResolverInterface.php @@ -83,7 +83,7 @@ interface ResolverInterface public function setLocaleCode($code); /** - * Push current locale to stack and replace with locale from specified store + * Push current locale to stack and replace with locale from specified scope * * @param int $scopeId * @return string|null diff --git a/lib/Magento/Mail/Template/TransportBuilder.php b/lib/Magento/Mail/Template/TransportBuilder.php index 313aa9d028e34b4e72ff22c92fc5a43bcf1d6239..a1782048d6367e6c75a33d71aa345edf0f5722ad 100644 --- a/lib/Magento/Mail/Template/TransportBuilder.php +++ b/lib/Magento/Mail/Template/TransportBuilder.php @@ -83,22 +83,30 @@ class TransportBuilder */ protected $_senderResolver; + /** + * @var \Magento\Mail\TransportInterfaceFactory + */ + protected $_mailTransportFactory; + /** * @param FactoryInterface $templateFactory * @param \Magento\Mail\Message $message * @param \Magento\Mail\Template\SenderResolverInterface $senderResolver * @param \Magento\ObjectManager $objectManager + * @param \Magento\Mail\TransportInterfaceFactory $mailTransportFactory */ public function __construct( \Magento\Mail\Template\FactoryInterface $templateFactory, \Magento\Mail\Message $message, \Magento\Mail\Template\SenderResolverInterface $senderResolver, - \Magento\ObjectManager $objectManager + \Magento\ObjectManager $objectManager, + \Magento\Mail\TransportInterfaceFactory $mailTransportFactory ) { $this->templateFactory = $templateFactory; $this->message = $message; $this->objectManager = $objectManager; $this->_senderResolver = $senderResolver; + $this->_mailTransportFactory = $mailTransportFactory; } /** @@ -209,15 +217,10 @@ class TransportBuilder public function getTransport() { $this->prepareMessage(); - - $result = $this->objectManager->create( - 'Magento\Mail\TransportInterface', - array('message' => clone $this->message) - ); - + $mailTransport = $this->_mailTransportFactory->create(array('message' => clone $this->message)); $this->reset(); - return $result; + return $mailTransport; } /** diff --git a/lib/Magento/Mail/TransportInterfaceFactory.php b/lib/Magento/Mail/TransportInterfaceFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..b2437b6636eb78b81f2e422f415287b0c20d4dc7 --- /dev/null +++ b/lib/Magento/Mail/TransportInterfaceFactory.php @@ -0,0 +1,70 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Mail; + +/** + * Factory class for \Magento\Mail\TransportInterface + */ +class TransportInterfaceFactory +{ + /** + * Object Manager instance + * + * @var \Magento\ObjectManager + */ + protected $_objectManager = null; + + /** + * Instance name to create + * + * @var string + */ + protected $_instanceName = null; + + /** + * Factory constructor + * + * @param \Magento\ObjectManager $objectManager + * @param string $instanceName + */ + public function __construct( + \Magento\ObjectManager $objectManager, + $instanceName = 'Magento\Mail\TransportInterface' + ) { + $this->_objectManager = $objectManager; + $this->_instanceName = $instanceName; + } + + /** + * Create class instance with specified parameters + * + * @param array $data + * @return \Magento\Catalog\Model\Category + */ + public function create(array $data = array()) + { + return $this->_objectManager->create($this->_instanceName, $data); + } +} diff --git a/lib/Magento/Math/Calculator.php b/lib/Magento/Math/Calculator.php index 9ac7efbb576987692cdaa4149f17448528ed6361..ffa38e32d1be45de3c270e6f344c8be53cba7852 100644 --- a/lib/Magento/Math/Calculator.php +++ b/lib/Magento/Math/Calculator.php @@ -38,16 +38,16 @@ class Calculator /** * Store instance * - * @var \Magento\BaseScopeInterface|null + * @var \Magento\App\ScopeInterface|null */ protected $_scope = null; /** * Initialize calculator * - * @param \Magento\BaseScopeInterface $scope + * @param \Magento\App\ScopeInterface $scope */ - public function __construct(\Magento\BaseScopeInterface $scope) + public function __construct(\Magento\App\ScopeInterface $scope) { $this->_scope = $scope; } diff --git a/lib/Magento/Message/Manager.php b/lib/Magento/Message/Manager.php index 74e357a0d6bcb23569615118028a01330614728d..2c309704802c0185b5ec7efe33af1493d7e92d76 100644 --- a/lib/Magento/Message/Manager.php +++ b/lib/Magento/Message/Manager.php @@ -128,7 +128,7 @@ class Manager implements ManagerInterface if ($clear) { $messages = clone $this->session->getData($group); $this->session->getData($group)->clear(); - $this->eventManager->dispatch('core_session_abstract_clear_messages'); + $this->eventManager->dispatch('session_abstract_clear_messages'); return $messages; } return $this->session->getData($group); @@ -145,7 +145,7 @@ class Manager implements ManagerInterface { $this->hasMessages = true; $this->getMessages(false, $group)->addMessage($message); - $this->eventManager->dispatch('core_session_abstract_add_message'); + $this->eventManager->dispatch('session_abstract_add_message'); return $this; } diff --git a/lib/Magento/Model/AbstractModel.php b/lib/Magento/Model/AbstractModel.php index b6ef85b794cd25359049758cbf37c59934208c3a..c18f80570d0fd456bed0b909371786d70f9234ce 100644 --- a/lib/Magento/Model/AbstractModel.php +++ b/lib/Magento/Model/AbstractModel.php @@ -250,7 +250,7 @@ abstract class AbstractModel extends \Magento\Object throw new \Magento\Model\Exception(__('Resource is not set.')); } - return $this->_resource ?: \Magento\App\ObjectManager::getInstance()->get($this->_resourceName); + return $this->_resource ? : \Magento\App\ObjectManager::getInstance()->get($this->_resourceName); } /** @@ -277,14 +277,15 @@ abstract class AbstractModel extends \Magento\Object } return $this->_resourceCollection ? clone $this ->_resourceCollection : \Magento\App\ObjectManager::getInstance() - ->create( - $this->_collectionName - ); + ->create( + $this->_collectionName + ); } /** * Retrieve collection instance * + * @deprecated * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getCollection() @@ -317,7 +318,7 @@ abstract class AbstractModel extends \Magento\Object protected function _getEventData() { return array( - 'data_object' => $this, + 'data_object' => $this, $this->_eventObject => $this, ); } diff --git a/app/code/Magento/Core/Model/Module/Output/Config.php b/lib/Magento/Module/Output/Config.php similarity index 72% rename from app/code/Magento/Core/Model/Module/Output/Config.php rename to lib/Magento/Module/Output/Config.php index 3c517e3459ec86d28bcc890270bdf59e7a4619c5..b366d4011ddfb20b00aa40b796b0bf0a523b5bfb 100644 --- a/app/code/Magento/Core/Model/Module/Output/Config.php +++ b/lib/Magento/Module/Output/Config.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Module\Output; +namespace Magento\Module\Output; class Config implements \Magento\Module\Output\ConfigInterface { @@ -33,16 +33,25 @@ class Config implements \Magento\Module\Output\ConfigInterface const XML_PATH_MODULE_OUTPUT_STATUS = 'advanced/modules_disable_output/%s'; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** - * @param \Magento\Core\Model\Store\ConfigInterface $storeConfig + * @var string */ - public function __construct(\Magento\Core\Model\Store\ConfigInterface $storeConfig) - { - $this->_storeConfig = $storeConfig; + protected $_storeType; + + /** + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param string $scopeType + */ + public function __construct( + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + $scopeType + ) { + $this->_scopeConfig = $scopeConfig; + $this->_storeType = $scopeType; } /** @@ -58,6 +67,6 @@ class Config implements \Magento\Module\Output\ConfigInterface */ public function isSetFlag($path) { - return $this->_storeConfig->getConfigFlag($path); + return $this->_scopeConfig->isSetFlag($path, $this->_storeType); } } diff --git a/lib/Magento/Module/ResourceInterface.php b/lib/Magento/Module/ResourceInterface.php index 5876ade60cca6e9d7750484eff8f961591e18425..0d325ad61e8f3fdeb82d5b9c8d9251aae3f0d844 100644 --- a/lib/Magento/Module/ResourceInterface.php +++ b/lib/Magento/Module/ResourceInterface.php @@ -23,6 +23,9 @@ */ namespace Magento\Module; +/** + * Resource Model Interface + */ interface ResourceInterface { /** @@ -55,7 +58,7 @@ interface ResourceInterface * * @param string $resName * @param string $version - * @return null + * @return $this */ public function setDataVersion($resName, $version); } diff --git a/lib/Magento/Module/Setup.php b/lib/Magento/Module/Setup.php new file mode 100644 index 0000000000000000000000000000000000000000..e64fa75db6b604ce2acbbd1fc8c5c86005ce2a65 --- /dev/null +++ b/lib/Magento/Module/Setup.php @@ -0,0 +1,801 @@ +<?php +/** + * Resource Setup Model + * + * 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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Module; + +class Setup implements \Magento\Module\Updater\SetupInterface +{ + /** + * Setup resource name + * @var string + */ + protected $_resourceName; + + /** + * Setup module configuration object + * + * @var array + */ + protected $_moduleConfig; + + /** + * Call afterApplyAllUpdates method flag + * + * @var boolean + */ + protected $_callAfterApplyAllUpdates = false; + + /** + * Setup Connection + * + * @var \Magento\DB\Adapter\Pdo\Mysql + */ + protected $_connection = null; + + /** + * Tables cache array + * + * @var array + */ + protected $_tables = array(); + + /** + * Tables data cache array + * + * @var array + */ + protected $_setupCache = array(); + + /** + * Modules configuration + * + * @var \Magento\App\Resource + */ + protected $_resourceModel; + + /** + * Modules configuration reader + * + * @var \Magento\Module\Dir\Reader + */ + protected $_modulesReader; + + /** + * @var \Magento\Event\ManagerInterface + */ + protected $_eventManager; + + /** + * @var \Magento\Logger + */ + protected $_logger; + + /** + * @var \Magento\Module\ResourceInterface + */ + protected $_resourceResource; + + /** + * @var \Magento\Module\Setup\MigrationFactory + */ + protected $_migrationFactory; + + /** + * Connection instance name + * + * @var string + */ + protected $_connectionName; + + /** + * Filesystem instance + * + * @var \Magento\App\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Filesystem\Directory\ReadInterface + */ + protected $modulesDir; + + /** + * @param \Magento\Module\Setup\Context $context + * @param string $resourceName + * @param string $moduleName + * @param string $connectionName + */ + public function __construct( + \Magento\Module\Setup\Context $context, + $resourceName, + $moduleName, + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION + ) { + $this->_eventManager = $context->getEventManager(); + $this->_resourceModel = $context->getResourceModel(); + $this->_logger = $context->getLogger(); + $this->_modulesReader = $context->getModulesReader(); + $this->_resourceName = $resourceName; + $this->_resourceResource = $context->getResourceResource(); + $this->_migrationFactory = $context->getMigrationFactory(); + $this->_moduleConfig = $context->getModuleList()->getModule($moduleName); + $this->filesystem = $context->getFilesystem(); + $this->modulesDir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); + $this->_connectionName = $connectionName; + } + + /** + * Get connection object + * + * @return \Magento\DB\Adapter\AdapterInterface + */ + public function getConnection() + { + if (null === $this->_connection) { + $this->_connection = $this->_resourceModel->getConnection($this->_connectionName); + } + return $this->_connection; + } + + /** + * Add table placeholder/table name relation + * + * @param string $tableName + * @param string $realTableName + * @return $this + */ + public function setTable($tableName, $realTableName) + { + $this->_tables[$tableName] = $realTableName; + return $this; + } + + /** + * Get table name (validated by db adapter) by table placeholder + * + * @param string|array $tableName + * @return string + */ + public function getTable($tableName) + { + $cacheKey = $this->_getTableCacheName($tableName); + if (!isset($this->_tables[$cacheKey])) { + $this->_tables[$cacheKey] = $this->_resourceModel->getTableName($tableName); + } + return $this->_tables[$cacheKey]; + } + + /** + * Retrieve table name for cache + * + * @param string|array $tableName + * @return string + */ + protected function _getTableCacheName($tableName) + { + if (is_array($tableName)) { + return join('_', $tableName); + } + return $tableName; + } + + /** + * Apply data updates to the system after upgrading. + * + * @return $this + */ + public function applyDataUpdates() + { + $dataVer = $this->_resourceResource->getDataVersion($this->_resourceName); + $configVer = $this->_moduleConfig['version']; + if ($dataVer !== false) { + $status = version_compare($configVer, $dataVer); + if ($status == self::VERSION_COMPARE_GREATER) { + $this->_upgradeData($dataVer, $configVer); + } + } elseif ($configVer) { + $this->_installData($configVer); + } + return $this; + } + + /** + * Apply module resource install, upgrade and data scripts + * + * @return $this|true + */ + public function applyUpdates() + { + $dbVer = $this->_resourceResource->getDbVersion($this->_resourceName); + $configVer = $this->_moduleConfig['version']; + + // Module is installed + if ($dbVer !== false) { + $status = version_compare($configVer, $dbVer); + switch ($status) { + case self::VERSION_COMPARE_LOWER: + $this->_rollbackResourceDb($configVer, $dbVer); + break; + case self::VERSION_COMPARE_GREATER: + $this->_upgradeResourceDb($dbVer, $configVer); + break; + default: + return true; + break; + } + } elseif ($configVer) { + $this->_installResourceDb($configVer); + } + + return $this; + } + + /** + * Run data install scripts + * + * @param string $newVersion + * @return $this + */ + protected function _installData($newVersion) + { + $oldVersion = $this->_modifyResourceDb(self::TYPE_DATA_INSTALL, '', $newVersion); + $this->_modifyResourceDb(self::TYPE_DATA_UPGRADE, $oldVersion, $newVersion); + $this->_resourceResource->setDataVersion($this->_resourceName, $newVersion); + + return $this; + } + + /** + * Run data upgrade scripts + * + * @param string $oldVersion + * @param string $newVersion + * @return $this + */ + protected function _upgradeData($oldVersion, $newVersion) + { + $this->_modifyResourceDb('data-upgrade', $oldVersion, $newVersion); + $this->_resourceResource->setDataVersion($this->_resourceName, $newVersion); + + return $this; + } + + /** + * Run resource installation file + * + * @param string $newVersion + * @return $this + */ + protected function _installResourceDb($newVersion) + { + $oldVersion = $this->_modifyResourceDb(self::TYPE_DB_INSTALL, '', $newVersion); + $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion); + $this->_resourceResource->setDbVersion($this->_resourceName, $newVersion); + + return $this; + } + + /** + * Run resource upgrade files from $oldVersion to $newVersion + * + * @param string $oldVersion + * @param string $newVersion + * @return $this + */ + protected function _upgradeResourceDb($oldVersion, $newVersion) + { + $this->_modifyResourceDb(self::TYPE_DB_UPGRADE, $oldVersion, $newVersion); + $this->_resourceResource->setDbVersion($this->_resourceName, $newVersion); + + return $this; + } + + /** + * Roll back resource + * + * @param string $newVersion + * @param string $oldVersion + * @return $this + */ + protected function _rollbackResourceDb($newVersion, $oldVersion) + { + $this->_modifyResourceDb(self::TYPE_DB_ROLLBACK, $newVersion, $oldVersion); + return $this; + } + + /** + * Uninstall resource + * + * @param string $version existing resource version + * @return $this + */ + protected function _uninstallResourceDb($version) + { + $this->_modifyResourceDb(self::TYPE_DB_UNINSTALL, $version, ''); + return $this; + } + + /** + * Retrieve available Database install/upgrade files for current module + * + * @param string $actionType + * @param string $fromVersion + * @param string $toVersion + * @return array + */ + protected function _getAvailableDbFiles($actionType, $fromVersion, $toVersion) + { + $modName = (string)$this->_moduleConfig['name']; + + $filesDir = $this->_modulesReader->getModuleDir('sql', $modName) . '/' . $this->_resourceName; + $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); + if (!$this->modulesDir->isDirectory($modulesDirPath) || !$this->modulesDir->isReadable($modulesDirPath)) { + return array(); + } + + $dbFiles = array(); + $typeFiles = array(); + $regExpDb = sprintf('#%s-(.*)\.(php|sql)$#i', $actionType); + $regExpType = sprintf('#%s-%s-(.*)\.(php|sql)$#i', 'mysql4', $actionType); + foreach ($this->modulesDir->read($modulesDirPath) as $file) { + $matches = array(); + if (preg_match($regExpDb, $file, $matches)) { + $dbFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); + } else if (preg_match($regExpType, $file, $matches)) { + $typeFiles[$matches[1]] = $this->modulesDir->getAbsolutePath($file); + } + } + + if (empty($typeFiles) && empty($dbFiles)) { + return array(); + } + + foreach ($typeFiles as $version => $file) { + $dbFiles[$version] = $file; + } + + return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $dbFiles); + } + + /** + * Retrieve available Data install/upgrade files for current module + * + * @param string $actionType + * @param string $fromVersion + * @param string $toVersion + * @return array + */ + protected function _getAvailableDataFiles($actionType, $fromVersion, $toVersion) + { + $modName = (string)$this->_moduleConfig['name']; + $files = array(); + + $filesDir = $this->_modulesReader->getModuleDir('data', $modName) . '/' . $this->_resourceName; + $modulesDirPath = $this->modulesDir->getRelativePath($filesDir); + if ($this->modulesDir->isDirectory($modulesDirPath) && $this->modulesDir->isReadable($modulesDirPath)) { + $regExp = sprintf('#%s-(.*)\.php$#i', $actionType); + foreach ($this->modulesDir->read($modulesDirPath) as $file) { + $matches = array(); + if (preg_match($regExp, $file, $matches)) { + $files[$matches[1]] = $this->modulesDir->getAbsolutePath($file); + } + } + } + + if (empty($files)) { + return array(); + } + + return $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $files); + } + + /** + * Save resource version + * + * @param string $actionType + * @param string $version + * @return $this + */ + protected function _setResourceVersion($actionType, $version) + { + switch ($actionType) { + case self::TYPE_DB_INSTALL: + case self::TYPE_DB_UPGRADE: + $this->_resourceResource->setDbVersion($this->_resourceName, $version); + break; + case self::TYPE_DATA_INSTALL: + case self::TYPE_DATA_UPGRADE: + $this->_resourceResource->setDataVersion($this->_resourceName, $version); + break; + default: + break; + } + + return $this; + } + + /** + * Run module modification files. Return version of last applied upgrade (false if no upgrades applied) + * @param string $actionType + * @param string $fromVersion + * @param string $toVersion + * @return false|string + * @throws \Magento\Exception + */ + protected function _modifyResourceDb($actionType, $fromVersion, $toVersion) + { + switch ($actionType) { + case self::TYPE_DB_INSTALL: + case self::TYPE_DB_UPGRADE: + $files = $this->_getAvailableDbFiles($actionType, $fromVersion, $toVersion); + break; + case self::TYPE_DATA_INSTALL: + case self::TYPE_DATA_UPGRADE: + $files = $this->_getAvailableDataFiles($actionType, $fromVersion, $toVersion); + break; + default: + $files = array(); + break; + } + if (empty($files) || !$this->getConnection()) { + return false; + } + + $version = false; + + foreach ($files as $file) { + $fileName = $file['fileName']; + $fileType = pathinfo($fileName, PATHINFO_EXTENSION); + $this->getConnection()->disallowDdlCache(); + try { + switch ($fileType) { + case 'php': + $result = $this->_includeFile($fileName); + break; + case 'sql': + $sql = $this->modulesDir->readFile($this->modulesDir->getRelativePath($fileName)); + if (!empty($sql)) { + + $result = $this->run($sql); + } else { + $result = true; + } + break; + default: + $result = false; + break; + } + + if ($result) { + $this->_setResourceVersion($actionType, $file['toVersion']); + $this->_logger->log($fileName); + } else { + $this->_logger->log("Failed resource setup: {$fileName}"); + } + } catch (\Exception $e) { + throw new \Magento\Exception(sprintf('Error in file: "%s" - %s', $fileName, $e->getMessage()), 0, $e); + } + $version = $file['toVersion']; + $this->getConnection()->allowDdlCache(); + } + return $version; + } + + /** + * Include file by path + * This method should perform only file inclusion. + * Implemented to prevent possibility of changing important and used variables + * inside the setup model while installing + * + * @param string $fileName + * @return mixed + */ + protected function _includeFile($fileName) + { + return include $fileName; + } + + /** + * Get data files for modifications + * + * @param string $actionType + * @param string $fromVersion + * @param string $toVersion + * @param array $arrFiles + * @return array + */ + protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) + { + $arrRes = []; + switch ($actionType) { + case self::TYPE_DB_INSTALL: + case self::TYPE_DATA_INSTALL: + uksort($arrFiles, 'version_compare'); + foreach ($arrFiles as $version => $file) { + if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { + $arrRes[0] = [ + 'toVersion' => $version, + 'fileName' => $file + ]; + } + } + break; + + case self::TYPE_DB_UPGRADE: + case self::TYPE_DATA_UPGRADE: + uksort($arrFiles, 'version_compare'); + foreach ($arrFiles as $version => $file) { + $versionInfo = explode('-', $version); + + // In array must be 2 elements: 0 => version from, 1 => version to + if (count($versionInfo) !== 2) { + break; + } + $infoFrom = $versionInfo[0]; + $infoTo = $versionInfo[1]; + if (version_compare($infoFrom, $fromVersion, '>=') + && version_compare($infoTo, $fromVersion, '>') + && version_compare($infoTo, $toVersion, '<=') + && version_compare($infoFrom, $toVersion, '<') + ) { + $arrRes[] = [ + 'toVersion' => $infoTo, + 'fileName' => $file + ]; + } + } + break; + + case self::TYPE_DB_ROLLBACK: + case self::TYPE_DB_UNINSTALL: + default: + break; + } + return $arrRes; + } + + /******************* UTILITY METHODS *****************/ + + /** + * Retrieve row or field from table by id or string and parent id + * + * @param string $table + * @param string $idField + * @param string|integer $rowId + * @param string|null $field + * @param string|null $parentField + * @param string|integer $parentId + * @return mixed + */ + public function getTableRow($table, $idField, $rowId, $field = null, $parentField = null, $parentId = 0) + { + $table = $this->getTable($table); + if (empty($this->_setupCache[$table][$parentId][$rowId])) { + $adapter = $this->getConnection(); + $bind = array('id_field' => $rowId); + $select = $adapter->select()->from($table)->where($adapter->quoteIdentifier($idField) . '= :id_field'); + if (null !== $parentField) { + $select->where($adapter->quoteIdentifier($parentField) . '= :parent_id'); + $bind['parent_id'] = $parentId; + } + $this->_setupCache[$table][$parentId][$rowId] = $adapter->fetchRow($select, $bind); + } + + if (null === $field) { + return $this->_setupCache[$table][$parentId][$rowId]; + } + return isset( + $this->_setupCache[$table][$parentId][$rowId][$field] + ) ? $this->_setupCache[$table][$parentId][$rowId][$field] : false; + } + + /** + * Delete table row + * + * @param string $table + * @param string $idField + * @param string|int $rowId + * @param null|string $parentField + * @param int|string $parentId + * @return $this + */ + public function deleteTableRow($table, $idField, $rowId, $parentField = null, $parentId = 0) + { + $table = $this->getTable($table); + $adapter = $this->getConnection(); + $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId); + if (!is_null($parentField)) { + $where[$adapter->quoteIdentifier($parentField) . '=?'] = $parentId; + } + + $adapter->delete($table, $where); + + if (isset($this->_setupCache[$table][$parentId][$rowId])) { + unset($this->_setupCache[$table][$parentId][$rowId]); + } + + return $this; + } + + /** + * Update one or more fields of table row + * + * @param string $table + * @param string $idField + * @param string|integer $rowId + * @param string|array $field + * @param mixed|null $value + * @param string $parentField + * @param string|integer $parentId + * @return $this + */ + public function updateTableRow($table, $idField, $rowId, $field, $value = null, $parentField = null, $parentId = 0) + { + $table = $this->getTable($table); + if (is_array($field)) { + $data = $field; + } else { + $data = array($field => $value); + } + + $adapter = $this->getConnection(); + $where = array($adapter->quoteIdentifier($idField) . '=?' => $rowId); + $adapter->update($table, $data, $where); + + if (isset($this->_setupCache[$table][$parentId][$rowId])) { + if (is_array($field)) { + $this->_setupCache[$table][$parentId][$rowId] = array_merge( + $this->_setupCache[$table][$parentId][$rowId], + $field + ); + } else { + $this->_setupCache[$table][$parentId][$rowId][$field] = $value; + } + } + + return $this; + } + + /** + * Check is table exists + * + * @param string $table + * @return bool + */ + public function tableExists($table) + { + $table = $this->getTable($table); + return $this->getConnection()->isTableExists($table); + } + + /** + * Run plain SQL query(ies) + * + * @param string $sql + * @return $this + */ + public function run($sql) + { + $this->getConnection()->multiQuery($sql); + return $this; + } + + /** + * Prepare database before install/upgrade + * + * @return $this + */ + public function startSetup() + { + $this->getConnection()->startSetup(); + return $this; + } + + /** + * Prepare database after install/upgrade + * + * @return $this + */ + public function endSetup() + { + $this->getConnection()->endSetup(); + return $this; + } + + /** + * Retrieve 32bit UNIQUE HASH for a Table index + * + * @param string $tableName + * @param array|string $fields + * @param string $indexType + * @return string + */ + public function getIdxName($tableName, $fields, $indexType = '') + { + return $this->_resourceModel->getIdxName($tableName, $fields, $indexType); + } + + /** + * Retrieve 32bit UNIQUE HASH for a Table foreign key + * + * @param string $priTableName the target table name + * @param string $priColumnName the target table column name + * @param string $refTableName the reference table name + * @param string $refColumnName the reference table column name + * @return string + */ + public function getFkName($priTableName, $priColumnName, $refTableName, $refColumnName) + { + return $this->_resourceModel->getFkName($priTableName, $priColumnName, $refTableName, $refColumnName); + } + + /** + * Check call afterApplyAllUpdates method for setup class + * + * @return bool + */ + public function getCallAfterApplyAllUpdates() + { + return $this->_callAfterApplyAllUpdates; + } + + /** + * Run each time after applying of all updates, + * if setup model setted $_callAfterApplyAllUpdates flag to true + * + * @return $this + */ + public function afterApplyAllUpdates() + { + return $this; + } + + /** + * @return \Magento\Event\ManagerInterface + */ + public function getEventManager() + { + return $this->_eventManager; + } + + /** + * @return \Magento\App\Filesystem + */ + public function getFilesystem() + { + return $this->filesystem; + } + + /** + * Create migration setup + * + * @param array $data + * @return \Magento\Module\Setup\Migration + */ + public function createMigrationSetup(array $data = array()) + { + return $this->_migrationFactory->create($data); + } +} diff --git a/app/code/Magento/Core/Model/Resource/Setup/Context.php b/lib/Magento/Module/Setup/Context.php similarity index 77% rename from app/code/Magento/Core/Model/Resource/Setup/Context.php rename to lib/Magento/Module/Setup/Context.php index 961117209e06763f1d6a1ccc026160533318a029..c4275d097fdd76abdc77f0342eeffdcca77eedfe 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Context.php +++ b/lib/Magento/Module/Setup/Context.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Setup; +namespace Magento\Module\Setup; class Context implements \Magento\ObjectManager\ContextInterface { @@ -56,20 +56,10 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_resourceResource; /** - * @var \Magento\Core\Model\Resource\Setup\MigrationFactory + * @var \Magento\Module\Setup\MigrationFactory */ protected $_migrationFactory; - /** - * @var \Magento\Core\Model\Resource\Theme\CollectionFactory - */ - protected $_themeResourceFactory; - - /** - * @var \Magento\Core\Model\Theme\CollectionFactory - */ - protected $_themeFactory; - /** * @var \Magento\Encryption\EncryptorInterface */ @@ -89,9 +79,7 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Module\ResourceInterface $resourceResource - * @param MigrationFactory $migrationFactory - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory - * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory + * @param \Magento\Module\Setup\MigrationFactory $migrationFactory * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\App\Filesystem $filesystem */ @@ -102,9 +90,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Module\Dir\Reader $modulesReader, \Magento\Module\ModuleListInterface $moduleList, \Magento\Module\ResourceInterface $resourceResource, - \Magento\Core\Model\Resource\Setup\MigrationFactory $migrationFactory, - \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, - \Magento\Core\Model\Theme\CollectionFactory $themeFactory, + \Magento\Module\Setup\MigrationFactory $migrationFactory, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\App\Filesystem $filesystem ) { @@ -115,8 +101,6 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_moduleList = $moduleList; $this->_resourceResource = $resourceResource; $this->_migrationFactory = $migrationFactory; - $this->_themeResourceFactory = $themeResourceFactory; - $this->_themeFactory = $themeFactory; $this->_encryptor = $encryptor; $this->filesystem = $filesystem; } @@ -162,7 +146,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Core\Model\Resource\Setup\MigrationFactory + * @return \Magento\Module\Setup\MigrationFactory */ public function getMigrationFactory() { @@ -177,22 +161,6 @@ class Context implements \Magento\ObjectManager\ContextInterface return $this->_resourceResource; } - /** - * @return \Magento\Core\Model\Theme\CollectionFactory - */ - public function getThemeFactory() - { - return $this->_themeFactory; - } - - /** - * @return \Magento\Core\Model\Resource\Theme\CollectionFactory - */ - public function getThemeResourceFactory() - { - return $this->_themeResourceFactory; - } - /** * @return \Magento\Encryption\EncryptorInterface */ diff --git a/app/code/Magento/Core/Model/Resource/Setup/Migration.php b/lib/Magento/Module/Setup/Migration.php similarity index 89% rename from app/code/Magento/Core/Model/Resource/Setup/Migration.php rename to lib/Magento/Module/Setup/Migration.php index 186f50fb9e7b4f9ceb43ca70b86b6b25b905507a..39df5a90e064d10d3abad5c76b0d4164ea5161b5 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Migration.php +++ b/lib/Magento/Module/Setup/Migration.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Setup; +namespace Magento\Module\Setup; /** * Resource setup model with methods needed for migration process between Magento versions * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Migration extends \Magento\Core\Model\Resource\Setup +class Migration extends \Magento\Module\Setup { /**#@+ * Type of field content where class alias is used @@ -57,16 +57,8 @@ class Migration extends \Magento\Core\Model\Resource\Setup /**#@-*/ /**#@+ - * Find/replace patterns + * Replace pattern */ - const PLAIN_FIND_PATTERN = '/^(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)::.*?$/sui'; - - const WIKI_FIND_PATTERN = '/{{(block|widget).*?(class|type)=\"(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)\".*?}}/sui'; - - const XML_FIND_PATTERN = '/<block.*?class=\"(?P<alias>[a-z]+[_a-z\d]*?\/[a-z]+[_a-z\d]*?)\".*?>/sui'; - - const SERIALIZED_FIND_PATTERN = '#(?P<string>s:\d+:"(?P<alias>[a-z]+[_a-z\d]*?/[a-z]+[_a-z\d]*?)")#sui'; - const SERIALIZED_REPLACE_PATTERN = 's:%d:"%s"'; /**#@-*/ @@ -123,15 +115,7 @@ class Migration extends \Magento\Core\Model\Resource\Setup * * @var array */ - protected $_replacePatterns = array( - self::FIELD_CONTENT_TYPE_WIKI => self::WIKI_FIND_PATTERN, - self::FIELD_CONTENT_TYPE_XML => self::XML_FIND_PATTERN - ); - - /** - * @var \Magento\Core\Helper\Data - */ - protected $_coreHelper; + protected $_replacePatterns = array(); /** * Path to map file from config @@ -153,24 +137,36 @@ class Migration extends \Magento\Core\Model\Resource\Setup protected $_directory; /** - * @param \Magento\Core\Model\Resource\Setup\Context $context - * @param string $resourceName - * @param \Magento\Core\Helper\Data $helper + * @var \Magento\Module\Setup\MigrationData + */ + protected $_migrationData; + + /** + * @param \Magento\Module\Setup\Context $context + * @param \Magento\Module\Setup\MigrationData $migrationData * @param string $confPathToMapFile + * @param string $resourceName * @param string $moduleName * @param string $connectionName + * @param array $compositeModules */ public function __construct( - \Magento\Core\Model\Resource\Setup\Context $context, + \Magento\Module\Setup\Context $context, $resourceName, - \Magento\Core\Helper\Data $helper, + $moduleName, + \Magento\Module\Setup\MigrationData $migrationData, $confPathToMapFile, - $moduleName = 'Magento_Core', - $connectionName = '' + $connectionName = \Magento\Module\Updater\SetupInterface::DEFAULT_SETUP_CONNECTION, + $compositeModules = array() ) { $this->_directory = $context->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); - $this->_coreHelper = $helper; $this->_pathToMapFile = $confPathToMapFile; + $this->_migrationData = $migrationData; + $this->_replacePatterns = array( + self::FIELD_CONTENT_TYPE_WIKI => $this->_migrationData->getWikiFindPattern(), + self::FIELD_CONTENT_TYPE_XML => $this->_migrationData->getXmlFindPattern() + ); + $this->_compositeModules = $compositeModules; parent::__construct($context, $resourceName, $moduleName, $connectionName); } @@ -449,7 +445,7 @@ class Migration extends \Magento\Core\Model\Resource\Setup */ protected function _getModelReplacement($data, $entityType = '') { - if (preg_match(self::PLAIN_FIND_PATTERN, $data, $matches)) { + if (preg_match($this->_migrationData->getPlainFindPattern(), $data, $matches)) { $classAlias = $matches['alias']; $className = $this->_getCorrespondingClassName($classAlias, $entityType); if ($className) { @@ -560,9 +556,6 @@ class Migration extends \Magento\Core\Model\Resource\Setup */ protected function _getCompositeModuleName($moduleAlias) { - if (null === $this->_compositeModules) { - $this->_compositeModules = static::getCompositeModules(); - } if (array_key_exists($moduleAlias, $this->_compositeModules)) { return $this->_compositeModules[$moduleAlias]; } @@ -634,7 +627,7 @@ class Migration extends \Magento\Core\Model\Resource\Setup $map = $this->_loadMap($this->_pathToMapFile); if (!empty($map)) { - $this->_aliasesMap = $this->_coreHelper->jsonDecode($map); + $this->_aliasesMap = $this->_jsonDecode($map); } } @@ -686,7 +679,7 @@ class Migration extends \Magento\Core\Model\Resource\Setup */ protected function _parseSerializedString($string) { - if ($string && preg_match_all(self::SERIALIZED_FIND_PATTERN, $string, $matches)) { + if ($string && preg_match_all($this->_migrationData->getSerializedFindPattern(), $string, $matches)) { unset($matches[0], $matches[1], $matches[2]); return $matches; } else { @@ -697,24 +690,23 @@ class Migration extends \Magento\Core\Model\Resource\Setup /** * List of correspondence between composite module aliases and module names * - * @static * @return array */ - public static function getCompositeModules() + public function getCompositeModules() { - return array( - 'adminnotification' => 'Magento_AdminNotification', - 'catalogindex' => 'Magento_CatalogIndex', - 'cataloginventory' => 'Magento_CatalogInventory', - 'catalogrule' => 'Magento_CatalogRule', - 'catalogsearch' => 'Magento_CatalogSearch', - 'currencysymbol' => 'Magento_CurrencySymbol', - 'giftmessage' => 'Magento_GiftMessage', - 'googleanalytics' => 'Magento_GoogleAnalytics', - 'googlebase' => 'Magento_GoogleBase', - 'importexport' => 'Magento_ImportExport', - 'productalert' => 'Magento_ProductAlert', - 'salesrule' => 'Magento_SalesRule' - ); + return $this->_compositeModules; + } + + /** + * Decodes the given $encodedValue string which is + * encoded in the JSON format + * + * @param string $encodedValue + * @param int $objectDecodeType + * @return mixed + */ + protected function _jsonDecode($encodedValue, $objectDecodeType = \Zend_Json::TYPE_ARRAY) + { + return \Zend_Json::decode($encodedValue, $objectDecodeType); } } diff --git a/lib/Magento/Module/Setup/MigrationData.php b/lib/Magento/Module/Setup/MigrationData.php new file mode 100644 index 0000000000000000000000000000000000000000..6cc2f9c67dd530566cdd55b5e2641bfecef76e63 --- /dev/null +++ b/lib/Magento/Module/Setup/MigrationData.php @@ -0,0 +1,103 @@ +<?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 Magento + * @package Magento_Module + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Module\Setup; + +/** + * Replace patterns needed for migration process between Magento versions + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class MigrationData +{ + /** + * List of required params + * + * @var string[] + */ + protected $_requiredParams = array('plain', 'wiki', 'xml', 'serialized'); + + /** + * List of replace patterns + * + * @var string[] + */ + protected $_patterns = array(); + + /** + * @param array $data + * @throws \InvalidArgumentException + */ + public function __construct( + array $data + ) { + foreach ($this->_requiredParams as $param) { + if (!isset($data[$param])) { + throw new \InvalidArgumentException("Missing required param " . $param); + } + $this->_patterns[$param] = $data[$param]; + } + } + + /** + * Get replace pattern + * + * @return string + */ + public function getPlainFindPattern() + { + return $this->_patterns['plain']; + } + + /** + * Get replace pattern + * + * @return string + */ + public function getWikiFindPattern() + { + return $this->_patterns['wiki']; + } + + /** + * Get replace pattern + * + * @return string + */ + public function getXmlFindPattern() + { + return $this->_patterns['xml']; + } + + /** + * Get replace pattern + * + * @return string + */ + public function getSerializedFindPattern() + { + return $this->_patterns['serialized']; + } +} diff --git a/app/code/Magento/Core/Model/Session/Pool.php b/lib/Magento/Module/Setup/MigrationFactory.php similarity index 56% rename from app/code/Magento/Core/Model/Session/Pool.php rename to lib/Magento/Module/Setup/MigrationFactory.php index b9bfd2962989362db23e97113ee958b7c6e627c1..d6a9ed7748d8288e8d371524042643fbde86e66b 100644 --- a/app/code/Magento/Core/Model/Session/Pool.php +++ b/lib/Magento/Module/Setup/MigrationFactory.php @@ -19,44 +19,60 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Module * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; +namespace Magento\Module\Setup; -use Magento\Session\SessionManagerInterface; - -class Pool +/** + * Factory class for \Magento\Module\Setup\Migration + */ +class MigrationFactory { /** + * Object Manager instance + * * @var \Magento\ObjectManager */ - protected $_objectManager; + protected $_objectManager = null; + + /** + * Instance name to create + * + * @var string + */ + protected $_instanceName = null; /** + * Factory constructor + * * @param \Magento\ObjectManager $objectManager + * @param string $instanceName */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\ObjectManager $objectManager, $instanceName = 'Magento\Module\Setup\Migration') { $this->_objectManager = $objectManager; + $this->_instanceName = $instanceName; } /** - * Create instance + * Create class instance with specified parameters * - * @param string $instanceName * @param array $data - * @throws \LogicException - * @return SessionManagerInterface + * @return \Magento\Module\Setup\Migration + * @throws \InvalidArgumentException */ - public function get($instanceName, $data = array()) + public function create(array $data = array()) { - $object = $this->_objectManager->get($instanceName, array('data' => $data)); - if (!$object instanceof SessionManagerInterface) { - throw new \LogicException($instanceName . ' doesn\'t implement \Magento\Session\SessionManagerInterface'); - } - return $object; + $migrationInstance = $this->_objectManager->create($this->_instanceName, $data); + + if (!$migrationInstance instanceof \Magento\Module\Setup\Migration) { + throw new \InvalidArgumentException( + $this->_instanceName . ' doesn\'n extend \Magento\Module\Setup\Migration' + ); + } + return $migrationInstance; } } diff --git a/lib/Magento/OSInfo.php b/lib/Magento/OsInfo.php similarity index 99% rename from lib/Magento/OSInfo.php rename to lib/Magento/OsInfo.php index 1d33c883e41cb36e76e8f56dfc98bd2107551c0e..7eff2bfa2067279cb2c56e13148c604f5e1fcbdb 100644 --- a/lib/Magento/OSInfo.php +++ b/lib/Magento/OsInfo.php @@ -28,7 +28,7 @@ namespace Magento; /** * Wrapper on PHP_OS constant */ -class OSInfo +class OsInfo { /** * Operation system diff --git a/lib/Magento/Service/Data/EAV/AbstractObject.php b/lib/Magento/Service/Data/EAV/AbstractObject.php index 4ec269ea1666522fe1fcd891530a8885d66143f4..ce8b2b70f16034e58ca5c8b13c3544cced4a8712 100644 --- a/lib/Magento/Service/Data/EAV/AbstractObject.php +++ b/lib/Magento/Service/Data/EAV/AbstractObject.php @@ -57,7 +57,7 @@ abstract class AbstractObject extends \Magento\Service\Data\AbstractObject /** * Retrieve custom attributes values as an associative array. * - * @return string[] + * @return string[]|null */ public function getCustomAttributes() { diff --git a/lib/Magento/Service/DataObjectConverter.php b/lib/Magento/Service/DataObjectConverter.php index 74fd9a80e03154a3ca82c57d6149bcb091486404..7fac97db914b2f40723a1644289f12f3289ea640 100644 --- a/lib/Magento/Service/DataObjectConverter.php +++ b/lib/Magento/Service/DataObjectConverter.php @@ -39,4 +39,71 @@ class DataObjectConverter $data = $dataObject->__toArray(); return ConvertArray::toFlatArray($data); } + + /** + * Convert keys to camelCase + * + * @param array $dataArray + * @return \stdClass + */ + public function convertKeysToCamelCase(array $dataArray) + { + $response = []; + foreach ($dataArray as $fieldName => $fieldValue) { + if (is_array($fieldValue) && !$this->_isSimpleSequentialArray($fieldValue)) { + $fieldValue = $this->convertKeysToCamelCase($fieldValue); + } + $fieldName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $fieldName)))); + $response[$fieldName] = $fieldValue; + } + return $response; + } + + /** + * Check if the array is a simple(one dimensional and not nested) and a sequential(non-associative) array + * + * @param array $data + * @return bool + */ + protected function _isSimpleSequentialArray(array $data) + { + foreach ($data as $key => $value) { + if (is_string($key) || is_array($value)) { + return false; + } + } + return true; + } + + /** + * Convert multidimensional object/array into multidimensional array of primitives. + * + * @param object|array $input + * @param bool $removeItemNode Remove Item node from arrays if true + * @return array + * @throws \InvalidArgumentException + */ + public function convertStdObjectToArray($input, $removeItemNode = false) + { + if (!is_object($input) && !is_array($input)) { + throw new \InvalidArgumentException("Input argument must be an array or object"); + } + if ($removeItemNode && isset($input->item)) { + /** + * In case when only one Data object value is passed, it will not be wrapped into a subarray + * within item node. If several Data object values are passed, they will be wrapped into + * an indexed array within item node. + */ + $input = is_object($input->item) ? [$input->item] : $input->item; + } + $result = array(); + foreach ((array)$input as $key => $value) { + if (is_object($value) || is_array($value)) { + $result[$key] = $this->convertStdObjectToArray($value, $removeItemNode); + } else { + $result[$key] = $value; + } + } + return $result; + } } diff --git a/app/code/Magento/Customer/Service/V1/Data/Filter.php b/lib/Magento/Service/V1/Data/Filter.php similarity index 91% rename from app/code/Magento/Customer/Service/V1/Data/Filter.php rename to lib/Magento/Service/V1/Data/Filter.php index 8e0b32b52988e66edfbdc3a293ed086af645ea72..99007abfe143e82a56d528060861a8ecd5785801 100644 --- a/app/code/Magento/Customer/Service/V1/Data/Filter.php +++ b/lib/Magento/Service/V1/Data/Filter.php @@ -21,10 +21,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Service\V1\Data; + +namespace Magento\Service\V1\Data; /** - * Filter Service Data Object used in search requests + * Filter which can be used by any methods from service layer. */ class Filter extends \Magento\Service\Data\AbstractObject { @@ -41,7 +42,7 @@ class Filter extends \Magento\Service\Data\AbstractObject /** * Get value * - * @return string | string[] + * @return string */ public function getValue() { @@ -51,7 +52,7 @@ class Filter extends \Magento\Service\Data\AbstractObject /** * Get condition type * - * @return string + * @return string|null */ public function getConditionType() { diff --git a/app/code/Magento/Customer/Service/V1/Data/FilterBuilder.php b/lib/Magento/Service/V1/Data/FilterBuilder.php similarity index 90% rename from app/code/Magento/Customer/Service/V1/Data/FilterBuilder.php rename to lib/Magento/Service/V1/Data/FilterBuilder.php index 9f1fc6e4a2c771aea1b25406243684b5adc7967c..1a402cff6a220fd4a1c64890377a8e7fa77767ef 100644 --- a/app/code/Magento/Customer/Service/V1/Data/FilterBuilder.php +++ b/lib/Magento/Service/V1/Data/FilterBuilder.php @@ -21,16 +21,15 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Customer\Service\V1\Data; -use Magento\Service\Data\AbstractObjectBuilder; +namespace Magento\Service\V1\Data; /** * Builder for Filter Service Data Object. * * @method Filter create() */ -class FilterBuilder extends AbstractObjectBuilder +class FilterBuilder extends \Magento\Service\Data\AbstractObjectBuilder { /** * Set field @@ -47,7 +46,7 @@ class FilterBuilder extends AbstractObjectBuilder /** * Set value * - * @param string|string[] $value + * @param string $value * @return $this */ public function setValue($value) diff --git a/app/code/Magento/Core/Model/Session/Config.php b/lib/Magento/Session/Config.php similarity index 92% rename from app/code/Magento/Core/Model/Session/Config.php rename to lib/Magento/Session/Config.php index 5a3a8c79215e434518b4097971abe4f2c5be1a5f..457aefc2a1f3f443d5ce8e5c461927d9cd4891b5 100644 --- a/app/code/Magento/Core/Model/Session/Config.php +++ b/lib/Magento/Session/Config.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; +namespace Magento\Session; use Magento\Session\Config\ConfigInterface; @@ -82,14 +82,9 @@ class Config implements ConfigInterface protected $options = array(); /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; - - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; + protected $_scopeConfig; /** * @var \Magento\Stdlib\String @@ -124,33 +119,38 @@ class Config implements ConfigInterface protected $_filesystem; /** - * @param \Magento\Core\Model\Store\Config $storeConfig - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @var string + */ + protected $_scopeType; + + /** + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Stdlib\String $stringHelper * @param \Magento\App\RequestInterface $request * @param \Magento\App\State $appState * @param \Magento\App\Filesystem $filesystem + * @param string $scopeType * @param string $saveMethod * @param null|string $savePath * @param null|string $cacheLimiter */ public function __construct( - \Magento\Core\Model\Store\Config $storeConfig, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Stdlib\String $stringHelper, \Magento\App\RequestInterface $request, \Magento\App\State $appState, \Magento\App\Filesystem $filesystem, + $scopeType, $saveMethod = \Magento\Session\SaveHandlerInterface::DEFAULT_HANDLER, $savePath = null, $cacheLimiter = null ) { - $this->_storeConfig = $storeConfig; - $this->_storeManager = $storeManager; + $this->_scopeConfig = $scopeConfig; $this->_stringHelper = $stringHelper; $this->_httpRequest = $request; $this->_appState = $appState; $this->_filesystem = $filesystem; + $this->_scopeType = $scopeType; $this->setSaveHandler($saveMethod === 'db' ? 'user' : $saveMethod); @@ -163,22 +163,22 @@ class Config implements ConfigInterface $this->setOption('session.cache_limiter', $cacheLimiter); } - $lifetime = $this->_storeConfig->getConfig(self::XML_PATH_COOKIE_LIFETIME, $this->_storeManager->getStore()); + $lifetime = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_LIFETIME, $this->_scopeType); $lifetime = is_numeric($lifetime) ? $lifetime : self::COOKIE_LIFETIME_DEFAULT; $this->setCookieLifetime($lifetime); - $path = $this->_storeConfig->getConfig(self::XML_PATH_COOKIE_PATH, $this->_storeManager->getStore()); + $path = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_PATH, $this->_scopeType); if (empty($path)) { $path = $this->_httpRequest->getBasePath(); } $this->setCookiePath($path); - $domain = $this->_storeConfig->getConfig(self::XML_PATH_COOKIE_DOMAIN, $this->_storeManager->getStore()); + $domain = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_DOMAIN, $this->_scopeType); $domain = empty($domain) ? $this->_httpRequest->getHttpHost() : $domain; $this->setCookieDomain((string)$domain); $this->setCookieHttpOnly( - $this->_storeConfig->getConfig(self::XML_PATH_COOKIE_HTTPONLY, $this->_storeManager->getStore()) + $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_HTTPONLY, $this->_scopeType) ); } @@ -389,7 +389,7 @@ class Config implements ConfigInterface public function getCookiePath() { if (!$this->hasOption('session.cookie_path')) { - $path = $this->_storeConfig->getConfig(self::XML_PATH_COOKIE_PATH, $this->_storeManager->getStore()); + $path = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_PATH, $this->_scopeType); if (empty($path)) { $path = $this->_httpRequest->getBasePath(); } diff --git a/lib/Magento/Session/Generic.php b/lib/Magento/Session/Generic.php index 77c80bb83dbbc0b2cad784186516b6f1e0d09d5c..1ef191c18f4bbc907b1b9f2554407cd627977961 100644 --- a/lib/Magento/Session/Generic.php +++ b/lib/Magento/Session/Generic.php @@ -28,7 +28,7 @@ class Generic extends SessionManager /** * Constructor * - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param SaveHandlerInterface $saveHandler @@ -37,7 +37,7 @@ class Generic extends SessionManager * @param null $sessionName */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, SaveHandlerInterface $saveHandler, diff --git a/lib/Magento/Session/SessionManager.php b/lib/Magento/Session/SessionManager.php index 1bd97fd9a299b598258b1bf0f9f08483bcc6154e..4fa10cdff90293a745b981bcc1bac5cd796f0799 100644 --- a/lib/Magento/Session/SessionManager.php +++ b/lib/Magento/Session/SessionManager.php @@ -58,7 +58,7 @@ class SessionManager implements SessionManagerInterface /** * Request * - * @var \Magento\App\RequestInterface + * @var \Magento\App\Request\Http */ protected $request; @@ -93,7 +93,7 @@ class SessionManager implements SessionManagerInterface /** * Constructor * - * @param \Magento\App\RequestInterface $request + * @param \Magento\App\Request\Http $request * @param SidResolverInterface $sidResolver * @param Config\ConfigInterface $sessionConfig * @param SaveHandlerInterface $saveHandler @@ -101,7 +101,7 @@ class SessionManager implements SessionManagerInterface * @param StorageInterface $storage */ public function __construct( - \Magento\App\RequestInterface $request, + \Magento\App\Request\Http $request, SidResolverInterface $sidResolver, Config\ConfigInterface $sessionConfig, SaveHandlerInterface $saveHandler, diff --git a/app/code/Magento/Core/Model/Session/SidResolver.php b/lib/Magento/Session/SidResolver.php similarity index 85% rename from app/code/Magento/Core/Model/Session/SidResolver.php rename to lib/Magento/Session/SidResolver.php index e9ec9260cebca7aa6a1f0275360408336fdd26c5..e7cda077b8d04613c1e9fcf234b11229101e4966 100644 --- a/app/code/Magento/Core/Model/Session/SidResolver.php +++ b/lib/Magento/Session/SidResolver.php @@ -25,10 +25,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; - -use Magento\Session\SessionManagerInterface; -use Magento\Session\SidResolverInterface; +namespace Magento\Session; class SidResolver implements SidResolverInterface { @@ -38,9 +35,9 @@ class SidResolver implements SidResolverInterface const XML_PATH_USE_FRONTEND_SID = 'web/session/use_frontend_sid'; /** - * @var \Magento\Core\Model\Store\ConfigInterface + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $coreStoreConfig; + protected $scopeConfig; /** * @var \Magento\UrlInterface @@ -73,21 +70,29 @@ class SidResolver implements SidResolverInterface protected $_useSessionInUrl = true; /** - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @var string + */ + protected $_scopeType; + + /** + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\UrlInterface $urlBuilder * @param \Magento\App\RequestInterface $request + * @param string $scopeType * @param array $sidNameMap */ public function __construct( - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\UrlInterface $urlBuilder, \Magento\App\RequestInterface $request, + $scopeType, array $sidNameMap = array() ) { - $this->coreStoreConfig = $coreStoreConfig; + $this->scopeConfig = $scopeConfig; $this->urlBuilder = $urlBuilder; $this->request = $request; $this->sidNameMap = $sidNameMap; + $this->_scopeType = $scopeType; } /** @@ -97,9 +102,11 @@ class SidResolver implements SidResolverInterface public function getSid(SessionManagerInterface $session) { $sidKey = null; - if ($this->coreStoreConfig->getConfig( - self::XML_PATH_USE_FRONTEND_SID - ) && $this->request->getQuery( + $useSidOnFrontend = $this->scopeConfig->getValue( + self::XML_PATH_USE_FRONTEND_SID, + $this->_scopeType + ); + if ($useSidOnFrontend && $this->request->getQuery( $this->getSessionIdQueryParam($session), false ) && $this->urlBuilder->isOwnOriginUrl() diff --git a/app/code/Magento/Core/Model/Session/Validator.php b/lib/Magento/Session/Validator.php similarity index 85% rename from app/code/Magento/Core/Model/Session/Validator.php rename to lib/Magento/Session/Validator.php index 5a84d638fd5d14f9ae2e18b1ebc4b2d1a289e7f7..f18831125a1c1b7ec314f720d856beb041cd183d 100644 --- a/app/code/Magento/Core/Model/Session/Validator.php +++ b/lib/Magento/Session/Validator.php @@ -21,11 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Session; - -use Magento\Session\Exception; -use Magento\Session\SessionManagerInterface; -use Magento\Session\ValidatorInterface; +namespace Magento\Session; /** * Session Validator @@ -51,9 +47,9 @@ class Validator implements ValidatorInterface const XML_PATH_USE_USER_AGENT = 'web/session/use_http_user_agent'; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * @var \Magento\HTTP\PhpEnvironment\RemoteAddress @@ -66,18 +62,26 @@ class Validator implements ValidatorInterface protected $_skippedAgentList; /** - * @param \Magento\Core\Model\Store\Config $storeConfig + * @var string + */ + protected $_scopeType; + + /** + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress + * @param string $scopeType * @param array $skippedUserAgentList */ public function __construct( - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, + $scopeType, array $skippedUserAgentList = array() ) { - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_remoteAddress = $remoteAddress; $this->_skippedAgentList = $skippedUserAgentList; + $this->_scopeType = $scopeType; } /** @@ -112,14 +116,16 @@ class Validator implements ValidatorInterface $sessionData = $_SESSION[self::VALIDATOR_KEY]; $validatorData = $this->_getSessionEnvironment(); - if ($this->_storeConfig->getConfig( - self::XML_PATH_USE_REMOTE_ADDR + if ($this->_scopeConfig->getValue( + self::XML_PATH_USE_REMOTE_ADDR, + $this->_scopeType ) && $sessionData[self::VALIDATOR_REMOTE_ADDR_KEY] != $validatorData[self::VALIDATOR_REMOTE_ADDR_KEY] ) { return false; } - if ($this->_storeConfig->getConfig( - self::XML_PATH_USE_HTTP_VIA + if ($this->_scopeConfig->getValue( + self::XML_PATH_USE_HTTP_VIA, + $this->_scopeType ) && $sessionData[self::VALIDATOR_HTTP_VIA_KEY] != $validatorData[self::VALIDATOR_HTTP_VIA_KEY] ) { return false; @@ -127,14 +133,16 @@ class Validator implements ValidatorInterface $httpXForwardedKey = $sessionData[self::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY]; $validatorXForwarded = $validatorData[self::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY]; - if ($this->_storeConfig->getConfig( - self::XML_PATH_USE_X_FORWARDED + if ($this->_scopeConfig->getValue( + self::XML_PATH_USE_X_FORWARDED, + $this->_scopeType ) && $httpXForwardedKey != $validatorXForwarded ) { return false; } - if ($this->_storeConfig->getConfig( - self::XML_PATH_USE_USER_AGENT + if ($this->_scopeConfig->getValue( + self::XML_PATH_USE_USER_AGENT, + $this->_scopeType ) && $sessionData[self::VALIDATOR_HTTP_USER_AGENT_KEY] != $validatorData[self::VALIDATOR_HTTP_USER_AGENT_KEY] ) { foreach ($this->_skippedAgentList as $agent) { diff --git a/lib/Magento/Shell.php b/lib/Magento/Shell.php index 863836f3df71d32ecddb6ac947f215bfb5272f87..7b921cdac091bf5d17ded756411b0b44a6908c0f 100644 --- a/lib/Magento/Shell.php +++ b/lib/Magento/Shell.php @@ -25,53 +25,52 @@ */ namespace Magento; +use Magento\Shell\CommandRendererInterface; + /** * Shell command line wrapper encapsulates command execution and arguments escaping */ -class Shell +class Shell implements ShellInterface { /** * Logger instance * * @var \Zend_Log */ - protected $_logger; + protected $logger; /** - * Operation system info - * - * @var OSInfo + * @var CommandRendererInterface */ - protected $_osInfo; + private $commandRenderer; /** - * @param OSInfo $osInfo + * @param CommandRendererInterface $commandRenderer * @param \Zend_Log $logger Logger instance to be used to log commands and their output */ - public function __construct(OSInfo $osInfo, \Zend_Log $logger = null) - { - $this->_logger = $logger; - $this->_osInfo = $osInfo; + public function __construct( + CommandRendererInterface $commandRenderer, + \Zend_Log $logger = null + ) { + $this->logger = $logger; + $this->commandRenderer = $commandRenderer; } /** * Execute a command through the command line, passing properly escaped arguments, and return its output * * @param string $command Command with optional argument markers '%s' - * @param array $arguments Argument values to substitute markers with + * @param string[] $arguments Argument values to substitute markers with * @return string Output of an executed command - * @throws \Magento\Exception if a command returns non-zero exit code + * @throws \Magento\Exception If a command returns non-zero exit code */ public function execute($command, array $arguments = array()) { - $arguments = array_map('escapeshellarg', $arguments); - $command = preg_replace('/\s?\||$/', ' 2>&1$0', $command); - // Output errors to STDOUT instead of STDERR - $command = vsprintf($command, $arguments); - $this->_log($command); + $command = $this->commandRenderer->render($command, $arguments); + $this->log($command); exec($command, $output, $exitCode); $output = implode(PHP_EOL, $output); - $this->_log($output); + $this->log($output); if ($exitCode) { $commandError = new \Exception($output, $exitCode); throw new \Magento\Exception("Command `{$command}` returned non-zero exit code.", 0, $commandError); @@ -79,33 +78,16 @@ class Shell return $output; } - /** - * Run external command in background - * - * @param string $command - * @return void - * @throws \Magento\Exception - */ - public function executeInBackground($command) - { - if ($this->_osInfo->isWindows()) { - $command = 'start /B "magento background task" ' . $command; - } else { - $command .= ' > /dev/null 2>1 &'; - } - pclose(popen($command, 'r')); - } - /** * Log a message, if a logger is specified * * @param string $message * @return void */ - protected function _log($message) + protected function log($message) { - if ($this->_logger) { - $this->_logger->log($message, \Zend_Log::INFO); + if ($this->logger) { + $this->logger->log($message, \Zend_Log::INFO); } } } diff --git a/lib/Magento/Shell/CommandRenderer.php b/lib/Magento/Shell/CommandRenderer.php new file mode 100644 index 0000000000000000000000000000000000000000..b7fef962e24eb23cc3c2fc8e596bfb91faf17fef --- /dev/null +++ b/lib/Magento/Shell/CommandRenderer.php @@ -0,0 +1,44 @@ +<?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 Magento + * @package Magento_Shell + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Shell; + +class CommandRenderer implements CommandRendererInterface +{ + /** + * Render command with arguments + * + * @param string $command + * @param array $arguments + * @return string + */ + public function render($command, array $arguments = array()) + { + $arguments = array_map('escapeshellarg', $arguments); + $command = preg_replace('/\s?\||$/', ' 2>&1$0', $command); + $command = vsprintf($command, $arguments); + return $command; + } +} diff --git a/lib/Magento/Shell/CommandRendererBackground.php b/lib/Magento/Shell/CommandRendererBackground.php new file mode 100644 index 0000000000000000000000000000000000000000..8db2aac8c484823d37c478c256c25df9b5158cd2 --- /dev/null +++ b/lib/Magento/Shell/CommandRendererBackground.php @@ -0,0 +1,59 @@ +<?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 Magento + * @package Magento_Shell + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Shell; + +use Magento\OsInfo; + +class CommandRendererBackground extends CommandRenderer +{ + /** + * @var \Magento\OsInfo + */ + protected $osInfo; + + /** + * @param OsInfo $osInfo + */ + public function __construct(OsInfo $osInfo) + { + $this->osInfo = $osInfo; + } + + /** + * Render command with arguments + * + * @param string $command + * @param array $arguments + * @return string + */ + public function render($command, array $arguments = array()) + { + $command = parent::render($command, $arguments); + return $this->osInfo->isWindows() ? + 'start /B "magento background task" ' . $command + : $command . ' > /dev/null &'; + } +} diff --git a/app/code/Magento/Core/Model/Store/Exception.php b/lib/Magento/Shell/CommandRendererInterface.php similarity index 76% rename from app/code/Magento/Core/Model/Store/Exception.php rename to lib/Magento/Shell/CommandRendererInterface.php index 232d1ab6352c0e539c12cd73475af09d040a6146..9d696bf547b9c88590692daf0c8001cee8e36848 100644 --- a/app/code/Magento/Core/Model/Store/Exception.php +++ b/lib/Magento/Shell/CommandRendererInterface.php @@ -19,22 +19,21 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Shell * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Shell; -/** - * Core store exception - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Model\Store; - -class Exception extends \Magento\Model\Exception +interface CommandRendererInterface { - + /** + * Render command with arguments + * + * @param string $command + * @param array $arguments + * @return string + */ + public function render($command, array $arguments = array()); } diff --git a/lib/Magento/ShellInterface.php b/lib/Magento/ShellInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..c57ce0291d01e8c8d7cd86304b857bc868fa8e95 --- /dev/null +++ b/lib/Magento/ShellInterface.php @@ -0,0 +1,42 @@ +<?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 Magento + * @package Magento_Shell + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento; + +/** + * Shell command line wrapper encapsulates command execution and arguments escaping + */ +interface ShellInterface +{ + /** + * Execute a command through the command line, passing properly escaped arguments + * + * @param string $command Command with optional argument markers '%s' + * @param string[] $arguments Argument values to substitute markers with + * @throws \Magento\Exception If a command returns non-zero exit code + * @return string + */ + public function execute($command, array $arguments = array()); +} diff --git a/lib/Magento/Stdlib/DateTime/Timezone.php b/lib/Magento/Stdlib/DateTime/Timezone.php index 4557bd5db272d49e3c8b600fb682ed9124f58181..8a81d83d54661f0717b640e4faababbe3a7618a3 100644 --- a/lib/Magento/Stdlib/DateTime/Timezone.php +++ b/lib/Magento/Stdlib/DateTime/Timezone.php @@ -36,7 +36,12 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface ); /** - * @var \Magento\BaseScopeResolverInterface + * @var string + */ + protected $_scopeType; + + /** + * @var \Magento\App\ScopeResolverInterface */ protected $_scopeResolver; @@ -56,17 +61,26 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface protected $_defaultTimezonePath; /** - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + + /** + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param \Magento\Locale\ResolverInterface $localeResolver * @param \Magento\Stdlib\DateTime $dateTime - * @param DateFactory $dateFactory + * @param \Magento\Stdlib\DateTime\DateFactory $dateFactory + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param string $scopeType * @param string $defaultTimezonePath */ public function __construct( - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\Locale\ResolverInterface $localeResolver, \Magento\Stdlib\DateTime $dateTime, \Magento\Stdlib\DateTime\DateFactory $dateFactory, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + $scopeType, $defaultTimezonePath ) { $this->_scopeResolver = $scopeResolver; @@ -74,6 +88,8 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface $this->_dateTime = $dateTime; $this->_dateFactory = $dateFactory; $this->_defaultTimezonePath = $defaultTimezonePath; + $this->_scopeConfig = $scopeConfig; + $this->_scopeType = $scopeType; } /** @@ -97,7 +113,7 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface */ public function getConfigTimezone() { - return $this->_scopeResolver->getScope()->getConfig('general/locale/timezone'); + return $this->_scopeConfig->getValue('general/locale/timezone', $this->_scopeType); } /** @@ -151,7 +167,7 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface } $date = $this->_dateFactory->create(array('date' => $date, 'part' => $part, 'locale' => $locale)); if ($useTimezone) { - $timezone = $this->_scopeResolver->getScope()->getConfig($this->getDefaultTimezonePath()); + $timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType); if ($timezone) { $date->setTimezone($timezone); } @@ -165,7 +181,7 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface */ public function scopeDate($scope = null, $date = null, $includeTime = false) { - $timezone = $this->_scopeResolver->getScope($scope)->getConfig($this->getDefaultTimezonePath()); + $timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope); $date = $this->_dateFactory->create( array('date' => $date, 'part' => null, 'locale' => $this->_localeResolver->getLocale()) ); @@ -250,7 +266,7 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface */ public function scopeTimeStamp($scope = null) { - $timezone = $this->_scopeResolver->getScope($scope)->getConfig($this->getDefaultTimezonePath()); + $timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope); $currentTimezone = @date_default_timezone_get(); @date_default_timezone_set($timezone); $date = date('Y-m-d H:i:s'); @@ -263,7 +279,7 @@ class Timezone implements \Magento\Stdlib\DateTime\TimezoneInterface */ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null) { - if (!$scope instanceof \Magento\BaseScopeInterface) { + if (!$scope instanceof \Magento\App\ScopeInterface) { $scope = $this->_scopeResolver->getScope($scope); } diff --git a/lib/Magento/Stdlib/DateTime/TimezoneInterface.php b/lib/Magento/Stdlib/DateTime/TimezoneInterface.php index 93a397d4dc0cbe4d4989808d5b90169e545ed1bb..252e07f29ca5c9c83023179959d7e3000df7de2f 100644 --- a/lib/Magento/Stdlib/DateTime/TimezoneInterface.php +++ b/lib/Magento/Stdlib/DateTime/TimezoneInterface.php @@ -167,7 +167,7 @@ interface TimezoneInterface /** * Checks if current date of the given scope (in the scope timezone) is within the range * - * @param int|string|\Magento\BaseScopeInterface $scope + * @param int|string|\Magento\App\ScopeInterface $scope * @param string|null $dateFrom * @param string|null $dateTo * @return bool diff --git a/lib/Magento/Translate.php b/lib/Magento/Translate.php index 4299bba58dd29d088a65bf23f7e8adf8d19fa7ff..3371567d7d3f057b7010d3c23112a818f6dacd9c 100644 --- a/lib/Magento/Translate.php +++ b/lib/Magento/Translate.php @@ -99,7 +99,7 @@ class Translate implements \Magento\TranslateInterface protected $_modulesReader; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $_scopeResolver; @@ -128,6 +128,11 @@ class Translate implements \Magento\TranslateInterface */ protected $request; + /** + * @var \Magento\File\Csv + */ + protected $_csvParser; + /** * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Locale\Hierarchy\Config $config @@ -135,12 +140,13 @@ class Translate implements \Magento\TranslateInterface * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Module\ModuleList $moduleList * @param \Magento\Module\Dir\Reader $modulesReader - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param \Magento\Translate\ResourceInterface $translate * @param \Magento\Locale\ResolverInterface $locale * @param \Magento\App\State $appState * @param \Magento\App\Filesystem $filesystem * @param App\RequestInterface $request + * @param \Magento\File\Csv $csvParser * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -151,12 +157,13 @@ class Translate implements \Magento\TranslateInterface \Magento\View\FileSystem $viewFileSystem, \Magento\Module\ModuleList $moduleList, \Magento\Module\Dir\Reader $modulesReader, - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\Translate\ResourceInterface $translate, \Magento\Locale\ResolverInterface $locale, \Magento\App\State $appState, \Magento\App\Filesystem $filesystem, - \Magento\App\RequestInterface $request + \Magento\App\RequestInterface $request, + \Magento\File\Csv $csvParser ) { $this->_viewDesign = $viewDesign; $this->_cache = $cache; @@ -170,6 +177,7 @@ class Translate implements \Magento\TranslateInterface $this->request = $request; $this->directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_localeHierarchy = $config->getHierarchy(); + $this->_csvParser = $csvParser; } /** @@ -396,9 +404,8 @@ class Translate implements \Magento\TranslateInterface { $data = array(); if ($this->directory->isExist($this->directory->getRelativePath($file))) { - $parser = new \Magento\File\Csv(); - $parser->setDelimiter(','); - $data = $parser->getDataPairs($file); + $this->_csvParser->setDelimiter(','); + $data = $this->_csvParser->getDataPairs($file); } return $data; } diff --git a/lib/Magento/Translate/Inline.php b/lib/Magento/Translate/Inline.php index c40e588b49cd1ed4ad00ff9200b5bb32d70c96a6..733588c4db38e64ed851017885a32f0ccb93265d 100644 --- a/lib/Magento/Translate/Inline.php +++ b/lib/Magento/Translate/Inline.php @@ -25,8 +25,6 @@ */ namespace Magento\Translate; -use Magento\BaseScopeInterface; - class Inline implements \Magento\Translate\InlineInterface { /** @@ -64,7 +62,7 @@ class Inline implements \Magento\Translate\InlineInterface protected $config; /** - * @var \Magento\BaseScopeResolverInterface + * @var \Magento\App\ScopeResolverInterface */ protected $scopeResolver; @@ -89,7 +87,9 @@ class Inline implements \Magento\Translate\InlineInterface protected $state; /** - * @param \Magento\BaseScopeResolverInterface $scopeResolver + * Initialize inline translation model + * + * @param \Magento\App\ScopeResolverInterface $scopeResolver * @param \Magento\UrlInterface $url * @param \Magento\View\LayoutInterface $layout * @param Inline\ConfigInterface $config @@ -100,7 +100,7 @@ class Inline implements \Magento\Translate\InlineInterface * @param null $scope */ public function __construct( - \Magento\BaseScopeResolverInterface $scopeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, \Magento\UrlInterface $url, \Magento\View\LayoutInterface $layout, \Magento\Translate\Inline\ConfigInterface $config, @@ -129,7 +129,7 @@ class Inline implements \Magento\Translate\InlineInterface public function isAllowed() { if ($this->isAllowed === null) { - if (!$this->scope instanceof BaseScopeInterface) { + if (!$this->scope instanceof \Magento\App\ScopeInterface) { $scope = $this->scopeResolver->getScope($this->scope); } $this->isAllowed = $this->config->isActive($scope) @@ -238,7 +238,7 @@ class Inline implements \Magento\Translate\InlineInterface { return $this->url->getUrl( $this->translatorRoute, - ['_secure' => $this->scopeResolver->getScope()->isCurrentlySecure()] + array('_secure' => $this->scopeResolver->getScope()->isCurrentlySecure()) ); } @@ -254,8 +254,10 @@ class Inline implements \Magento\Translate\InlineInterface foreach ($body as &$part) { $this->stripInlineTranslations($part); } - } else if (is_string($body)) { - $body = preg_replace('#' . \Magento\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', '$1', $body); + } else { + if (is_string($body)) { + $body = preg_replace('#' . \Magento\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', '$1', $body); + } } return $this; } diff --git a/lib/Magento/Translate/Inline/ConfigInterface.php b/lib/Magento/Translate/Inline/ConfigInterface.php index e11b50272a6eaa17b10c4509ccfc8d32c8a4bed2..421c09de6d5e02e9b53700173a2bf24ac9a47328 100644 --- a/lib/Magento/Translate/Inline/ConfigInterface.php +++ b/lib/Magento/Translate/Inline/ConfigInterface.php @@ -30,7 +30,7 @@ interface ConfigInterface /** * Check whether inline translation is enabled * - * @param null|string|bool|int|\Magento\Core\Model\Store $scope + * @param null|string|bool|int|\Magento\Store\Model\Store $scope * @return bool */ public function isActive($scope = null); @@ -38,7 +38,7 @@ interface ConfigInterface /** * Check whether allowed client ip for inline translation * - * @param null|string|bool|int|\Magento\Core\Model\Store $scope + * @param null|string|bool|int|\Magento\Store\Model\Store $scope * @return bool */ public function isDevAllowed($scope = null); diff --git a/lib/Magento/Url.php b/lib/Magento/Url.php index 4398515df5ca06f381dcd4bdc26824366be8a808..eef1cc6105753ca22b3378a5eefe1c5369530e9c 100644 --- a/lib/Magento/Url.php +++ b/lib/Magento/Url.php @@ -106,6 +106,11 @@ class Url extends \Magento\Object implements \Magento\UrlInterface '_scope_to_url' ); + /** + * @var string + */ + protected $_scopeType; + /** * Request instance * @@ -128,7 +133,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface protected $_urlSecurityInfo; /** - * @var \Magento\Core\Model\Session + * @var \Magento\Session\Generic */ protected $_session; @@ -159,6 +164,11 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ protected $_queryParamsResolver; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request @@ -168,6 +178,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Url\RouteParamsResolverFactory $routeParamsResolver * @param \Magento\Url\QueryParamsResolverInterface $queryParamsResolver + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig + * @param string $scopeType * @param array $data */ public function __construct( @@ -179,6 +191,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface \Magento\Session\SidResolverInterface $sidResolver, \Magento\Url\RouteParamsResolverFactory $routeParamsResolver, \Magento\Url\QueryParamsResolverInterface $queryParamsResolver, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, + $scopeType, array $data = array() ) { $this->_request = $request; @@ -189,6 +203,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $this->_sidResolver = $sidResolver; $this->_routeParamsResolver = $routeParamsResolver->create(); $this->_queryParamsResolver = $queryParamsResolver; + $this->_scopeConfig = $scopeConfig; + $this->_scopeType = $scopeType; parent::__construct($data); } @@ -287,7 +303,11 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ protected function _getConfig($path) { - return $this->_getScope()->getConfig($path); + return $this->_scopeConfig->getValue( + $path, + $this->_scopeType, + $this->_getScope() + ); } /** @@ -400,15 +420,15 @@ class Url extends \Magento\Object implements \Magento\UrlInterface /** * Add availability support urls without scope code */ - if ($this->_getType() == \Magento\UrlInterface::URL_TYPE_LINK && - $this->_getRequest()->isDirectAccessFrontendName( + if ($this->_getType() == \Magento\UrlInterface::URL_TYPE_LINK + && $this->_getRequest()->isDirectAccessFrontendName( $this->_getRouteFrontName() ) ) { $this->_routeParamsResolver->setType(\Magento\UrlInterface::URL_TYPE_DIRECT_LINK); } - $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); + $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); $this->_routeParamsResolver->setType(self::DEFAULT_URL_TYPE); return $result; } @@ -843,7 +863,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface } $sessionId = $this->_session->getSessionIdForHost($url); if ($this->_sidResolver->getUseSessionVar() && !$sessionId) { - $this->setQueryParam('___SID', $this->_isSecure() ? 'S' : 'U'); // Secure/Unsecure + $this->setQueryParam('___SID', $this->_isSecure() ? 'S' : 'U'); } elseif ($sessionId) { $this->setQueryParam($this->_sidResolver->getSessionIdQueryParam($this->_session), $sessionId); } @@ -930,10 +950,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface // @codingStandardsIgnoreEnd function ($match) { if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { - return $match[1] - . $this->_sidResolver->getSessionIdQueryParam($this->_session) - . '=' . $this->_session->getSessionId() - . (isset($match[3]) ? $match[3] : ''); + return $match[1] . $this->_sidResolver->getSessionIdQueryParam($this->_session) . '=' + . $this->_session->getSessionId() . (isset($match[3]) ? $match[3] : ''); } else { if ($match[1] == '?') { return isset($match[3]) ? '?' : ''; diff --git a/lib/Magento/Url/ScopeInterface.php b/lib/Magento/Url/ScopeInterface.php index b0e7892988285a30afdcbbaaed7164b082916a01..0ae5bef6ab5bf1f503a74084096b37df1c1a193a 100644 --- a/lib/Magento/Url/ScopeInterface.php +++ b/lib/Magento/Url/ScopeInterface.php @@ -23,7 +23,7 @@ */ namespace Magento\Url; -interface ScopeInterface extends \Magento\BaseScopeInterface +interface ScopeInterface extends \Magento\App\ScopeInterface { /** * Retrieve base URL @@ -34,14 +34,6 @@ interface ScopeInterface extends \Magento\BaseScopeInterface */ public function getBaseUrl($type = '', $secure = null); - /** - * Retrieve scope configuration data - * - * @param string $path - * @return string|null - */ - public function getConfig($path); - /** * Check is URL should be secure * diff --git a/lib/Magento/Url/ScopeResolverInterface.php b/lib/Magento/Url/ScopeResolverInterface.php index a93f847f21877bcf86750e38139d8b47126d27c1..5eb970346f7ba0a24b9b5a0c8504b6557d8cd4d2 100644 --- a/lib/Magento/Url/ScopeResolverInterface.php +++ b/lib/Magento/Url/ScopeResolverInterface.php @@ -23,7 +23,7 @@ */ namespace Magento\Url; -interface ScopeResolverInterface extends \Magento\BaseScopeResolverInterface +interface ScopeResolverInterface extends \Magento\App\ScopeResolverInterface { /** * Retrieve scopes array diff --git a/lib/Magento/View/Context.php b/lib/Magento/View/Context.php index e1899993d53dfe66a49e218f0f84051f8c4947ea..bc16e3ea759e046244e32cde5e26780e139679fa 100644 --- a/lib/Magento/View/Context.php +++ b/lib/Magento/View/Context.php @@ -26,7 +26,7 @@ namespace Magento\View; use Magento\App\Request\Http as Request; use Magento\App\FrontControllerInterface; use Magento\TranslateInterface; -use Magento\Core\Model\Store\Config as StoreConfig; +use Magento\App\Config\ScopeConfigInterface; use Magento\View\Url as ViewUrl; use Magento\View\ConfigInterface as ViewConfig; use Magento\Logger; @@ -100,9 +100,9 @@ class Context /** * Store config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $storeConfig; + protected $scopeConfig; /** * Front controller @@ -163,7 +163,7 @@ class Context * @param Cache $cache * @param DesignInterface $design * @param SessionManager $session - * @param StoreConfig $storeConfig + * @param ScopeConfigInterface $scopeConfig * @param FrontControllerInterface $frontController * @param ViewUrl $viewUrl * @param ViewConfig $viewConfig @@ -184,7 +184,7 @@ class Context Cache $cache, DesignInterface $design, SessionManager $session, - StoreConfig $storeConfig, + ScopeConfigInterface $scopeConfig, FrontControllerInterface $frontController, ViewUrl $viewUrl, ViewConfig $viewConfig, @@ -200,7 +200,7 @@ class Context $this->cache = $cache; $this->design = $design; $this->session = $session; - $this->storeConfig = $storeConfig; + $this->scopeConfig = $scopeConfig; $this->frontController = $frontController; $this->viewUrl = $viewUrl; $this->viewConfig = $viewConfig; @@ -281,13 +281,13 @@ class Context } /** - * Retrieve store config + * Retrieve scope config * - * @return \Magento\Core\Model\Store\Config + * @return \Magento\App\Config\ScopeConfigInterface */ - public function getStoreConfig() + public function getScopeConfig() { - return $this->storeConfig; + return $this->scopeConfig; } /** @@ -357,7 +357,7 @@ class Context */ public function getArea() { - return $this->layout->getArea(); + return $this->appState->getAreaCode(); } /** @@ -517,8 +517,8 @@ class Context public function getDesignTheme() { $theme = $this->design->getDesignTheme(); - $theme->setCode('magento_plushe'); - $theme->setThemePath('magento_plushe'); + $theme->setCode('Magento/plushe'); + $theme->setThemePath('Magento/plushe'); $theme->setId(8); return $this->getPhysicalTheme($theme); diff --git a/lib/Magento/View/Design/Theme/ResolverInterface.php b/lib/Magento/View/Design/Theme/ResolverInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..933a277ce8f85cb7de097ce59eda9ade95435f7a --- /dev/null +++ b/lib/Magento/View/Design/Theme/ResolverInterface.php @@ -0,0 +1,37 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\View\Design\Theme; + +/** + * Theme resolver interface + */ +interface ResolverInterface +{ + /** + * Retrieve instance of a theme currently used in an area + * + * @return \Magento\View\Design\ThemeInterface + */ + public function get(); +} diff --git a/lib/Magento/View/Design/Theme/Validator.php b/lib/Magento/View/Design/Theme/Validator.php index 0cf5431b1a8a22a072c9a1846804c68edfc17359..e4413eb474638d0310cd9563ab4e091ad65af7da 100644 --- a/lib/Magento/View/Design/Theme/Validator.php +++ b/lib/Magento/View/Design/Theme/Validator.php @@ -222,7 +222,7 @@ class Validator { $this->_errorMessages = array(); foreach ($this->_dataValidators as $dataKey => $validators) { - if (!isset($data[$dataKey]) || !$data->dataHasChangedFor($dataKey)) { + if (!isset($data[$dataKey])) { continue; } diff --git a/lib/Magento/View/DesignLoader.php b/lib/Magento/View/DesignLoader.php index 6f2180296b489a2982839428b6efa0f4f7a37e4b..24e44d4b5854a7d42b2c217ca51465607b6c6192 100644 --- a/lib/Magento/View/DesignLoader.php +++ b/lib/Magento/View/DesignLoader.php @@ -42,23 +42,23 @@ class DesignLoader /** * Layout * - * @var \Magento\View\LayoutInterface + * @var \Magento\App\State */ - protected $_layout; + protected $appState; /** * @param \Magento\App\RequestInterface $request * @param \Magento\App\AreaList $areaList - * @param LayoutInterface $layout + * @param \Magento\App\State $appState */ public function __construct( \Magento\App\RequestInterface $request, \Magento\App\AreaList $areaList, - \Magento\View\LayoutInterface $layout + \Magento\App\State $appState ) { $this->_request = $request; $this->_areaList = $areaList; - $this->_layout = $layout; + $this->appState = $appState; } /** @@ -68,7 +68,7 @@ class DesignLoader */ public function load() { - $area = $this->_areaList->getArea($this->_layout->getArea()); + $area = $this->_areaList->getArea($this->appState->getAreaCode()); $area->load(\Magento\Core\Model\App\Area::PART_DESIGN); $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); $area->detectDesign($this->_request); diff --git a/lib/Magento/View/Element/AbstractBlock.php b/lib/Magento/View/Element/AbstractBlock.php index 8a537071039840875f157c1c9c727a2f8350f62b..1947270e8fd8e4ea1ad6a8d50a59e3517634d63f 100644 --- a/lib/Magento/View/Element/AbstractBlock.php +++ b/lib/Magento/View/Element/AbstractBlock.php @@ -172,6 +172,11 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_isScopePrivate = false; + /** + * @var \Magento\App\Config\ScopeConfigInterface + */ + protected $_scopeConfig; + /** * Constructor * @@ -189,7 +194,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_design = $context->getDesignPackage(); $this->_session = $context->getSession(); $this->_sidResolver = $context->getSidResolver(); - $this->_storeConfig = $context->getStoreConfig(); + $this->_scopeConfig = $context->getScopeConfig(); $this->_viewUrl = $context->getViewUrl(); $this->_viewConfig = $context->getViewConfig(); $this->_cacheState = $context->getCacheState(); @@ -221,9 +226,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected function _construct() { - /** - * Please override this one instead of overriding real __construct constructor - */ } /** @@ -627,7 +629,10 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface public function toHtml() { $this->_eventManager->dispatch('view_block_abstract_to_html_before', array('block' => $this)); - if ($this->_storeConfig->getConfig('advanced/modules_disable_output/' . $this->getModuleName())) { + if ($this->_scopeConfig->getValue( + 'advanced/modules_disable_output/' . $this->getModuleName(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )) { return ''; } diff --git a/lib/Magento/View/Element/Context.php b/lib/Magento/View/Element/Context.php index e2f2579bc2c6af8d7288e0011f5ba12bdb819430..e829a36cc8ac28122476199d40b0c575a7439850 100644 --- a/lib/Magento/View/Element/Context.php +++ b/lib/Magento/View/Element/Context.php @@ -98,11 +98,11 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_sidResolver; /** - * Store config + * Scope config * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_storeConfig; + protected $_scopeConfig; /** * View URL @@ -166,7 +166,7 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\View\DesignInterface $design * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -188,7 +188,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\View\DesignInterface $design, \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -207,7 +207,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_design = $design; $this->_session = $session; $this->_sidResolver = $sidResolver; - $this->_storeConfig = $storeConfig; + $this->_scopeConfig = $scopeConfig; $this->_viewUrl = $viewUrl; $this->_viewConfig = $viewConfig; $this->_cacheState = $cacheState; @@ -289,13 +289,13 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * Get store config + * Get scope config * - * @return \Magento\Core\Model\Store\Config + * @return \Magento\App\Config\ScopeConfigInterface */ - public function getStoreConfig() + public function getScopeConfig() { - return $this->_storeConfig; + return $this->_scopeConfig; } /** diff --git a/app/code/Magento/Core/Block/Formkey.php b/lib/Magento/View/Element/FormKey.php similarity index 80% rename from app/code/Magento/Core/Block/Formkey.php rename to lib/Magento/View/Element/FormKey.php index 01fe4cef97676b3abb3644d09d0342641d25d94d..cd937dbc087805ee2a4499a31dacec10f12a4c1e 100644 --- a/app/code/Magento/Core/Block/Formkey.php +++ b/lib/Magento/View/Element/FormKey.php @@ -27,9 +27,9 @@ /** * Frontend form key content block */ -namespace Magento\Core\Block; +namespace Magento\View\Element; -class Formkey extends \Magento\View\Element\Template +class FormKey extends \Magento\View\Element\AbstractBlock { /** * @var \Magento\Data\Form\FormKey @@ -37,12 +37,12 @@ class Formkey extends \Magento\View\Element\Template protected $formKey; /** - * @param \Magento\View\Element\Template\Context $context + * @param \Magento\View\Element\Context $context * @param \Magento\Data\Form\FormKey $formKey * @param array $data */ public function __construct( - \Magento\View\Element\Template\Context $context, + \Magento\View\Element\Context $context, \Magento\Data\Form\FormKey $formKey, array $data = array() ) { @@ -59,4 +59,12 @@ class Formkey extends \Magento\View\Element\Template { return $this->formKey->getFormKey(); } + + /** + * @inheritdoc + */ + protected function _toHtml() + { + return '<input name="form_key" type="hidden" value="' . $this->getFormKey() . '" />'; + } } diff --git a/lib/Magento/View/Element/Html/Calendar.php b/lib/Magento/View/Element/Html/Calendar.php index 4024f1165c34846eca5c0eaffe6e326a71598c07..790f67a646ec9aec421fe605391f9b52ce9b9067 100644 --- a/lib/Magento/View/Element/Html/Calendar.php +++ b/lib/Magento/View/Element/Html/Calendar.php @@ -109,10 +109,21 @@ class Calendar extends \Magento\View\Element\Template $this->assign('pm', $this->encoder->encode(\Zend_Locale_Data::getContent($localeCode, 'pm'))); // get first day of week and weekend days - $this->assign('firstDay', (int)$this->_storeConfig->getConfig('general/locale/firstday')); + $this->assign( + 'firstDay', + (int)$this->_scopeConfig->getValue( + 'general/locale/firstday', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); $this->assign( 'weekendDays', - $this->encoder->encode((string)$this->_storeConfig->getConfig('general/locale/weekend')) + $this->encoder->encode( + (string)$this->_scopeConfig->getValue( + 'general/locale/weekend', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ) ); // define default format and tooltip format @@ -154,7 +165,7 @@ class Calendar extends \Magento\View\Element\Template /** * Getter for store timestamp based on store timezone settings * - * @param null|string|bool|int|\Magento\Core\Model\Store $store + * @param null|string|bool|int|\Magento\Store\Model\Store $store * @return int */ public function getStoreTimestamp($store = null) diff --git a/lib/Magento/View/Element/Template.php b/lib/Magento/View/Element/Template.php index 00b3bd5e5873ff6f688355a9518f245de4af3583..1063986be1a1c6580cff9d227d68f1fc24aa1764 100644 --- a/lib/Magento/View/Element/Template.php +++ b/lib/Magento/View/Element/Template.php @@ -95,7 +95,7 @@ class Template extends AbstractBlock /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -329,7 +329,10 @@ class Template extends AbstractBlock protected function isAllowSymlinks() { if (null === $this->_allowSymlinks) { - $this->_allowSymlinks = $this->_storeConfig->getConfigFlag(self::XML_PATH_TEMPLATE_ALLOW_SYMLINK); + $this->_allowSymlinks = $this->_scopeConfig->isSetFlag( + self::XML_PATH_TEMPLATE_ALLOW_SYMLINK, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); } return $this->_allowSymlinks; } diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 8b910c79a9086c88e891aa42966d1403da02aa89..334125f26508662e84602cba2398e05d95a85883 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -54,7 +54,7 @@ class Context extends \Magento\View\Element\Context /** * Store manager * - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; @@ -68,7 +68,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\DesignInterface $design * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Session\SidResolverInterface $sidResolver - * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState @@ -81,7 +81,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -95,7 +95,7 @@ class Context extends \Magento\View\Element\Context \Magento\View\DesignInterface $design, \Magento\Session\SessionManagerInterface $session, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Core\Model\Store\Config $storeConfig, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, @@ -108,7 +108,7 @@ class Context extends \Magento\View\Element\Context \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager ) { parent::__construct( $request, @@ -120,7 +120,7 @@ class Context extends \Magento\View\Element\Context $design, $session, $sidResolver, - $storeConfig, + $scopeConfig, $viewUrl, $viewConfig, $cacheState, @@ -192,7 +192,7 @@ class Context extends \Magento\View\Element\Context /** * Get store manager * - * @return \Magento\Core\Model\StoreManagerInterface + * @return \Magento\Store\Model\StoreManagerInterface */ public function getStoreManager() { diff --git a/app/code/Magento/Core/Model/Layout.php b/lib/Magento/View/Layout.php similarity index 94% rename from app/code/Magento/Core/Model/Layout.php rename to lib/Magento/View/Layout.php index 23690fd2475b1a0410a71f1906b60deed70dced0..8c9b05d3344ec96374d943c399e668761e1bc835 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/lib/Magento/View/Layout.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; use Magento\View\Layout\Element; @@ -100,13 +100,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $_output = array(); - /** - * Layout area (f.e. admin, frontend) - * - * @var string - */ - protected $_area; - /** * Helper blocks cache for this layout * @@ -153,7 +146,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn protected $argumentInterpreter; /** - * @var \Magento\Core\Model\Layout\ScheduledStructure + * @var \Magento\View\Layout\ScheduledStructure */ protected $_scheduledStructure; @@ -164,13 +157,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $_renderers = array(); - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * Core event manager proxy * @@ -179,11 +165,11 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn protected $_eventManager; /** - * Core store config + * Application configuration * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\App\Config\ScopeConfigInterface */ - protected $_coreStoreConfig; + protected $_scopeConfig; /** * @var \Magento\Logger $logger @@ -195,11 +181,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $_processorFactory; - /** - * @var \Magento\Core\Model\Resource\Theme\CollectionFactory - */ - protected $themeFactory; - /** * @var \Magento\App\State */ @@ -215,47 +196,57 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $isPrivate = false; + /** + * @var string + */ + protected $scopeType; + + /** + * @var \Magento\View\Design\Theme\ResolverInterface + */ + protected $themeResolver; + + /** + * @var \Magento\App\ScopeResolverInterface + */ + protected $scopeResolver; + /** * @param \Magento\View\Layout\ProcessorFactory $processorFactory - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\View\DesignInterface $design * @param \Magento\View\Element\BlockFactory $blockFactory * @param \Magento\Data\Structure $structure * @param \Magento\View\Layout\Argument\Parser $argumentParser * @param \Magento\Data\Argument\InterpreterInterface $argumentInterpreter - * @param \Magento\Core\Model\Layout\ScheduledStructure $scheduledStructure - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\View\Layout\ScheduledStructure $scheduledStructure + * @param \Magento\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\App\State $appState * @param \Magento\Message\ManagerInterface $messageManager - * @param string $area + * @param \Magento\View\Design\Theme\ResolverInterface $themeResolver + * @param \Magento\App\ScopeResolverInterface $scopeResolver + * @param string $scopeType */ public function __construct( \Magento\View\Layout\ProcessorFactory $processorFactory, - \Magento\Core\Model\Resource\Theme\CollectionFactory $themeFactory, \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Data $coreData, - \Magento\View\DesignInterface $design, \Magento\View\Element\BlockFactory $blockFactory, \Magento\Data\Structure $structure, \Magento\View\Layout\Argument\Parser $argumentParser, \Magento\Data\Argument\InterpreterInterface $argumentInterpreter, - \Magento\Core\Model\Layout\ScheduledStructure $scheduledStructure, - \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\View\Layout\ScheduledStructure $scheduledStructure, + \Magento\App\Config\ScopeConfigInterface $scopeConfig, \Magento\App\State $appState, \Magento\Message\ManagerInterface $messageManager, - $area = \Magento\View\DesignInterface::DEFAULT_AREA + \Magento\View\Design\Theme\ResolverInterface $themeResolver, + \Magento\App\ScopeResolverInterface $scopeResolver, + $scopeType ) { $this->_eventManager = $eventManager; - $this->_coreData = $coreData; - $this->_coreStoreConfig = $coreStoreConfig; - $this->_design = $design; + $this->_scopeConfig = $scopeConfig; $this->_blockFactory = $blockFactory; $this->_appState = $appState; - $this->_area = $area; $this->_structure = $structure; $this->argumentParser = $argumentParser; $this->argumentInterpreter = $argumentInterpreter; @@ -264,9 +255,11 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_renderingOutput = new \Magento\Object(); $this->_scheduledStructure = $scheduledStructure; $this->_processorFactory = $processorFactory; - $this->themeFactory = $themeFactory; $this->_logger = $logger; $this->messageManager = $messageManager; + $this->scopeType = $scopeType; + $this->themeResolver = $themeResolver; + $this->scopeResolver = $scopeResolver; } /** @@ -293,57 +286,12 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn public function getUpdate() { if (!$this->_update) { - $theme = $this->_getThemeInstance($this->getArea()); + $theme = $this->themeResolver->get(); $this->_update = $this->_processorFactory->create(array('theme' => $theme)); } return $this->_update; } - /** - * Retrieve instance of a theme currently used in an area - * - * @param string $area - * @return Theme - */ - protected function _getThemeInstance($area) - { - if ($this->_design->getDesignTheme()->getArea() == $area || $this->_design->getArea() == $area) { - return $this->_design->getDesignTheme(); - } - /** @var \Magento\Core\Model\Resource\Theme\Collection $themeCollection */ - $themeCollection = $this->_themeFactory->create(); - $themeIdentifier = $this->_design->getConfigurationDesignTheme($area); - if (is_numeric($themeIdentifier)) { - $result = $themeCollection->getItemById($themeIdentifier); - } else { - $themeFullPath = $area . \Magento\View\Design\ThemeInterface::PATH_SEPARATOR . $themeIdentifier; - $result = $themeCollection->getThemeByFullPath($themeFullPath); - } - return $result; - } - - /** - * Retrieve layout area - * - * @return string - */ - public function getArea() - { - return $this->_appState->getAreaCode(); - } - - /** - * Set area code - * - * @param string $areaCode - * @return void - * @deprecated - */ - public function setArea($areaCode) - { - $this->_area = $areaCode; - } - /** * Layout xml generation * @@ -837,7 +785,9 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $configPath = (string)$node->getAttribute('ifconfig'); - if (!empty($configPath) && !$this->_coreStoreConfig->getConfigFlag($configPath)) { + if (!empty($configPath) + && !$this->_scopeConfig->isSetFlag($configPath, $this->scopeType, $this->scopeResolver->getScope()) + ) { $this->_scheduledStructure->unsetElement($elementName); return; } @@ -937,7 +887,9 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn protected function _generateAction($node, $parent) { $configPath = $node->getAttribute('ifconfig'); - if ($configPath && !$this->_coreStoreConfig->getConfigFlag($configPath)) { + if ($configPath + && !$this->_scopeConfig->isSetFlag($configPath, $this->scopeType, $this->scopeResolver->getScope()) + ) { return; } diff --git a/app/code/Magento/Core/Model/StoreFactory.php b/lib/Magento/View/Layout/Factory.php similarity index 72% rename from app/code/Magento/Core/Model/StoreFactory.php rename to lib/Magento/View/Layout/Factory.php index 39107969b26224d6dc9b5ce7a678d63970fdb391..49978bc803ef45804ee9d1b72d4eaabcab218936 100644 --- a/app/code/Magento/Core/Model/StoreFactory.php +++ b/lib/Magento/View/Layout/Factory.php @@ -18,36 +18,39 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View\Layout; -class StoreFactory +class Factory { + /** + * Entity class name + */ + const CLASS_NAME = 'Magento\View\Layout'; + /** * @var \Magento\ObjectManager */ - protected $_objectManager; + protected $objectManager; /** * @param \Magento\ObjectManager $objectManager */ public function __construct(\Magento\ObjectManager $objectManager) { - $this->_objectManager = $objectManager; + $this->objectManager = $objectManager; } /** - * Create store instance + * Create class instance with specified parameters * - * @param array $arguments - * @return Store + * @param array $data + * @return \Magento\View\Layout */ - public function create(array $arguments = array()) + public function create(array $data = array()) { - return $this->_objectManager->create('Magento\Core\Model\Store', $arguments); + return $this->objectManager->create(self::CLASS_NAME, $data); } } diff --git a/lib/Magento/View/Layout/Proxy.php b/lib/Magento/View/Layout/Proxy.php new file mode 100644 index 0000000000000000000000000000000000000000..c5ea24373660b7af77d642d922e68219069cf86a --- /dev/null +++ b/lib/Magento/View/Layout/Proxy.php @@ -0,0 +1,928 @@ +<?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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\View\Layout; + +/** + * Proxy class for \Magento\View\Layout + * + * @SuppressWarnings(PHPMD.ExcessivePublicCount) + */ +class Proxy extends \Magento\View\Layout +{ + /** + * Object Manager instance + * + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * Proxied instance name + * + * @var string + */ + protected $instanceName; + + /** + * Proxied instance + * + * @var \Magento\View\Layout + */ + protected $subject; + + /** + * Instance shareability flag + * + * @var bool + */ + protected $isShared; + + /** + * @param \Magento\ObjectManager $objectManager + * @param string $instanceName + * @param bool $shared + */ + public function __construct( + \Magento\ObjectManager $objectManager, + $instanceName = 'Magento\View\Layout', + $shared = true + ) { + $this->objectManager = $objectManager; + $this->instanceName = $instanceName; + $this->isShared = $shared; + } + + /** + * @return array + */ + public function __sleep() + { + return array('_subject', '_isShared'); + } + + /** + * Retrieve ObjectManager from global scope + * + * @return void + */ + public function __wakeup() + { + $this->objectManager = \Magento\App\ObjectManager::getInstance(); + } + + /** + * Clone proxied instance + * + * @return void + */ + public function __clone() + { + $this->subject = clone $this->getSubject(); + } + + /** + * Get proxied instance + * + * @return \Magento\View\Layout + */ + protected function getSubject() + { + if (!$this->subject) { + $this->subject = true === $this->isShared + ? $this->objectManager->get($this->instanceName) + : $this->objectManager->create($this->instanceName); + } + return $this->subject; + } + + /** + * Retrieve the layout update instance + * + * @return \Magento\View\Layout\ProcessorInterface + */ + public function getUpdate() + { + return $this->getSubject()->getUpdate(); + } + + /** + * Layout xml generation + * + * @return $this + */ + public function generateXml() + { + return $this->getSubject()->generateXml(); + } + + /** + * Create structure of elements from the loaded XML configuration + * + * @return void + */ + public function generateElements() + { + $this->getSubject()->generateElements(); + } + + /** + * Get child block if exists + * + * @param string $parentName + * @param string $alias + * @return bool|\Magento\View\Element\AbstractBlock + */ + public function getChildBlock($parentName, $alias) + { + return $this->getSubject()->getChildBlock($parentName, $alias); + } + + /** + * Set child element into layout structure + * + * @param string $parentName + * @param string $elementName + * @param string $alias + * @return $this + */ + public function setChild($parentName, $elementName, $alias) + { + return $this->getSubject()->setChild($parentName, $elementName, $alias); + } + + /** + * Reorder a child of a specified element + * + * If $offsetOrSibling is null, it will put the element to the end + * If $offsetOrSibling is numeric (integer) value, it will put the element after/before specified position + * Otherwise -- after/before specified sibling + * + * @param string $parentName + * @param string $childName + * @param string|int|null $offsetOrSibling + * @param bool $after + * @return void + */ + public function reorderChild($parentName, $childName, $offsetOrSibling, $after = true) + { + $this->getSubject()->reorderChild($parentName, $childName, $offsetOrSibling, $after); + } + + /** + * Remove child element from parent + * + * @param string $parentName + * @param string $alias + * @return $this + */ + public function unsetChild($parentName, $alias) + { + return $this->getSubject()->unsetChild($parentName, $alias); + } + + /** + * Get list of child names + * + * @param string $parentName + * @return array + */ + public function getChildNames($parentName) + { + return $this->getSubject()->getChildNames($parentName); + } + + /** + * Get list of child blocks + * + * Returns associative array of <alias> => <block instance> + * + * @param string $parentName + * @return array + */ + public function getChildBlocks($parentName) + { + return $this->getSubject()->getChildBlocks($parentName); + } + + /** + * Get child name by alias + * + * @param string $parentName + * @param string $alias + * @return bool|string + */ + public function getChildName($parentName, $alias) + { + return $this->getSubject()->getChildName($parentName, $alias); + } + + /** + * Find an element in layout, render it and return string with its output + * + * @param string $name + * @param bool $useCache + * @return string + */ + public function renderElement($name, $useCache = true) + { + return $this->getSubject()->renderElement($name, $useCache); + } + + /** + * Add element to parent group + * + * @param string $blockName + * @param string $parentGroupName + * @return bool + */ + public function addToParentGroup($blockName, $parentGroupName) + { + return $this->getSubject()->addToParentGroup($blockName, $parentGroupName); + } + + /** + * Get element names for specified group + * + * @param string $blockName + * @param string $groupName + * @return array + */ + public function getGroupChildNames($blockName, $groupName) + { + return $this->getSubject()->getGroupChildNames($blockName, $groupName); + } + + /** + * Check if element exists in layout structure + * + * @param string $name + * @return bool + */ + public function hasElement($name) + { + return $this->getSubject()->hasElement($name); + } + + /** + * Get property value of an element + * + * @param string $name + * @param string $attribute + * @return mixed + */ + public function getElementProperty($name, $attribute) + { + return $this->getSubject()->getElementProperty($name, $attribute); + } + + /** + * Whether specified element is a block + * + * @param string $name + * @return bool + */ + public function isBlock($name) + { + return $this->getSubject()->isBlock($name); + } + + /** + * Checks if element with specified name is container + * + * @param string $name + * @return bool + */ + public function isContainer($name) + { + return $this->getSubject()->isContainer($name); + } + + /** + * Whether the specified element may be manipulated externally + * + * @param string $name + * @return bool + */ + public function isManipulationAllowed($name) + { + return $this->getSubject()->isManipulationAllowed($name); + } + + /** + * Save block in blocks registry + * + * @param string $name + * @param \Magento\View\Element\AbstractBlock $block + * @return $this + */ + public function setBlock($name, $block) + { + return $this->getSubject()->setBlock($name, $block); + } + + /** + * Remove block from registry + * + * @param string $name + * @return $this + */ + public function unsetElement($name) + { + return $this->getSubject()->unsetElement($name); + } + + /** + * Block Factory + * + * @param string $type + * @param string $name + * @param array $attributes + * @return \Magento\View\Element\AbstractBlock + */ + public function createBlock($type, $name = '', array $attributes = array()) + { + return $this->getSubject()->createBlock($type, $name, $attributes); + } + + /** + * Add a block to registry, create new object if needed + * + * @param string|\Magento\View\Element\AbstractBlock $block + * @param string $name + * @param string $parent + * @param string $alias + * @return \Magento\View\Element\AbstractBlock + */ + public function addBlock($block, $name = '', $parent = '', $alias = '') + { + return $this->getSubject()->addBlock($block, $name, $parent, $alias); + } + + /** + * Insert container into layout structure + * + * @param string $name + * @param string $label + * @param array $options + * @param string $parent + * @param string $alias + * @return void + */ + public function addContainer($name, $label, array $options = array(), $parent = '', $alias = '') + { + $this->getSubject()->addContainer($name, $label, $options, $parent, $alias); + } + + /** + * Rename element in layout and layout structure + * + * @param string $oldName + * @param string $newName + * @return bool + */ + public function renameElement($oldName, $newName) + { + return $this->getSubject()->renameElement($oldName, $newName); + } + + /** + * Retrieve all blocks from registry as array + * + * @return array + */ + public function getAllBlocks() + { + return $this->getSubject()->getAllBlocks(); + } + + /** + * Get block object by name + * + * @param string $name + * @return \Magento\View\Element\AbstractBlock|bool + */ + public function getBlock($name) + { + return $this->getSubject()->getBlock($name); + } + + /** + * Gets parent name of an element with specified name + * + * @param string $childName + * @return bool|string + */ + public function getParentName($childName) + { + return $this->getSubject()->getParentName($childName); + } + + /** + * Get element alias by name + * + * @param string $name + * @return bool|string + */ + public function getElementAlias($name) + { + return $this->getSubject()->getElementAlias($name); + } + + /** + * Add an element to output + * + * @param string $name + * @return $this + */ + public function addOutputElement($name) + { + return $this->getSubject()->addOutputElement($name); + } + + /** + * Remove an element from output + * + * @param string $name + * @return $this + */ + public function removeOutputElement($name) + { + return $this->getSubject()->removeOutputElement($name); + } + + /** + * Get all blocks marked for output + * + * @return string + */ + public function getOutput() + { + return $this->getSubject()->getOutput(); + } + + /** + * Retrieve messages block + * + * @return \Magento\View\Element\Messages + */ + public function getMessagesBlock() + { + return $this->getSubject()->getMessagesBlock(); + } + + /** + * Get block singleton + * + * @param string $type + * @throws \Magento\Model\Exception + * @return \Magento\App\Helper\AbstractHelper + */ + public function getBlockSingleton($type) + { + return $this->getSubject()->getBlockSingleton($type); + } + + /** + * Retrieve block factory + * + * @return \Magento\View\Element\BlockFactory + */ + public function getBlockFactory() + { + return $this->getSubject()->getBlockFactory(); + } + + /** + * @param string $namespace + * @param string $staticType + * @param string $dynamicType + * @param string $type + * @param string $template + * @param array $data + * @return $this + */ + public function addAdjustableRenderer($namespace, $staticType, $dynamicType, $type, $template, $data = array()) + { + return $this->getSubject()->addAdjustableRenderer( + $namespace, + $staticType, + $dynamicType, + $type, + $template, + $data + ); + } + + /** + * Get renderer options + * + * @param string $namespace + * @param string $staticType + * @param string $dynamicType + * @return array|null + */ + public function getRendererOptions($namespace, $staticType, $dynamicType) + { + return $this->getSubject()->getRendererOptions($namespace, $staticType, $dynamicType); + } + + /** + * Execute renderer + * + * @param string $namespace + * @param string $staticType + * @param string $dynamicType + * @param array $data + * @return void + */ + public function executeRenderer($namespace, $staticType, $dynamicType, $data = array()) + { + $this->getSubject()->executeRenderer($namespace, $staticType, $dynamicType, $data); + } + + /** + * Init messages by message storage(s), loading and adding messages to layout messages block + * + * @param string|array $messageGroups + * @return void + */ + public function initMessages($messageGroups = array()) + { + $this->getSubject()->initMessages($messageGroups); + } + + /** + * Check is exists non-cacheable layout elements + * + * @return bool + */ + public function isCacheable() + { + return $this->getSubject()->isCacheable(); + } + + /** + * Check is exists non-cacheable layout elements + * + * @return bool + */ + public function isPrivate() + { + return $this->getSubject()->isPrivate(); + } + + /** + * Mark layout as private + * + * @param bool $isPrivate + * @return $this + */ + public function setIsPrivate($isPrivate = true) + { + return $this->getSubject()->setIsPrivate($isPrivate); + } + + /** + * Sets xml for this configuration + * + * @param \Magento\Simplexml\Element $node + * @return $this + */ + public function setXml(\Magento\Simplexml\Element $node) + { + return $this->getSubject()->setXml($node); + } + + /** + * Returns node found by the $path + * + * @param string $path + * @return \Magento\Simplexml\Element|bool + * @see \Magento\Simplexml\Element::descend + */ + public function getNode($path = null) + { + return $this->getSubject()->getNode($path); + } + + /** + * Returns nodes found by xpath expression + * + * @param string $xpath + * @return \SimpleXMLElement[]|bool + */ + public function getXpath($xpath) + { + return $this->getSubject()->getXpath($xpath); + } + + /** + * Set cache + * + * @param \Magento\Simplexml\Config\Cache\AbstractCache $cache + * @return $this + */ + public function setCache($cache) + { + return $this->getSubject()->setCache($cache); + } + + /** + * Return cache + * + * @return \Magento\Simplexml\Config\Cache\AbstractCache + */ + public function getCache() + { + return $this->getSubject()->getCache(); + } + + /** + * Set whether cache is saved + * + * @param boolean $flag + * @return $this + */ + public function setCacheSaved($flag) + { + return $this->getSubject()->setCacheSaved($flag); + } + + /** + * Return whether cache is saved + * + * @return bool + * + * @SuppressWarnings(PHPMD.BooleanGetMethodName) + */ + public function getCacheSaved() + { + return $this->getSubject()->getCacheSaved(); + } + + /** + * Set cache ID + * + * @param string $id + * @return $this + */ + public function setCacheId($id) + { + return $this->getSubject()->setCacheId($id); + } + + /** + * Return cache ID + * + * @return string + */ + public function getCacheId() + { + return $this->getSubject()->getCacheId(); + } + + /** + * Set cache tags + * + * @param array $tags + * @return $this + */ + public function setCacheTags($tags) + { + return $this->getSubject()->setCacheTags($tags); + } + + /** + * Return cache tags + * + * @return array + */ + public function getCacheTags() + { + return $this->getSubject()->getCacheTags(); + } + + /** + * Set cache lifetime + * + * @param int $lifetime + * @return $this + */ + public function setCacheLifetime($lifetime) + { + return $this->getSubject()->setCacheLifetime($lifetime); + } + + /** + * Return cache lifetime + * + * @return int + */ + public function getCacheLifetime() + { + return $this->getSubject()->getCacheLifetime(); + } + + /** + * Set cache checksum + * + * @param string $data + * @return $this + */ + public function setCacheChecksum($data) + { + return $this->getSubject()->setCacheChecksum($data); + } + + /** + * Update cache checksum + * + * @param string $data + * @return $this + */ + public function updateCacheChecksum($data) + { + return $this->getSubject()->updateCacheChecksum($data); + } + + /** + * Return cache checksum + * + * @return string + */ + public function getCacheChecksum() + { + return $this->getSubject()->getCacheChecksum(); + } + + /** + * Get cache checksum ID + * + * @return string + */ + public function getCacheChecksumId() + { + return $this->getSubject()->getCacheChecksumId(); + } + + /** + * Fetch cache checksum + * + * @return boolean + */ + public function fetchCacheChecksum() + { + return $this->getSubject()->fetchCacheChecksum(); + } + + /** + * Validate cache checksum + * + * @return boolean + */ + public function validateCacheChecksum() + { + return $this->getSubject()->validateCacheChecksum(); + } + + /** + * Load cache + * + * @return boolean + */ + public function loadCache() + { + return $this->getSubject()->loadCache(); + } + + /** + * Save cache + * + * @param array $tags + * @return $this + */ + public function saveCache($tags = null) + { + return $this->getSubject()->saveCache($tags); + } + + /** + * Return Xml of node as string + * + * @return string + */ + public function getXmlString() + { + return $this->getSubject()->getXmlString(); + } + + /** + * Remove cache + * + * @return $this + */ + public function removeCache() + { + return $this->getSubject()->removeCache(); + } + + /** + * Imports XML file + * + * @param string $filePath + * @return boolean + */ + public function loadFile($filePath) + { + return $this->getSubject()->loadFile($filePath); + } + + /** + * Imports XML string + * + * @param string $string + * @return boolean + */ + public function loadString($string) + { + return $this->getSubject()->loadString($string); + } + + /** + * Imports DOM node + * + * @param \DOMNode $dom + * @return bool + */ + public function loadDom($dom) + { + return $this->getSubject()->loadDom($dom); + } + + /** + * Create node by $path and set its value. + * + * @param string $path separated by slashes + * @param string $value + * @param boolean $overwrite + * @return $this + */ + public function setNode($path, $value, $overwrite = true) + { + return $this->getSubject()->setNode($path, $value, $overwrite); + } + + /** + * Process configuration xml + * + * @return $this + */ + public function applyExtends() + { + return $this->getSubject()->applyExtends(); + } + + /** + * Stub method for processing file data right after loading the file text + * + * @param string $text + * @return string + */ + public function processFileData($text) + { + return $this->getSubject()->processFileData($text); + } + + /** + * Extend configuration + * + * @param \Magento\Simplexml\Config $config + * @param boolean $overwrite + * @return $this + */ + public function extend(\Magento\Simplexml\Config $config, $overwrite = true) + { + return $this->getSubject()->extend($config, $overwrite); + } +} diff --git a/app/code/Magento/Core/Model/Layout/ScheduledStructure.php b/lib/Magento/View/Layout/ScheduledStructure.php similarity index 98% rename from app/code/Magento/Core/Model/Layout/ScheduledStructure.php rename to lib/Magento/View/Layout/ScheduledStructure.php index 101008d9640e2523a12d5012335258ecaed12b93..df2deb7b2d4f226dbb8fba5f2b14cbb8a2d91eea 100644 --- a/app/code/Magento/Core/Model/Layout/ScheduledStructure.php +++ b/lib/Magento/View/Layout/ScheduledStructure.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Layout; +namespace Magento\View\Layout; /** * Layout structure model @@ -67,6 +65,8 @@ class ScheduledStructure /** * @param array $data + * + * @SuppressWarnings(PHPMD.NPathComplexity) */ public function __construct(array $data = array()) { diff --git a/lib/Magento/View/LayoutInterface.php b/lib/Magento/View/LayoutInterface.php index 09eda2e2150ba1065f02359d83f87232471cdd78..6a16b94819cfddc7c973088213afda321caff77b 100644 --- a/lib/Magento/View/LayoutInterface.php +++ b/lib/Magento/View/LayoutInterface.php @@ -280,21 +280,6 @@ interface LayoutInterface */ public function getBlockFactory(); - /** - * Retrieve layout area - * - * @return string - */ - public function getArea(); - - /** - * Set layout area - * - * @param string $area - * @return LayoutInterface - */ - public function setArea($area); - /** * Get property value of an element * diff --git a/lib/Magento/Xml/Generator.php b/lib/Magento/Xml/Generator.php index 86f4cb890aaa191cf061742c72eebea2206d4fd1..ffda226d39d66c16907f5224a283bd7c084583f8 100644 --- a/lib/Magento/Xml/Generator.php +++ b/lib/Magento/Xml/Generator.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Xml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -87,6 +85,7 @@ class Generator /** * @param array $content * @return $this + * @throws \DOMException */ public function arrayToXml($content) { @@ -95,18 +94,12 @@ class Generator return $this; } foreach ($content as $_key => $_item) { - try { - $node = $this->getDom()->createElement($_key); - } catch (\DOMException $e) { - // echo $e->getMessage(); - var_dump($_item); - exit; - } + $node = $this->getDom()->createElement(preg_replace('/[^\w-]/i', '', $_key)); $parentNode->appendChild($node); if (is_array($_item) && isset($_item['_attribute'])) { if (is_array($_item['_value'])) { if (isset($_item['_value'][0])) { - foreach ($_item['_value'] as $_k => $_v) { + foreach ($_item['_value'] as $_v) { $this->_setCurrentDom($node)->arrayToXml($_v); } } else { @@ -125,7 +118,7 @@ class Generator } elseif (is_array($_item) && !isset($_item[0])) { $this->_setCurrentDom($node)->arrayToXml($_item); } elseif (is_array($_item) && isset($_item[0])) { - foreach ($_item as $k => $v) { + foreach ($_item as $v) { $this->_setCurrentDom($node)->arrayToXml(array($this->_getIndexedArrayItemName() => $v)); } } @@ -170,8 +163,8 @@ class Generator */ protected function _getIndexedArrayItemName() { - return isset( - $this->_defaultIndexedArrayItemName - ) ? $this->_defaultIndexedArrayItemName : self::DEFAULT_ENTITY_ITEM_NAME; + return isset($this->_defaultIndexedArrayItemName) + ? $this->_defaultIndexedArrayItemName + : self::DEFAULT_ENTITY_ITEM_NAME; } } diff --git a/lib/flex/uploader/uploader.mxml b/lib/flex/uploader/uploader.mxml deleted file mode 100644 index bd36e2634ef4e71115e26759efba060457d411aa..0000000000000000000000000000000000000000 --- a/lib/flex/uploader/uploader.mxml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<mx:Application - xmlns:mx="http://www.adobe.com/2006/mxml" - width="230" - height="20" - xmlns:upload="varien.upload.*" - xmlns:bridge="bridge.*" - layout="absolute" - backgroundGradientAlphas="[1.0, 1.0]" - backgroundGradientColors="[#D7E5EF, #D7E5EF]" - > - <upload:Uploader id="upload" ></upload:Uploader> - <bridge:FABridge></bridge:FABridge> - <mx:Button - label="Browse Files..." - click="upload.browse();" - alpha="1" - width="110" - height="20" - borderColor="#ED6502" - color="#FFFFFF" - textRollOverColor="#FFFFFF" - fontSize="12" - fontFamily="arial,helvetica,sans-serif" - cornerRadius="0" - x="0" - y="0" - fillAlphas="[1.0, 1.0]" - fillColors="[#FA8F29, #FA8F29]" - > - </mx:Button> - <mx:Button - label="Upload Files" - click="upload.upload();" - alpha="1" - width="110" - height="20" - borderColor="#ED6502" - color="#FFFFFF" - textRollOverColor="#FFFFFF" - fontSize="12" - fontFamily="arial,helvetica,sans-serif" - cornerRadius="0" - x="120" - y="0" - fillAlphas="[1.0, 1.0]" - fillColors="[#FA8F29, #FA8F29]" - > - </mx:Button> -</mx:Application> \ No newline at end of file diff --git a/lib/flex/uploader/uploaderSingle.mxml b/lib/flex/uploader/uploaderSingle.mxml deleted file mode 100644 index 85669060291a6d4d857f66ab1b8bf5f1fec641e5..0000000000000000000000000000000000000000 --- a/lib/flex/uploader/uploaderSingle.mxml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<mx:Application - xmlns:mx="http://www.adobe.com/2006/mxml" - width="32" - height="20" - xmlns:upload="varien.upload.*" - xmlns:bridge="bridge.*" - layout="absolute" - backgroundGradientAlphas="[1.0, 1.0]" - backgroundGradientColors="[#D7E5EF, #D7E5EF]" - > - <mx:Script> - <![CDATA[ - public function hideBrowseButton():void { - btnBrowse.visible = false; - btnRemove.visible = true; - } - public function hideRemoveButton():void { - btnBrowse.visible = true; - btnRemove.visible = false; - } - ]]> - </mx:Script> - <upload:UploaderSingle id="upload" ></upload:UploaderSingle> - <bridge:FABridge></bridge:FABridge> - <mx:Button - label="..." - click="upload.browse();" - alpha="1" - width="32" - height="20" - borderColor="#ED6502" - color="#FFFFFF" - textRollOverColor="#FFFFFF" - fontSize="12" - fontFamily="arial,helvetica,sans-serif" - cornerRadius="0" - x="0" - y="0" - fillAlphas="[1.0, 1.0]" - fillColors="[#FA8F29, #FA8F29]" - id="btnBrowse" - > - </mx:Button> - <mx:Button - label="X" - click="upload.removeFiles(); btnBrowse.visible = true; btnRemove.visible = false;" - alpha="1" - height="20" - borderColor="#EC5314" - color="#FFFFFF" - textRollOverColor="#FFFFFF" - fontSize="12" - fontFamily="arial,helvetica,sans-serif" - cornerRadius="0" - fillAlphas="[1.0, 1.0]" - fillColors="[#EC5314, #EC5314]" - id="btnRemove" - width="32" - y="0" - x="0" - visible="false" - > - </mx:Button> -</mx:Application> \ No newline at end of file diff --git a/lib/flex/varien/varien/upload/Uploader.as b/lib/flex/varien/varien/upload/Uploader.as deleted file mode 100644 index 6910bfcaac11df3c984eb273c0d0ca8131647cdf..0000000000000000000000000000000000000000 --- a/lib/flex/varien/varien/upload/Uploader.as +++ /dev/null @@ -1,627 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -package varien.upload -{ - import flash.errors.IOError; - import flash.errors.IllegalOperationError; - import flash.events.DataEvent; - import flash.events.Event; - import flash.events.EventDispatcher; - import flash.events.HTTPStatusEvent; - import flash.events.IOErrorEvent; - import flash.events.ProgressEvent; - import flash.events.SecurityErrorEvent; - import flash.net.FileFilter; - import flash.net.FileReference; - import flash.net.FileReferenceList; - import flash.net.URLRequest; - import flash.net.URLRequestMethod; - import flash.net.URLVariables; - - import mx.core.IMXMLObject; - import mx.utils.ObjectUtil; - - - /** - * @eventType varien.upload.UploaderEvent.OPEN - */ - [Event(name='open', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.RESET - */ - [Event(name='reset', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.REMOVE - */ - [Event(name='remove', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.PROGRESS - */ - [Event(name='progress', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.ERROR - */ - [Event(name='error', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.SELECT - */ - [Event(name='select', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.COMPLETE - */ - [Event(name='complete', type='varien.upload.UploaderEvent')] - - /** - * @eventType varien.upload.UploaderEvent.CANCEL - */ - [Event(name='cancel', type='varien.upload.UploaderEvent')] - - public class Uploader extends EventDispatcher implements IMXMLObject - { - public var document:Object; - - public var id:String; - - public var useTypeFilter:Boolean; - - protected var _fileList:FileReferenceList; - protected var _typeFilters:Object; - protected var _config:Object; - protected var _files:Object; - protected var _counter:uint; - protected var _laterUploadStack:Array; - - public static const FILE_NEW:String = 'new'; - public static const FILE_PROGRESS:String = 'progress'; - public static const FILE_COMPLETE:String = 'complete'; - public static const FILE_FULL_COMPLETE:String = 'full_complete'; - public static const FILE_ERROR:String = 'error'; - - public static const ERROR_ZERO_SIZE:Number = 1; - public static const ERROR_HTTP:Number = 2; - public static const ERROR_IO:Number = 3; - public static const ERROR_SECURITY:Number = 4; - public static const ERROR_SSL:Number = 5; - - /** - * Constructor - * - * @param config configuration of uploader - */ - public function Uploader(config:Object=null) - { - super(); - _fileList = new FileReferenceList(); - _files = {}; - _typeFilters = {}; - _config = {}; - useTypeFilter = false; - _laterUploadStack = []; - _fileList.addEventListener(Event.SELECT, _handleSelect); - } - - /** - * Implementing of IMXMLObject - * - * @see IMXMLObject - */ - public function initialized(document:Object, id:String):void - { - this.document = document; - this.id = id; - } - - /** - * Browse files for upload - */ - public function browse():void - { - _fileList.browse(useTypeFilter ? getTypeFiltersArray() : null); - } - - /** - * Add file filter for uploader - * - * @param filterId filter unique id - * @param filterLabel label that will be showed in dialog box - * @param fileTypes array of file filter masks - */ - public function addTypeFilter(filterId:String, filterLabel:String, fileTypes:Array):void - { - _typeFilters[filterId] = new FileFilter(filterLabel, fileTypes.join(';')); - } - - /** - * Retrieve file filters as array - */ - public function getTypeFiltersArray():Array - { - var filters:Array = new Array(); - for each (var typeFilter:FileFilter in _typeFilters) { - filters.push(typeFilter); - } - return filters; - } - - /** - * Retrieve file filters as object - */ - public function getTypeFilters():Object - { - return _typeFilters; - } - - /** - * Retrieve file filter with specified id - * - * @param filterId filter unique id - */ - public function getTypeFilter(filterId:String):FileFilter - { - return hasTypeFilter(filterId) ? _typeFilters[filterId] : null; - } - - /** - * Check if filter with specified id exists - * - * @param filterId filter unique id - */ - public function hasTypeFilter(filterId:String):Boolean - { - return (_typeFilters[filterId] is FileFilter); - } - - /** - * Remove type filter with specified id - * - * @param filterId filter unique id - */ - public function removeTypeFilter(filterId:String):void - { - if (hasTypeFilter(filterId)) { - delete _typeFilters[filterId]; - } - } - - /** - * Upload configuration property - * - * For example: - * uploadObject.config = { - * url: 'http://myhost.com/fileUpload.php', - * params: {test:1}, - * file_field: 'file' - * }; - */ - - public function set config(value:Object):void - { - for (var property:String in value) { - _config[property] = value[property]; - } - } - - public function get config():Object - { - return _config; - } - - /** - * Retrieve file info with specified id - * - * @param id file id - */ - public function getFileInfo(id:String):Object - { - var file:FileReference = _getFileById(id); - if (file) { - return _collectFileInfo(id); - } - return null; - } - - /** - * Retrieve file info for all files as array - */ - public function get filesInfo():Array - { - var result:Array = []; - for (var id:String in _files) { - result.push(_collectFileInfo(id)); - } - return result; - } - - /** - * Removes file info for file with specified id - */ - public function removeFiles():void - { - for (var id:String in _files) { - delete _files[id]; - } - _createEvent(UploaderEvent.REMOVE_ALL); - } - - /** - * Removes file info for file with specified id - * - * @param id file id - */ - public function removeFile(id:String):void - { - if(_files[id]) { - delete _files[id]; - } - _createEvent(UploaderEvent.REMOVE); - } - - /** - * Start uploading of files - */ - public function upload():void - { - if (config) { - for(var id:String in _files) { - if(_files[id].status == Uploader.FILE_NEW - || - (_files[id].status == Uploader.FILE_ERROR - && _files[id].errorCode!=Uploader.ERROR_ZERO_SIZE)) { - _uploadOneFile(id); - } - } - } - } - - protected function _uploadOneFile(id:String):void - { - var request:URLRequest = new URLRequest(config.url); - request.method = URLRequestMethod.POST; - request.data = new URLVariables(); - if (config.params) { - for (var property:String in config.params) { - request.data[property] = config.params[property]; - } - } - - var file:FileReference = _files[id].file as FileReference; - - file.addEventListener( - ProgressEvent.PROGRESS, - _handleProgress - ); - - file.addEventListener( - DataEvent.UPLOAD_COMPLETE_DATA, - _handleComplete - ); - - file.addEventListener( - Event.COMPLETE, - _handlePartialComplete - ); - - file.addEventListener( - IOErrorEvent.IO_ERROR, - _handleIOError - ); - - file.addEventListener( - SecurityErrorEvent.SECURITY_ERROR, - _handleSecurityError - ); - - file.addEventListener( - HTTPStatusEvent.HTTP_STATUS, - _handleHttpStatus - ); - _files[id].status = Uploader.FILE_PROGRESS; - _files[id].uploadTry ++; - file.upload(request, config.file_field); - } - - /** - * Collects file info from FileReference object with specified id - * - * @param id file id - */ - protected function _collectFileInfo(id:String):Object - { - var info:Object = {}; - info.id = id; - info.name = _files[id].file.name; - try { - info.size = _files[id].file.size; - } catch (exception:IOError) { - info.size = 0; - } - info.creator = _files[id].file.creator; - info.status = _files[id].status; - info.error = _files[id].error; - info.errorCode = _files[id].errorCode; - info.progress = _files[id].progress; - info.http = _files[id].http; - info.response = _files[id].response; - return info; - } - - /** - * Generates unique file id - * - * @param file FileReference - */ - protected function _uniqueFileId(file:FileReference):String - { - return 'file_' + uint(_counter++).toString(); - } - - /** - * Retrieve file reference by id - * - * @param id file id - */ - protected function _getFileById(id:String):FileReference - { - if(_files[id]) { - return _files[id].file; - } - return null; - } - - /** - * Retrieve file id by reference - * - * @param file FileReference - */ - protected function _getIdByFile(file:FileReference):String - { - for (var id:String in _files) { - if(_files[id].file===file) { - return id; - } - } - return null; - } - - /** - * Create and dispatch UploadEvent with specified type - * - * @param eventType type of UploadEvent - */ - protected function _createEvent(eventType:String, fileId:String=null):void - { - var event:UploaderEvent = new UploaderEvent(eventType); - if(fileId === null) { - event.data = {files: filesInfo}; - } else { - event.data = {file : getFileInfo(fileId)}; - } - dispatchEvent(event); - } - - /** - * Property indicates that all passed for upload file uploaded successfully - */ - public function get allComplete():Boolean - { - for (var id:String in _files) { - if (_files[id].status == Uploader.FILE_PROGRESS - || _files[id].status == Uploader.FILE_COMPLETE) { - return false; - } - } - - return true; - } - - /** - * Property indicates that all passed for upload file has IO Error - * This problem only on servers with self-signed sertificates. - */ - public function get allIOError():Boolean - { - for (var id:String in _files) { - if (_files[id].status == Uploader.FILE_PROGRESS - && _laterUploadStack.indexOf(id)===-1) { - return false; - } - } - - return true; - } - - protected function _handleSelect(event:Event):void - { - for each (var file:FileReference in _fileList.fileList) { - // Try to catch bad files - var badFile:Boolean = false; - var zeroSize:Boolean = false; - try { - file.size; - } - catch (exception:IllegalOperationError) { - badFile = true; - } - catch (exception:IOError) { // If file size == 0 - zeroSize = true; - } - - if(!badFile) { - var id:String = _uniqueFileId(file); - _files[id] = {status:Uploader.FILE_NEW, file:file, uploadTry:0}; - if(zeroSize) { - _files[id].status = Uploader.FILE_ERROR; - _files[id].errorCode = Uploader.ERROR_ZERO_SIZE; - _files[id].error = 'File size should be more than 0 bytes'; - } - } - } - _createEvent(UploaderEvent.SELECT); - } - - protected function _handleProgress(event:ProgressEvent):void - { - var id:String = _getIdByFile(event.target as FileReference); - if (_files[id]) { - _files[id].progress = {total: event.bytesTotal, loaded: event.bytesLoaded}; - } - _createEvent(UploaderEvent.PROGRESS, id); - } - - protected function _handleComplete(event:DataEvent):void - { - var id:String = _getIdByFile(event.target as FileReference); - if (_files[id]) { - _files[id].status = Uploader.FILE_FULL_COMPLETE; - _files[id].progress = {total: _files[id].size, loaded: _files[id].size}; - _files[id].response = event.data; - _files[id].http = 200; - } - - _uploadFromLaterStack(); - _createEvent(UploaderEvent.PROGRESS, id); - if (allComplete) { - _createEvent(UploaderEvent.COMPLETE); - } - } - - protected function _handlePartialComplete(event:Event):void - { - var id:String = _getIdByFile(event.target as FileReference); - if(_files[id]) { - _files[id].progress = {total: _files[id].size, loaded: _files[id].size}; - _files[id].status = Uploader.FILE_COMPLETE; - } - _createEvent(UploaderEvent.PROGRESS, id); - } - - protected function _handleIOError(event:IOErrorEvent):void - { - var id:String = _getIdByFile(event.target as FileReference); - if(_files[id]) { - if(_files[id].status != Uploader.FILE_ERROR){ - if (_files[id].uploadTry > 1) { - _files[id].status = Uploader.FILE_ERROR; - _files[id].error = 'I/O Error'; - _files[id].errorCode = Uploader.ERROR_IO; - } else { - _resetFileHandlers(id); - _laterUploadStack.push(id); - if (allIOError) { - _markAsSSLError(); - } - return; - } - } - } - _createEvent(UploaderEvent.ERROR, id); - } - - protected function _markAsSSLError():void - { - for (var id:String in _files) { - if (_files[id].status == Uploader.FILE_PROGRESS) { - _files[id].status = Uploader.FILE_ERROR; - _files[id].error = 'SSL self-signed sertificate error'; - _files[id].errorCode = Uploader.ERROR_SSL; - _createEvent(UploaderEvent.ERROR, id); - } - } - } - - protected function _uploadFromLaterStack():void - { - if (_laterUploadStack.length > 0) { - _uploadOneFile(_laterUploadStack.shift()); - } - } - - protected function _resetFileHandlers(id:String):void - { - var file:FileReference = (_files[id].file as FileReference); - - file.removeEventListener( - ProgressEvent.PROGRESS, - _handleProgress - ); - - file.removeEventListener( - DataEvent.UPLOAD_COMPLETE_DATA, - _handleComplete - ); - - file.removeEventListener( - Event.COMPLETE, - _handlePartialComplete - ); - - file.removeEventListener( - IOErrorEvent.IO_ERROR, - _handleIOError - ); - - file.removeEventListener( - SecurityErrorEvent.SECURITY_ERROR, - _handleSecurityError - ); - - file.removeEventListener( - HTTPStatusEvent.HTTP_STATUS, - _handleHttpStatus - ); - } - - protected function _handleSecurityError(event:SecurityErrorEvent):void - { - var id:String = _getIdByFile(event.target as FileReference); - if (_files[id]) { - _files[id].status = Uploader.FILE_ERROR; - _files[id].error = 'Security Error'; - _files[id].errorCode = Uploader.ERROR_SECURITY; - } - _createEvent(UploaderEvent.ERROR, id); - } - - protected function _handleHttpStatus(event:HTTPStatusEvent):void - { - var id:String = _getIdByFile(event.target as FileReference); - if (_files[id]) { - if (_files[id].status != Uploader.FILE_ERROR){ - _files[id].status = Uploader.FILE_ERROR; - _files[id].error = 'Http Status Error'; - _files[id].errorCode = Uploader.ERROR_HTTP; - } - _files[id].http = event.status; - } - _createEvent(UploaderEvent.ERROR, id); - } - - } - -} diff --git a/lib/flex/varien/varien/upload/UploaderEvent.as b/lib/flex/varien/varien/upload/UploaderEvent.as deleted file mode 100644 index 14c8d2ae532ddc1ca69f9ed861542e7349beca92..0000000000000000000000000000000000000000 --- a/lib/flex/varien/varien/upload/UploaderEvent.as +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -package varien.upload -{ - import flash.events.Event; - - public class UploaderEvent extends Event - { - /** - * @eventType progress - */ - public static const PROGRESS:String = 'progress'; - - /** - * @eventType error - */ - public static const ERROR:String = 'error'; - - /** - * @eventType select - */ - public static const SELECT:String = 'select'; - - /** - * @eventType complete - */ - public static const COMPLETE:String = 'complete'; - - /** - * @eventType cancel - */ - public static const CANCEL:String = 'cancel'; - - /** - * @eventType remove - */ - public static const REMOVE:String = 'remove'; - - /** - * @eventType removeall - */ - public static const REMOVE_ALL:String = 'removeall'; - - protected var _data:Object; - - public function UploaderEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) - { - super(type, bubbles, cancelable); - - } - - public function get data():Object - { - return _data; - } - - public function set data(value:Object):void - { - _data = value; - } - } -} \ No newline at end of file diff --git a/lib/flex/varien/varien/upload/UploaderSingle.as b/lib/flex/varien/varien/upload/UploaderSingle.as deleted file mode 100644 index e78c1f5125d5f9b4f0da6cc7d9ddd417f15aa904..0000000000000000000000000000000000000000 --- a/lib/flex/varien/varien/upload/UploaderSingle.as +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-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. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -package varien.upload -{ - import flash.errors.IOError; - import flash.errors.IllegalOperationError; - import flash.events.Event; - import flash.net.FileReference; - - import mx.core.IMXMLObject; - - /** - * @eventType varien.upload.UploaderEvent.SELECT - */ - [Event(name='select', type='varien.upload.UploaderEvent')] - - public class UploaderSingle extends Uploader implements IMXMLObject - { - - protected var _file:FileReference; - - /** - * Constructor - * - * @param config configuration of uploader - */ - public function UploaderSingle(config:Object=null) - { - super(config); - _file = new FileReference(); - _file.addEventListener(Event.SELECT, _handleSelect); - } - - /** - * Browse files for upload - */ - override public function browse():void - { - _file.browse(useTypeFilter ? getTypeFiltersArray() : null); - } - - override protected function _handleSelect(event:Event):void - { - var badFile:Boolean = false; - var zeroSize:Boolean = false; - try { - _file.size; - } - catch (exception:IllegalOperationError) { - badFile = true; - } - catch (exception:IOError) { // If file size == 0 - zeroSize = true; - } - - if(!badFile) { - var id:String = _uniqueFileId(_file); - _files[id] = {status:Uploader.FILE_NEW, file:_file, uploadTry:0}; - if(zeroSize) { - _files[id].status = Uploader.FILE_ERROR; - _files[id].errorCode = Uploader.ERROR_ZERO_SIZE; - _files[id].error = 'File size should be more than 0 bytes'; - } - } - _createEvent(UploaderEvent.SELECT); - } - - } - -} diff --git a/pub/cron.php b/pub/cron.php index 3ac4fa68e379fa079fc2c9f9d9020aaa1fc17b96..436c43df683d8b18a04ad405455004f0cbd449c8 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -25,14 +25,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use Magento\Store\Model\StoreManager; -use Magento\Core\Model\StoreManager; require dirname(__DIR__) . '/app/bootstrap.php'; umask(0); -$params = array( - StoreManager::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true -); +$params = array(StoreManager::PARAM_RUN_CODE => 'admin', \Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); $entryPoint->run('Magento\App\Cron', array('parameters' => array('group::'))); diff --git a/pub/lib/css/docs/docs.css b/pub/lib/css/docs/docs.css index 677c8fa974cae23dc6574f537b8694d1e90840b4..9a8acb19f841af93994b2e35e15e324d74ea7f06 100644 --- a/pub/lib/css/docs/docs.css +++ b/pub/lib/css/docs/docs.css @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/* magento_blank */ +/* Magento/blank */ body { margin: 0; padding: 0; diff --git a/pub/lib/css/source/lib/buttons.less b/pub/lib/css/source/lib/buttons.less index 4fbcb9e2a66150027d0451fc23f62b243db30faf..f3ba7ce56d847bd1f2d09e0e2910af923817b19d 100644 --- a/pub/lib/css/source/lib/buttons.less +++ b/pub/lib/css/source/lib/buttons.less @@ -76,7 +76,7 @@ ); .add-padding(@_button-padding); .add-width(@_button-width); - color: @_button-color; + .css(color, @_button-color); .add-border(@_button-border); cursor: @_button-cursor; display: @_button-display; @@ -113,7 +113,7 @@ ); .add-border(@_button-border-active); .tab-focus(); - color: @_button-color-active; + .css(color, @_button-color-active); } &:hover { .add-background(@_button-background-hover); @@ -124,7 +124,7 @@ @_button-gradient ); .add-border(@_button-border-hover); - color: @_button-color-hover; + .css(color, @_button-color-hover); } &.disabled, &[disabled], diff --git a/pub/lib/css/source/lib/dropdowns.less b/pub/lib/css/source/lib/dropdowns.less index 2e868e905b90c62135f70550c60d72ecc277edd5..c525b4e1480f41979d0174f1cf4285a0a807cacf 100644 --- a/pub/lib/css/source/lib/dropdowns.less +++ b/pub/lib/css/source/lib/dropdowns.less @@ -104,8 +104,11 @@ .dropdown-split( @_toggle-selector : ~".action.toggle", @_options-selector : ~"ul.dropdown", + @_button-selector : ~".action.split", @_dropdown-split-actions-padding: @dropdown-split-actions-padding, + @_dropdown-split-button-actions-padding: @dropdown-split-button-actions-padding, + @_dropdown-split-toggle-actions-padding: @dropdown-split-toggle-actions-padding, @_dropdown-split-toggle-position: @dropdown-split-toggle-position, @_dropdown-split-list-position-top: @dropdown-split-list-position-top, @_dropdown-split-list-position-bottom: @dropdown-split-list-position-bottom, @@ -142,14 +145,16 @@ position: relative; //overflow: hidden; ._dropdown-split-toggle-position( + @_button-selector, + @_toggle-selector, @_dropdown-split-toggle-position, @_dropdown-split-button-border-radius-fix ); - .action.split { - .add-padding(@_dropdown-split-actions-padding); + @{_button-selector} { + .add-padding(@_dropdown-split-button-actions-padding); } - .action.toggle { - .add-padding(@_dropdown-split-actions-padding); + @{_toggle-selector} { + .add-padding(@_dropdown-split-toggle-actions-padding); ._dropdown-split-icon( @_dropdown-split-toggle-icon-content, @_dropdown-split-toggle-active-icon-content, @@ -184,7 +189,7 @@ @_dropdown-split-list-position-right ); @{_options-selector} { - ._dropdown-split-list-position-default( + ._dropdown-split-list-position-default ( @_dropdown-split-list-position-top, @_dropdown-split-list-position-bottom, @_dropdown-split-list-position-left, @@ -407,14 +412,16 @@ // Split dropdown toggle position = left ._dropdown-split-toggle-position( + @_button-selector, + @_toggle-selector, @_dropdown-split-toggle-position, @_dropdown-split-button-border-radius-fix ) when (@_dropdown-split-toggle-position = left) { - .action.split { + @{_button-selector} { float: right; margin: 0; } - .action.toggle { + @{_toggle-selector} { float: left; margin: 0; } @@ -422,14 +429,16 @@ // Split dropdown toggle position = right ._dropdown-split-toggle-position( + @_button-selector, + @_toggle-selector, @_dropdown-split-toggle-position, @_dropdown-split-button-border-radius-fix ) when (@_dropdown-split-toggle-position = right) { - .action.split { + @{_button-selector} { float: left; margin: 0; } - .action.toggle { + @{_toggle-selector} { float: right; margin: 0; } @@ -439,16 +448,18 @@ // and // Dropdown-split-button-border-radius-fix = true ._dropdown-split-toggle-position( + @_button-selector, + @_toggle-selector, @_dropdown-split-toggle-position, @_dropdown-split-button-border-radius-fix ) when (@_dropdown-split-toggle-position = right) and (@_dropdown-split-button-border-radius-fix = true) { - button.action.split { + button@{_button-selector} { -webkit-border-top-right-radius: 0; -webkit-border-bottom-right-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; } - button + .action.toggle { + button + @{_toggle-selector} { border-left: 0; -webkit-border-top-left-radius: 0; -webkit-border-bottom-left-radius: 0; @@ -461,16 +472,18 @@ // and // Dropdown-split-button-border-radius-fix = true ._dropdown-split-toggle-position( + @_button-selector, + @_toggle-selector, @_dropdown-split-toggle-position, @_dropdown-split-button-border-radius-fix ) when (@_dropdown-split-toggle-position = left) and (@_dropdown-split-button-border-radius-fix = true) { - button.action.split { + button@{_button-selector} { -webkit-border-top-left-radius: 0; -webkit-border-bottom-left-radius: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; } - button + .action.toggle { + button + @{_toggle-selector} { border-right: 0; -webkit-border-top-right-radius: 0; -webkit-border-bottom-right-radius: 0; @@ -524,7 +537,7 @@ // Dropdown list item border != 0 ._dropdown-list-item-border( @_dropdown-list-item-border -) when not (@_dropdown-list-item-border = 0) { +) when not (@_dropdown-list-item-border = 0) and not (@_dropdown-list-item-border = false) and not (@_dropdown-list-item-border = '') { border-top: @_dropdown-list-item-border; &:first-child { border: none; diff --git a/pub/lib/css/source/lib/icons.less b/pub/lib/css/source/lib/icons.less index f85714e305610521ed5d533e1197e1918213a218..4b55966cf481dda7d16f92a75d8b5b2b18bc22e4 100644 --- a/pub/lib/css/source/lib/icons.less +++ b/pub/lib/css/source/lib/icons.less @@ -364,7 +364,7 @@ when (@_icon-image-position = before) { @_icon-font-margin, @_icon-font-vertical-align ) { - font-family: "@{_icon-font}"; + font-family: @_icon-font; content: @_icon-font-content; ._icon-font-size(@_icon-font-size, @_icon-font-line-height); ._add-color(@_icon-font-color); diff --git a/pub/lib/css/source/lib/layout.less b/pub/lib/css/source/lib/layout.less index 3445dea2c31ab5307817bae036b53ee0d11b84b8..a69b720e84658d5768e81df3f2b45832e7a4b02a 100644 --- a/pub/lib/css/source/lib/layout.less +++ b/pub/lib/css/source/lib/layout.less @@ -29,7 +29,6 @@ @_layout-max-width: @layout-max-width, @_layout-indent: @layout-indent ) { - .box-sizing(); margin: 0 auto; padding-left: @layout-indent; padding-right: @layout-indent; diff --git a/pub/lib/css/source/lib/lib.less b/pub/lib/css/source/lib/lib.less index 99f969b5e0823f4273e07224c30b3e98af2129c6..caeddddcae706a7499dd85351842f4543f56e505 100644 --- a/pub/lib/css/source/lib/lib.less +++ b/pub/lib/css/source/lib/lib.less @@ -1,4 +1,4 @@ -// /** +/** // // * Magento // * // * NOTICE OF LICENSE @@ -20,7 +20,7 @@ // * @category design // * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) // * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ +*/ @import (reference) "abstract.less"; @import "actions-toolbar.less"; diff --git a/pub/lib/css/source/lib/navigation.less b/pub/lib/css/source/lib/navigation.less index 91a6310df51e11e091101c46b1be4a9f9b94aaea..1e96938309903c43908d8f89a319fba03c0a8eca 100644 --- a/pub/lib/css/source/lib/navigation.less +++ b/pub/lib/css/source/lib/navigation.less @@ -204,7 +204,6 @@ position: absolute; width: 86%; .box-sizing(); - .transition(left .3s ease-out 0); ul { margin: 0; padding: 0; diff --git a/pub/lib/css/source/lib/variables.less b/pub/lib/css/source/lib/variables.less index 719c85558af0305cf0cf572209a9644c20982f83..635f0d9d053b90b3e6e87482caecff711f196826 100644 --- a/pub/lib/css/source/lib/variables.less +++ b/pub/lib/css/source/lib/variables.less @@ -628,6 +628,10 @@ @icon-comment: '\e620'; @icon-up: '\e621'; @icon-down: '\e622'; +@icon-arrow-up-thin: '\e623'; +@icon-arrow-right-thin: '\e624'; +@icon-arrow-left-thin: '\e625'; +@icon-arrow-down-thin: '\e626'; // // Messages variables @@ -1166,6 +1170,8 @@ // Variables split dropdown @dropdown-split-actions-padding: 0 5px; +@dropdown-split-toggle-actions-padding: ''; +@dropdown-split-button-actions-padding: ''; @dropdown-split-toggle-position: right; @dropdown-split-list-position-top: @dropdown-list-position-top; @dropdown-split-list-position-bottom: @dropdown-list-position-bottom; diff --git a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot index 46bb1a8a229e62224040111651939f13b58b5cb2..9ebea234bb800c969e6bcf32312b9f2f645a486c 100644 Binary files a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot and b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot differ diff --git a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.svg b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.svg index 415f866c8277a5d025f978ec3630869577b56720..77168dfe5e742a9a073e34a1d4c13d2dc7bf04a6 100644 --- a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.svg +++ b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.svg @@ -42,4 +42,8 @@ <glyph unicode="" d="M519.57 665.893c-127.232 2.487-231.936-75.922-233.911-175.141-0.695-34.487 11.154-66.926 32.219-94.72l-5.486 5.522c36.242-46.519-34.816-171.52-34.816-171.52l159.232 78.702c25.161-7.936 46.994-1.536 75.63-2.121 127.232-2.487 231.973 75.886 233.911 175.067 2.011 99.255-99.511 181.723-226.779 184.21z" /> <glyph unicode="" d="M514.158 489.582l136.558-132.791 26.075 27.794-162.853 158.354-166.729-162.743 26.587-27.136z" /> <glyph unicode="" d="M509.842 406.418l-136.558 132.791-26.075-27.794 162.853-158.354 166.729 162.743-26.587 27.136z" /> +<glyph unicode="" d="M938.824 426.028l-0.504 106.238-426.32 426.322-426.322-426.322-0.504-106.238 389.444 389.442v-880.006h74.764v880.006z" /> +<glyph unicode="" d="M1.994 518.75h748.928l-283.278 291.206h200.254l354.108-363.956-354.108-363.956h-200.254l283.278 291.174h-748.928v145.532z" /> +<glyph unicode="" d="M1022.006 375.25h-748.928l283.278-291.206h-200.254l-354.108 363.956 354.108 363.956h200.254l-283.278-291.174h748.928v-145.532z" /> +<glyph unicode="" d="M85.174 468.026l0.504-106.238 426.322-426.324 426.32 426.324 0.504 106.238-389.444-389.444 0.002 880.006h-74.764v-880.004z" /> </font></defs></svg> \ No newline at end of file diff --git a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.ttf b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.ttf index 72d63e92b7fd29393783332d957512f1bee50e03..62a247a28417c5749234becf3f584ab3145ae464 100644 Binary files a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.ttf and b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.ttf differ diff --git a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff index c72410e888841e9150b86f0e8cd8cb6d9ee8f2e3..ab9ef635f29a7d8f4e6fd6dc4b2ebe78f357808e 100644 Binary files a/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff and b/pub/lib/fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff differ diff --git a/pub/lib/images/logo.svg b/pub/lib/images/logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..f180d8c732f7b646a2fd9b915ae6011147e00fa7 --- /dev/null +++ b/pub/lib/images/logo.svg @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + width="62.93px" height="41.536px" viewBox="0 0 62.93 41.536" enable-background="new 0 0 62.93 41.536" xml:space="preserve"> +<path fill="#ef672f" d="M7.779,0L0,4.713v8.957l2.021,1.189V5.902L7.781,2.4l5.766,3.497l0.023,0.014l-0.002,8.935l2-1.177V4.713 + L7.779,0z M8.809,5.514v10.472l-1.03,0.629l-1.029-0.632V5.522L4.081,7.165v8.956l3.698,2.262l3.73-2.278V7.159L8.809,5.514z"/> +<!-- <path fill="#FAB47D" d="M4.081,7.165l2.668,1.629V5.522L4.081,7.165z M8.809,5.514v3.301l2.701-1.656L8.809,5.514z M15.568,4.713 + L7.779,0L0,4.713l2.021,1.189L7.781,2.4l5.79,3.511L15.568,4.713z"/> --> +<path fill="#FFFFFF" d="M27.449,13.332l-0.537-6.849l-2.72,6.886h-0.886l-2.72-6.886l-0.523,6.849h-1.098l0.686-8.606H21.1 + l2.683,7.062l2.682-7.062H27.9l0.675,8.606H27.449z"/> +<path fill="#FFFFFF" d="M33.311,13.332l-0.125-0.799c-0.473,0.486-1.121,0.924-2.095,0.924c-1.073,0-1.746-0.649-1.746-1.66 + c0-1.483,1.272-2.069,3.755-2.333v-0.25c0-0.749-0.449-1.01-1.136-1.01c-0.724,0-1.409,0.224-2.059,0.511l-0.149-0.96 + c0.711-0.288,1.385-0.499,2.309-0.499c1.445,0,2.146,0.586,2.146,1.908v4.167H33.311L33.311,13.332z M33.1,10.312 + c-2.196,0.212-2.658,0.811-2.658,1.422c0,0.486,0.325,0.799,0.888,0.799c0.647,0,1.271-0.324,1.771-0.836V10.312z"/> +<path fill="#FFFFFF" d="M40.582,7.294l0.162,0.997l-1.136,0.112c0.162,0.275,0.238,0.587,0.238,0.923 + c0,1.272-1.074,2.046-2.283,2.046c-0.149,0-0.3-0.014-0.449-0.037c-0.175,0.11-0.299,0.25-0.299,0.36 + c0,0.212,0.211,0.263,1.26,0.449L38.5,12.22c1.26,0.225,2.045,0.624,2.045,1.547c0,1.248-1.359,1.834-2.906,1.834 + s-2.781-0.486-2.781-1.534c0-0.61,0.425-1.085,1.261-1.534c-0.263-0.188-0.373-0.398-0.373-0.623c0-0.287,0.224-0.574,0.623-0.812 + c-0.661-0.324-1.11-0.96-1.11-1.771c0-1.285,1.073-2.07,2.282-2.07c0.599,0,1.123,0.174,1.535,0.499L40.582,7.294z M35.918,13.979 + c0,0.474,0.61,0.823,1.771,0.823c1.161,0,1.811-0.398,1.811-0.897c0-0.362-0.275-0.61-1.123-0.761l-0.711-0.125 + c-0.324-0.063-0.498-0.1-0.736-0.148C36.23,13.218,35.918,13.568,35.918,13.979z M37.539,8.067c-0.748,0-1.209,0.574-1.209,1.297 + c0,0.686,0.473,1.222,1.209,1.222c0.762,0,1.233-0.561,1.233-1.272S38.275,8.067,37.539,8.067z"/> +<path fill="#FFFFFF" d="M45.871,10.474H41.83c0.037,1.385,0.696,2.033,1.732,2.033c0.861,0,1.484-0.336,2.134-0.848l0.161,0.998 + c-0.636,0.497-1.396,0.797-2.382,0.797c-1.547,0-2.757-0.937-2.757-3.119c0-1.909,1.122-3.081,2.62-3.081 + c1.731,0,2.531,1.334,2.531,2.981C45.871,10.299,45.871,10.399,45.871,10.474z M43.326,8.129c-0.687,0-1.271,0.487-1.446,1.509 + h2.868C44.611,8.678,44.188,8.129,43.326,8.129z"/> +<path fill="#FFFFFF" d="M50.549,13.332V9.277c0-0.611-0.262-1.023-0.91-1.023c-0.587,0-1.186,0.387-1.723,0.96v4.118h-1.109V7.381 + h0.885l0.139,0.861c0.562-0.511,1.261-0.985,2.107-0.985c1.122,0,1.723,0.673,1.723,1.746v4.331h-1.111V13.332z"/> +<path fill="#FFFFFF" d="M54.938,13.431c-1.048,0-1.732-0.375-1.732-1.572V8.316h-0.898V7.381h0.898V5.398l1.086-0.162v2.145h1.283 + l0.149,0.936H54.29v3.343c0,0.486,0.198,0.785,0.821,0.785c0.199,0,0.374-0.012,0.513-0.037l0.148,0.947 + C55.587,13.393,55.326,13.431,54.938,13.431z"/> +<path fill="#FFFFFF" d="M58.619,13.457c-1.585,0-2.732-1.136-2.732-3.095c0-1.958,1.147-3.105,2.732-3.105 + c1.596,0,2.768,1.147,2.768,3.105C61.387,12.321,60.215,13.457,58.619,13.457z M58.619,8.191c-1.073,0-1.609,0.923-1.609,2.17 + c0,1.225,0.561,2.172,1.609,2.172c1.098,0,1.646-0.925,1.646-2.172C60.265,9.14,59.691,8.191,58.619,8.191z"/> +<g> + <path fill="#FFFFFF" d="M62.174,8.272c-0.446,0-0.756-0.31-0.756-0.773c0-0.46,0.315-0.776,0.756-0.776 + c0.446,0,0.756,0.313,0.756,0.776C62.93,7.958,62.613,8.272,62.174,8.272z M62.174,6.813c-0.359,0-0.646,0.246-0.646,0.686 + c0,0.437,0.287,0.683,0.646,0.683c0.363,0,0.65-0.247,0.65-0.683C62.824,7.059,62.533,6.813,62.174,6.813z M62.396,7.912 + L62.14,7.545h-0.084v0.353H61.91V7.042h0.26c0.181,0,0.301,0.09,0.301,0.25c0,0.123-0.067,0.203-0.174,0.236l0.246,0.35 + L62.396,7.912z M62.17,7.176h-0.113v0.253h0.107c0.096,0,0.155-0.04,0.155-0.127C62.32,7.219,62.268,7.176,62.17,7.176z"/> +</g> +<!-- <g> + <g> + <g> + <circle fill="#E0DACF" cx="32.363" cy="17.265" r="0.161"/> + <polygon fill="#E0DACF" points="32.248,19.639 32.248,17.869 32.479,17.869 32.479,17.969 32.479,19.639 "/> + <path fill="#E0DACF" d="M34.33,19.639v-1.06c0-0.209-0.056-0.36-0.163-0.455c-0.109-0.094-0.249-0.141-0.421-0.141 + c-0.095,0-0.185,0.016-0.271,0.045c-0.086,0.029-0.162,0.074-0.229,0.137c-0.065,0.063-0.117,0.142-0.156,0.236 + c-0.038,0.094-0.058,0.207-0.058,0.34v0.896H32.8v-1.357c0-0.02-0.001-0.047-0.001-0.086c-0.002-0.037-0.003-0.076-0.004-0.117 + c-0.002-0.041-0.002-0.08-0.004-0.119c-0.001-0.039-0.002-0.067-0.002-0.09h0.222l0.015,0.383 + c0.017-0.039,0.043-0.084,0.079-0.135s0.085-0.098,0.147-0.143c0.062-0.045,0.137-0.082,0.223-0.113 + c0.088-0.029,0.188-0.045,0.303-0.045c0.24,0,0.431,0.061,0.572,0.184c0.144,0.121,0.213,0.313,0.213,0.572v1.066L34.33,19.639 + L34.33,19.639z"/> + <path fill="#E0DACF" d="M36.363,19.533c-0.153,0.105-0.368,0.158-0.641,0.158c-0.156,0-0.295-0.021-0.418-0.063 + c-0.121-0.043-0.225-0.105-0.309-0.187s-0.148-0.18-0.191-0.295c-0.043-0.112-0.063-0.244-0.063-0.39s0.022-0.276,0.069-0.393 + c0.049-0.117,0.117-0.215,0.205-0.299c0.087-0.082,0.193-0.145,0.317-0.188s0.263-0.064,0.415-0.064 + c0.114,0,0.221,0.012,0.319,0.037c0.101,0.023,0.188,0.061,0.267,0.111c0.077,0.049,0.142,0.11,0.192,0.188 + c0.052,0.076,0.086,0.166,0.105,0.27h-0.246c-0.028-0.141-0.098-0.25-0.208-0.323c-0.11-0.076-0.252-0.113-0.426-0.113 + c-0.108,0-0.208,0.019-0.301,0.054c-0.094,0.032-0.175,0.082-0.243,0.147s-0.123,0.146-0.163,0.241 + c-0.04,0.099-0.061,0.205-0.061,0.328c0,0.115,0.017,0.22,0.05,0.313c0.032,0.095,0.08,0.175,0.145,0.24 + c0.063,0.067,0.143,0.118,0.235,0.157c0.095,0.037,0.199,0.056,0.319,0.056c0.194,0,0.349-0.037,0.46-0.11 + c0.111-0.076,0.181-0.183,0.205-0.32h0.246C36.613,19.279,36.52,19.428,36.363,19.533z"/> + </g> + <path fill="#E0DACF" d="M28.713,18.807c-0.365,0.012-0.592,0.075-0.592,0.315c0,0.156,0.124,0.324,0.438,0.324 + c0.422,0,0.646-0.229,0.646-0.607v-0.041C29.059,18.798,28.877,18.8,28.713,18.807z M29.609,19.305 + c0,0.116,0.004,0.231,0.015,0.336h-0.374c-0.012-0.086-0.016-0.17-0.016-0.254c-0.2,0.25-0.44,0.321-0.774,0.321 + c-0.495,0-0.76-0.264-0.76-0.565c0-0.438,0.358-0.593,0.985-0.604c0.17-0.004,0.362-0.006,0.521-0.006v-0.044 + c0-0.293-0.188-0.413-0.515-0.413c-0.241,0-0.421,0.102-0.438,0.272h-0.422c0.045-0.433,0.498-0.539,0.896-0.539 + c0.479,0,0.881,0.17,0.881,0.674L29.609,19.305L29.609,19.305z"/> + <path fill="#E0DACF" d="M25.234,18.591c-0.016-0.375-0.287-0.518-0.576-0.518c-0.313,0-0.563,0.16-0.606,0.518H25.234z + M24.043,18.859c0.021,0.365,0.272,0.58,0.619,0.58c0.238,0,0.452-0.096,0.523-0.309H25.6c-0.081,0.432-0.538,0.578-0.933,0.578 + c-0.717,0-1.035-0.396-1.035-0.931c0-0.586,0.329-0.971,1.041-0.971c0.566,0,0.982,0.297,0.982,0.942v0.107h-1.612V18.859z"/> + <path fill="#E0DACF" d="M26.688,19.434c0.374,0,0.63-0.271,0.63-0.677c0-0.405-0.256-0.676-0.63-0.676 + c-0.372,0-0.63,0.271-0.63,0.676C26.058,19.164,26.316,19.434,26.688,19.434z M25.657,17.102h0.4v1.01 + c0.197-0.235,0.469-0.303,0.736-0.303c0.447,0,0.944,0.301,0.944,0.953c0,0.547-0.396,0.946-0.952,0.946 + c-0.291,0-0.566-0.104-0.736-0.313c0,0.082-0.004,0.166-0.013,0.244h-0.396c0.007-0.127,0.014-0.287,0.014-0.416v-2.122H25.657z" + /> + <path fill="#E0DACF" d="M31.658,17.875l-1.243,2.441h-0.45l0.356-0.678l-0.938-1.764h0.471l0.689,1.377l0.688-1.377H31.658 + L31.658,17.875z"/> + </g> + <g> + <path fill="#E0DACF" d="M36.713,17.875h0.033v0.045h0.052v0.023h-0.052v0.1c0,0.019,0.006,0.029,0.026,0.029 + c0.006,0,0.017-0.002,0.025-0.002v0.023c-0.011,0-0.021,0.002-0.033,0.002c-0.033,0-0.053-0.012-0.053-0.051v-0.103h-0.045v-0.022 + h0.045L36.713,17.875L36.713,17.875z"/> + <path fill="#E0DACF" d="M36.843,17.958c0-0.012-0.001-0.024-0.001-0.039h0.031c0,0.011,0.001,0.021,0.001,0.031h0.001 + c0.02-0.025,0.044-0.037,0.071-0.037c0.029,0,0.054,0.015,0.063,0.043c0.014-0.022,0.039-0.043,0.072-0.043 + c0.049,0,0.079,0.023,0.079,0.08v0.101h-0.034v-0.089c0-0.041-0.013-0.067-0.049-0.067c-0.029,0-0.062,0.021-0.062,0.076v0.08 + h-0.033v-0.091c0-0.045-0.016-0.065-0.047-0.065c-0.028,0-0.062,0.021-0.062,0.072v0.084h-0.033L36.843,17.958L36.843,17.958z"/> + </g> +</g> +<g> + <path fill="#E0DACF" d="M20.223,19.628l-0.035-0.223c-0.133,0.137-0.313,0.258-0.586,0.258c-0.3,0-0.488-0.182-0.488-0.465 + c0-0.414,0.355-0.578,1.05-0.65v-0.069c0-0.209-0.125-0.283-0.316-0.283c-0.203,0-0.395,0.063-0.576,0.144l-0.041-0.269 + c0.198-0.079,0.388-0.141,0.646-0.141c0.403,0,0.6,0.164,0.6,0.534v1.164H20.223z M20.162,18.785 + c-0.613,0.06-0.742,0.228-0.742,0.398c0,0.135,0.091,0.223,0.248,0.223c0.181,0,0.354-0.092,0.494-0.234V18.785z"/> + <path fill="#E0DACF" d="M21.979,19.628v-1.133c0-0.172-0.073-0.287-0.254-0.287c-0.164,0-0.332,0.109-0.48,0.271v1.149h-0.313 + v-1.664h0.248l0.039,0.24c0.156-0.143,0.352-0.274,0.59-0.274c0.313,0,0.48,0.188,0.48,0.487v1.211H21.979z"/> +</g> +<g> + <path fill="#E0DACF" d="M39.098,19.643c-0.447,0-0.773-0.312-0.773-0.865c0-0.567,0.349-0.868,0.78-0.868 + c0.244,0,0.419,0.063,0.544,0.153l-0.045,0.304c-0.153-0.125-0.311-0.185-0.502-0.185c-0.272,0-0.465,0.205-0.465,0.592 + c0,0.404,0.206,0.597,0.499,0.597c0.167,0,0.313-0.037,0.485-0.185l0.045,0.278C39.494,19.594,39.32,19.643,39.098,19.643z"/> + <path fill="#E0DACF" d="M40.678,19.643c-0.443,0-0.764-0.317-0.764-0.865c0-0.547,0.319-0.868,0.764-0.868 + c0.446,0,0.773,0.321,0.773,0.868C41.451,19.326,41.124,19.643,40.678,19.643z M40.678,18.169c-0.301,0-0.45,0.259-0.45,0.607 + c0,0.342,0.157,0.607,0.45,0.607c0.307,0,0.46-0.26,0.46-0.607C41.138,18.436,40.978,18.169,40.678,18.169z"/> + <path fill="#E0DACF" d="M43.881,19.607v-1.133c0-0.172-0.063-0.287-0.244-0.287c-0.164,0-0.32,0.107-0.471,0.27v1.15h-0.312v-1.133 + c0-0.172-0.063-0.287-0.244-0.287c-0.164,0-0.32,0.107-0.471,0.27v1.15h-0.31v-1.664h0.247l0.038,0.24 + c0.156-0.143,0.346-0.275,0.578-0.275c0.245,0,0.377,0.105,0.44,0.275c0.149-0.143,0.352-0.275,0.585-0.275 + c0.317,0,0.472,0.189,0.472,0.488v1.211H43.881z"/> + <path fill="#E0DACF" d="M45.383,19.628c-0.164,0-0.313-0.03-0.418-0.073v0.655l-0.312,0.045v-2.313h0.248l0.037,0.24 + c0.127-0.146,0.297-0.275,0.541-0.275c0.359,0,0.656,0.266,0.656,0.82C46.137,19.335,45.787,19.628,45.383,19.628z M45.432,18.184 + c-0.188,0-0.334,0.114-0.467,0.293v0.799c0.125,0.063,0.227,0.093,0.404,0.093c0.262,0,0.452-0.214,0.452-0.625 + C45.822,18.378,45.658,18.184,45.432,18.184z"/> + <path fill="#E0DACF" d="M47.51,19.607l-0.035-0.223c-0.132,0.135-0.313,0.258-0.586,0.258c-0.299,0-0.488-0.182-0.488-0.465 + c0-0.414,0.356-0.578,1.052-0.652v-0.068c0-0.209-0.126-0.283-0.318-0.283c-0.201,0-0.395,0.063-0.574,0.144l-0.043-0.269 + c0.199-0.079,0.388-0.141,0.646-0.141c0.404,0,0.601,0.164,0.601,0.535v1.164H47.51z M47.451,18.764 + c-0.614,0.059-0.743,0.228-0.743,0.396c0,0.137,0.091,0.226,0.247,0.226c0.182,0,0.354-0.093,0.496-0.234V18.764z"/> + <path fill="#E0DACF" d="M49.268,19.607v-1.133c0-0.172-0.074-0.287-0.256-0.287c-0.164,0-0.331,0.107-0.479,0.27v1.15h-0.312 + v-1.664h0.247l0.038,0.24c0.158-0.143,0.354-0.275,0.59-0.275c0.314,0,0.481,0.189,0.481,0.488v1.211H49.268z"/> + <path fill="#E0DACF" d="M50.678,19.753c-0.143,0.388-0.32,0.488-0.596,0.488c-0.043,0-0.077-0.008-0.109-0.014l-0.041-0.271 + c0.053,0.015,0.115,0.023,0.174,0.023c0.129,0,0.217-0.063,0.267-0.195l0.063-0.172l-0.605-1.645l0.307-0.049l0.454,1.324 + l0.44-1.302h0.318L50.678,19.753z"/> +</g> --> +<path fill="#676056" d="M7.779,21.219L0,25.932v8.957l2.021,1.189v-8.957l5.76-3.502l5.766,3.497l0.023,0.015l-0.002,8.935l2-1.177 + v-8.957L7.779,21.219z M8.809,26.734v10.472l-1.03,0.629l-1.029-0.632V26.742l-2.668,1.644v8.955l3.698,2.262l3.73-2.278v-8.944 + L8.809,26.734z"/> +</svg> diff --git a/pub/lib/jquery/handlebars/handlebars-v1.3.0.js b/pub/lib/jquery/handlebars/handlebars-v1.3.0.js new file mode 100644 index 0000000000000000000000000000000000000000..bec7085c510185199d205a26576046bc832861a3 --- /dev/null +++ b/pub/lib/jquery/handlebars/handlebars-v1.3.0.js @@ -0,0 +1,2746 @@ +/*! + + handlebars v1.3.0 + +Copyright (C) 2011 by Yehuda Katz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +@license +*/ +/* exported Handlebars */ +var Handlebars = (function() { +// handlebars/safe-string.js +var __module4__ = (function() { + "use strict"; + var __exports__; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = function() { + return "" + this.string; + }; + + __exports__ = SafeString; + return __exports__; +})(); + +// handlebars/utils.js +var __module3__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + /*jshint -W004 */ + var SafeString = __dependency1__; + + var escape = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + + var badChars = /[&<>"'`]/g; + var possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr] || "&"; + } + + function extend(obj, value) { + for(var key in value) { + if(Object.prototype.hasOwnProperty.call(value, key)) { + obj[key] = value[key]; + } + } + } + + __exports__.extend = extend;var toString = Object.prototype.toString; + __exports__.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + var isFunction = function(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + if (isFunction(/x/)) { + isFunction = function(value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + __exports__.isFunction = isFunction; + var isArray = Array.isArray || function(value) { + return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; + }; + __exports__.isArray = isArray; + + function escapeExpression(string) { + // don't escape SafeStrings, since they're already safe + if (string instanceof SafeString) { + return string.toString(); + } else if (!string && string !== 0) { + return ""; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = "" + string; + + if(!possible.test(string)) { return string; } + return string.replace(badChars, escapeChar); + } + + __exports__.escapeExpression = escapeExpression;function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + __exports__.isEmpty = isEmpty; + return __exports__; +})(__module4__); + +// handlebars/exception.js +var __module5__ = (function() { + "use strict"; + var __exports__; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var line; + if (node && node.firstLine) { + line = node.firstLine; + + message += ' - ' + line + ':' + node.firstColumn; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (line) { + this.lineNumber = line; + this.column = node.firstColumn; + } + } + + Exception.prototype = new Error(); + + __exports__ = Exception; + return __exports__; +})(); + +// handlebars/base.js +var __module2__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + + var VERSION = "1.3.0"; + __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; + __exports__.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '>= 1.0.0' + }; + __exports__.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function(name, fn, inverse) { + if (toString.call(name) === objectType) { + if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } + Utils.extend(this.helpers, name); + } else { + if (inverse) { fn.not = inverse; } + this.helpers[name] = fn; + } + }, + + registerPartial: function(name, str) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + this.partials[name] = str; + } + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function(arg) { + if(arguments.length === 2) { + return undefined; + } else { + throw new Exception("Missing helper: '" + arg + "'"); + } + }); + + instance.registerHelper('blockHelperMissing', function(context, options) { + var inverse = options.inverse || function() {}, fn = options.fn; + + if (isFunction(context)) { context = context.call(this); } + + if(context === true) { + return fn(this); + } else if(context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if(context.length > 0) { + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + return fn(context); + } + }); + + instance.registerHelper('each', function(context, options) { + var fn = options.fn, inverse = options.inverse; + var i = 0, ret = "", data; + + if (isFunction(context)) { context = context.call(this); } + + if (options.data) { + data = createFrame(options.data); + } + + if(context && typeof context === 'object') { + if (isArray(context)) { + for(var j = context.length; i<j; i++) { + if (data) { + data.index = i; + data.first = (i === 0); + data.last = (i === (context.length-1)); + } + ret = ret + fn(context[i], { data: data }); + } + } else { + for(var key in context) { + if(context.hasOwnProperty(key)) { + if(data) { + data.key = key; + data.index = i; + data.first = (i === 0); + } + ret = ret + fn(context[key], {data: data}); + i++; + } + } + } + } + + if(i === 0){ + ret = inverse(this); + } + + return ret; + }); + + instance.registerHelper('if', function(conditional, options) { + if (isFunction(conditional)) { conditional = conditional.call(this); } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function(conditional, options) { + return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash}); + }); + + instance.registerHelper('with', function(context, options) { + if (isFunction(context)) { context = context.call(this); } + + if (!Utils.isEmpty(context)) return options.fn(context); + }); + + instance.registerHelper('log', function(context, options) { + var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; + instance.log(level, context); + }); + } + + var logger = { + methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, + + // State enum + DEBUG: 0, + INFO: 1, + WARN: 2, + ERROR: 3, + level: 3, + + // can be overridden in the host environment + log: function(level, obj) { + if (logger.level <= level) { + var method = logger.methodMap[level]; + if (typeof console !== 'undefined' && console[method]) { + console[method].call(console, obj); + } + } + } + }; + __exports__.logger = logger; + function log(level, obj) { logger.log(level, obj); } + + __exports__.log = log;var createFrame = function(object) { + var obj = {}; + Utils.extend(obj, object); + return obj; + }; + __exports__.createFrame = createFrame; + return __exports__; +})(__module3__, __module5__); + +// handlebars/runtime.js +var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { + "use strict"; + var __exports__ = {}; + var Utils = __dependency1__; + var Exception = __dependency2__; + var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; + var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; + + function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = REVISION_CHANGES[currentRevision], + compilerVersions = REVISION_CHANGES[compilerRevision]; + throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+ + "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+ + "Please update your runtime to a newer version ("+compilerInfo[1]+")."); + } + } + } + + __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial + + function template(templateSpec, env) { + if (!env) { + throw new Exception("No environment passed to template"); + } + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { + var result = env.VM.invokePartial.apply(this, arguments); + if (result != null) { return result; } + + if (env.compile) { + var options = { helpers: helpers, partials: partials, data: data }; + partials[name] = env.compile(partial, { data: data !== undefined }, env); + return partials[name](context, options); + } else { + throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); + } + }; + + // Just add water + var container = { + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + programs: [], + program: function(i, fn, data) { + var programWrapper = this.programs[i]; + if(data) { + programWrapper = program(i, fn, data); + } else if (!programWrapper) { + programWrapper = this.programs[i] = program(i, fn); + } + return programWrapper; + }, + merge: function(param, common) { + var ret = param || common; + + if (param && common && (param !== common)) { + ret = {}; + Utils.extend(ret, common); + Utils.extend(ret, param); + } + return ret; + }, + programWithDepth: env.VM.programWithDepth, + noop: env.VM.noop, + compilerInfo: null + }; + + return function(context, options) { + options = options || {}; + var namespace = options.partial ? options : env, + helpers, + partials; + + if (!options.partial) { + helpers = options.helpers; + partials = options.partials; + } + var result = templateSpec.call( + container, + namespace, context, + helpers, + partials, + options.data); + + if (!options.partial) { + env.VM.checkRevision(container.compilerInfo); + } + + return result; + }; + } + + __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { + var args = Array.prototype.slice.call(arguments, 3); + + var prog = function(context, options) { + options = options || {}; + + return fn.apply(this, [context, options.data || data].concat(args)); + }; + prog.program = i; + prog.depth = args.length; + return prog; + } + + __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { + var prog = function(context, options) { + options = options || {}; + + return fn(context, options.data || data); + }; + prog.program = i; + prog.depth = 0; + return prog; + } + + __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { + var options = { partial: true, helpers: helpers, partials: partials, data: data }; + + if(partial === undefined) { + throw new Exception("The partial " + name + " could not be found"); + } else if(partial instanceof Function) { + return partial(context, options); + } + } + + __exports__.invokePartial = invokePartial;function noop() { return ""; } + + __exports__.noop = noop; + return __exports__; +})(__module3__, __module5__, __module2__); + +// handlebars.runtime.js +var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { + "use strict"; + var __exports__; + /*globals Handlebars: true */ + var base = __dependency1__; + + // Each of these augment the Handlebars object. No need to setup here. + // (This is done to easily share code between commonjs and browse envs) + var SafeString = __dependency2__; + var Exception = __dependency3__; + var Utils = __dependency4__; + var runtime = __dependency5__; + + // For compatibility and usage outside of module systems, make the Handlebars object a namespace + var create = function() { + var hb = new base.HandlebarsEnvironment(); + + Utils.extend(hb, base); + hb.SafeString = SafeString; + hb.Exception = Exception; + hb.Utils = Utils; + + hb.VM = runtime; + hb.template = function(spec) { + return runtime.template(spec, hb); + }; + + return hb; + }; + + var Handlebars = create(); + Handlebars.create = create; + + __exports__ = Handlebars; + return __exports__; +})(__module2__, __module4__, __module5__, __module3__, __module6__); + +// handlebars/compiler/ast.js +var __module7__ = (function(__dependency1__) { + "use strict"; + var __exports__; + var Exception = __dependency1__; + + function LocationInfo(locInfo){ + locInfo = locInfo || {}; + this.firstLine = locInfo.first_line; + this.firstColumn = locInfo.first_column; + this.lastColumn = locInfo.last_column; + this.lastLine = locInfo.last_line; + } + + var AST = { + ProgramNode: function(statements, inverseStrip, inverse, locInfo) { + var inverseLocationInfo, firstInverseNode; + if (arguments.length === 3) { + locInfo = inverse; + inverse = null; + } else if (arguments.length === 2) { + locInfo = inverseStrip; + inverseStrip = null; + } + + LocationInfo.call(this, locInfo); + this.type = "program"; + this.statements = statements; + this.strip = {}; + + if(inverse) { + firstInverseNode = inverse[0]; + if (firstInverseNode) { + inverseLocationInfo = { + first_line: firstInverseNode.firstLine, + last_line: firstInverseNode.lastLine, + last_column: firstInverseNode.lastColumn, + first_column: firstInverseNode.firstColumn + }; + this.inverse = new AST.ProgramNode(inverse, inverseStrip, inverseLocationInfo); + } else { + this.inverse = new AST.ProgramNode(inverse, inverseStrip); + } + this.strip.right = inverseStrip.left; + } else if (inverseStrip) { + this.strip.left = inverseStrip.right; + } + }, + + MustacheNode: function(rawParams, hash, open, strip, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "mustache"; + this.strip = strip; + + // Open may be a string parsed from the parser or a passed boolean flag + if (open != null && open.charAt) { + // Must use charAt to support IE pre-10 + var escapeFlag = open.charAt(3) || open.charAt(2); + this.escaped = escapeFlag !== '{' && escapeFlag !== '&'; + } else { + this.escaped = !!open; + } + + if (rawParams instanceof AST.SexprNode) { + this.sexpr = rawParams; + } else { + // Support old AST API + this.sexpr = new AST.SexprNode(rawParams, hash); + } + + this.sexpr.isRoot = true; + + // Support old AST API that stored this info in MustacheNode + this.id = this.sexpr.id; + this.params = this.sexpr.params; + this.hash = this.sexpr.hash; + this.eligibleHelper = this.sexpr.eligibleHelper; + this.isHelper = this.sexpr.isHelper; + }, + + SexprNode: function(rawParams, hash, locInfo) { + LocationInfo.call(this, locInfo); + + this.type = "sexpr"; + this.hash = hash; + + var id = this.id = rawParams[0]; + var params = this.params = rawParams.slice(1); + + // a mustache is an eligible helper if: + // * its id is simple (a single part, not `this` or `..`) + var eligibleHelper = this.eligibleHelper = id.isSimple; + + // a mustache is definitely a helper if: + // * it is an eligible helper, and + // * it has at least one parameter or hash segment + this.isHelper = eligibleHelper && (params.length || hash); + + // if a mustache is an eligible helper but not a definite + // helper, it is ambiguous, and will be resolved in a later + // pass or at runtime. + }, + + PartialNode: function(partialName, context, strip, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "partial"; + this.partialName = partialName; + this.context = context; + this.strip = strip; + }, + + BlockNode: function(mustache, program, inverse, close, locInfo) { + LocationInfo.call(this, locInfo); + + if(mustache.sexpr.id.original !== close.path.original) { + throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original, this); + } + + this.type = 'block'; + this.mustache = mustache; + this.program = program; + this.inverse = inverse; + + this.strip = { + left: mustache.strip.left, + right: close.strip.right + }; + + (program || inverse).strip.left = mustache.strip.right; + (inverse || program).strip.right = close.strip.left; + + if (inverse && !program) { + this.isInverse = true; + } + }, + + ContentNode: function(string, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "content"; + this.string = string; + }, + + HashNode: function(pairs, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "hash"; + this.pairs = pairs; + }, + + IdNode: function(parts, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "ID"; + + var original = "", + dig = [], + depth = 0; + + for(var i=0,l=parts.length; i<l; i++) { + var part = parts[i].part; + original += (parts[i].separator || '') + part; + + if (part === ".." || part === "." || part === "this") { + if (dig.length > 0) { + throw new Exception("Invalid path: " + original, this); + } else if (part === "..") { + depth++; + } else { + this.isScoped = true; + } + } else { + dig.push(part); + } + } + + this.original = original; + this.parts = dig; + this.string = dig.join('.'); + this.depth = depth; + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; + }, + + PartialNameNode: function(name, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "PARTIAL_NAME"; + this.name = name.original; + }, + + DataNode: function(id, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "DATA"; + this.id = id; + }, + + StringNode: function(string, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "STRING"; + this.original = + this.string = + this.stringModeValue = string; + }, + + IntegerNode: function(integer, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "INTEGER"; + this.original = + this.integer = integer; + this.stringModeValue = Number(integer); + }, + + BooleanNode: function(bool, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "BOOLEAN"; + this.bool = bool; + this.stringModeValue = bool === "true"; + }, + + CommentNode: function(comment, locInfo) { + LocationInfo.call(this, locInfo); + this.type = "comment"; + this.comment = comment; + } + }; + + // Must be exported as an object rather than the root of the module as the jison lexer + // most modify the object to operate properly. + __exports__ = AST; + return __exports__; +})(__module5__); + +// handlebars/compiler/parser.js +var __module9__ = (function() { + "use strict"; + var __exports__; + /* jshint ignore:start */ + /* Jison generated parser */ + var handlebars = (function(){ + var parser = {trace: function trace() { }, + yy: {}, + symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, + terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, + productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], + performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: return new yy.ProgramNode($$[$0-1], this._$); + break; + case 2: return new yy.ProgramNode([], this._$); + break; + case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0], this._$); + break; + case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0], this._$); + break; + case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], [], this._$); + break; + case 6:this.$ = new yy.ProgramNode($$[$0], this._$); + break; + case 7:this.$ = new yy.ProgramNode([], this._$); + break; + case 8:this.$ = new yy.ProgramNode([], this._$); + break; + case 9:this.$ = [$$[$0]]; + break; + case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; + break; + case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); + break; + case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); + break; + case 13:this.$ = $$[$0]; + break; + case 14:this.$ = $$[$0]; + break; + case 15:this.$ = new yy.ContentNode($$[$0], this._$); + break; + case 16:this.$ = new yy.CommentNode($$[$0], this._$); + break; + case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; + break; + case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); + break; + case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); + break; + case 23:this.$ = stripFlags($$[$0-1], $$[$0]); + break; + case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); + break; + case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); + break; + case 26:this.$ = $$[$0]; + break; + case 27:this.$ = new yy.StringNode($$[$0], this._$); + break; + case 28:this.$ = new yy.IntegerNode($$[$0], this._$); + break; + case 29:this.$ = new yy.BooleanNode($$[$0], this._$); + break; + case 30:this.$ = $$[$0]; + break; + case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; + break; + case 32:this.$ = new yy.HashNode($$[$0], this._$); + break; + case 33:this.$ = [$$[$0-2], $$[$0]]; + break; + case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); + break; + case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); + break; + case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); + break; + case 37:this.$ = new yy.DataNode($$[$0], this._$); + break; + case 38:this.$ = new yy.IdNode($$[$0], this._$); + break; + case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; + break; + case 40:this.$ = [{part: $$[$0]}]; + break; + case 43:this.$ = []; + break; + case 44:$$[$0-1].push($$[$0]); + break; + case 47:this.$ = [$$[$0]]; + break; + case 48:$$[$0-1].push($$[$0]); + break; + } + }, + table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], + defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") + this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) + if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + + + function stripFlags(open, close) { + return { + left: open.charAt(2) === '~', + right: close.charAt(0) === '~' || close.charAt(1) === '~' + }; + } + + /* Jison generated lexer */ + var lexer = (function(){ + var lexer = ({EOF:1, + parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput:function (input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; + if (this.options.ranges) this.yylloc.range = [0,0]; + this.offset = 0; + return this; + }, + input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length-len-1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length-1); + this.matched = this.matched.substr(0, this.matched.length-1); + + if (lines.length-1) this.yylineno -= lines.length-1; + var r = this.yylloc.range; + + this.yylloc = {first_line: this.yylloc.first_line, + last_line: this.yylineno+1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more:function () { + this._more = true; + return this; + }, + less:function (n) { + this.unput(this.match.slice(n)); + }, + pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); + }, + showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c+"^"; + }, + next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, + match, + tempMatch, + index, + col, + lines; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i=0;i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = {first_line: this.yylloc.last_line, + last_line: this.yylineno+1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); + if (this.done && this._input) this.done = false; + if (token) return token; + else return; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + {text: "", token: null, line: this.yylineno}); + } + }, + lex:function lex() { + var r = this.next(); + if (typeof r !== 'undefined') { + return r; + } else { + return this.lex(); + } + }, + begin:function begin(condition) { + this.conditionStack.push(condition); + }, + popState:function popState() { + return this.conditionStack.pop(); + }, + _currentRules:function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; + }, + topState:function () { + return this.conditionStack[this.conditionStack.length-2]; + }, + pushState:function begin(condition) { + this.begin(condition); + }}); + lexer.options = {}; + lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); + } + + + var YYSTATE=YY_START + switch($avoiding_name_collisions) { + case 0: + if(yy_.yytext.slice(-2) === "\\\\") { + strip(0,1); + this.begin("mu"); + } else if(yy_.yytext.slice(-1) === "\\") { + strip(0,1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if(yy_.yytext) return 14; + + break; + case 1:return 14; + break; + case 2: + this.popState(); + return 14; + + break; + case 3:strip(0,4); this.popState(); return 15; + break; + case 4:return 35; + break; + case 5:return 36; + break; + case 6:return 25; + break; + case 7:return 16; + break; + case 8:return 20; + break; + case 9:return 19; + break; + case 10:return 19; + break; + case 11:return 23; + break; + case 12:return 22; + break; + case 13:this.popState(); this.begin('com'); + break; + case 14:strip(3,5); this.popState(); return 15; + break; + case 15:return 22; + break; + case 16:return 41; + break; + case 17:return 40; + break; + case 18:return 40; + break; + case 19:return 44; + break; + case 20:// ignore whitespace + break; + case 21:this.popState(); return 24; + break; + case 22:this.popState(); return 18; + break; + case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; + break; + case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; + break; + case 25:return 42; + break; + case 26:return 34; + break; + case 27:return 34; + break; + case 28:return 33; + break; + case 29:return 40; + break; + case 30:yy_.yytext = strip(1,2); return 40; + break; + case 31:return 'INVALID'; + break; + case 32:return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; + lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; + return lexer;})() + parser.lexer = lexer; + function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; + return new Parser; + })();__exports__ = handlebars; + /* jshint ignore:end */ + return __exports__; +})(); + +// handlebars/compiler/base.js +var __module8__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__ = {}; + var parser = __dependency1__; + var AST = __dependency2__; + + __exports__.parser = parser; + + function parse(input) { + // Just return if an already-compile AST was passed in. + if(input.constructor === AST.ProgramNode) { return input; } + + parser.yy = AST; + return parser.parse(input); + } + + __exports__.parse = parse; + return __exports__; +})(__module9__, __module7__); + +// handlebars/compiler/compiler.js +var __module10__ = (function(__dependency1__) { + "use strict"; + var __exports__ = {}; + var Exception = __dependency1__; + + function Compiler() {} + + __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a + // function in a context. This is necessary for mustache compatibility, which + // requires that context functions in blocks are evaluated by blockHelperMissing, + // and then proceed as if the resulting value was provided to blockHelperMissing. + + Compiler.prototype = { + compiler: Compiler, + + disassemble: function() { + var opcodes = this.opcodes, opcode, out = [], params, param; + + for (var i=0, l=opcodes.length; i<l; i++) { + opcode = opcodes[i]; + + if (opcode.opcode === 'DECLARE') { + out.push("DECLARE " + opcode.name + "=" + opcode.value); + } else { + params = []; + for (var j=0; j<opcode.args.length; j++) { + param = opcode.args[j]; + if (typeof param === "string") { + param = "\"" + param.replace("\n", "\\n") + "\""; + } + params.push(param); + } + out.push(opcode.opcode + " " + params.join(" ")); + } + } + + return out.join("\n"); + }, + + equals: function(other) { + var len = this.opcodes.length; + if (other.opcodes.length !== len) { + return false; + } + + for (var i = 0; i < len; i++) { + var opcode = this.opcodes[i], + otherOpcode = other.opcodes[i]; + if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) { + return false; + } + for (var j = 0; j < opcode.args.length; j++) { + if (opcode.args[j] !== otherOpcode.args[j]) { + return false; + } + } + } + + len = this.children.length; + if (other.children.length !== len) { + return false; + } + for (i = 0; i < len; i++) { + if (!this.children[i].equals(other.children[i])) { + return false; + } + } + + return true; + }, + + guid: 0, + + compile: function(program, options) { + this.opcodes = []; + this.children = []; + this.depths = {list: []}; + this.options = options; + + // These changes will propagate to the other compiler components + var knownHelpers = this.options.knownHelpers; + this.options.knownHelpers = { + 'helperMissing': true, + 'blockHelperMissing': true, + 'each': true, + 'if': true, + 'unless': true, + 'with': true, + 'log': true + }; + if (knownHelpers) { + for (var name in knownHelpers) { + this.options.knownHelpers[name] = knownHelpers[name]; + } + } + + return this.accept(program); + }, + + accept: function(node) { + var strip = node.strip || {}, + ret; + if (strip.left) { + this.opcode('strip'); + } + + ret = this[node.type](node); + + if (strip.right) { + this.opcode('strip'); + } + + return ret; + }, + + program: function(program) { + var statements = program.statements; + + for(var i=0, l=statements.length; i<l; i++) { + this.accept(statements[i]); + } + this.isSimple = l === 1; + + this.depths.list = this.depths.list.sort(function(a, b) { + return a - b; + }); + + return this; + }, + + compileProgram: function(program) { + var result = new this.compiler().compile(program, this.options); + var guid = this.guid++, depth; + + this.usePartial = this.usePartial || result.usePartial; + + this.children[guid] = result; + + for(var i=0, l=result.depths.list.length; i<l; i++) { + depth = result.depths.list[i]; + + if(depth < 2) { continue; } + else { this.addDepth(depth - 1); } + } + + return guid; + }, + + block: function(block) { + var mustache = block.mustache, + program = block.program, + inverse = block.inverse; + + if (program) { + program = this.compileProgram(program); + } + + if (inverse) { + inverse = this.compileProgram(inverse); + } + + var sexpr = mustache.sexpr; + var type = this.classifySexpr(sexpr); + + if (type === "helper") { + this.helperSexpr(sexpr, program, inverse); + } else if (type === "simple") { + this.simpleSexpr(sexpr); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('blockValue'); + } else { + this.ambiguousSexpr(sexpr, program, inverse); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('ambiguousBlockValue'); + } + + this.opcode('append'); + }, + + hash: function(hash) { + var pairs = hash.pairs, pair, val; + + this.opcode('pushHash'); + + for(var i=0, l=pairs.length; i<l; i++) { + pair = pairs[i]; + val = pair[1]; + + if (this.options.stringParams) { + if(val.depth) { + this.addDepth(val.depth); + } + this.opcode('getContext', val.depth || 0); + this.opcode('pushStringParam', val.stringModeValue, val.type); + + if (val.type === 'sexpr') { + // Subexpressions get evaluated and passed in + // in string params mode. + this.sexpr(val); + } + } else { + this.accept(val); + } + + this.opcode('assignToHash', pair[0]); + } + this.opcode('popHash'); + }, + + partial: function(partial) { + var partialName = partial.partialName; + this.usePartial = true; + + if(partial.context) { + this.ID(partial.context); + } else { + this.opcode('push', 'depth0'); + } + + this.opcode('invokePartial', partialName.name); + this.opcode('append'); + }, + + content: function(content) { + this.opcode('appendContent', content.string); + }, + + mustache: function(mustache) { + this.sexpr(mustache.sexpr); + + if(mustache.escaped && !this.options.noEscape) { + this.opcode('appendEscaped'); + } else { + this.opcode('append'); + } + }, + + ambiguousSexpr: function(sexpr, program, inverse) { + var id = sexpr.id, + name = id.parts[0], + isBlock = program != null || inverse != null; + + this.opcode('getContext', id.depth); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + this.opcode('invokeAmbiguous', name, isBlock); + }, + + simpleSexpr: function(sexpr) { + var id = sexpr.id; + + if (id.type === 'DATA') { + this.DATA(id); + } else if (id.parts.length) { + this.ID(id); + } else { + // Simplified ID for `this` + this.addDepth(id.depth); + this.opcode('getContext', id.depth); + this.opcode('pushContext'); + } + + this.opcode('resolvePossibleLambda'); + }, + + helperSexpr: function(sexpr, program, inverse) { + var params = this.setupFullMustacheParams(sexpr, program, inverse), + name = sexpr.id.parts[0]; + + if (this.options.knownHelpers[name]) { + this.opcode('invokeKnownHelper', params.length, name); + } else if (this.options.knownHelpersOnly) { + throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); + } else { + this.opcode('invokeHelper', params.length, name, sexpr.isRoot); + } + }, + + sexpr: function(sexpr) { + var type = this.classifySexpr(sexpr); + + if (type === "simple") { + this.simpleSexpr(sexpr); + } else if (type === "helper") { + this.helperSexpr(sexpr); + } else { + this.ambiguousSexpr(sexpr); + } + }, + + ID: function(id) { + this.addDepth(id.depth); + this.opcode('getContext', id.depth); + + var name = id.parts[0]; + if (!name) { + this.opcode('pushContext'); + } else { + this.opcode('lookupOnContext', id.parts[0]); + } + + for(var i=1, l=id.parts.length; i<l; i++) { + this.opcode('lookup', id.parts[i]); + } + }, + + DATA: function(data) { + this.options.data = true; + if (data.id.isScoped || data.id.depth) { + throw new Exception('Scoped data references are not supported: ' + data.original, data); + } + + this.opcode('lookupData'); + var parts = data.id.parts; + for(var i=0, l=parts.length; i<l; i++) { + this.opcode('lookup', parts[i]); + } + }, + + STRING: function(string) { + this.opcode('pushString', string.string); + }, + + INTEGER: function(integer) { + this.opcode('pushLiteral', integer.integer); + }, + + BOOLEAN: function(bool) { + this.opcode('pushLiteral', bool.bool); + }, + + comment: function() {}, + + // HELPERS + opcode: function(name) { + this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) }); + }, + + declare: function(name, value) { + this.opcodes.push({ opcode: 'DECLARE', name: name, value: value }); + }, + + addDepth: function(depth) { + if(depth === 0) { return; } + + if(!this.depths[depth]) { + this.depths[depth] = true; + this.depths.list.push(depth); + } + }, + + classifySexpr: function(sexpr) { + var isHelper = sexpr.isHelper; + var isEligible = sexpr.eligibleHelper; + var options = this.options; + + // if ambiguous, we can possibly resolve the ambiguity now + if (isEligible && !isHelper) { + var name = sexpr.id.parts[0]; + + if (options.knownHelpers[name]) { + isHelper = true; + } else if (options.knownHelpersOnly) { + isEligible = false; + } + } + + if (isHelper) { return "helper"; } + else if (isEligible) { return "ambiguous"; } + else { return "simple"; } + }, + + pushParams: function(params) { + var i = params.length, param; + + while(i--) { + param = params[i]; + + if(this.options.stringParams) { + if(param.depth) { + this.addDepth(param.depth); + } + + this.opcode('getContext', param.depth || 0); + this.opcode('pushStringParam', param.stringModeValue, param.type); + + if (param.type === 'sexpr') { + // Subexpressions get evaluated and passed in + // in string params mode. + this.sexpr(param); + } + } else { + this[param.type](param); + } + } + }, + + setupFullMustacheParams: function(sexpr, program, inverse) { + var params = sexpr.params; + this.pushParams(params); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + if (sexpr.hash) { + this.hash(sexpr.hash); + } else { + this.opcode('emptyHash'); + } + + return params; + } + }; + + function precompile(input, options, env) { + if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); + } + + options = options || {}; + if (!('data' in options)) { + options.data = true; + } + + var ast = env.parse(input); + var environment = new env.Compiler().compile(ast, options); + return new env.JavaScriptCompiler().compile(environment, options); + } + + __exports__.precompile = precompile;function compile(input, options, env) { + if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { + throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); + } + + options = options || {}; + + if (!('data' in options)) { + options.data = true; + } + + var compiled; + + function compileInput() { + var ast = env.parse(input); + var environment = new env.Compiler().compile(ast, options); + var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); + return env.template(templateSpec); + } + + // Template is only compiled on first use and cached after that point. + return function(context, options) { + if (!compiled) { + compiled = compileInput(); + } + return compiled.call(this, context, options); + }; + } + + __exports__.compile = compile; + return __exports__; +})(__module5__); + +// handlebars/compiler/javascript-compiler.js +var __module11__ = (function(__dependency1__, __dependency2__) { + "use strict"; + var __exports__; + var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; + var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; + var log = __dependency1__.log; + var Exception = __dependency2__; + + function Literal(value) { + this.value = value; + } + + function JavaScriptCompiler() {} + + JavaScriptCompiler.prototype = { + // PUBLIC API: You can override these methods in a subclass to provide + // alternative compiled forms for name lookup and buffering semantics + nameLookup: function(parent, name /* , type*/) { + var wrap, + ret; + if (parent.indexOf('depth') === 0) { + wrap = true; + } + + if (/^[0-9]+$/.test(name)) { + ret = parent + "[" + name + "]"; + } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + ret = parent + "." + name; + } + else { + ret = parent + "['" + name + "']"; + } + + if (wrap) { + return '(' + parent + ' && ' + ret + ')'; + } else { + return ret; + } + }, + + compilerInfo: function() { + var revision = COMPILER_REVISION, + versions = REVISION_CHANGES[revision]; + return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; + }, + + appendToBuffer: function(string) { + if (this.environment.isSimple) { + return "return " + string + ";"; + } else { + return { + appendToBuffer: true, + content: string, + toString: function() { return "buffer += " + string + ";"; } + }; + } + }, + + initializeBuffer: function() { + return this.quotedString(""); + }, + + namespace: "Handlebars", + // END PUBLIC API + + compile: function(environment, options, context, asObject) { + this.environment = environment; + this.options = options || {}; + + log('debug', this.environment.disassemble() + "\n\n"); + + this.name = this.environment.name; + this.isChild = !!context; + this.context = context || { + programs: [], + environments: [], + aliases: { } + }; + + this.preamble(); + + this.stackSlot = 0; + this.stackVars = []; + this.registers = { list: [] }; + this.hashes = []; + this.compileStack = []; + this.inlineStack = []; + + this.compileChildren(environment, options); + + var opcodes = environment.opcodes, opcode; + + this.i = 0; + + for(var l=opcodes.length; this.i<l; this.i++) { + opcode = opcodes[this.i]; + + if(opcode.opcode === 'DECLARE') { + this[opcode.name] = opcode.value; + } else { + this[opcode.opcode].apply(this, opcode.args); + } + + // Reset the stripNext flag if it was not set by this operation. + if (opcode.opcode !== this.stripNext) { + this.stripNext = false; + } + } + + // Flush any trailing content that might be pending. + this.pushSource(''); + + if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { + throw new Exception('Compile completed with content left on stack'); + } + + return this.createFunctionContext(asObject); + }, + + preamble: function() { + var out = []; + + if (!this.isChild) { + var namespace = this.namespace; + + var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; + if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } + if (this.options.data) { copies = copies + " data = data || {};"; } + out.push(copies); + } else { + out.push(''); + } + + if (!this.environment.isSimple) { + out.push(", buffer = " + this.initializeBuffer()); + } else { + out.push(""); + } + + // track the last context pushed into place to allow skipping the + // getContext opcode when it would be a noop + this.lastContext = 0; + this.source = out; + }, + + createFunctionContext: function(asObject) { + var locals = this.stackVars.concat(this.registers.list); + + if(locals.length > 0) { + this.source[1] = this.source[1] + ", " + locals.join(", "); + } + + // Generate minimizer alias mappings + if (!this.isChild) { + for (var alias in this.context.aliases) { + if (this.context.aliases.hasOwnProperty(alias)) { + this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; + } + } + } + + if (this.source[1]) { + this.source[1] = "var " + this.source[1].substring(2) + ";"; + } + + // Merge children + if (!this.isChild) { + this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; + } + + if (!this.environment.isSimple) { + this.pushSource("return buffer;"); + } + + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; + + for(var i=0, l=this.environment.depths.list.length; i<l; i++) { + params.push("depth" + this.environment.depths.list[i]); + } + + // Perform a second pass over the output to merge content when possible + var source = this.mergeSource(); + + if (!this.isChild) { + source = this.compilerInfo()+source; + } + + if (asObject) { + params.push(source); + + return Function.apply(this, params); + } else { + var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; + log('debug', functionSource + "\n\n"); + return functionSource; + } + }, + mergeSource: function() { + // WARN: We are not handling the case where buffer is still populated as the source should + // not have buffer append operations as their final action. + var source = '', + buffer; + for (var i = 0, len = this.source.length; i < len; i++) { + var line = this.source[i]; + if (line.appendToBuffer) { + if (buffer) { + buffer = buffer + '\n + ' + line.content; + } else { + buffer = line.content; + } + } else { + if (buffer) { + source += 'buffer += ' + buffer + ';\n '; + buffer = undefined; + } + source += line + '\n '; + } + } + return source; + }, + + // [blockValue] + // + // On stack, before: hash, inverse, program, value + // On stack, after: return value of blockHelperMissing + // + // The purpose of this opcode is to take a block of the form + // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and + // replace it on the stack with the result of properly + // invoking blockHelperMissing. + blockValue: function() { + this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; + + var params = ["depth0"]; + this.setupParams(0, params); + + this.replaceStack(function(current) { + params.splice(1, 0, current); + return "blockHelperMissing.call(" + params.join(", ") + ")"; + }); + }, + + // [ambiguousBlockValue] + // + // On stack, before: hash, inverse, program, value + // Compiler value, before: lastHelper=value of last found helper, if any + // On stack, after, if no lastHelper: same as [blockValue] + // On stack, after, if lastHelper: value + ambiguousBlockValue: function() { + this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; + + var params = ["depth0"]; + this.setupParams(0, params); + + var current = this.topStack(); + params.splice(1, 0, current); + + this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }"); + }, + + // [appendContent] + // + // On stack, before: ... + // On stack, after: ... + // + // Appends the string value of `content` to the current buffer + appendContent: function(content) { + if (this.pendingContent) { + content = this.pendingContent + content; + } + if (this.stripNext) { + content = content.replace(/^\s+/, ''); + } + + this.pendingContent = content; + }, + + // [strip] + // + // On stack, before: ... + // On stack, after: ... + // + // Removes any trailing whitespace from the prior content node and flags + // the next operation for stripping if it is a content node. + strip: function() { + if (this.pendingContent) { + this.pendingContent = this.pendingContent.replace(/\s+$/, ''); + } + this.stripNext = 'strip'; + }, + + // [append] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Coerces `value` to a String and appends it to the current buffer. + // + // If `value` is truthy, or 0, it is coerced into a string and appended + // Otherwise, the empty string is appended + append: function() { + // Force anything that is inlined onto the stack so we don't have duplication + // when we examine local + this.flushInline(); + var local = this.popStack(); + this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }"); + if (this.environment.isSimple) { + this.pushSource("else { " + this.appendToBuffer("''") + " }"); + } + }, + + // [appendEscaped] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Escape `value` and append it to the buffer + appendEscaped: function() { + this.context.aliases.escapeExpression = 'this.escapeExpression'; + + this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); + }, + + // [getContext] + // + // On stack, before: ... + // On stack, after: ... + // Compiler value, after: lastContext=depth + // + // Set the value of the `lastContext` compiler value to the depth + getContext: function(depth) { + if(this.lastContext !== depth) { + this.lastContext = depth; + } + }, + + // [lookupOnContext] + // + // On stack, before: ... + // On stack, after: currentContext[name], ... + // + // Looks up the value of `name` on the current context and pushes + // it onto the stack. + lookupOnContext: function(name) { + this.push(this.nameLookup('depth' + this.lastContext, name, 'context')); + }, + + // [pushContext] + // + // On stack, before: ... + // On stack, after: currentContext, ... + // + // Pushes the value of the current context onto the stack. + pushContext: function() { + this.pushStackLiteral('depth' + this.lastContext); + }, + + // [resolvePossibleLambda] + // + // On stack, before: value, ... + // On stack, after: resolved value, ... + // + // If the `value` is a lambda, replace it on the stack by + // the return value of the lambda + resolvePossibleLambda: function() { + this.context.aliases.functionType = '"function"'; + + this.replaceStack(function(current) { + return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current; + }); + }, + + // [lookup] + // + // On stack, before: value, ... + // On stack, after: value[name], ... + // + // Replace the value on the stack with the result of looking + // up `name` on `value` + lookup: function(name) { + this.replaceStack(function(current) { + return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context'); + }); + }, + + // [lookupData] + // + // On stack, before: ... + // On stack, after: data, ... + // + // Push the data lookup operator + lookupData: function() { + this.pushStackLiteral('data'); + }, + + // [pushStringParam] + // + // On stack, before: ... + // On stack, after: string, currentContext, ... + // + // This opcode is designed for use in string mode, which + // provides the string value of a parameter along with its + // depth rather than resolving it immediately. + pushStringParam: function(string, type) { + this.pushStackLiteral('depth' + this.lastContext); + + this.pushString(type); + + // If it's a subexpression, the string result + // will be pushed after this opcode. + if (type !== 'sexpr') { + if (typeof string === 'string') { + this.pushString(string); + } else { + this.pushStackLiteral(string); + } + } + }, + + emptyHash: function() { + this.pushStackLiteral('{}'); + + if (this.options.stringParams) { + this.push('{}'); // hashContexts + this.push('{}'); // hashTypes + } + }, + pushHash: function() { + if (this.hash) { + this.hashes.push(this.hash); + } + this.hash = {values: [], types: [], contexts: []}; + }, + popHash: function() { + var hash = this.hash; + this.hash = this.hashes.pop(); + + if (this.options.stringParams) { + this.push('{' + hash.contexts.join(',') + '}'); + this.push('{' + hash.types.join(',') + '}'); + } + + this.push('{\n ' + hash.values.join(',\n ') + '\n }'); + }, + + // [pushString] + // + // On stack, before: ... + // On stack, after: quotedString(string), ... + // + // Push a quoted version of `string` onto the stack + pushString: function(string) { + this.pushStackLiteral(this.quotedString(string)); + }, + + // [push] + // + // On stack, before: ... + // On stack, after: expr, ... + // + // Push an expression onto the stack + push: function(expr) { + this.inlineStack.push(expr); + return expr; + }, + + // [pushLiteral] + // + // On stack, before: ... + // On stack, after: value, ... + // + // Pushes a value onto the stack. This operation prevents + // the compiler from creating a temporary variable to hold + // it. + pushLiteral: function(value) { + this.pushStackLiteral(value); + }, + + // [pushProgram] + // + // On stack, before: ... + // On stack, after: program(guid), ... + // + // Push a program expression onto the stack. This takes + // a compile-time guid and converts it into a runtime-accessible + // expression. + pushProgram: function(guid) { + if (guid != null) { + this.pushStackLiteral(this.programExpression(guid)); + } else { + this.pushStackLiteral(null); + } + }, + + // [invokeHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // Pops off the helper's parameters, invokes the helper, + // and pushes the helper's return value onto the stack. + // + // If the helper is not found, `helperMissing` is called. + invokeHelper: function(paramSize, name, isRoot) { + this.context.aliases.helperMissing = 'helpers.helperMissing'; + this.useRegister('helper'); + + var helper = this.lastHelper = this.setupHelper(paramSize, name, true); + var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); + + var lookup = 'helper = ' + helper.name + ' || ' + nonHelper; + if (helper.paramsInit) { + lookup += ',' + helper.paramsInit; + } + + this.push( + '(' + + lookup + + ',helper ' + + '? helper.call(' + helper.callParams + ') ' + + ': helperMissing.call(' + helper.helperMissingParams + '))'); + + // Always flush subexpressions. This is both to prevent the compounding size issue that + // occurs when the code has to be duplicated for inlining and also to prevent errors + // due to the incorrect options object being passed due to the shared register. + if (!isRoot) { + this.flushInline(); + } + }, + + // [invokeKnownHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // This operation is used when the helper is known to exist, + // so a `helperMissing` fallback is not required. + invokeKnownHelper: function(paramSize, name) { + var helper = this.setupHelper(paramSize, name); + this.push(helper.name + ".call(" + helper.callParams + ")"); + }, + + // [invokeAmbiguous] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of disambiguation + // + // This operation is used when an expression like `{{foo}}` + // is provided, but we don't know at compile-time whether it + // is a helper or a path. + // + // This operation emits more code than the other options, + // and can be avoided by passing the `knownHelpers` and + // `knownHelpersOnly` flags at compile-time. + invokeAmbiguous: function(name, helperCall) { + this.context.aliases.functionType = '"function"'; + this.useRegister('helper'); + + this.emptyHash(); + var helper = this.setupHelper(0, name, helperCall); + + var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); + + var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); + var nextStack = this.nextStack(); + + if (helper.paramsInit) { + this.pushSource(helper.paramsInit); + } + this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }'); + this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }'); + }, + + // [invokePartial] + // + // On stack, before: context, ... + // On stack after: result of partial invocation + // + // This operation pops off a context, invokes a partial with that context, + // and pushes the result of the invocation back. + invokePartial: function(name) { + var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; + + if (this.options.data) { + params.push("data"); + } + + this.context.aliases.self = "this"; + this.push("self.invokePartial(" + params.join(", ") + ")"); + }, + + // [assignToHash] + // + // On stack, before: value, hash, ... + // On stack, after: hash, ... + // + // Pops a value and hash off the stack, assigns `hash[key] = value` + // and pushes the hash back onto the stack. + assignToHash: function(key) { + var value = this.popStack(), + context, + type; + + if (this.options.stringParams) { + type = this.popStack(); + context = this.popStack(); + } + + var hash = this.hash; + if (context) { + hash.contexts.push("'" + key + "': " + context); + } + if (type) { + hash.types.push("'" + key + "': " + type); + } + hash.values.push("'" + key + "': (" + value + ")"); + }, + + // HELPERS + + compiler: JavaScriptCompiler, + + compileChildren: function(environment, options) { + var children = environment.children, child, compiler; + + for(var i=0, l=children.length; i<l; i++) { + child = children[i]; + compiler = new this.compiler(); + + var index = this.matchExistingProgram(child); + + if (index == null) { + this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children + index = this.context.programs.length; + child.index = index; + child.name = 'program' + index; + this.context.programs[index] = compiler.compile(child, options, this.context); + this.context.environments[index] = child; + } else { + child.index = index; + child.name = 'program' + index; + } + } + }, + matchExistingProgram: function(child) { + for (var i = 0, len = this.context.environments.length; i < len; i++) { + var environment = this.context.environments[i]; + if (environment && environment.equals(child)) { + return i; + } + } + }, + + programExpression: function(guid) { + this.context.aliases.self = "this"; + + if(guid == null) { + return "self.noop"; + } + + var child = this.environment.children[guid], + depths = child.depths.list, depth; + + var programParams = [child.index, child.name, "data"]; + + for(var i=0, l = depths.length; i<l; i++) { + depth = depths[i]; + + if(depth === 1) { programParams.push("depth0"); } + else { programParams.push("depth" + (depth - 1)); } + } + + return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; + }, + + register: function(name, val) { + this.useRegister(name); + this.pushSource(name + " = " + val + ";"); + }, + + useRegister: function(name) { + if(!this.registers[name]) { + this.registers[name] = true; + this.registers.list.push(name); + } + }, + + pushStackLiteral: function(item) { + return this.push(new Literal(item)); + }, + + pushSource: function(source) { + if (this.pendingContent) { + this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))); + this.pendingContent = undefined; + } + + if (source) { + this.source.push(source); + } + }, + + pushStack: function(item) { + this.flushInline(); + + var stack = this.incrStack(); + if (item) { + this.pushSource(stack + " = " + item + ";"); + } + this.compileStack.push(stack); + return stack; + }, + + replaceStack: function(callback) { + var prefix = '', + inline = this.isInline(), + stack, + createdStack, + usedLiteral; + + // If we are currently inline then we want to merge the inline statement into the + // replacement statement via ',' + if (inline) { + var top = this.popStack(true); + + if (top instanceof Literal) { + // Literals do not need to be inlined + stack = top.value; + usedLiteral = true; + } else { + // Get or create the current stack name for use by the inline + createdStack = !this.stackSlot; + var name = !createdStack ? this.topStackName() : this.incrStack(); + + prefix = '(' + this.push(name) + ' = ' + top + '),'; + stack = this.topStack(); + } + } else { + stack = this.topStack(); + } + + var item = callback.call(this, stack); + + if (inline) { + if (!usedLiteral) { + this.popStack(); + } + if (createdStack) { + this.stackSlot--; + } + this.push('(' + prefix + item + ')'); + } else { + // Prevent modification of the context depth variable. Through replaceStack + if (!/^stack/.test(stack)) { + stack = this.nextStack(); + } + + this.pushSource(stack + " = (" + prefix + item + ");"); + } + return stack; + }, + + nextStack: function() { + return this.pushStack(); + }, + + incrStack: function() { + this.stackSlot++; + if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } + return this.topStackName(); + }, + topStackName: function() { + return "stack" + this.stackSlot; + }, + flushInline: function() { + var inlineStack = this.inlineStack; + if (inlineStack.length) { + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + this.pushStack(entry); + } + } + } + }, + isInline: function() { + return this.inlineStack.length; + }, + + popStack: function(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + if (!inline) { + if (!this.stackSlot) { + throw new Exception('Invalid stack pop'); + } + this.stackSlot--; + } + return item; + } + }, + + topStack: function(wrapped) { + var stack = (this.isInline() ? this.inlineStack : this.compileStack), + item = stack[stack.length - 1]; + + if (!wrapped && (item instanceof Literal)) { + return item.value; + } else { + return item; + } + }, + + quotedString: function(str) { + return '"' + str + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + setupHelper: function(paramSize, name, missingParams) { + var params = [], + paramsInit = this.setupParams(paramSize, params, missingParams); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + paramsInit: paramsInit, + name: foundHelper, + callParams: ["depth0"].concat(params).join(", "), + helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") + }; + }, + + setupOptions: function(paramSize, params) { + var options = [], contexts = [], types = [], param, inverse, program; + + options.push("hash:" + this.popStack()); + + if (this.options.stringParams) { + options.push("hashTypes:" + this.popStack()); + options.push("hashContexts:" + this.popStack()); + } + + inverse = this.popStack(); + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + if (!program) { + this.context.aliases.self = "this"; + program = "self.noop"; + } + + if (!inverse) { + this.context.aliases.self = "this"; + inverse = "self.noop"; + } + + options.push("inverse:" + inverse); + options.push("fn:" + program); + } + + for(var i=0; i<paramSize; i++) { + param = this.popStack(); + params.push(param); + + if(this.options.stringParams) { + types.push(this.popStack()); + contexts.push(this.popStack()); + } + } + + if (this.options.stringParams) { + options.push("contexts:[" + contexts.join(",") + "]"); + options.push("types:[" + types.join(",") + "]"); + } + + if(this.options.data) { + options.push("data:data"); + } + + return options; + }, + + // the params and contexts arguments are passed in arrays + // to fill in + setupParams: function(paramSize, params, useRegister) { + var options = '{' + this.setupOptions(paramSize, params).join(',') + '}'; + + if (useRegister) { + this.useRegister('options'); + params.push('options'); + return 'options=' + options; + } else { + params.push(options); + return ''; + } + } + }; + + var reservedWords = ( + "break else new var" + + " case finally return void" + + " catch for switch while" + + " continue function this with" + + " default if throw" + + " delete in try" + + " do instanceof typeof" + + " abstract enum int short" + + " boolean export interface static" + + " byte extends long super" + + " char final native synchronized" + + " class float package throws" + + " const goto private transient" + + " debugger implements protected volatile" + + " double import public let yield" + ).split(" "); + + var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; + + for(var i=0, l=reservedWords.length; i<l; i++) { + compilerWords[reservedWords[i]] = true; + } + + JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { + if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) { + return true; + } + return false; + }; + + __exports__ = JavaScriptCompiler; + return __exports__; +})(__module2__, __module5__); + +// handlebars.js +var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { + "use strict"; + var __exports__; + /*globals Handlebars: true */ + var Handlebars = __dependency1__; + + // Compiler imports + var AST = __dependency2__; + var Parser = __dependency3__.parser; + var parse = __dependency3__.parse; + var Compiler = __dependency4__.Compiler; + var compile = __dependency4__.compile; + var precompile = __dependency4__.precompile; + var JavaScriptCompiler = __dependency5__; + + var _create = Handlebars.create; + var create = function() { + var hb = _create(); + + hb.compile = function(input, options) { + return compile(input, options, hb); + }; + hb.precompile = function (input, options) { + return precompile(input, options, hb); + }; + + hb.AST = AST; + hb.Compiler = Compiler; + hb.JavaScriptCompiler = JavaScriptCompiler; + hb.Parser = Parser; + hb.parse = parse; + + return hb; + }; + + Handlebars = create(); + Handlebars.create = create; + + __exports__ = Handlebars; + return __exports__; +})(__module1__, __module7__, __module8__, __module10__, __module11__); + + return __module0__; +})(); diff --git a/pub/lib/jquery/jquery-1.8.2.js b/pub/lib/jquery/jquery-1.8.2.js new file mode 100644 index 0000000000000000000000000000000000000000..12c7797fdc6a98f9e3bd37d8416fe33a057deaae --- /dev/null +++ b/pub/lib/jquery/jquery-1.8.2.js @@ -0,0 +1,9440 @@ +/*! + * jQuery JavaScript Library v1.8.2 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time) + */ +(function( window, undefined ) { +var + // A central reference to the root jQuery(document) + rootjQuery, + + // The deferred used on DOM ready + readyList, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + navigator = window.navigator, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // Save a reference to some core methods + core_push = Array.prototype.push, + core_slice = Array.prototype.slice, + core_indexOf = Array.prototype.indexOf, + core_toString = Object.prototype.toString, + core_hasOwn = Object.prototype.hasOwnProperty, + core_trim = String.prototype.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, + + // Used for detecting and trimming whitespace + core_rnotwhite = /\S/, + core_rspace = /\s+/, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // The ready event handler and self cleanup method + DOMContentLoaded = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + } else if ( document.readyState === "complete" ) { + // we're here because readyState === "complete" in oldIE + // which is good enough for us to call the dom ready! + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context && context.nodeType ? context.ownerDocument || context : document ); + + // scripts is true for back-compat + selector = jQuery.parseHTML( match[1], doc, true ); + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + this.attr.call( selector, context, true ); + } + + return jQuery.merge( this, selector ); + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.8.2", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ), + "slice", core_slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ core_toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // scripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, scripts ) { + var parsed; + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + scripts = context; + context = 0; + } + context = context || document; + + // Single tag + if ( (parsed = rsingleTag.exec( data )) ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); + return jQuery.merge( [], + (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); + }, + + parseJSON: function( data ) { + if ( !data || typeof data !== "string") { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && core_rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var name, + i = 0, + length = obj.length, + isObj = length === undefined || jQuery.isFunction( obj ); + + if ( args ) { + if ( isObj ) { + for ( name in obj ) { + if ( callback.apply( obj[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( obj[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in obj ) { + if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var type, + ret = results || []; + + if ( arr != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + type = jQuery.type( arr ); + + if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { + core_push.call( ret, arr ); + } else { + jQuery.merge( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, + ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready, 1 ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.split( core_rspace ), function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { + list.push( arg ); + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + return jQuery.inArray( fn, list ) > -1; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? + function() { + var returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + } : + newDefer[ action ] + ); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] = list.fire + deferred[ tuple[0] ] = list.fire; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + fragment, + eventName, + i, + isSupported, + clickFn, + div = document.createElement("div"); + + // Preliminary tests + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + a.style.cssText = "top:1px;float:left;opacity:.5"; + + // Can't get basic test support + if ( !all || !all.length ) { + return {}; + } + + // First batch of supports tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: ( document.compatMode === "CSS1Compat" ), + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", clickFn = function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent("onclick"); + div.detachEvent( "onclick", clickFn ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + input.setAttribute( "checked", "checked" ); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: true, + change: true, + focusin: true + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + // Run tests that need a body at doc ready + jQuery(function() { + var container, div, tds, marginDiv, + divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // NOTE: To any future maintainer, we've window.getComputedStyle + // because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = document.createElement("div"); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "<div></div>"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + container.style.zoom = 1; + } + + // Null elements to avoid leaks in IE + body.removeChild( container ); + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + fragment.removeChild( div ); + all = a = select = opt = input = fragment = div = null; + + return support; +})(); +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + deletedIds: [], + + // Remove at next major release (1.9/2.0) + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } + + parts[1] = value; + this.each(function() { + var self = jQuery( this ); + + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery.removeData( elem, type + "queue", true ); + jQuery.removeData( elem, key, true ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, fixSpecified, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea|)$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var removes, className, elem, c, cl, i, l; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + if ( (value && typeof value === "string") || value === undefined ) { + removes = ( value || "" ).split( core_rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + if ( elem.nodeType === 1 && elem.className ) { + + className = (" " + elem.className + " ").replace( rclass, " " ); + + // loop over each item in the removal list + for ( c = 0, cl = removes.length; c < cl; c++ ) { + // Remove until there is nothing to remove, + while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { + className = className.replace( " " + removes[ c ] + " " , " " ); + } + } + elem.className = value ? jQuery.trim( className ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( core_rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 + attrFn: {}, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, isBool, + i = 0; + + if ( value && elem.nodeType === 1 ) { + + attrNames = value.split( core_rspace ); + + for ( ; i < attrNames.length; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); + + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true, + coords: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.value = value + "" ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, + rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var t, tns, type, origType, namespaces, origCount, + j, events, special, eventType, handleObj, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, "events", true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, + type = event.type || event, + namespaces = []; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + for ( old = elem; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old === (elem.ownerDocument || document) ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, + handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = core_slice.call( arguments ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = []; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.disabled !== true || event.type !== "click" ) { + selMatch = {}; + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) + event.metaKey = !!event.metaKey; + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 – + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "_submit_attached" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "_submit_attached", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "_change_attached", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var cachedruns, + assertGetIdNotName, + Expr, + getText, + isXML, + contains, + compile, + sortOrder, + hasDuplicate, + outermostContext, + + baseHasDuplicate = true, + strundefined = "undefined", + + expando = ( "sizcache" + Math.random() ).replace( ".", "" ), + + Token = String, + document = window.document, + docElem = document.documentElement, + dirruns = 0, + done = 0, + pop = [].pop, + push = [].push, + slice = [].slice, + // Use a stripped-down indexOf if a native one is unavailable + indexOf = [].indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + // Augment a function for special use by Sizzle + markFunction = function( fn, value ) { + fn[ expando ] = value == null || value; + return fn; + }, + + createCache = function() { + var cache = {}, + keys = []; + + return markFunction(function( key, value ) { + // Only keep the most recent entries + if ( keys.push( key ) > Expr.cacheLength ) { + delete cache[ keys.shift() ]; + } + + return (cache[ key ] = value); + }, cache ); + }, + + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // Regex + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments not in parens/brackets, + // then attribute selectors and non-pseudos (denoted by :), + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", + + // For matchExpr.POS and matchExpr.needsContext + pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, + + rnot = /^:not/, + rsibling = /[\x20\t\r\n\f]*[+~]/, + rendsWithNot = /:not\($/, + + rheader = /h\d/i, + rinputs = /input|select|textarea|button/i, + + rbackslash = /\\(?!\\)/g, + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "POS": new RegExp( pos, "i" ), + "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) + }, + + // Support + + // Used for testing something on an element + assert = function( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } + }, + + // Check if getElementsByTagName("*") returns only elements + assertTagNameNoComments = assert(function( div ) { + div.appendChild( document.createComment("") ); + return !div.getElementsByTagName("*").length; + }), + + // Check if getAttribute returns normalized href attributes + assertHrefNotNormalized = assert(function( div ) { + div.innerHTML = "<a href='#'></a>"; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }), + + // Check if attributes should be retrieved by attribute nodes + assertAttributes = assert(function( div ) { + div.innerHTML = "<select></select>"; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }), + + // Check if getElementsByClassName can be trusted + assertUsableClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }), + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + assertUsableName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = document.getElementsByName && + // buggy browsers will return fewer than the correct 2 + document.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + document.getElementsByName( expando + 0 ).length; + assertGetIdNotName = !document.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + +// If slice is not available, provide a backup +try { + slice.call( docElem.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + for ( ; (elem = this[i]); i++ ) { + results.push( elem ); + } + return results; + }; +} + +function Sizzle( selector, context, results, seed ) { + results = results || []; + context = context || document; + var match, elem, xml, m, + nodeType = context.nodeType; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( nodeType !== 1 && nodeType !== 9 ) { + return []; + } + + xml = isXML( context ); + + if ( !xml && !seed ) { + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); +} + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + return Sizzle( expr, null, null, [ elem ] ).length > 0; +}; + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + } else { + + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } + return ret; +}; + +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +// Element contains another +contains = Sizzle.contains = docElem.contains ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); + } : + docElem.compareDocumentPosition ? + function( a, b ) { + return b && !!( a.compareDocumentPosition( b ) & 16 ); + } : + function( a, b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + return false; + }; + +Sizzle.attr = function( elem, name ) { + var val, + xml = isXML( elem ); + + if ( !xml ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( xml || assertAttributes ) { + return elem.getAttribute( name ); + } + val = elem.getAttributeNode( name ); + return val ? + typeof elem[ name ] === "boolean" ? + elem[ name ] ? name : null : + val.specified ? val.value : null : + null; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + // IE6/7 return a modified href + attrHandle: assertHrefNotNormalized ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }, + + find: { + "ID": assertGetIdNotName ? + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + } : + function( id, context, xml ) { + if ( typeof context.getElementById !== strundefined && !xml ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }, + + "TAG": assertTagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + var elem, + tmp = [], + i = 0; + + for ( ; (elem = results[i]); i++ ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }, + + "NAME": assertUsableName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }, + + "CLASS": assertUsableClassName && function( className, context, xml ) { + if ( typeof context.getElementsByClassName !== strundefined && !xml ) { + return context.getElementsByClassName( className ); + } + } + }, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( rbackslash, "" ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 3 xn-component of xn+y argument ([+-]?\d*n|) + 4 sign of xn-component + 5 x of xn-component + 6 sign of y-component + 7 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1] === "nth" ) { + // nth-child requires argument + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); + match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); + + // other types prohibit arguments + } else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var unquoted, excess; + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + if ( match[3] ) { + match[2] = match[3]; + } else if ( (unquoted = match[4]) ) { + // Only check arguments that contain a pseudo + if ( rpseudo.test(unquoted) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + unquoted = unquoted.slice( 0, excess ); + match[0] = match[0].slice( 0, excess ); + } + match[2] = unquoted; + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + "ID": assertGetIdNotName ? + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + return elem.getAttribute("id") === id; + }; + } : + function( id ) { + id = id.replace( rbackslash, "" ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === id; + }; + }, + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); + + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ expando ][ className ]; + if ( !pattern ) { + pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") ); + } + return function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }; + }, + + "ATTR": function( name, operator, check ) { + return function( elem, context ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.substr( result.length - check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, argument, first, last ) { + + if ( type === "nth" ) { + return function( elem ) { + var node, diff, + parent = elem.parentNode; + + if ( first === 1 && last === 0 ) { + return true; + } + + if ( parent ) { + diff = 0; + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + diff++; + if ( elem === node ) { + break; + } + } + } + } + + // Incorporate the offset (or cast to NaN), then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + }; + } + + return function( elem ) { + var node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + var nodeType; + elem = elem.firstChild; + while ( elem ) { + if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { + return false; + } + elem = elem.nextSibling; + } + return true; + }, + + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "text": function( elem ) { + var type, attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + (type = elem.type) === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); + }, + + // Input types + "radio": createInputPseudo("radio"), + "checkbox": createInputPseudo("checkbox"), + "file": createInputPseudo("file"), + "password": createInputPseudo("password"), + "image": createInputPseudo("image"), + + "submit": createButtonPseudo("submit"), + "reset": createButtonPseudo("reset"), + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "focus": function( elem ) { + var doc = elem.ownerDocument; + return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href); + }, + + "active": function( elem ) { + return elem === elem.ownerDocument.activeElement; + }, + + // Positional types + "first": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = 0; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = 1; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +function siblingCheck( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; +} + +sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? + a.compareDocumentPosition : + a.compareDocumentPosition(b) & 4 + ) ? -1 : 1; + } : + function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + +// Always assume the presence of duplicates if sort doesn't +// pass them to our comparison function (as in Google Chrome). +[0, 0].sort( sortOrder ); +baseHasDuplicate = !hasDuplicate; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + i = 1; + + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + + return results; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, soFar, groups, preFilters, + cached = tokenCache[ expando ][ selector ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + soFar = soFar.slice( match[0].length ); + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + + // Cast descendant combinators to space + matched.type = match[0].replace( rtrim, " " ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + // The last two arguments here are (context, xml) for backCompat + (match = preFilters[ type ]( match, document, true ))) ) { + + tokens.push( matched = new Token( match.shift() ) ); + soFar = soFar.slice( matched.length ); + matched.type = type; + matched.matches = match; + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && combinator.dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( !xml ) { + var cache, + dirkey = dirruns + " " + doneName + " ", + cachedkey = dirkey + cachedruns; + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( (cache = elem[ expando ]) === cachedkey ) { + return elem.sizset; + } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { + if ( elem.sizset ) { + return elem; + } + } else { + elem[ expando ] = cachedkey; + if ( matcher( elem, context, xml ) ) { + elem.sizset = true; + return elem; + } + elem.sizset = false; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( checkNonElements || elem.nodeType === 1 ) { + if ( matcher( elem, context, xml ) ) { + return elem; + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones + if ( seed && postFinder ) { + return; + } + + var i, elem, postFilterIn, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + postFilterIn = condense( matcherOut, postMap ); + postFilter( postFilterIn, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = postFilterIn.length; + while ( i-- ) { + if ( (elem = postFilterIn[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + // Keep seed and results synchronized + if ( seed ) { + // Ignore postFinder because it can't coexist with seed + i = preFilter && matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + seed[ preMap[i] ] = !(results[ preMap[i] ] = elem); + } + } + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + // The concatenated values are (context, xml) for backCompat + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && tokens.join("") + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Nested matchers should use non-integer dirruns + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = superMatcher.el; + } + + // Add elements passing elementMatchers directly to results + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + for ( j = 0; (matcher = elementMatchers[j]); j++ ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++superMatcher.el; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + for ( j = 0; (matcher = setMatchers[j]); j++ ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + superMatcher.el = 0; + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ expando ][ selector ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results, seed ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results, seed ); + } + return results; +} + +function select( selector, context, results, seed, xml ) { + var i, tokens, token, type, find, + match = tokenize( selector ), + j = match.length; + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !xml && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().length ); + } + + // Fetch a seed set for right-to-left matching + for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( rbackslash, "" ), + rsibling.test( tokens[0].type ) && context.parentNode || context, + xml + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && tokens.join(""); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + xml, + results, + rsibling.test( selector ) + ); + return results; +} + +if ( document.querySelectorAll ) { + (function() { + var disconnectedMatch, + oldSelect = select, + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // qSa(:focus) reports false when true (Chrome 21), + // A support test would require too much code (would include document ready) + rbuggyQSA = [":focus"], + + // matchesSelector(:focus) reports false when true (Chrome 21), + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + // A support test would require too much code (would include document ready) + // just skip matchesSelector for :active + rbuggyMatches = [ ":active", ":focus" ], + matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector; + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = "<select><option selected=''></option></select>"; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here (do not put tests after this one) + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE9 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "<p test=''></p>"; + if ( div.querySelectorAll("[test^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here (do not put tests after this one) + div.innerHTML = "<input type='hidden'/>"; + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push(":enabled", ":disabled"); + } + }); + + // rbuggyQSA always contains :focus, so no need for a length check + rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); + + select = function( selector, context, results, seed, xml ) { + // Only use querySelectorAll when not filtering, + // when this is not xml, + // and when no QSA bugs apply + if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + var groups, i, + old = true, + nid = expando, + newContext = context, + newSelector = context.nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + groups[i].join(""); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + + return oldSelect( selector, context, results, seed, xml ); + }; + + if ( matches ) { + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + try { + matches.call( div, "[test!='']:sizzle" ); + rbuggyMatches.push( "!=", pseudos ); + } catch ( e ) {} + }); + + // rbuggyMatches always contains :active and :focus, so no need for a length check + rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); + + Sizzle.matchesSelector = function( elem, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyMatches always contains :active, so no need for an existence check + if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, null, null, [ elem ] ).length > 0; + }; + } + })(); +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Back-compat +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, l, length, n, r, ret, + self = this; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + ret = this.pushStack( "", "find", selector ); + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + rnocache = /<(?:script|object|embed|option|style)/i, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rcheckableType = /^(?:checkbox|radio)$/, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + area: [ 1, "<map>", "</map>" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, +// unless wrapped in a div with non-breaking characters in front of it. +if ( !jQuery.support.htmlSerialize ) { + wrapMap._default = [ 1, "X<div>", "</div>" ]; +} + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); + } + }, + + after: function() { + if ( !isDisconnected( this[0] ) ) { + return this.domManip(arguments, false, function( elem ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + } + + if ( arguments.length ) { + var set = jQuery.clean( arguments ); + return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); + } + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + jQuery.cleanData( [ elem ] ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName("*") ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1></$2>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( elem.getElementsByTagName( "*" ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + if ( !isDisconnected( this[0] ) ) { + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( jQuery.isFunction( value ) ) { + return this.each(function(i) { + var self = jQuery(this), old = self.html(); + self.replaceWith( value.call( this, i, old ) ); + }); + } + + if ( typeof value !== "string" ) { + value = jQuery( value ).detach(); + } + + return this.each(function() { + var next = this.nextSibling, + parent = this.parentNode; + + jQuery( this ).remove(); + + if ( next ) { + jQuery(next).before( value ); + } else { + jQuery(parent).append( value ); + } + }); + } + + return this.length ? + this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : + this; + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = [].concat.apply( [], args ); + + var results, first, fragment, iNoClone, + i = 0, + value = args[0], + scripts = [], + l = this.length; + + // We can't cloneNode fragments that contain checked, in WebKit + if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { + return this.each(function() { + jQuery(this).domManip( args, table, callback ); + }); + } + + if ( jQuery.isFunction(value) ) { + return this.each(function(i) { + var self = jQuery(this); + args[0] = value.call( this, i, table ? self.html() : undefined ); + self.domManip( args, table, callback ); + }); + } + + if ( this[0] ) { + results = jQuery.buildFragment( args, this, scripts ); + fragment = results.fragment; + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + // Fragments from the fragment cache must always be cloned and never used in place. + for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + i === iNoClone ? + fragment : + jQuery.clone( fragment, true, true ) + ); + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + + if ( scripts.length ) { + jQuery.each( scripts, function( i, elem ) { + if ( elem.src ) { + if ( jQuery.ajax ) { + jQuery.ajax({ + url: elem.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.error("no ajax"); + } + } else { + jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + + if ( elem.parentNode ) { + elem.parentNode.removeChild( elem ); + } + }); + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function cloneFixAttributes( src, dest ) { + var nodeName; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + // clearAttributes removes the attributes, which we don't want, + // but also removes the attachEvent events, which we *do* want + if ( dest.clearAttributes ) { + dest.clearAttributes(); + } + + // mergeAttributes, in contrast, only merges back on the + // original attributes, not the events + if ( dest.mergeAttributes ) { + dest.mergeAttributes( src ); + } + + nodeName = dest.nodeName.toLowerCase(); + + if ( nodeName === "object" ) { + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + + // IE blanks contents when cloning scripts + } else if ( nodeName === "script" && dest.text !== src.text ) { + dest.text = src.text; + } + + // Event data gets referenced instead of copied if the expando + // gets copied too + dest.removeAttribute( jQuery.expando ); +} + +jQuery.buildFragment = function( args, context, scripts ) { + var fragment, cacheable, cachehit, + first = args[ 0 ]; + + // Set context from what may come in as undefined or a jQuery collection or a node + // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & + // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception + context = context || document; + context = !context.nodeType && context[0] || context; + context = context.ownerDocument || context; + + // Only cache "small" (1/2 KB) HTML strings that are associated with the main document + // Cloning options loses the selected state, so don't cache them + // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment + // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache + // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 + if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && + first.charAt(0) === "<" && !rnocache.test( first ) && + (jQuery.support.checkClone || !rchecked.test( first )) && + (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + + // Mark cacheable and look for a hit + cacheable = true; + fragment = jQuery.fragments[ first ]; + cachehit = fragment !== undefined; + } + + if ( !fragment ) { + fragment = context.createDocumentFragment(); + jQuery.clean( args, context, fragment, scripts ); + + // Update the cache, but only store false + // unless this is a second parsing of the same content + if ( cacheable ) { + jQuery.fragments[ first ] = cachehit && fragment; + } + } + + return { fragment: fragment, cacheable: cacheable }; +}; + +jQuery.fragments = {}; + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + l = insert.length, + parent = this.length === 1 && this[0].parentNode; + + if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { + insert[ original ]( this[0] ); + return this; + } else { + for ( ; i < l; i++ ) { + elems = ( i > 0 ? this.clone(true) : this ).get(); + jQuery( insert[i] )[ original ]( elems ); + ret = ret.concat( elems ); + } + + return this.pushStack( ret, name, insert.selector ); + } + }; +}); + +function getAll( elem ) { + if ( typeof elem.getElementsByTagName !== "undefined" ) { + return elem.getElementsByTagName( "*" ); + + } else if ( typeof elem.querySelectorAll !== "undefined" ) { + return elem.querySelectorAll( "*" ); + + } else { + return []; + } +} + +// Used in clean, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var srcElements, + destElements, + i, + clone; + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + // IE copies events bound via attachEvent when using cloneNode. + // Calling detachEvent on the clone will also remove the events + // from the original. In order to get around this, we use some + // proprietary methods to clear the events. Thanks to MooTools + // guys for this hotness. + + cloneFixAttributes( elem, clone ); + + // Using Sizzle here is crazy slow, so we use getElementsByTagName instead + srcElements = getAll( elem ); + destElements = getAll( clone ); + + // Weird iteration because IE will replace the length property + // with an element if you are cloning the body and one of the + // elements on the page has a name or id of "length" + for ( i = 0; srcElements[i]; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + cloneFixAttributes( srcElements[i], destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + cloneCopyEvent( elem, clone ); + + if ( deepDataAndEvents ) { + srcElements = getAll( elem ); + destElements = getAll( clone ); + + for ( i = 0; srcElements[i]; ++i ) { + cloneCopyEvent( srcElements[i], destElements[i] ); + } + } + } + + srcElements = destElements = null; + + // Return the cloned set + return clone; + }, + + clean: function( elems, context, fragment, scripts ) { + var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, + safe = context === document && safeFragment, + ret = []; + + // Ensure that context is a document + if ( !context || typeof context.createDocumentFragment === "undefined" ) { + context = document; + } + + // Use the already-created safe fragment if context permits + for ( i = 0; (elem = elems[i]) != null; i++ ) { + if ( typeof elem === "number" ) { + elem += ""; + } + + if ( !elem ) { + continue; + } + + // Convert html string into DOM nodes + if ( typeof elem === "string" ) { + if ( !rhtml.test( elem ) ) { + elem = context.createTextNode( elem ); + } else { + // Ensure a safe container in which to render the html + safe = safe || createSafeFragment( context ); + div = context.createElement("div"); + safe.appendChild( div ); + + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(rxhtmlTag, "<$1></$2>"); + + // Go to html and back, then peel off extra wrappers + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + depth = wrap[0]; + div.innerHTML = wrap[1] + elem + wrap[2]; + + // Move to the right depth + while ( depth-- ) { + div = div.lastChild; + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !jQuery.support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + hasBody = rtbody.test(elem); + tbody = tag === "table" && !hasBody ? + div.firstChild && div.firstChild.childNodes : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !hasBody ? + div.childNodes : + []; + + for ( j = tbody.length - 1; j >= 0 ; --j ) { + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { + tbody[ j ].parentNode.removeChild( tbody[ j ] ); + } + } + } + + // IE completely kills leading whitespace when innerHTML is used + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); + } + + elem = div.childNodes; + + // Take out of fragment container (we need a fresh div each time) + div.parentNode.removeChild( div ); + } + } + + if ( elem.nodeType ) { + ret.push( elem ); + } else { + jQuery.merge( ret, elem ); + } + } + + // Fix #11356: Clear elements from safeFragment + if ( div ) { + elem = div = safe = null; + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + for ( i = 0; (elem = ret[i]) != null; i++ ) { + if ( jQuery.nodeName( elem, "input" ) ) { + fixDefaultChecked( elem ); + } else if ( typeof elem.getElementsByTagName !== "undefined" ) { + jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); + } + } + } + + // Append elements to a provided document fragment + if ( fragment ) { + // Special handling of each script element + handleScript = function( elem ) { + // Check if we consider it executable + if ( !elem.type || rscriptType.test( elem.type ) ) { + // Detach the script and store it in the scripts array (if provided) or the fragment + // Return truthy to indicate that it has been handled + return scripts ? + scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : + fragment.appendChild( elem ); + } + }; + + for ( i = 0; (elem = ret[i]) != null; i++ ) { + // Check if we're done after handling an executable script + if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { + // Append to fragment and handle embedded scripts + fragment.appendChild( elem ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration + jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); + + // Splice the scripts into ret after their former ancestor and advance our index beyond them + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + i += jsTags.length; + } + } + } + } + + return ret; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var data, id, elem, type, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + jQuery.deletedIds.push( id ); + } + } + } + } + } +}); +// Limit scope pollution from any deprecated API +(function() { + +var matched, browser; + +// Use of jQuery.browser is frowned upon. +// More details: http://api.jquery.com/jQuery.browser +// jQuery.uaMatch maintained for back-compat +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + +matched = jQuery.uaMatch( navigator.userAgent ); +browser = {}; + +if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; +} + +// Chrome is Webkit, but Webkit is also Safari. +if ( browser.chrome ) { + browser.webkit = true; +} else if ( browser.webkit ) { + browser.safari = true; +} + +jQuery.browser = browser; + +jQuery.sub = function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; +}; + +})(); +var curCSS, iframe, iframeDoc, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity=([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), + elemdisplay = {}, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], + + eventsToggle = jQuery.fn.toggle; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var elem, display, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && elem.style.display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + display = curCSS( elem, "display" ); + + if ( !values[ index ] && display !== "none" ) { + jQuery._data( elem, "olddisplay", display ); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state, fn2 ) { + var bool = typeof state === "boolean"; + + if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { + return eventsToggle.apply( this, arguments ); + } + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, numeric, extra ) { + var val, num, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( numeric || extra !== undefined ) { + num = parseFloat( val ); + return numeric || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: To any future maintainer, we've window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + curCSS = function( elem, name ) { + var ret, width, minWidth, maxWidth, + computed = window.getComputedStyle( elem, null ), + style = elem.style; + + if ( computed ) { + + ret = computed[ name ]; + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + curCSS = function( elem, name ) { + var left, rsLeft, + ret = elem.currentStyle && elem.currentStyle[ name ], + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + elem.runtimeStyle.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + elem.runtimeStyle.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + // we use jQuery.css instead of curCSS here + // because of the reliableMarginRight CSS hook! + val += jQuery.css( elem, extra + cssExpand[ i ], true ); + } + + // From this point on we use curCSS for maximum performance (relevant in animations) + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } else { + // at this point, extra isn't content, so add padding + val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + valueIsBorderBox = true, + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox + ) + ) + "px"; +} + + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + if ( elemdisplay[ nodeName ] ) { + return elemdisplay[ nodeName ]; + } + + var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), + display = elem.css("display"); + elem.remove(); + + // If the simple way fails, + // get element's real default display by attaching it to a temp iframe + if ( display === "none" || display === "" ) { + // Use the already-created iframe if possible + iframe = document.body.appendChild( + iframe || jQuery.extend( document.createElement("iframe"), { + frameBorder: 0, + width: 0, + height: 0 + }) + ); + + // Create a cacheable copy of the iframe document on first call. + // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML + // document to it; WebKit & Firefox won't allow reusing the iframe document. + if ( !iframeDoc || !iframe.createElement ) { + iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; + iframeDoc.write("<!doctype html><html><body>"); + iframeDoc.close(); + } + + elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); + + display = curCSS( elem, "display" ); + document.body.removeChild( iframe ); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + + return display; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { + return jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }); + } else { + return getWidthOrHeight( elem, name, extra ); + } + } + }, + + set: function( elem, value, extra ) { + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" + ) : 0 + ); + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there there is no filter style applied in a css rule, we are done + if ( currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +// These hooks cannot be added until DOM ready because the support test +// for it is not run until after DOM ready +jQuery(function() { + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, function() { + if ( computed ) { + return curCSS( elem, "marginRight" ); + } + }); + } + }; + } + + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + var ret = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; + } + } + }; + }); + } + +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ], + expanded = {}; + + for ( i = 0; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, + rselectTextarea = /^(?:select|textarea)/i; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + return this.elements ? jQuery.makeArray( this.elements ) : this; + }) + .filter(function(){ + return this.name && !this.disabled && + ( this.checked || rselectTextarea.test( this.nodeName ) || + rinput.test( this.type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val, i ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +//Serialize an array of form elements or a set of +//key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // If array item is non-scalar (array or object), encode its + // numeric index to resolve deserialization ambiguity issues. + // Note that rack (as of 1.0.0) can't currently deserialize + // nested arrays properly, and attempting to do so may cause + // a server error. Possible fixes are to modify rack's + // deserialization algorithm or to provide an option or flag + // to force array serialization to be shallow. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} +var + // Document location + ajaxLocParts, + ajaxLocation, + + rhash = /#.*$/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rquery = /\?/, + rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, + rts = /([?&])_=[^&]*/, + rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = ["*/"] + ["*"]; + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, list, placeBefore, + dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), + i = 0, + length = dataTypes.length; + + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + for ( ; i < length; i++ ) { + dataType = dataTypes[ i ]; + // We control if we're asked to add before + // any existing element + placeBefore = /^\+/.test( dataType ); + if ( placeBefore ) { + dataType = dataType.substr( 1 ) || "*"; + } + list = structure[ dataType ] = structure[ dataType ] || []; + // then we add to the structure accordingly + list[ placeBefore ? "unshift" : "push" ]( func ); + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, + dataType /* internal */, inspected /* internal */ ) { + + dataType = dataType || options.dataTypes[ 0 ]; + inspected = inspected || {}; + + inspected[ dataType ] = true; + + var selection, + list = structure[ dataType ], + i = 0, + length = list ? list.length : 0, + executeOnly = ( structure === prefilters ); + + for ( ; i < length && ( executeOnly || !selection ); i++ ) { + selection = list[ i ]( options, originalOptions, jqXHR ); + // If we got redirected to another dataType + // we try there if executing only and not done already + if ( typeof selection === "string" ) { + if ( !executeOnly || inspected[ selection ] ) { + selection = undefined; + } else { + options.dataTypes.unshift( selection ); + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, selection, inspected ); + } + } + } + // If we're only executing or nothing was selected + // we try the catchall dataType if not done already + if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { + selection = inspectPrefiltersOrTransports( + structure, options, originalOptions, jqXHR, "*", inspected ); + } + // unnecessary when only executing (prefilters) + // but it'll be ignored by the caller in that case + return selection; +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } +} + +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } + + // Don't do a request if no elements are being requested + if ( !this.length ) { + return this; + } + + var selector, type, response, + self = this, + off = url.indexOf(" "); + + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // Request the remote document + jQuery.ajax({ + url: url, + + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params, + complete: function( jqXHR, status ) { + if ( callback ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + } + } + }).done(function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + // See if a selector was specified + self.html( selector ? + + // Create a dummy div to hold the results + jQuery("<div>") + + // inject the contents of the document in, removing the scripts + // to avoid any 'Permission Denied' errors in IE + .append( responseText.replace( rscript, "" ) ) + + // Locate the specified elements + .find( selector ) : + + // If not, just inject the full result + responseText ); + + }); + + return this; +}; + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ + jQuery.fn[ o ] = function( f ){ + return this.on( o, f ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + type: method, + url: url, + data: data, + success: callback, + dataType: type + }); + }; +}); + +jQuery.extend({ + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + if ( settings ) { + // Building a settings object + ajaxExtend( target, jQuery.ajaxSettings ); + } else { + // Extending ajaxSettings + settings = target; + target = jQuery.ajaxSettings; + } + ajaxExtend( target, settings ); + return target; + }, + + ajaxSettings: { + url: ajaxLocation, + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + type: "GET", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + processData: true, + async: true, + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + xml: "application/xml, text/xml", + html: "text/html", + text: "text/plain", + json: "application/json, text/javascript", + "*": allTypes + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // List of data converters + // 1) key format is "source_type destination_type" (a single space in-between) + // 2) the catchall symbol "*" can be used for source_type + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + context: true, + url: true + } + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // ifModified key + ifModifiedKey, + // Response headers + responseHeadersString, + responseHeaders, + // transport + transport, + // timeout handle + timeoutTimer, + // Cross-domain detection vars + parts, + // To know if global events are to be dispatched + fireGlobals, + // Loop variable + i, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events + // It's the callbackContext if one was provided in the options + // and if it's a DOM node or a jQuery collection + globalEventContext = callbackContext !== s && + ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? + jQuery( callbackContext ) : jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + + readyState: 0, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( !state ) { + var lname = name.toLowerCase(); + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match === undefined ? null : match; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + statusText = statusText || strAbort; + if ( transport ) { + transport.abort( statusText ); + } + done( 0, statusText ); + return this; + } + }; + + // Callback for when everything is done + // It is defined here because jslint complains if it is declared + // at the end of the function (which would be more logical and readable) + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ ifModifiedKey ] = modified; + } + modified = jqXHR.getResponseHeader("Etag"); + if ( modified ) { + jQuery.etag[ ifModifiedKey ] = modified; + } + } + + // If not modified + if ( status === 304 ) { + + statusText = "notmodified"; + isSuccess = true; + + // If we have data + } else { + + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( !statusText || status ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + // Attach deferreds + deferred.promise( jqXHR ); + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + jqXHR.complete = completeDeferred.add; + + // Status-dependent callbacks + jqXHR.statusCode = function( map ) { + if ( map ) { + var tmp; + if ( state < 2 ) { + for ( tmp in map ) { + statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; + } + } else { + tmp = map[ jqXHR.status ]; + jqXHR.always( tmp ); + } + } + return this; + }; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // We also use the url parameter if available + s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ) || false; + s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== + ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Get ifModifiedKey before adding the anti-cache parameter + ifModifiedKey = s.url; + + // Add anti-cache in url if needed + if ( s.cache === false ) { + + var ts = jQuery.now(), + // try replacing _= if it is there + ret = s.url.replace( rts, "$1_=" + ts ); + + // if nothing was replaced, add timestamp to the end + s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + ifModifiedKey = ifModifiedKey || s.url; + if ( jQuery.lastModified[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + } + if ( jQuery.etag[ ifModifiedKey ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + } + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout( function(){ + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch (e) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + return jqXHR; + }, + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {} + +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + + var conv, conv2, current, tmp, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ], + converters = {}, + i = 0; + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { + + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { + + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } + + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } + + // Update prev for next iteration + prev = current; + } + } + + return { state: "success", data: response }; +} +var oldCallbacks = [], + rquestion = /\?/, + rjsonp = /(=)\?(?=&|$)|\?\?/, + nonce = jQuery.now(); + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + data = s.data, + url = s.url, + hasCallback = s.jsonp !== false, + replaceInUrl = hasCallback && rjsonp.test( url ), + replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && + !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && + rjsonp.test( data ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + overwritten = window[ callbackName ]; + + // Insert callback into url or form data + if ( replaceInUrl ) { + s.url = url.replace( rjsonp, "$1" + callbackName ); + } else if ( replaceInData ) { + s.data = data.replace( rjsonp, "$1" + callbackName ); + } else if ( hasCallback ) { + s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; + + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + }); + + // Delegate to script + return "script"; + } +}); +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /javascript|ecmascript/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement( "script" ); + + script.async = "async"; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( head && script.parentNode ) { + head.removeChild( script ); + } + + // Dereference the script + script = undefined; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( 0, 1 ); + } + } + }; + } +}); +var xhrCallbacks, + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject ? function() { + // Abort all pending requests + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( 0, 1 ); + } + } : false, + xhrId = 0; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +(function( xhr ) { + jQuery.extend( jQuery.support, { + ajax: !!xhr, + cors: !!xhr && ( "withCredentials" in xhr ) + }); +})( jQuery.ajaxSettings.xhr() ); + +// Create transport if the browser can provide an xhr +if ( jQuery.support.ajax ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var handle, i, + xhr = s.xhr(); + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( _ ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + + var status, + statusText, + responseHeaders, + responses, + xml; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + responses = {}; + xml = xhr.responseXML; + + // Construct response list + if ( xml && xml.documentElement /* #4958 */ ) { + responses.xml = xml; + } + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + try { + responses.text = xhr.responseText; + } catch( _ ) { + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback, 0 ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback(0,1); + } + } + }; + } + }); +} +var fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; + + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } + + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }, 0 ); + return ( fxNow = jQuery.now() ); +} + +function createTweens( animation, props ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { + + // we're done with this property + return; + } + } + }); +} + +function Animation( elem, properties, options ) { + var result, + index = 0, + tweenerIndex = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + percent = 1 - ( remaining / animation.duration || 0 ), + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end, easing ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } + + createTweens( animation, props ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + anim: animation, + queue: animation.opts.queue, + elem: elem + }) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, + + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } +}); + +function defaultPrefilter( elem, props, opts ) { + var index, prop, value, length, dataShow, tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } + + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; + + } else { + style.zoom = 1; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.done(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } + + + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } + + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery.removeData( elem, "fxshow", true ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } +} + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } + + // passing any value as a 4th parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, false, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Remove in 2.0 - this supports IE8's panic based approach +// to setting things on disconnected nodes + +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" || + // special check for .toggle( handler, handler, ... ) + ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { + + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() + + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations resolve immediately + if ( empty ) { + anim.stop( true ); + } + }; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + } +}); + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; + + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } +}; + +jQuery.timers = []; +jQuery.fx = Tween.prototype.init; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } +}; + +jQuery.fx.timer = function( timer ) { + if ( timer() && jQuery.timers.push( timer ) && !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.interval = 13; + +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; + +// Back Compat <1.8 extension point +jQuery.fx.step = {}; + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} +var rroot = /^(?:body|html)$/i; + +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + if ( (body = doc.body) === elem ) { + return jQuery.offset.bodyOffset( elem ); + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== "undefined" ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + clientTop = docElem.clientTop || body.clientTop || 0; + clientLeft = docElem.clientLeft || body.clientLeft || 0; + scrollTop = win.pageYOffset || docElem.scrollTop; + scrollLeft = win.pageXOffset || docElem.scrollLeft; + return { + top: box.top + scrollTop - clientTop, + left: box.left + scrollLeft - clientLeft + }; +}; + +jQuery.offset = { + + bodyOffset: function( body ) { + var top = body.offsetTop, + left = body.offsetLeft; + + if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { + top += parseFloat( jQuery.css(body, "marginTop") ) || 0; + left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; + } + + return { top: top, left: left }; + }, + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[0] ) { + return; + } + + var elem = this[0], + + // Get *real* offsetParent + offsetParent = this.offsetParent(), + + // Get correct offsets + offset = this.offset(), + parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + + // Subtract element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; + offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; + + // Add offsetParent borders + parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; + parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; + + // Subtract the two offsets + return { + top: offset.top - parentOffset.top, + left: offset.left - parentOffset.left + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.body; + while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.body; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return jQuery.access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, value, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); +}); +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + +})( window ); diff --git a/pub/lib/jquery/jquery-migrate.js b/pub/lib/jquery/jquery-migrate.js new file mode 100644 index 0000000000000000000000000000000000000000..25b6c813146a3276fa0f9b64e4e436250de58551 --- /dev/null +++ b/pub/lib/jquery/jquery-migrate.js @@ -0,0 +1,521 @@ +/*! + * jQuery Migrate - v1.2.1 - 2013-05-08 + * https://github.com/jquery/jquery-migrate + * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT + */ +(function( jQuery, window, undefined ) { +// See http://bugs.jquery.com/ticket/13335 +// "use strict"; + + +var warnedAbout = {}; + +// List of warnings already given; public read only +jQuery.migrateWarnings = []; + +// Set to true to prevent console output; migrateWarnings still maintained +// jQuery.migrateMute = false; + +// Show a message on the console so devs know we're active +if ( !jQuery.migrateMute && window.console && window.console.log ) { + window.console.log("JQMIGRATE: Logging is active"); +} + +// Set to false to disable traces that appear with warnings +if ( jQuery.migrateTrace === undefined ) { + jQuery.migrateTrace = true; +} + +// Forget any warnings we've already given; public +jQuery.migrateReset = function() { + warnedAbout = {}; + jQuery.migrateWarnings.length = 0; +}; + +function migrateWarn( msg) { + var console = window.console; + if ( !warnedAbout[ msg ] ) { + warnedAbout[ msg ] = true; + jQuery.migrateWarnings.push( msg ); + if ( console && console.warn && !jQuery.migrateMute ) { + console.warn( "JQMIGRATE: " + msg ); + if ( jQuery.migrateTrace && console.trace ) { + console.trace(); + } + } + } +} + +function migrateWarnProp( obj, prop, value, msg ) { + if ( Object.defineProperty ) { + // On ES5 browsers (non-oldIE), warn if the code tries to get prop; + // allow property to be overwritten in case some other plugin wants it + try { + Object.defineProperty( obj, prop, { + configurable: true, + enumerable: true, + get: function() { + migrateWarn( msg ); + return value; + }, + set: function( newValue ) { + migrateWarn( msg ); + value = newValue; + } + }); + return; + } catch( err ) { + // IE8 is a dope about Object.defineProperty, can't warn there + } + } + + // Non-ES5 (or broken) browser; just set the property + jQuery._definePropertyBroken = true; + obj[ prop ] = value; +} + +if ( document.compatMode === "BackCompat" ) { + // jQuery has never supported or tested Quirks Mode + migrateWarn( "jQuery is not compatible with Quirks Mode" ); +} + + +var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn, + oldAttr = jQuery.attr, + valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get || + function() { return null; }, + valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set || + function() { return undefined; }, + rnoType = /^(?:input|button)$/i, + rnoAttrNodeType = /^[238]$/, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + ruseDefault = /^(?:checked|selected)$/i; + +// jQuery.attrFn +migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" ); + +jQuery.attr = function( elem, name, value, pass ) { + var lowerName = name.toLowerCase(), + nType = elem && elem.nodeType; + + if ( pass ) { + // Since pass is used internally, we only warn for new jQuery + // versions where there isn't a pass arg in the formal params + if ( oldAttr.length < 4 ) { + migrateWarn("jQuery.fn.attr( props, pass ) is deprecated"); + } + if ( elem && !rnoAttrNodeType.test( nType ) && + (attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) { + return jQuery( elem )[ name ]( value ); + } + } + + // Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking + // for disconnected elements we don't warn on $( "<button>", { type: "button" } ). + if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) { + migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8"); + } + + // Restore boolHook for boolean property/attribute synchronization + if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) { + jQuery.attrHooks[ lowerName ] = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && + ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } + }; + + // Warn only for attributes that can remain distinct from their properties post-1.9 + if ( ruseDefault.test( lowerName ) ) { + migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" ); + } + } + + return oldAttr.call( jQuery, elem, name, value ); +}; + +// attrHooks: value +jQuery.attrHooks.value = { + get: function( elem, name ) { + var nodeName = ( elem.nodeName || "" ).toLowerCase(); + if ( nodeName === "button" ) { + return valueAttrGet.apply( this, arguments ); + } + if ( nodeName !== "input" && nodeName !== "option" ) { + migrateWarn("jQuery.fn.attr('value') no longer gets properties"); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value ) { + var nodeName = ( elem.nodeName || "" ).toLowerCase(); + if ( nodeName === "button" ) { + return valueAttrSet.apply( this, arguments ); + } + if ( nodeName !== "input" && nodeName !== "option" ) { + migrateWarn("jQuery.fn.attr('value', val) no longer sets properties"); + } + // Does not return so that setAttribute is also used + elem.value = value; + } +}; + + +var matched, browser, + oldInit = jQuery.fn.init, + oldParseJSON = jQuery.parseJSON, + // Note: XSS check is done below after string is trimmed + rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/; + +// $(html) "looks like html" rule change +jQuery.fn.init = function( selector, context, rootjQuery ) { + var match; + + if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) && + (match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) { + // This is an HTML string according to the "old" rules; is it still? + if ( selector.charAt( 0 ) !== "<" ) { + migrateWarn("$(html) HTML strings must start with '<' character"); + } + if ( match[ 3 ] ) { + migrateWarn("$(html) HTML text after last tag is ignored"); + } + // Consistently reject any HTML-like string starting with a hash (#9521) + // Note that this may break jQuery 1.6.x code that otherwise would work. + if ( match[ 0 ].charAt( 0 ) === "#" ) { + migrateWarn("HTML string cannot start with a '#' character"); + jQuery.error("JQMIGRATE: Invalid selector string (XSS)"); + } + // Now process using loose rules; let pre-1.8 play too + if ( context && context.context ) { + // jQuery object as context; parseHTML expects a DOM object + context = context.context; + } + if ( jQuery.parseHTML ) { + return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ), + context, rootjQuery ); + } + } + return oldInit.apply( this, arguments ); +}; +jQuery.fn.init.prototype = jQuery.fn; + +// Let $.parseJSON(falsy_value) return null +jQuery.parseJSON = function( json ) { + if ( !json && json !== null ) { + migrateWarn("jQuery.parseJSON requires a valid JSON string"); + return null; + } + return oldParseJSON.apply( this, arguments ); +}; + +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + +// Don't clobber any existing jQuery.browser in case it's different +if ( !jQuery.browser ) { + matched = jQuery.uaMatch( navigator.userAgent ); + browser = {}; + + if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; + } + + // Chrome is Webkit, but Webkit is also Safari. + if ( browser.chrome ) { + browser.webkit = true; + } else if ( browser.webkit ) { + browser.safari = true; + } + + jQuery.browser = browser; +} + +// Warn if the code tries to get jQuery.browser +migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" ); + +jQuery.sub = function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + migrateWarn( "jQuery.sub() is deprecated" ); + return jQuerySub; +}; + + +// Ensure that $.ajax gets the new parseJSON defined in core.js +jQuery.ajaxSetup({ + converters: { + "text json": jQuery.parseJSON + } +}); + + +var oldFnData = jQuery.fn.data; + +jQuery.fn.data = function( name ) { + var ret, evt, + elem = this[0]; + + // Handles 1.7 which has this behavior and 1.8 which doesn't + if ( elem && name === "events" && arguments.length === 1 ) { + ret = jQuery.data( elem, name ); + evt = jQuery._data( elem, name ); + if ( ( ret === undefined || ret === evt ) && evt !== undefined ) { + migrateWarn("Use of jQuery.fn.data('events') is deprecated"); + return evt; + } + } + return oldFnData.apply( this, arguments ); +}; + + +var rscriptType = /\/(java|ecma)script/i, + oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack; + +jQuery.fn.andSelf = function() { + migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"); + return oldSelf.apply( this, arguments ); +}; + +// Since jQuery.clean is used internally on older versions, we only shim if it's missing +if ( !jQuery.clean ) { + jQuery.clean = function( elems, context, fragment, scripts ) { + // Set context per 1.8 logic + context = context || document; + context = !context.nodeType && context[0] || context; + context = context.ownerDocument || context; + + migrateWarn("jQuery.clean() is deprecated"); + + var i, elem, handleScript, jsTags, + ret = []; + + jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes ); + + // Complex logic lifted directly from jQuery 1.8 + if ( fragment ) { + // Special handling of each script element + handleScript = function( elem ) { + // Check if we consider it executable + if ( !elem.type || rscriptType.test( elem.type ) ) { + // Detach the script and store it in the scripts array (if provided) or the fragment + // Return truthy to indicate that it has been handled + return scripts ? + scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : + fragment.appendChild( elem ); + } + }; + + for ( i = 0; (elem = ret[i]) != null; i++ ) { + // Check if we're done after handling an executable script + if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { + // Append to fragment and handle embedded scripts + fragment.appendChild( elem ); + if ( typeof elem.getElementsByTagName !== "undefined" ) { + // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration + jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); + + // Splice the scripts into ret after their former ancestor and advance our index beyond them + ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); + i += jsTags.length; + } + } + } + } + + return ret; + }; +} + +var eventAdd = jQuery.event.add, + eventRemove = jQuery.event.remove, + eventTrigger = jQuery.event.trigger, + oldToggle = jQuery.fn.toggle, + oldLive = jQuery.fn.live, + oldDie = jQuery.fn.die, + ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess", + rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ), + rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + hoverHack = function( events ) { + if ( typeof( events ) !== "string" || jQuery.event.special.hover ) { + return events; + } + if ( rhoverHack.test( events ) ) { + migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"); + } + return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +// Event props removed in 1.9, put them back if needed; no practical way to warn them +if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) { + jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" ); +} + +// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7 +if ( jQuery.event.dispatch ) { + migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" ); +} + +// Support for 'hover' pseudo-event and ajax event warnings +jQuery.event.add = function( elem, types, handler, data, selector ){ + if ( elem !== document && rajaxEvent.test( types ) ) { + migrateWarn( "AJAX events should be attached to document: " + types ); + } + eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector ); +}; +jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){ + eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes ); +}; + +jQuery.fn.error = function() { + var args = Array.prototype.slice.call( arguments, 0); + migrateWarn("jQuery.fn.error() is deprecated"); + args.splice( 0, 0, "error" ); + if ( arguments.length ) { + return this.bind.apply( this, args ); + } + // error event should not bubble to window, although it does pre-1.7 + this.triggerHandler.apply( this, args ); + return this; +}; + +jQuery.fn.toggle = function( fn, fn2 ) { + + // Don't mess with animation or css toggles + if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { + return oldToggle.apply( this, arguments ); + } + migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated"); + + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); +}; + +jQuery.fn.live = function( types, data, fn ) { + migrateWarn("jQuery.fn.live() is deprecated"); + if ( oldLive ) { + return oldLive.apply( this, arguments ); + } + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; +}; + +jQuery.fn.die = function( types, fn ) { + migrateWarn("jQuery.fn.die() is deprecated"); + if ( oldDie ) { + return oldDie.apply( this, arguments ); + } + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; +}; + +// Turn global events into document-triggered events +jQuery.event.trigger = function( event, data, elem, onlyHandlers ){ + if ( !elem && !rajaxEvent.test( event ) ) { + migrateWarn( "Global events are undocumented and deprecated" ); + } + return eventTrigger.call( this, event, data, elem || document, onlyHandlers ); +}; +jQuery.each( ajaxEvents.split("|"), + function( _, name ) { + jQuery.event.special[ name ] = { + setup: function() { + var elem = this; + + // The document needs no shimming; must be !== for oldIE + if ( elem !== document ) { + jQuery.event.add( document, name + "." + jQuery.guid, function() { + jQuery.event.trigger( name, null, elem, true ); + }); + jQuery._data( this, name, jQuery.guid++ ); + } + return false; + }, + teardown: function() { + if ( this !== document ) { + jQuery.event.remove( document, name + "." + jQuery._data( this, name ) ); + } + return false; + } + }; + } +); + + +})( jQuery, window ); diff --git a/pub/lib/jquery/jquery-migrate.min.js b/pub/lib/jquery/jquery-migrate.min.js new file mode 100644 index 0000000000000000000000000000000000000000..62149c28b9d88d8e270878af97927a2897aa845b --- /dev/null +++ b/pub/lib/jquery/jquery-migrate.min.js @@ -0,0 +1,2 @@ +/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */ +jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window); \ No newline at end of file diff --git a/pub/lib/jquery/jquery-ui-1.9.2.js b/pub/lib/jquery/jquery-ui-1.9.2.js new file mode 100644 index 0000000000000000000000000000000000000000..d556f0d7f605fcc1ab4dad10ebd7ee6d3e5bc35c --- /dev/null +++ b/pub/lib/jquery/jquery-ui-1.9.2.js @@ -0,0 +1,14933 @@ +/*! jQuery UI - v1.9.2 - 2012-11-23 +* http://jqueryui.com +* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js +* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */ + +(function( $, undefined ) { + +var uuid = 0, + runiqueId = /^ui-id-\d+$/; + +// prevent duplicate loading +// this is only a problem because we proxy existing functions +// and we don't want to double proxy them +$.ui = $.ui || {}; +if ( $.ui.version ) { + return; +} + +$.extend( $.ui, { + version: "1.9.2", + + keyCode: { + BACKSPACE: 8, + COMMA: 188, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + LEFT: 37, + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SPACE: 32, + TAB: 9, + UP: 38 + } +}); + +// plugins +$.fn.extend({ + _focus: $.fn.focus, + focus: function( delay, fn ) { + return typeof delay === "number" ? + this.each(function() { + var elem = this; + setTimeout(function() { + $( elem ).focus(); + if ( fn ) { + fn.call( elem ); + } + }, delay ); + }) : + this._focus.apply( this, arguments ); + }, + + scrollParent: function() { + var scrollParent; + if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { + scrollParent = this.parents().filter(function() { + return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); + }).eq(0); + } else { + scrollParent = this.parents().filter(function() { + return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); + }).eq(0); + } + + return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; + }, + + zIndex: function( zIndex ) { + if ( zIndex !== undefined ) { + return this.css( "zIndex", zIndex ); + } + + if ( this.length ) { + var elem = $( this[ 0 ] ), position, value; + while ( elem.length && elem[ 0 ] !== document ) { + // Ignore z-index if position is set to a value where z-index is ignored by the browser + // This makes behavior of this function consistent across browsers + // WebKit always returns auto if the element is positioned + position = elem.css( "position" ); + if ( position === "absolute" || position === "relative" || position === "fixed" ) { + // IE returns 0 when zIndex is not specified + // other browsers return a string + // we ignore the case of nested elements with an explicit value of 0 + // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> + value = parseInt( elem.css( "zIndex" ), 10 ); + if ( !isNaN( value ) && value !== 0 ) { + return value; + } + } + elem = elem.parent(); + } + } + + return 0; + }, + + uniqueId: function() { + return this.each(function() { + if ( !this.id ) { + this.id = "ui-id-" + (++uuid); + } + }); + }, + + removeUniqueId: function() { + return this.each(function() { + if ( runiqueId.test( this.id ) ) { + $( this ).removeAttr( "id" ); + } + }); + } +}); + +// selectors +function focusable( element, isTabIndexNotNaN ) { + var map, mapName, img, + nodeName = element.nodeName.toLowerCase(); + if ( "area" === nodeName ) { + map = element.parentNode; + mapName = map.name; + if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { + return false; + } + img = $( "img[usemap=#" + mapName + "]" )[0]; + return !!img && visible( img ); + } + return ( /input|select|textarea|button|object/.test( nodeName ) ? + !element.disabled : + "a" === nodeName ? + element.href || isTabIndexNotNaN : + isTabIndexNotNaN) && + // the element and all of its ancestors must be visible + visible( element ); +} + +function visible( element ) { + return $.expr.filters.visible( element ) && + !$( element ).parents().andSelf().filter(function() { + return $.css( this, "visibility" ) === "hidden"; + }).length; +} + +$.extend( $.expr[ ":" ], { + data: $.expr.createPseudo ? + $.expr.createPseudo(function( dataName ) { + return function( elem ) { + return !!$.data( elem, dataName ); + }; + }) : + // support: jQuery <1.8 + function( elem, i, match ) { + return !!$.data( elem, match[ 3 ] ); + }, + + focusable: function( element ) { + return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); + }, + + tabbable: function( element ) { + var tabIndex = $.attr( element, "tabindex" ), + isTabIndexNaN = isNaN( tabIndex ); + return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); + } +}); + +// support +$(function() { + var body = document.body, + div = body.appendChild( div = document.createElement( "div" ) ); + + // access offsetHeight before setting the style to prevent a layout bug + // in IE 9 which causes the element to continue to take up space even + // after it is removed from the DOM (#8026) + div.offsetHeight; + + $.extend( div.style, { + minHeight: "100px", + height: "auto", + padding: 0, + borderWidth: 0 + }); + + $.support.minHeight = div.offsetHeight === 100; + $.support.selectstart = "onselectstart" in div; + + // set display to none to avoid a layout bug in IE + // http://dev.jquery.com/ticket/4014 + body.removeChild( div ).style.display = "none"; +}); + +// support: jQuery <1.8 +if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { + $.each( [ "Width", "Height" ], function( i, name ) { + var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], + type = name.toLowerCase(), + orig = { + innerWidth: $.fn.innerWidth, + innerHeight: $.fn.innerHeight, + outerWidth: $.fn.outerWidth, + outerHeight: $.fn.outerHeight + }; + + function reduce( elem, size, border, margin ) { + $.each( side, function() { + size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; + if ( border ) { + size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; + } + if ( margin ) { + size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; + } + }); + return size; + } + + $.fn[ "inner" + name ] = function( size ) { + if ( size === undefined ) { + return orig[ "inner" + name ].call( this ); + } + + return this.each(function() { + $( this ).css( type, reduce( this, size ) + "px" ); + }); + }; + + $.fn[ "outer" + name] = function( size, margin ) { + if ( typeof size !== "number" ) { + return orig[ "outer" + name ].call( this, size ); + } + + return this.each(function() { + $( this).css( type, reduce( this, size, true, margin ) + "px" ); + }); + }; + }); +} + +// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) +if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { + $.fn.removeData = (function( removeData ) { + return function( key ) { + if ( arguments.length ) { + return removeData.call( this, $.camelCase( key ) ); + } else { + return removeData.call( this ); + } + }; + })( $.fn.removeData ); +} + + + + + +// deprecated + +(function() { + var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || []; + $.ui.ie = uaMatch.length ? true : false; + $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6; +})(); + +$.fn.extend({ + disableSelection: function() { + return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + + ".ui-disableSelection", function( event ) { + event.preventDefault(); + }); + }, + + enableSelection: function() { + return this.unbind( ".ui-disableSelection" ); + } +}); + +$.extend( $.ui, { + // $.ui.plugin is deprecated. Use the proxy pattern instead. + plugin: { + add: function( module, option, set ) { + var i, + proto = $.ui[ module ].prototype; + for ( i in set ) { + proto.plugins[ i ] = proto.plugins[ i ] || []; + proto.plugins[ i ].push( [ option, set[ i ] ] ); + } + }, + call: function( instance, name, args ) { + var i, + set = instance.plugins[ name ]; + if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { + return; + } + + for ( i = 0; i < set.length; i++ ) { + if ( instance.options[ set[ i ][ 0 ] ] ) { + set[ i ][ 1 ].apply( instance.element, args ); + } + } + } + }, + + contains: $.contains, + + // only used by resizable + hasScroll: function( el, a ) { + + //If overflow is hidden, the element might have extra content, but the user wants to hide it + if ( $( el ).css( "overflow" ) === "hidden") { + return false; + } + + var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", + has = false; + + if ( el[ scroll ] > 0 ) { + return true; + } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + el[ scroll ] = 1; + has = ( el[ scroll ] > 0 ); + el[ scroll ] = 0; + return has; + }, + + // these are odd functions, fix the API or move into individual plugins + isOverAxis: function( x, reference, size ) { + //Determines when x coordinate is over "b" element axis + return ( x > reference ) && ( x < ( reference + size ) ); + }, + isOver: function( y, x, top, left, height, width ) { + //Determines when x, y coordinates is over "b" element + return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); + } +}); + +})( jQuery ); + +(function( $, undefined ) { + +var uuid = 0, + slice = Array.prototype.slice, + _cleanData = $.cleanData; +$.cleanData = function( elems ) { + for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { + try { + $( elem ).triggerHandler( "remove" ); + // http://bugs.jquery.com/ticket/8235 + } catch( e ) {} + } + _cleanData( elems ); +}; + +$.widget = function( name, base, prototype ) { + var fullName, existingConstructor, constructor, basePrototype, + namespace = name.split( "." )[ 0 ]; + + name = name.split( "." )[ 1 ]; + fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + // create selector for plugin + $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + return !!$.data( elem, fullName ); + }; + + $[ namespace ] = $[ namespace ] || {}; + existingConstructor = $[ namespace ][ name ]; + constructor = $[ namespace ][ name ] = function( options, element ) { + // allow instantiation without "new" keyword + if ( !this._createWidget ) { + return new constructor( options, element ); + } + + // allow instantiation without initializing for simple inheritance + // must use "new" keyword (the code above always passes args) + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + // extend with the existing constructor to carry over any static properties + $.extend( constructor, existingConstructor, { + version: prototype.version, + // copy the object used to create the prototype in case we need to + // redefine the widget later + _proto: $.extend( {}, prototype ), + // track widgets that inherit from this widget in case this widget is + // redefined after a widget inherits from it + _childConstructors: [] + }); + + basePrototype = new base(); + // we need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from + basePrototype.options = $.widget.extend( {}, basePrototype.options ); + $.each( prototype, function( prop, value ) { + if ( $.isFunction( value ) ) { + prototype[ prop ] = (function() { + var _super = function() { + return base.prototype[ prop ].apply( this, arguments ); + }, + _superApply = function( args ) { + return base.prototype[ prop ].apply( this, args ); + }; + return function() { + var __super = this._super, + __superApply = this._superApply, + returnValue; + + this._super = _super; + this._superApply = _superApply; + + returnValue = value.apply( this, arguments ); + + this._super = __super; + this._superApply = __superApply; + + return returnValue; + }; + })(); + } + }); + constructor.prototype = $.widget.extend( basePrototype, { + // TODO: remove support for widgetEventPrefix + // always use the name + a colon as the prefix, e.g., draggable:start + // don't prefix for widgets that aren't DOM-based + widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name + }, prototype, { + constructor: constructor, + namespace: namespace, + widgetName: name, + // TODO remove widgetBaseClass, see #8155 + widgetBaseClass: fullName, + widgetFullName: fullName + }); + + // If this widget is being redefined then we need to find all widgets that + // are inheriting from it and redefine all of them so that they inherit from + // the new version of this widget. We're essentially trying to replace one + // level in the prototype chain. + if ( existingConstructor ) { + $.each( existingConstructor._childConstructors, function( i, child ) { + var childPrototype = child.prototype; + + // redefine the child widget using the same prototype that was + // originally used, but inherit from the new version of the base + $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); + }); + // remove the list of existing child constructors from the old constructor + // so the old child constructors can be garbage collected + delete existingConstructor._childConstructors; + } else { + base._childConstructors.push( constructor ); + } + + $.widget.bridge( name, constructor ); +}; + +$.widget.extend = function( target ) { + var input = slice.call( arguments, 1 ), + inputIndex = 0, + inputLength = input.length, + key, + value; + for ( ; inputIndex < inputLength; inputIndex++ ) { + for ( key in input[ inputIndex ] ) { + value = input[ inputIndex ][ key ]; + if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + // Clone objects + if ( $.isPlainObject( value ) ) { + target[ key ] = $.isPlainObject( target[ key ] ) ? + $.widget.extend( {}, target[ key ], value ) : + // Don't extend strings, arrays, etc. with objects + $.widget.extend( {}, value ); + // Copy everything else by reference + } else { + target[ key ] = value; + } + } + } + } + return target; +}; + +$.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName || name; + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string", + args = slice.call( arguments, 1 ), + returnValue = this; + + // allow multiple hashes to be passed on init + options = !isMethodCall && args.length ? + $.widget.extend.apply( null, [ options ].concat(args) ) : + options; + + if ( isMethodCall ) { + this.each(function() { + var methodValue, + instance = $.data( this, fullName ); + if ( !instance ) { + return $.error( "cannot call methods on " + name + " prior to initialization; " + + "attempted to call method '" + options + "'" ); + } + if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { + return $.error( "no such method '" + options + "' for " + name + " widget instance" ); + } + methodValue = instance[ options ].apply( instance, args ); + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue && methodValue.jquery ? + returnValue.pushStack( methodValue.get() ) : + methodValue; + return false; + } + }); + } else { + this.each(function() { + var instance = $.data( this, fullName ); + if ( instance ) { + instance.option( options || {} )._init(); + } else { + $.data( this, fullName, new object( options, this ) ); + } + }); + } + + return returnValue; + }; +}; + +$.Widget = function( /* options, element */ ) {}; +$.Widget._childConstructors = []; + +$.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + defaultElement: "<div>", + options: { + disabled: false, + + // callbacks + create: null + }, + _createWidget: function( options, element ) { + element = $( element || this.defaultElement || this )[ 0 ]; + this.element = $( element ); + this.uuid = uuid++; + this.eventNamespace = "." + this.widgetName + this.uuid; + this.options = $.widget.extend( {}, + this.options, + this._getCreateOptions(), + options ); + + this.bindings = $(); + this.hoverable = $(); + this.focusable = $(); + + if ( element !== this ) { + // 1.9 BC for #7810 + // TODO remove dual storage + $.data( element, this.widgetName, this ); + $.data( element, this.widgetFullName, this ); + this._on( true, this.element, { + remove: function( event ) { + if ( event.target === element ) { + this.destroy(); + } + } + }); + this.document = $( element.style ? + // element within the document + element.ownerDocument : + // element is window or document + element.document || element ); + this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); + } + + this._create(); + this._trigger( "create", null, this._getCreateEventData() ); + this._init(); + }, + _getCreateOptions: $.noop, + _getCreateEventData: $.noop, + _create: $.noop, + _init: $.noop, + + destroy: function() { + this._destroy(); + // we can probably remove the unbind calls in 2.0 + // all event bindings should go through this._on() + this.element + .unbind( this.eventNamespace ) + // 1.9 BC for #7810 + // TODO remove dual storage + .removeData( this.widgetName ) + .removeData( this.widgetFullName ) + // support: jquery <1.6.3 + // http://bugs.jquery.com/ticket/9413 + .removeData( $.camelCase( this.widgetFullName ) ); + this.widget() + .unbind( this.eventNamespace ) + .removeAttr( "aria-disabled" ) + .removeClass( + this.widgetFullName + "-disabled " + + "ui-state-disabled" ); + + // clean up events and states + this.bindings.unbind( this.eventNamespace ); + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + }, + _destroy: $.noop, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key, + parts, + curOption, + i; + + if ( arguments.length === 0 ) { + // don't return a reference to the internal hash + return $.widget.extend( {}, this.options ); + } + + if ( typeof key === "string" ) { + // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } + options = {}; + parts = key.split( "." ); + key = parts.shift(); + if ( parts.length ) { + curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); + for ( i = 0; i < parts.length - 1; i++ ) { + curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; + curOption = curOption[ parts[ i ] ]; + } + key = parts.pop(); + if ( value === undefined ) { + return curOption[ key ] === undefined ? null : curOption[ key ]; + } + curOption[ key ] = value; + } else { + if ( value === undefined ) { + return this.options[ key ] === undefined ? null : this.options[ key ]; + } + options[ key ] = value; + } + } + + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var key; + + for ( key in options ) { + this._setOption( key, options[ key ] ); + } + + return this; + }, + _setOption: function( key, value ) { + this.options[ key ] = value; + + if ( key === "disabled" ) { + this.widget() + .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value ) + .attr( "aria-disabled", value ); + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + } + + return this; + }, + + enable: function() { + return this._setOption( "disabled", false ); + }, + disable: function() { + return this._setOption( "disabled", true ); + }, + + _on: function( suppressDisabledCheck, element, handlers ) { + var delegateElement, + instance = this; + + // no suppressDisabledCheck flag, shuffle arguments + if ( typeof suppressDisabledCheck !== "boolean" ) { + handlers = element; + element = suppressDisabledCheck; + suppressDisabledCheck = false; + } + + // no element argument, shuffle and use this.element + if ( !handlers ) { + handlers = element; + element = this.element; + delegateElement = this.widget(); + } else { + // accept selectors, DOM elements + element = delegateElement = $( element ); + this.bindings = this.bindings.add( element ); + } + + $.each( handlers, function( event, handler ) { + function handlerProxy() { + // allow widgets to customize the disabled handling + // - disabled as an array instead of boolean + // - disabled class as method for disabling individual parts + if ( !suppressDisabledCheck && + ( instance.options.disabled === true || + $( this ).hasClass( "ui-state-disabled" ) ) ) { + return; + } + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + + // copy the guid so direct unbinding works + if ( typeof handler !== "string" ) { + handlerProxy.guid = handler.guid = + handler.guid || handlerProxy.guid || $.guid++; + } + + var match = event.match( /^(\w+)\s*(.*)$/ ), + eventName = match[1] + instance.eventNamespace, + selector = match[2]; + if ( selector ) { + delegateElement.delegate( selector, eventName, handlerProxy ); + } else { + element.bind( eventName, handlerProxy ); + } + }); + }, + + _off: function( element, eventName ) { + eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; + element.unbind( eventName ).undelegate( eventName ); + }, + + _delay: function( handler, delay ) { + function handlerProxy() { + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + var instance = this; + return setTimeout( handlerProxy, delay || 0 ); + }, + + _hoverable: function( element ) { + this.hoverable = this.hoverable.add( element ); + this._on( element, { + mouseenter: function( event ) { + $( event.currentTarget ).addClass( "ui-state-hover" ); + }, + mouseleave: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-hover" ); + } + }); + }, + + _focusable: function( element ) { + this.focusable = this.focusable.add( element ); + this._on( element, { + focusin: function( event ) { + $( event.currentTarget ).addClass( "ui-state-focus" ); + }, + focusout: function( event ) { + $( event.currentTarget ).removeClass( "ui-state-focus" ); + } + }); + }, + + _trigger: function( type, event, data ) { + var prop, orig, + callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + // the original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + return !( $.isFunction( callback ) && + callback.apply( this.element[0], [ event ].concat( data ) ) === false || + event.isDefaultPrevented() ); + } +}; + +$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { + $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + var hasOptions, + effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; + options = options || {}; + if ( typeof options === "number" ) { + options = { duration: options }; + } + hasOptions = !$.isEmptyObject( options ); + options.complete = callback; + if ( options.delay ) { + element.delay( options.delay ); + } + if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) { + element[ method ]( options ); + } else if ( effectName !== method && element[ effectName ] ) { + element[ effectName ]( options.duration, options.easing, callback ); + } else { + element.queue(function( next ) { + $( this )[ method ](); + if ( callback ) { + callback.call( element[ 0 ] ); + } + next(); + }); + } + }; +}); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + $.Widget.prototype._getCreateOptions = function() { + return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; + }; +} + +})( jQuery ); + +(function( $, undefined ) { + +var mouseHandled = false; +$( document ).mouseup( function( e ) { + mouseHandled = false; +}); + +$.widget("ui.mouse", { + version: "1.9.2", + options: { + cancel: 'input,textarea,button,select,option', + distance: 1, + delay: 0 + }, + _mouseInit: function() { + var that = this; + + this.element + .bind('mousedown.'+this.widgetName, function(event) { + return that._mouseDown(event); + }) + .bind('click.'+this.widgetName, function(event) { + if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) { + $.removeData(event.target, that.widgetName + '.preventClickEvent'); + event.stopImmediatePropagation(); + return false; + } + }); + + this.started = false; + }, + + // TODO: make sure destroying one instance of mouse doesn't mess with + // other instances of mouse + _mouseDestroy: function() { + this.element.unbind('.'+this.widgetName); + if ( this._mouseMoveDelegate ) { + $(document) + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + } + }, + + _mouseDown: function(event) { + // don't let more than one widget handle mouseStart + if( mouseHandled ) { return; } + + // we may have missed mouseup (out of window) + (this._mouseStarted && this._mouseUp(event)); + + this._mouseDownEvent = event; + + var that = this, + btnIsLeft = (event.which === 1), + // event.target.nodeName works around a bug in IE 8 with + // disabled inputs (#7620) + elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); + if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { + return true; + } + + this.mouseDelayMet = !this.options.delay; + if (!this.mouseDelayMet) { + this._mouseDelayTimer = setTimeout(function() { + that.mouseDelayMet = true; + }, this.options.delay); + } + + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { + this._mouseStarted = (this._mouseStart(event) !== false); + if (!this._mouseStarted) { + event.preventDefault(); + return true; + } + } + + // Click event may never have fired (Gecko & Opera) + if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { + $.removeData(event.target, this.widgetName + '.preventClickEvent'); + } + + // these delegates are required to keep context + this._mouseMoveDelegate = function(event) { + return that._mouseMove(event); + }; + this._mouseUpDelegate = function(event) { + return that._mouseUp(event); + }; + $(document) + .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); + + event.preventDefault(); + + mouseHandled = true; + return true; + }, + + _mouseMove: function(event) { + // IE mouseup check - mouseup happened when mouse was out of window + if ($.ui.ie && !(document.documentMode >= 9) && !event.button) { + return this._mouseUp(event); + } + + if (this._mouseStarted) { + this._mouseDrag(event); + return event.preventDefault(); + } + + if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { + this._mouseStarted = + (this._mouseStart(this._mouseDownEvent, event) !== false); + (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); + } + + return !this._mouseStarted; + }, + + _mouseUp: function(event) { + $(document) + .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) + .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + + if (this._mouseStarted) { + this._mouseStarted = false; + + if (event.target === this._mouseDownEvent.target) { + $.data(event.target, this.widgetName + '.preventClickEvent', true); + } + + this._mouseStop(event); + } + + return false; + }, + + _mouseDistanceMet: function(event) { + return (Math.max( + Math.abs(this._mouseDownEvent.pageX - event.pageX), + Math.abs(this._mouseDownEvent.pageY - event.pageY) + ) >= this.options.distance + ); + }, + + _mouseDelayMet: function(event) { + return this.mouseDelayMet; + }, + + // These are placeholder methods, to be overridden by extending plugin + _mouseStart: function(event) {}, + _mouseDrag: function(event) {}, + _mouseStop: function(event) {}, + _mouseCapture: function(event) { return true; } +}); + +})(jQuery); + +(function( $, undefined ) { + +$.widget("ui.draggable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "drag", + options: { + addClasses: true, + appendTo: "parent", + axis: false, + connectToSortable: false, + containment: false, + cursor: "auto", + cursorAt: false, + grid: false, + handle: false, + helper: "original", + iframeFix: false, + opacity: false, + refreshPositions: false, + revert: false, + revertDuration: 500, + scope: "default", + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + snap: false, + snapMode: "both", + snapTolerance: 20, + stack: false, + zIndex: false + }, + _create: function() { + + if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) + this.element[0].style.position = 'relative'; + + (this.options.addClasses && this.element.addClass("ui-draggable")); + (this.options.disabled && this.element.addClass("ui-draggable-disabled")); + + this._mouseInit(); + + }, + + _destroy: function() { + this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); + this._mouseDestroy(); + }, + + _mouseCapture: function(event) { + + var o = this.options; + + // among others, prevent a drag on a resizable-handle + if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) + return false; + + //Quit if we're not on a valid handle + this.handle = this._getHandle(event); + if (!this.handle) + return false; + + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { + $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') + .css({ + width: this.offsetWidth+"px", height: this.offsetHeight+"px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); + + return true; + + }, + + _mouseStart: function(event) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper(event); + + this.helper.addClass("ui-draggable-dragging"); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + this.cssPosition = this.helper.css("position"); + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.positionAbs = this.element.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + //Generate the original position + this.originalPosition = this.position = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + //Trigger event + callbacks + if(this._trigger("start", event) === false) { + this._clear(); + return false; + } + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + + this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position + + //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) + if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); + + return true; + }, + + _mouseDrag: function(event, noPropagation) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + //Call plugins and callbacks and use the resulting position if something is returned + if (!noPropagation) { + var ui = this._uiHash(); + if(this._trigger('drag', event, ui) === false) { + this._mouseUp({}); + return false; + } + this.position = ui.position; + } + + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + return false; + }, + + _mouseStop: function(event) { + + //If we are using droppables, inform the manager about the drop + var dropped = false; + if ($.ui.ddmanager && !this.options.dropBehaviour) + dropped = $.ui.ddmanager.drop(this, event); + + //if a drop comes from outside (a sortable) + if(this.dropped) { + dropped = this.dropped; + this.dropped = false; + } + + //if the original element is no longer in the DOM don't bother to continue (see #8269) + var element = this.element[0], elementInDom = false; + while ( element && (element = element.parentNode) ) { + if (element == document ) { + elementInDom = true; + } + } + if ( !elementInDom && this.options.helper === "original" ) + return false; + + if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { + var that = this; + $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { + if(that._trigger("stop", event) !== false) { + that._clear(); + } + }); + } else { + if(this._trigger("stop", event) !== false) { + this._clear(); + } + } + + return false; + }, + + _mouseUp: function(event) { + //Remove frame helpers + $("div.ui-draggable-iframeFix").each(function() { + this.parentNode.removeChild(this); + }); + + //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) + if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); + + return $.ui.mouse.prototype._mouseUp.call(this, event); + }, + + cancel: function() { + + if(this.helper.is(".ui-draggable-dragging")) { + this._mouseUp({}); + } else { + this._clear(); + } + + return this; + + }, + + _getHandle: function(event) { + + var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; + $(this.options.handle, this.element) + .find("*") + .andSelf() + .each(function() { + if(this == event.target) handle = true; + }); + + return handle; + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); + + if(!helper.parents('body').length) + helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); + + if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) + helper.css("position", "absolute"); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.element.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.element.css("marginLeft"),10) || 0), + top: (parseInt(this.element.css("marginTop"),10) || 0), + right: (parseInt(this.element.css("marginRight"),10) || 0), + bottom: (parseInt(this.element.css("marginBottom"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, + o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, + (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { + var c = $(o.containment); + var ce = c[0]; if(!ce) return; + var co = c.offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom + ]; + this.relative_container = c; + + } else if(o.containment.constructor == Array) { + this.containment = o.containment; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + var containment; + if(this.containment) { + if (this.relative_container){ + var co = this.relative_container.offset(); + containment = [ this.containment[0] + co.left, + this.containment[1] + co.top, + this.containment[2] + co.left, + this.containment[3] + co.top ]; + } + else { + containment = this.containment; + } + + if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; + } + + if(o.grid) { + //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) + var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; + pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; + pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _clear: function() { + this.helper.removeClass("ui-draggable-dragging"); + if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); + //if($.ui.ddmanager) $.ui.ddmanager.current = null; + this.helper = null; + this.cancelHelperRemoval = false; + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function(type, event, ui) { + ui = ui || this._uiHash(); + $.ui.plugin.call(this, type, [event, ui]); + if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins + return $.Widget.prototype._trigger.call(this, type, event, ui); + }, + + plugins: {}, + + _uiHash: function(event) { + return { + helper: this.helper, + position: this.position, + originalPosition: this.originalPosition, + offset: this.positionAbs + }; + } + +}); + +$.ui.plugin.add("draggable", "connectToSortable", { + start: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options, + uiSortable = $.extend({}, ui, { item: inst.element }); + inst.sortables = []; + $(o.connectToSortable).each(function() { + var sortable = $.data(this, 'sortable'); + if (sortable && !sortable.options.disabled) { + inst.sortables.push({ + instance: sortable, + shouldRevert: sortable.options.revert + }); + sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). + sortable._trigger("activate", event, uiSortable); + } + }); + + }, + stop: function(event, ui) { + + //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper + var inst = $(this).data("draggable"), + uiSortable = $.extend({}, ui, { item: inst.element }); + + $.each(inst.sortables, function() { + if(this.instance.isOver) { + + this.instance.isOver = 0; + + inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance + this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) + + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' + if(this.shouldRevert) this.instance.options.revert = true; + + //Trigger the stop of the sortable + this.instance._mouseStop(event); + + this.instance.options.helper = this.instance.options._helper; + + //If the helper has been the original item, restore properties in the sortable + if(inst.options.helper == 'original') + this.instance.currentItem.css({ top: 'auto', left: 'auto' }); + + } else { + this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance + this.instance._trigger("deactivate", event, uiSortable); + } + + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), that = this; + + var checkPos = function(o) { + var dyClick = this.offset.click.top, dxClick = this.offset.click.left; + var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; + var itemHeight = o.height, itemWidth = o.width; + var itemTop = o.top, itemLeft = o.left; + + return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); + }; + + $.each(inst.sortables, function(i) { + + var innermostIntersecting = false; + var thisSortable = this; + //Copy over some variables to allow calling the sortable's native _intersectsWith + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + + if(this.instance._intersectsWith(this.instance.containerCache)) { + innermostIntersecting = true; + $.each(inst.sortables, function () { + this.instance.positionAbs = inst.positionAbs; + this.instance.helperProportions = inst.helperProportions; + this.instance.offset.click = inst.offset.click; + if (this != thisSortable + && this.instance._intersectsWith(this.instance.containerCache) + && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])) + innermostIntersecting = false; + return innermostIntersecting; + }); + } + + + if(innermostIntersecting) { + //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once + if(!this.instance.isOver) { + + this.instance.isOver = 1; + //Now we fake the start of dragging for the sortable instance, + //by cloning the list group item, appending it to the sortable and using it as inst.currentItem + //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) + this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); + this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it + this.instance.options.helper = function() { return ui.helper[0]; }; + + event.target = this.instance.currentItem[0]; + this.instance._mouseCapture(event, true); + this.instance._mouseStart(event, true, true); + + //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes + this.instance.offset.click.top = inst.offset.click.top; + this.instance.offset.click.left = inst.offset.click.left; + this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; + this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; + + inst._trigger("toSortable", event); + inst.dropped = this.instance.element; //draggable revert needs that + //hack so receive/update callbacks work (mostly) + inst.currentItem = inst.element; + this.instance.fromOutside = inst; + + } + + //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable + if(this.instance.currentItem) this.instance._mouseDrag(event); + + } else { + + //If it doesn't intersect with the sortable, and it intersected before, + //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval + if(this.instance.isOver) { + + this.instance.isOver = 0; + this.instance.cancelHelperRemoval = true; + + //Prevent reverting on this forced stop + this.instance.options.revert = false; + + // The out event needs to be triggered independently + this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + + this.instance._mouseStop(event, true); + this.instance.options.helper = this.instance.options._helper; + + //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size + this.instance.currentItem.remove(); + if(this.instance.placeholder) this.instance.placeholder.remove(); + + inst._trigger("fromSortable", event); + inst.dropped = false; //draggable revert needs that + } + + }; + + }); + + } +}); + +$.ui.plugin.add("draggable", "cursor", { + start: function(event, ui) { + var t = $('body'), o = $(this).data('draggable').options; + if (t.css("cursor")) o._cursor = t.css("cursor"); + t.css("cursor", o.cursor); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if (o._cursor) $('body').css("cursor", o._cursor); + } +}); + +$.ui.plugin.add("draggable", "opacity", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data('draggable').options; + if(t.css("opacity")) o._opacity = t.css("opacity"); + t.css('opacity', o.opacity); + }, + stop: function(event, ui) { + var o = $(this).data('draggable').options; + if(o._opacity) $(ui.helper).css('opacity', o._opacity); + } +}); + +$.ui.plugin.add("draggable", "scroll", { + start: function(event, ui) { + var i = $(this).data("draggable"); + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); + }, + drag: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options, scrolled = false; + + if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { + + if(!o.axis || o.axis != 'x') { + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) + i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; + } + + if(!o.axis || o.axis != 'y') { + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) + i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; + } + + } else { + + if(!o.axis || o.axis != 'x') { + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } + + if(!o.axis || o.axis != 'y') { + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(i, event); + + } +}); + +$.ui.plugin.add("draggable", "snap", { + start: function(event, ui) { + + var i = $(this).data("draggable"), o = i.options; + i.snapElements = []; + + $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { + var $t = $(this); var $o = $t.offset(); + if(this != i.element[0]) i.snapElements.push({ + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + }); + }); + + }, + drag: function(event, ui) { + + var inst = $(this).data("draggable"), o = inst.options; + var d = o.snapTolerance; + + var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for (var i = inst.snapElements.length - 1; i >= 0; i--){ + + var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, + t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; + + //Yes, I know, this is insane ;) + if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { + if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = false; + continue; + } + + if(o.snapMode != 'inner') { + var ts = Math.abs(t - y2) <= d; + var bs = Math.abs(b - y1) <= d; + var ls = Math.abs(l - x2) <= d; + var rs = Math.abs(r - x1) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + } + + var first = (ts || bs || ls || rs); + + if(o.snapMode != 'outer') { + var ts = Math.abs(t - y1) <= d; + var bs = Math.abs(b - y2) <= d; + var ls = Math.abs(l - x1) <= d; + var rs = Math.abs(r - x2) <= d; + if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; + if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; + if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + } + + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) + (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + inst.snapElements[i].snapping = (ts || bs || ls || rs || first); + + }; + + } +}); + +$.ui.plugin.add("draggable", "stack", { + start: function(event, ui) { + + var o = $(this).data("draggable").options; + + var group = $.makeArray($(o.stack)).sort(function(a,b) { + return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); + }); + if (!group.length) { return; } + + var min = parseInt(group[0].style.zIndex) || 0; + $(group).each(function(i) { + this.style.zIndex = min + i; + }); + + this[0].style.zIndex = min + group.length; + + } +}); + +$.ui.plugin.add("draggable", "zIndex", { + start: function(event, ui) { + var t = $(ui.helper), o = $(this).data("draggable").options; + if(t.css("zIndex")) o._zIndex = t.css("zIndex"); + t.css('zIndex', o.zIndex); + }, + stop: function(event, ui) { + var o = $(this).data("draggable").options; + if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); + } +}); + +})(jQuery); + +(function( $, undefined ) { + +$.widget("ui.droppable", { + version: "1.9.2", + widgetEventPrefix: "drop", + options: { + accept: '*', + activeClass: false, + addClasses: true, + greedy: false, + hoverClass: false, + scope: 'default', + tolerance: 'intersect' + }, + _create: function() { + + var o = this.options, accept = o.accept; + this.isover = 0; this.isout = 1; + + this.accept = $.isFunction(accept) ? accept : function(d) { + return d.is(accept); + }; + + //Store the droppable's proportions + this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; + $.ui.ddmanager.droppables[o.scope].push(this); + + (o.addClasses && this.element.addClass("ui-droppable")); + + }, + + _destroy: function() { + var drop = $.ui.ddmanager.droppables[this.options.scope]; + for ( var i = 0; i < drop.length; i++ ) + if ( drop[i] == this ) + drop.splice(i, 1); + + this.element.removeClass("ui-droppable ui-droppable-disabled"); + }, + + _setOption: function(key, value) { + + if(key == 'accept') { + this.accept = $.isFunction(value) ? value : function(d) { + return d.is(value); + }; + } + $.Widget.prototype._setOption.apply(this, arguments); + }, + + _activate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.addClass(this.options.activeClass); + (draggable && this._trigger('activate', event, this.ui(draggable))); + }, + + _deactivate: function(event) { + var draggable = $.ui.ddmanager.current; + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + (draggable && this._trigger('deactivate', event, this.ui(draggable))); + }, + + _over: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); + this._trigger('over', event, this.ui(draggable)); + } + + }, + + _out: function(event) { + + var draggable = $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('out', event, this.ui(draggable)); + } + + }, + + _drop: function(event,custom) { + + var draggable = custom || $.ui.ddmanager.current; + if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element + + var childrenIntersection = false; + this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { + var inst = $.data(this, 'droppable'); + if( + inst.options.greedy + && !inst.options.disabled + && inst.options.scope == draggable.options.scope + && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) + && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) + ) { childrenIntersection = true; return false; } + }); + if(childrenIntersection) return false; + + if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + if(this.options.activeClass) this.element.removeClass(this.options.activeClass); + if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); + this._trigger('drop', event, this.ui(draggable)); + return this.element; + } + + return false; + + }, + + ui: function(c) { + return { + draggable: (c.currentItem || c.element), + helper: c.helper, + position: c.position, + offset: c.positionAbs + }; + } + +}); + +$.ui.intersect = function(draggable, droppable, toleranceMode) { + + if (!droppable.offset) return false; + + var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, + y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; + var l = droppable.offset.left, r = l + droppable.proportions.width, + t = droppable.offset.top, b = t + droppable.proportions.height; + + switch (toleranceMode) { + case 'fit': + return (l <= x1 && x2 <= r + && t <= y1 && y2 <= b); + break; + case 'intersect': + return (l < x1 + (draggable.helperProportions.width / 2) // Right Half + && x2 - (draggable.helperProportions.width / 2) < r // Left Half + && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half + && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half + break; + case 'pointer': + var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), + isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); + return isOver; + break; + case 'touch': + return ( + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); + break; + default: + return false; + break; + } + +}; + +/* + This manager tracks offsets of draggables and droppables +*/ +$.ui.ddmanager = { + current: null, + droppables: { 'default': [] }, + prepareOffsets: function(t, event) { + + var m = $.ui.ddmanager.droppables[t.options.scope] || []; + var type = event ? event.type : null; // workaround for #2317 + var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); + + droppablesLoop: for (var i = 0; i < m.length; i++) { + + if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted + for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item + m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + + if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + + m[i].offset = m[i].element.offset(); + m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; + + } + + }, + drop: function(draggable, event) { + + var dropped = false; + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(!this.options) return; + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + dropped = this._drop.call(this, event) || dropped; + + if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { + this.isout = 1; this.isover = 0; + this._deactivate.call(this, event); + } + + }); + return dropped; + + }, + dragStart: function( draggable, event ) { + //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) + draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + }); + }, + drag: function(draggable, event) { + + //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. + if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); + + //Run through all droppables and check their positions based on specific tolerance options + $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + + if(this.options.disabled || this.greedyChild || !this.visible) return; + var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + if(!c) return; + + var parentInstance; + if (this.options.greedy) { + // find droppable parents with same scope + var scope = this.options.scope; + var parent = this.element.parents(':data(droppable)').filter(function () { + return $.data(this, 'droppable').options.scope === scope; + }); + + if (parent.length) { + parentInstance = $.data(parent[0], 'droppable'); + parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + } + } + + // we just moved into a greedy child + if (parentInstance && c == 'isover') { + parentInstance['isover'] = 0; + parentInstance['isout'] = 1; + parentInstance._out.call(parentInstance, event); + } + + this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; + this[c == "isover" ? "_over" : "_out"].call(this, event); + + // we just moved out of a greedy child + if (parentInstance && c == 'isout') { + parentInstance['isout'] = 0; + parentInstance['isover'] = 1; + parentInstance._over.call(parentInstance, event); + } + }); + + }, + dragStop: function( draggable, event ) { + draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); + //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) + if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + } +}; + +})(jQuery); + +(function( $, undefined ) { + +$.widget("ui.resizable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "resize", + options: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + containment: false, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + iframeFix: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + zIndex: 1000 + }, + _create: function() { + + var that = this, o = this.options; + this.element.addClass("ui-resizable"); + + $.extend(this, { + _aspectRatio: !!(o.aspectRatio), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null + }); + + //Wrap the element if it cannot hold child nodes + if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { + + //Create a wrapper element and set the wrapper to the new current internal element + this.element.wrap( + $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ + position: this.element.css('position'), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css('top'), + left: this.element.css('left') + }) + ); + + //Overwrite the original this.element + this.element = this.element.parent().data( + "resizable", this.element.data('resizable') + ); + + this.elementIsWrapper = true; + + //Move margins to the wrapper + this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); + this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); + + //Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css('resize'); + this.originalElement.css('resize', 'none'); + + //Push the actual element to our proportionallyResize internal array + this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); + + // avoid IE jump (hard set the margin) + this.originalElement.css({ margin: this.originalElement.css('margin') }); + + // fix handlers offset + this._proportionallyResize(); + + } + + this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); + if(this.handles.constructor == String) { + + if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; + var n = this.handles.split(","); this.handles = {}; + + for(var i = 0; i < n.length; i++) { + + var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; + var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); + + // Apply zIndex to all handles - see #7960 + axis.css({ zIndex: o.zIndex }); + + //TODO : What's going on here? + if ('se' == handle) { + axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); + }; + + //Insert into internal handles object and append to element + this.handles[handle] = '.ui-resizable-'+handle; + this.element.append(axis); + } + + } + + this._renderAxis = function(target) { + + target = target || this.element; + + for(var i in this.handles) { + + if(this.handles[i].constructor == String) + this.handles[i] = $(this.handles[i], this.element).show(); + + //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) + if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { + + var axis = $(this.handles[i], this.element), padWrapper = 0; + + //Checking the correct pad and border + padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); + + //The padding type i have to apply... + var padPos = [ 'padding', + /ne|nw|n/.test(i) ? 'Top' : + /se|sw|s/.test(i) ? 'Bottom' : + /^e$/.test(i) ? 'Right' : 'Left' ].join(""); + + target.css(padPos, padWrapper); + + this._proportionallyResize(); + + } + + //TODO: What's that good for? There's not anything to be executed left + if(!$(this.handles[i]).length) + continue; + + } + }; + + //TODO: make renderAxis a prototype function + this._renderAxis(this.element); + + this._handles = $('.ui-resizable-handle', this.element) + .disableSelection(); + + //Matching axis name + this._handles.mouseover(function() { + if (!that.resizing) { + if (this.className) + var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + //Axis, default = se + that.axis = axis && axis[1] ? axis[1] : 'se'; + } + }); + + //If we want to auto hide the elements + if (o.autoHide) { + this._handles.hide(); + $(this.element) + .addClass("ui-resizable-autohide") + .mouseenter(function() { + if (o.disabled) return; + $(this).removeClass("ui-resizable-autohide"); + that._handles.show(); + }) + .mouseleave(function(){ + if (o.disabled) return; + if (!that.resizing) { + $(this).addClass("ui-resizable-autohide"); + that._handles.hide(); + } + }); + } + + //Initialize the mouse interaction + this._mouseInit(); + + }, + + _destroy: function() { + + this._mouseDestroy(); + + var _destroy = function(exp) { + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") + .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); + }; + + //TODO: Unwrap at same DOM position + if (this.elementIsWrapper) { + _destroy(this.element); + var wrapper = this.element; + this.originalElement.css({ + position: wrapper.css('position'), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css('top'), + left: wrapper.css('left') + }).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css('resize', this.originalResizeStyle); + _destroy(this.originalElement); + + return this; + }, + + _mouseCapture: function(event) { + var handle = false; + for (var i in this.handles) { + if ($(this.handles[i])[0] == event.target) { + handle = true; + } + } + + return !this.options.disabled && handle; + }, + + _mouseStart: function(event) { + + var o = this.options, iniPos = this.element.position(), el = this.element; + + this.resizing = true; + this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; + + // bugfix for http://dev.jquery.com/ticket/1749 + if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { + el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); + } + + this._renderProxy(); + + var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); + + if (o.containment) { + curleft += $(o.containment).scrollLeft() || 0; + curtop += $(o.containment).scrollTop() || 0; + } + + //Store needed variables + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.originalPosition = { left: curleft, top: curtop }; + this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + //Aspect Ratio + this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); + + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + + el.addClass("ui-resizable-resizing"); + this._propagate("start", event); + return true; + }, + + _mouseDrag: function(event) { + + //Increase performance, avoid regex + var el = this.helper, o = this.options, props = {}, + that = this, smp = this.originalMousePosition, a = this.axis; + + var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; + var trigger = this._change[a]; + if (!trigger) return false; + + // Calculate the attrs that will be change + var data = trigger.apply(this, [event, dx, dy]); + + // Put this in the mouseDrag handler since the user can start pressing shift while resizing + this._updateVirtualBoundaries(event.shiftKey); + if (this._aspectRatio || event.shiftKey) + data = this._updateRatio(data, event); + + data = this._respectSize(data, event); + + // plugins callbacks need to be called first + this._propagate("resize", event); + + el.css({ + top: this.position.top + "px", left: this.position.left + "px", + width: this.size.width + "px", height: this.size.height + "px" + }); + + if (!this._helper && this._proportionallyResizeElements.length) + this._proportionallyResize(); + + this._updateCache(data); + + // calling the user callback at the end + this._trigger('resize', event, this.ui()); + + return false; + }, + + _mouseStop: function(event) { + + this.resizing = false; + var o = this.options, that = this; + + if(this._helper) { + var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + if (!o.animate) + this.element.css($.extend(s, { top: top, left: left })); + + that.helper.height(that.size.height); + that.helper.width(that.size.width); + + if (this._helper && !o.animate) this._proportionallyResize(); + } + + $('body').css('cursor', 'auto'); + + this.element.removeClass("ui-resizable-resizing"); + + this._propagate("stop", event); + + if (this._helper) this.helper.remove(); + return false; + + }, + + _updateVirtualBoundaries: function(forceAspectRatio) { + var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + + b = { + minWidth: isNumber(o.minWidth) ? o.minWidth : 0, + maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, + minHeight: isNumber(o.minHeight) ? o.minHeight : 0, + maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity + }; + + if(this._aspectRatio || forceAspectRatio) { + // We want to create an enclosing box whose aspect ration is the requested one + // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; + if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; + if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; + if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + } + this._vBoundaries = b; + }, + + _updateCache: function(data) { + var o = this.options; + this.offset = this.helper.offset(); + if (isNumber(data.left)) this.position.left = data.left; + if (isNumber(data.top)) this.position.top = data.top; + if (isNumber(data.height)) this.size.height = data.height; + if (isNumber(data.width)) this.size.width = data.width; + }, + + _updateRatio: function(data, event) { + + var o = this.options, cpos = this.position, csize = this.size, a = this.axis; + + if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); + else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); + + if (a == 'sw') { + data.left = cpos.left + (csize.width - data.width); + data.top = null; + } + if (a == 'nw') { + data.top = cpos.top + (csize.height - data.height); + data.left = cpos.left + (csize.width - data.width); + } + + return data; + }, + + _respectSize: function(data, event) { + + var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); + + if (isminw) data.width = o.minWidth; + if (isminh) data.height = o.minHeight; + if (ismaxw) data.width = o.maxWidth; + if (ismaxh) data.height = o.maxHeight; + + var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; + var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + + if (isminw && cw) data.left = dw - o.minWidth; + if (ismaxw && cw) data.left = dw - o.maxWidth; + if (isminh && ch) data.top = dh - o.minHeight; + if (ismaxh && ch) data.top = dh - o.maxHeight; + + // fixing jump error on top/left - bug #2330 + var isNotwh = !data.width && !data.height; + if (isNotwh && !data.left && data.top) data.top = null; + else if (isNotwh && !data.top && data.left) data.left = null; + + return data; + }, + + _proportionallyResize: function() { + + var o = this.options; + if (!this._proportionallyResizeElements.length) return; + var element = this.helper || this.element; + + for (var i=0; i < this._proportionallyResizeElements.length; i++) { + + var prel = this._proportionallyResizeElements[i]; + + if (!this.borderDif) { + var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], + p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; + + this.borderDif = $.map(b, function(v, i) { + var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; + return border + padding; + }); + } + + prel.css({ + height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, + width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 + }); + + }; + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if(this._helper) { + + this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); + + // fix ie6 offset TODO: This seems broken + var ie6offset = ($.ui.ie6 ? 1 : 0), + pxyoffset = ( $.ui.ie6 ? 2 : -1 ); + + this.helper.addClass(this._helper).css({ + width: this.element.outerWidth() + pxyoffset, + height: this.element.outerHeight() + pxyoffset, + position: 'absolute', + left: this.elementOffset.left - ie6offset +'px', + top: this.elementOffset.top - ie6offset +'px', + zIndex: ++o.zIndex //TODO: Don't modify option + }); + + this.helper + .appendTo("body") + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function(event, dx, dy) { + return { width: this.originalSize.width + dx }; + }, + w: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function(event, dx, dy) { + var o = this.options, cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function(event, dx, dy) { + return { height: this.originalSize.height + dy }; + }, + se: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + sw: function(event, dx, dy) { + return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + }, + ne: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); + }, + nw: function(event, dx, dy) { + return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); + } + }, + + _propagate: function(n, event) { + $.ui.plugin.call(this, n, [event, this.ui()]); + (n != "resize" && this._trigger(n, event, this.ui())); + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +}); + +/* + * Resizable Extensions + */ + +$.ui.plugin.add("resizable", "alsoResize", { + + start: function (event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var _store = function (exp) { + $(exp).each(function() { + var el = $(this); + el.data("resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) + }); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } + }else{ + _store(o.alsoResize); + } + }, + + resize: function (event, ui) { + var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition; + + var delta = { + height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, + top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 + }, + + _alsoResize = function (exp, c) { + $(exp).each(function() { + var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; + + $.each(css, function (i, prop) { + var sum = (start[prop]||0) + (delta[prop]||0); + if (sum && sum >= 0) + style[prop] = sum || null; + }); + + el.css(style); + }); + }; + + if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); + }else{ + _alsoResize(o.alsoResize); + } + }, + + stop: function (event, ui) { + $(this).removeData("resizable-alsoresize"); + } +}); + +$.ui.plugin.add("resizable", "animate", { + + stop: function(event, ui) { + var that = $(this).data("resizable"), o = that.options; + + var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width; + + var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, + left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + + that.element.animate( + $.extend(style, top && left ? { top: top, left: left } : {}), { + duration: o.animateDuration, + easing: o.animateEasing, + step: function() { + + var data = { + width: parseInt(that.element.css('width'), 10), + height: parseInt(that.element.css('height'), 10), + top: parseInt(that.element.css('top'), 10), + left: parseInt(that.element.css('left'), 10) + }; + + if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); + + // propagating resize, and updating values for each animation step + that._updateCache(data); + that._propagate("resize", event); + + } + } + ); + } + +}); + +$.ui.plugin.add("resizable", "containment", { + + start: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, el = that.element; + var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; + if (!ce) return; + + that.containerElement = $(ce); + + if (/document/.test(oc) || oc == document) { + that.containerOffset = { left: 0, top: 0 }; + that.containerPosition = { left: 0, top: 0 }; + + that.parentData = { + element: $(document), left: 0, top: 0, + width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight + }; + } + + // i'm a node, so compute top, left, right, bottom + else { + var element = $(ce), p = []; + $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); + + that.containerOffset = element.offset(); + that.containerPosition = element.position(); + that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; + + var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width, + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); + + that.parentData = { + element: ce, left: co.left, top: co.top, width: width, height: height + }; + } + }, + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, + ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position, + pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement; + + if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; + + if (cp.left < (that._helper ? co.left : 0)) { + that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + that.position.left = o.helper ? co.left : 0; + } + + if (cp.top < (that._helper ? co.top : 0)) { + that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + that.position.top = that._helper ? co.top : 0; + } + + that.offset.left = that.parentData.left+that.position.left; + that.offset.top = that.parentData.top+that.position.top; + + var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ), + hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); + + var isParent = that.containerElement.get(0) == that.element.parent().get(0), + isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position')); + + if(isParent && isOffsetRelative) woset -= that.parentData.left; + + if (woset + that.size.width >= that.parentData.width) { + that.size.width = that.parentData.width - woset; + if (pRatio) that.size.height = that.size.width / that.aspectRatio; + } + + if (hoset + that.size.height >= that.parentData.height) { + that.size.height = that.parentData.height - hoset; + if (pRatio) that.size.width = that.size.height * that.aspectRatio; + } + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options, cp = that.position, + co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement; + + var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; + + if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + if (that._helper && !o.animate && (/static/).test(ce.css('position'))) + $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + + } +}); + +$.ui.plugin.add("resizable", "ghost", { + + start: function(event, ui) { + + var that = $(this).data("resizable"), o = that.options, cs = that.size; + + that.ghost = that.originalElement.clone(); + that.ghost + .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) + .addClass('ui-resizable-ghost') + .addClass(typeof o.ghost == 'string' ? o.ghost : ''); + + that.ghost.appendTo(that.helper); + + }, + + resize: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width }); + }, + + stop: function(event, ui){ + var that = $(this).data("resizable"), o = that.options; + if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0)); + } + +}); + +$.ui.plugin.add("resizable", "grid", { + + resize: function(event, ui) { + var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey; + o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; + var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); + + if (/^(se|s|e)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + } + else if (/^(ne)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + } + else if (/^(sw)$/.test(a)) { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.left = op.left - ox; + } + else { + that.size.width = os.width + ox; + that.size.height = os.height + oy; + that.position.top = op.top - oy; + that.position.left = op.left - ox; + } + } + +}); + +$.ui.plugin.add("resizable", "iframeFix", { + start: function (event, ui) { + var o = $(this).data('resizable').options; + $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function () { + $('<div class="ui-resizable-iframeFix" style="background: #fff;"></div>') + .css({ + width: this.offsetWidth + "px", height: this.offsetHeight + "px", + position: "absolute", opacity: "0.001", zIndex: 1000 + }) + .css($(this).offset()) + .appendTo("body"); + }); + }, + stop: function (event, ui) { + $("div.ui-resizable-iframeFix").each(function () { + this.parentNode.removeChild(this); + }); + } +}); + +var num = function(v) { + return parseInt(v, 10) || 0; +}; + +var isNumber = function(value) { + return !isNaN(parseInt(value, 10)); +}; + +})(jQuery); + +(function( $, undefined ) { + +$.widget("ui.selectable", $.ui.mouse, { + version: "1.9.2", + options: { + appendTo: 'body', + autoRefresh: true, + distance: 0, + filter: '*', + tolerance: 'touch' + }, + _create: function() { + var that = this; + + this.element.addClass("ui-selectable"); + + this.dragged = false; + + // cache selectee children based on filter + var selectees; + this.refresh = function() { + selectees = $(that.options.filter, that.element[0]); + selectees.addClass("ui-selectee"); + selectees.each(function() { + var $this = $(this); + var pos = $this.offset(); + $.data(this, "selectable-item", { + element: this, + $element: $this, + left: pos.left, + top: pos.top, + right: pos.left + $this.outerWidth(), + bottom: pos.top + $this.outerHeight(), + startselected: false, + selected: $this.hasClass('ui-selected'), + selecting: $this.hasClass('ui-selecting'), + unselecting: $this.hasClass('ui-unselecting') + }); + }); + }; + this.refresh(); + + this.selectees = selectees.addClass("ui-selectee"); + + this._mouseInit(); + + this.helper = $("<div class='ui-selectable-helper'></div>"); + }, + + _destroy: function() { + this.selectees + .removeClass("ui-selectee") + .removeData("selectable-item"); + this.element + .removeClass("ui-selectable ui-selectable-disabled"); + this._mouseDestroy(); + }, + + _mouseStart: function(event) { + var that = this; + + this.opos = [event.pageX, event.pageY]; + + if (this.options.disabled) + return; + + var options = this.options; + + this.selectees = $(options.filter, this.element[0]); + + this._trigger("start", event); + + $(options.appendTo).append(this.helper); + // position helper (lasso) + this.helper.css({ + "left": event.clientX, + "top": event.clientY, + "width": 0, + "height": 0 + }); + + if (options.autoRefresh) { + this.refresh(); + } + + this.selectees.filter('.ui-selected').each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.startselected = true; + if (!event.metaKey && !event.ctrlKey) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + }); + + $(event.target).parents().andSelf().each(function() { + var selectee = $.data(this, "selectable-item"); + if (selectee) { + var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); + selectee.$element + .removeClass(doSelect ? "ui-unselecting" : "ui-selected") + .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); + selectee.unselecting = !doSelect; + selectee.selecting = doSelect; + selectee.selected = doSelect; + // selectable (UN)SELECTING callback + if (doSelect) { + that._trigger("selecting", event, { + selecting: selectee.element + }); + } else { + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + return false; + } + }); + + }, + + _mouseDrag: function(event) { + var that = this; + this.dragged = true; + + if (this.options.disabled) + return; + + var options = this.options; + + var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; + if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); + + this.selectees.each(function() { + var selectee = $.data(this, "selectable-item"); + //prevent helper from being selected if appendTo: selectable + if (!selectee || selectee.element == that.element[0]) + return; + var hit = false; + if (options.tolerance == 'touch') { + hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); + } else if (options.tolerance == 'fit') { + hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); + } + + if (hit) { + // SELECT + if (selectee.selected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + } + if (selectee.unselecting) { + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + } + if (!selectee.selecting) { + selectee.$element.addClass('ui-selecting'); + selectee.selecting = true; + // selectable SELECTING callback + that._trigger("selecting", event, { + selecting: selectee.element + }); + } + } else { + // UNSELECT + if (selectee.selecting) { + if ((event.metaKey || event.ctrlKey) && selectee.startselected) { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + selectee.$element.addClass('ui-selected'); + selectee.selected = true; + } else { + selectee.$element.removeClass('ui-selecting'); + selectee.selecting = false; + if (selectee.startselected) { + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + } + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + if (selectee.selected) { + if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { + selectee.$element.removeClass('ui-selected'); + selectee.selected = false; + + selectee.$element.addClass('ui-unselecting'); + selectee.unselecting = true; + // selectable UNSELECTING callback + that._trigger("unselecting", event, { + unselecting: selectee.element + }); + } + } + } + }); + + return false; + }, + + _mouseStop: function(event) { + var that = this; + + this.dragged = false; + + var options = this.options; + + $('.ui-unselecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-unselecting'); + selectee.unselecting = false; + selectee.startselected = false; + that._trigger("unselected", event, { + unselected: selectee.element + }); + }); + $('.ui-selecting', this.element[0]).each(function() { + var selectee = $.data(this, "selectable-item"); + selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.selecting = false; + selectee.selected = true; + selectee.startselected = true; + that._trigger("selected", event, { + selected: selectee.element + }); + }); + this._trigger("stop", event); + + this.helper.remove(); + + return false; + } + +}); + +})(jQuery); + +(function( $, undefined ) { + +$.widget("ui.sortable", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "sort", + ready: false, + options: { + appendTo: "parent", + axis: false, + connectWith: false, + containment: false, + cursor: 'auto', + cursorAt: false, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: '> *', + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000 + }, + _create: function() { + + var o = this.options; + this.containerCache = {}; + this.element.addClass("ui-sortable"); + + //Get the items + this.refresh(); + + //Let's determine if the items are being displayed horizontally + this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + //We're ready to go + this.ready = true + + }, + + _destroy: function() { + this.element + .removeClass("ui-sortable ui-sortable-disabled"); + this._mouseDestroy(); + + for ( var i = this.items.length - 1; i >= 0; i-- ) + this.items[i].item.removeData(this.widgetName + "-item"); + + return this; + }, + + _setOption: function(key, value){ + if ( key === "disabled" ) { + this.options[ key ] = value; + + this.widget().toggleClass( "ui-sortable-disabled", !!value ); + } else { + // Don't call widget base _setOption for disable as it adds ui-state-disabled class + $.Widget.prototype._setOption.apply(this, arguments); + } + }, + + _mouseCapture: function(event, overrideHandle) { + var that = this; + + if (this.reverting) { + return false; + } + + if(this.options.disabled || this.options.type == 'static') return false; + + //We have to refresh the items data once first + this._refreshItems(event); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + var currentItem = null, nodes = $(event.target).parents().each(function() { + if($.data(this, that.widgetName + '-item') == that) { + currentItem = $(this); + return false; + } + }); + if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target); + + if(!currentItem) return false; + if(this.options.handle && !overrideHandle) { + var validHandle = false; + + $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); + if(!validHandle) return false; + } + + this.currentItem = currentItem; + this._removeCurrentsFromItems(); + return true; + + }, + + _mouseStart: function(event, overrideHandle, noActivation) { + + var o = this.options; + this.currentContainer = this; + + //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture + this.refreshPositions(); + + //Create and append the visible helper + this.helper = this._createHelper(event); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Get the next scrolling parent + this.scrollParent = this.helper.scrollParent(); + + //The element's absolute position on the page minus margins + this.offset = this.currentItem.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend(this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper + }); + + // Only after we got the offset, we can change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css("position", "absolute"); + this.cssPosition = this.helper.css("position"); + + //Generate the original position + this.originalPosition = this._generatePosition(event); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); + + //Cache the former DOM position + this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; + + //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way + if(this.helper[0] != this.currentItem[0]) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Set a containment if given in the options + if(o.containment) + this._setContainment(); + + if(o.cursor) { // cursor option + if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); + $('body').css("cursor", o.cursor); + } + + if(o.opacity) { // opacity option + if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); + this.helper.css("opacity", o.opacity); + } + + if(o.zIndex) { // zIndex option + if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); + this.helper.css("zIndex", o.zIndex); + } + + //Prepare scrolling + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') + this.overflowOffset = this.scrollParent.offset(); + + //Call callbacks + this._trigger("start", event, this._uiHash()); + + //Recache the helper size + if(!this._preserveHelperProportions) + this._cacheHelperProportions(); + + + //Post 'activate' events to possible containers + if(!noActivation) { + for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); } + } + + //Prepare possible droppables + if($.ui.ddmanager) + $.ui.ddmanager.current = this; + + if ($.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + + this.dragging = true; + + this.helper.addClass("ui-sortable-helper"); + this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position + return true; + + }, + + _mouseDrag: function(event) { + + //Compute the helpers position + this.position = this._generatePosition(event); + this.positionAbs = this._convertPositionTo("absolute"); + + if (!this.lastPositionAbs) { + this.lastPositionAbs = this.positionAbs; + } + + //Do scrolling + if(this.options.scroll) { + var o = this.options, scrolled = false; + if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { + + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; + else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) + this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; + else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) + this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + + } else { + + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); + else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); + else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + + } + + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + $.ui.ddmanager.prepareOffsets(this, event); + } + + //Regenerate the absolute position used for position checks + this.positionAbs = this._convertPositionTo("absolute"); + + //Set the helper position + if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; + if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + + //Rearrange + for (var i = this.items.length - 1; i >= 0; i--) { + + //Cache variables and intersection, continue if no intersection + var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); + if (!intersection) continue; + + // Only put the placeholder inside the current Container, skip all + // items form other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this moving items in "sub-sortables" can cause the placeholder to jitter + // beetween the outer and inner container. + if (item.instance !== this.currentContainer) continue; + + if (itemElement != this.currentItem[0] //cannot intersect with itself + && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before + && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked + && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) + //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container + ) { + + this.direction = intersection == 1 ? "down" : "up"; + + if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { + this._rearrange(event, item); + } else { + break; + } + + this._trigger("change", event, this._uiHash()); + break; + } + } + + //Post events to containers + this._contactContainers(event); + + //Interconnect with droppables + if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + + //Call callbacks + this._trigger('sort', event, this._uiHash()); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function(event, noPropagation) { + + if(!event) return; + + //If we are using droppables, inform the manager about the drop + if ($.ui.ddmanager && !this.options.dropBehaviour) + $.ui.ddmanager.drop(this, event); + + if(this.options.revert) { + var that = this; + var cur = this.placeholder.offset(); + + this.reverting = true; + + $(this.helper).animate({ + left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), + top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) + }, parseInt(this.options.revert, 10) || 500, function() { + that._clear(event); + }); + } else { + this._clear(event, noPropagation); + } + + return false; + + }, + + cancel: function() { + + if(this.dragging) { + + this._mouseUp({ target: null }); + + if(this.options.helper == "original") + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + else + this.currentItem.show(); + + //Post deactivating events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + this.containers[i]._trigger("deactivate", null, this._uiHash(this)); + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", null, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); + + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } + } + + return this; + + }, + + serialize: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var str = []; o = o || {}; + + $(items).each(function() { + var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); + if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); + }); + + if(!str.length && o.key) { + str.push(o.key + '='); + } + + return str.join('&'); + + }, + + toArray: function(o) { + + var items = this._getItemsAsjQuery(o && o.connected); + var ret = []; o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function(item) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height; + + var l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height; + + var dyClick = this.offset.click.top, + dxClick = this.offset.click.left; + + var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; + + if( this.options.tolerance == "pointer" + || this.options.forcePointerForContainers + || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) + ) { + return isOverElement; + } else { + + return (l < x1 + (this.helperProportions.width / 2) // Right Half + && x2 - (this.helperProportions.width / 2) < r // Left Half + && t < y1 + (this.helperProportions.height / 2) // Bottom Half + && y2 - (this.helperProportions.height / 2) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function(item) { + + var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + isOverElement = isOverElementHeight && isOverElementWidth, + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (!isOverElement) + return false; + + return this.floating ? + ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); + + }, + + _intersectsWithSides: function(item) { + + var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + verticalDirection = this._getDragVerticalDirection(), + horizontalDirection = this._getDragHorizontalDirection(); + + if (this.floating && horizontalDirection) { + return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); + } else { + return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta != 0 && (delta > 0 ? "down" : "up"); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta != 0 && (delta > 0 ? "right" : "left"); + }, + + refresh: function(event) { + this._refreshItems(event); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor == String + ? [options.connectWith] + : options.connectWith; + }, + + _getItemsAsjQuery: function(connected) { + + var items = []; + var queries = []; + var connectWith = this._connectWith(); + + if(connectWith && connected) { + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); + } + }; + }; + } + + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); + + for (var i = queries.length - 1; i >= 0; i--){ + queries[i][0].each(function() { + items.push(this); + }); + }; + + return $(items); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); + + this.items = $.grep(this.items, function (item) { + for (var j=0; j < list.length; j++) { + if(list[j] == item.item[0]) + return false; + }; + return true; + }); + + }, + + _refreshItems: function(event) { + + this.items = []; + this.containers = [this]; + var items = this.items; + var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; + var connectWith = this._connectWith(); + + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down + for (var i = connectWith.length - 1; i >= 0; i--){ + var cur = $(connectWith[i]); + for (var j = cur.length - 1; j >= 0; j--){ + var inst = $.data(cur[j], this.widgetName); + if(inst && inst != this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); + this.containers.push(inst); + } + }; + }; + } + + for (var i = queries.length - 1; i >= 0; i--) { + var targetData = queries[i][1]; + var _queries = queries[i][0]; + + for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { + var item = $(_queries[j]); + + item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) + + items.push({ + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + }); + }; + }; + + }, + + refreshPositions: function(fast) { + + //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change + if(this.offsetParent && this.helper) { + this.offset.parent = this._getParentOffset(); + } + + for (var i = this.items.length - 1; i >= 0; i--){ + var item = this.items[i]; + + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + continue; + + var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + + if (!fast) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + var p = t.offset(); + item.left = p.left; + item.top = p.top; + }; + + if(this.options.custom && this.options.custom.refreshContainers) { + this.options.custom.refreshContainers.call(this); + } else { + for (var i = this.containers.length - 1; i >= 0; i--){ + var p = this.containers[i].element.offset(); + this.containers[i].containerCache.left = p.left; + this.containers[i].containerCache.top = p.top; + this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); + this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); + }; + } + + return this; + }, + + _createPlaceholder: function(that) { + that = that || this; + var o = that.options; + + if(!o.placeholder || o.placeholder.constructor == String) { + var className = o.placeholder; + o.placeholder = { + element: function() { + + var el = $(document.createElement(that.currentItem[0].nodeName)) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper")[0]; + + if(!className) + el.style.visibility = "hidden"; + + return el; + }, + update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified + if(className && !o.forcePlaceholderSize) return; + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item + if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }; + if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }; + } + }; + } + + //Create the placeholder + that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); + + //Append it after the actual current item + that.currentItem.after(that.placeholder); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update(that, that.placeholder); + + }, + + _contactContainers: function(event) { + + // get innermost container that intersects with item + var innermostContainer = null, innermostIndex = null; + + + for (var i = this.containers.length - 1; i >= 0; i--){ + + // never consider a container that's located within the item itself + if($.contains(this.currentItem[0], this.containers[i].element[0])) + continue; + + if(this._intersectsWith(this.containers[i].containerCache)) { + + // if we've already found a container and it's more "inner" than this, then continue + if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) + continue; + + innermostContainer = this.containers[i]; + innermostIndex = i; + + } else { + // container doesn't intersect. trigger "out" event if necessary + if(this.containers[i].containerCache.over) { + this.containers[i]._trigger("out", event, this._uiHash(this)); + this.containers[i].containerCache.over = 0; + } + } + + } + + // if no intersecting containers found, return + if(!innermostContainer) return; + + // move the item into the container if it's not there already + if(this.containers.length === 1) { + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } else { + + //When entering a new container, we will find the item with the least distance and append our item near it + var dist = 10000; var itemWithLeastDistance = null; + var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top'; + var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height'; + var base = this.positionAbs[posProperty] + this.offset.click[posProperty]; + for (var j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; + if(this.items[j].item[0] == this.currentItem[0]) continue; + var cur = this.items[j].item.offset()[posProperty]; + var nearBottom = false; + if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){ + nearBottom = true; + cur += this.items[j][sizeProperty]; + } + + if(Math.abs(cur - base) < dist) { + dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; + this.direction = nearBottom ? "up": "down"; + } + } + + if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + return; + + this.currentContainer = this.containers[innermostIndex]; + itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); + this._trigger("change", event, this._uiHash()); + this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + + //Update the placeholder + this.options.placeholder.update(this.currentContainer, this.placeholder); + + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } + + + }, + + _createHelper: function(event) { + + var o = this.options; + var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); + + if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already + $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + + if(helper[0] == this.currentItem[0]) + this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; + + if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); + if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); + + return helper; + + }, + + _adjustOffsetFromHelper: function(obj) { + if (typeof obj == 'string') { + obj = obj.split(' '); + } + if ($.isArray(obj)) { + obj = {left: +obj[0], top: +obj[1] || 0}; + } + if ('left' in obj) { + this.offset.click.left = obj.left + this.margins.left; + } + if ('right' in obj) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ('top' in obj) { + this.offset.click.top = obj.top + this.margins.top; + } + if ('bottom' in obj) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that + // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag + if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information + || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + po = { top: 0, left: 0 }; + + return { + top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), + left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) + }; + + }, + + _getRelativeOffset: function() { + + if(this.cssPosition == "relative") { + var p = this.currentItem.position(); + return { + top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), + left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), + top: (parseInt(this.currentItem.css("marginTop"),10) || 0) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var o = this.options; + if(o.containment == 'parent') o.containment = this.helper[0].parentNode; + if(o.containment == 'document' || o.containment == 'window') this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + + if(!(/^(document|window|parent)$/).test(o.containment)) { + var ce = $(o.containment)[0]; + var co = $(o.containment).offset(); + var over = ($(ce).css("overflow") != 'hidden'); + + this.containment = [ + co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, + co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, + co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, + co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function(d, pos) { + + if(!pos) pos = this.position; + var mod = d == "absolute" ? 1 : -1; + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + return { + top: ( + pos.top // The absolute mouse position + + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + ), + left: ( + pos.left // The absolute mouse position + + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent + + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) + - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + ) + }; + + }, + + _generatePosition: function(event) { + + var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + this.offset.relative = this._getRelativeOffset(); + } + + var pageX = event.pageX; + var pageY = event.pageY; + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if(this.originalPosition) { //If we are not dragging yet, we won't check for options + + if(this.containment) { + if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; + if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; + if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; + if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + } + + if(o.grid) { + var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + + var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + } + + } + + return { + top: ( + pageY // The absolute mouse position + - this.offset.click.top // Click offset (relative to the element) + - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.top // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + ), + left: ( + pageX // The absolute mouse position + - this.offset.click.left // Click offset (relative to the element) + - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent + - this.offset.parent.left // The offsetParent's offset without borders (offset + border) + + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + ) + }; + + }, + + _rearrange: function(event, i, a, hardRefresh) { + + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay(function() { + if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + }); + + }, + + _clear: function(event, noPropagation) { + + this.reverting = false; + // We delay all events that have to be triggered to after the point where the placeholder has been removed and + // everything else normalized again + var delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) + if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); + this._noFinalSort = null; + + if(this.helper[0] == this.currentItem[0]) { + for(var i in this._storedCSS) { + if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; + } + this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + } else { + this.currentItem.show(); + } + + if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + + // Check if the items Container has Changed and trigger appropriate + // events. + if (this !== this.currentContainer) { + if(!noPropagation) { + delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); + delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); + } + } + + + //Post events to containers + for (var i = this.containers.length - 1; i >= 0; i--){ + if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + if(this.containers[i].containerCache.over) { + delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + this.containers[i].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor + if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity + if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index + + this.dragging = false; + if(this.cancelHelperRemoval) { + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return false; + } + + if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + + if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; + + if(!noPropagation) { + for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + this._trigger("stop", event, this._uiHash()); + } + + this.fromOutside = false; + return true; + + }, + + _trigger: function() { + if ($.Widget.prototype._trigger.apply(this, arguments) === false) { + this.cancel(); + } + }, + + _uiHash: function(_inst) { + var inst = _inst || this; + return { + helper: inst.helper, + placeholder: inst.placeholder || $([]), + position: inst.position, + originalPosition: inst.originalPosition, + offset: inst.positionAbs, + item: inst.currentItem, + sender: _inst ? _inst.element : null + }; + } + +}); + +})(jQuery); + +;(jQuery.effects || (function($, undefined) { + +var backCompat = $.uiBackCompat !== false, + // prefix used for storing data on .data() + dataSpace = "ui-effects-"; + +$.effects = { + effect: {} +}; + +/*! + * jQuery Color Animations v2.0.0 + * http://jquery.com/ + * + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * Date: Mon Aug 13 13:41:02 2012 -0500 + */ +(function( jQuery, undefined ) { + + var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "), + + // plusequals test for += 100 -= 100 + rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, + // a set of RE's that can match strings and generate color tuples. + stringParsers = [{ + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ], + execResult[ 3 ], + execResult[ 4 ] + ]; + } + }, { + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + parse: function( execResult ) { + return [ + execResult[ 1 ] * 2.55, + execResult[ 2 ] * 2.55, + execResult[ 3 ] * 2.55, + execResult[ 4 ] + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ], 16 ) + ]; + } + }, { + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, + parse: function( execResult ) { + return [ + parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), + parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), + parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) + ]; + } + }, { + re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + space: "hsla", + parse: function( execResult ) { + return [ + execResult[ 1 ], + execResult[ 2 ] / 100, + execResult[ 3 ] / 100, + execResult[ 4 ] + ]; + } + }], + + // jQuery.Color( ) + color = jQuery.Color = function( color, green, blue, alpha ) { + return new jQuery.Color.fn.parse( color, green, blue, alpha ); + }, + spaces = { + rgba: { + props: { + red: { + idx: 0, + type: "byte" + }, + green: { + idx: 1, + type: "byte" + }, + blue: { + idx: 2, + type: "byte" + } + } + }, + + hsla: { + props: { + hue: { + idx: 0, + type: "degrees" + }, + saturation: { + idx: 1, + type: "percent" + }, + lightness: { + idx: 2, + type: "percent" + } + } + } + }, + propTypes = { + "byte": { + floor: true, + max: 255 + }, + "percent": { + max: 1 + }, + "degrees": { + mod: 360, + floor: true + } + }, + support = color.support = {}, + + // element for support tests + supportElem = jQuery( "<p>" )[ 0 ], + + // colors = jQuery.Color.names + colors, + + // local aliases of functions called often + each = jQuery.each; + +// determine rgba support immediately +supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; +support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; + +// define cache name and alpha properties +// for rgba and hsla spaces +each( spaces, function( spaceName, space ) { + space.cache = "_" + spaceName; + space.props.alpha = { + idx: 3, + type: "percent", + def: 1 + }; +}); + +function clamp( value, prop, allowEmpty ) { + var type = propTypes[ prop.type ] || {}; + + if ( value == null ) { + return (allowEmpty || !prop.def) ? null : prop.def; + } + + // ~~ is an short way of doing floor for positive numbers + value = type.floor ? ~~value : parseFloat( value ); + + // IE will pass in empty strings as value for alpha, + // which will hit this case + if ( isNaN( value ) ) { + return prop.def; + } + + if ( type.mod ) { + // we add mod before modding to make sure that negatives values + // get converted properly: -10 -> 350 + return (value + type.mod) % type.mod; + } + + // for now all property types without mod have min and max + return 0 > value ? 0 : type.max < value ? type.max : value; +} + +function stringParse( string ) { + var inst = color(), + rgba = inst._rgba = []; + + string = string.toLowerCase(); + + each( stringParsers, function( i, parser ) { + var parsed, + match = parser.re.exec( string ), + values = match && parser.parse( match ), + spaceName = parser.space || "rgba"; + + if ( values ) { + parsed = inst[ spaceName ]( values ); + + // if this was an rgba parse the assignment might happen twice + // oh well.... + inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; + rgba = inst._rgba = parsed._rgba; + + // exit each( stringParsers ) here because we matched + return false; + } + }); + + // Found a stringParser that handled it + if ( rgba.length ) { + + // if this came from a parsed string, force "transparent" when alpha is 0 + // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) + if ( rgba.join() === "0,0,0,0" ) { + jQuery.extend( rgba, colors.transparent ); + } + return inst; + } + + // named colors + return colors[ string ]; +} + +color.fn = jQuery.extend( color.prototype, { + parse: function( red, green, blue, alpha ) { + if ( red === undefined ) { + this._rgba = [ null, null, null, null ]; + return this; + } + if ( red.jquery || red.nodeType ) { + red = jQuery( red ).css( green ); + green = undefined; + } + + var inst = this, + type = jQuery.type( red ), + rgba = this._rgba = []; + + // more than 1 argument specified - assume ( red, green, blue, alpha ) + if ( green !== undefined ) { + red = [ red, green, blue, alpha ]; + type = "array"; + } + + if ( type === "string" ) { + return this.parse( stringParse( red ) || colors._default ); + } + + if ( type === "array" ) { + each( spaces.rgba.props, function( key, prop ) { + rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); + }); + return this; + } + + if ( type === "object" ) { + if ( red instanceof color ) { + each( spaces, function( spaceName, space ) { + if ( red[ space.cache ] ) { + inst[ space.cache ] = red[ space.cache ].slice(); + } + }); + } else { + each( spaces, function( spaceName, space ) { + var cache = space.cache; + each( space.props, function( key, prop ) { + + // if the cache doesn't exist, and we know how to convert + if ( !inst[ cache ] && space.to ) { + + // if the value was null, we don't need to copy it + // if the key was alpha, we don't need to copy it either + if ( key === "alpha" || red[ key ] == null ) { + return; + } + inst[ cache ] = space.to( inst._rgba ); + } + + // this is the only case where we allow nulls for ALL properties. + // call clamp with alwaysAllowEmpty + inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); + }); + + // everything defined but alpha? + if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + // use the default of 1 + inst[ cache ][ 3 ] = 1; + if ( space.from ) { + inst._rgba = space.from( inst[ cache ] ); + } + } + }); + } + return this; + } + }, + is: function( compare ) { + var is = color( compare ), + same = true, + inst = this; + + each( spaces, function( _, space ) { + var localCache, + isCache = is[ space.cache ]; + if (isCache) { + localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; + each( space.props, function( _, prop ) { + if ( isCache[ prop.idx ] != null ) { + same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); + return same; + } + }); + } + return same; + }); + return same; + }, + _space: function() { + var used = [], + inst = this; + each( spaces, function( spaceName, space ) { + if ( inst[ space.cache ] ) { + used.push( spaceName ); + } + }); + return used.pop(); + }, + transition: function( other, distance ) { + var end = color( other ), + spaceName = end._space(), + space = spaces[ spaceName ], + startColor = this.alpha() === 0 ? color( "transparent" ) : this, + start = startColor[ space.cache ] || space.to( startColor._rgba ), + result = start.slice(); + + end = end[ space.cache ]; + each( space.props, function( key, prop ) { + var index = prop.idx, + startValue = start[ index ], + endValue = end[ index ], + type = propTypes[ prop.type ] || {}; + + // if null, don't override start value + if ( endValue === null ) { + return; + } + // if null - use end + if ( startValue === null ) { + result[ index ] = endValue; + } else { + if ( type.mod ) { + if ( endValue - startValue > type.mod / 2 ) { + startValue += type.mod; + } else if ( startValue - endValue > type.mod / 2 ) { + startValue -= type.mod; + } + } + result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); + } + }); + return this[ spaceName ]( result ); + }, + blend: function( opaque ) { + // if we are already opaque - return ourself + if ( this._rgba[ 3 ] === 1 ) { + return this; + } + + var rgb = this._rgba.slice(), + a = rgb.pop(), + blend = color( opaque )._rgba; + + return color( jQuery.map( rgb, function( v, i ) { + return ( 1 - a ) * blend[ i ] + a * v; + })); + }, + toRgbaString: function() { + var prefix = "rgba(", + rgba = jQuery.map( this._rgba, function( v, i ) { + return v == null ? ( i > 2 ? 1 : 0 ) : v; + }); + + if ( rgba[ 3 ] === 1 ) { + rgba.pop(); + prefix = "rgb("; + } + + return prefix + rgba.join() + ")"; + }, + toHslaString: function() { + var prefix = "hsla(", + hsla = jQuery.map( this.hsla(), function( v, i ) { + if ( v == null ) { + v = i > 2 ? 1 : 0; + } + + // catch 1 and 2 + if ( i && i < 3 ) { + v = Math.round( v * 100 ) + "%"; + } + return v; + }); + + if ( hsla[ 3 ] === 1 ) { + hsla.pop(); + prefix = "hsl("; + } + return prefix + hsla.join() + ")"; + }, + toHexString: function( includeAlpha ) { + var rgba = this._rgba.slice(), + alpha = rgba.pop(); + + if ( includeAlpha ) { + rgba.push( ~~( alpha * 255 ) ); + } + + return "#" + jQuery.map( rgba, function( v ) { + + // default to 0 when nulls exist + v = ( v || 0 ).toString( 16 ); + return v.length === 1 ? "0" + v : v; + }).join(""); + }, + toString: function() { + return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); + } +}); +color.fn.parse.prototype = color.fn; + +// hsla conversions adapted from: +// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 + +function hue2rgb( p, q, h ) { + h = ( h + 1 ) % 1; + if ( h * 6 < 1 ) { + return p + (q - p) * h * 6; + } + if ( h * 2 < 1) { + return q; + } + if ( h * 3 < 2 ) { + return p + (q - p) * ((2/3) - h) * 6; + } + return p; +} + +spaces.hsla.to = function ( rgba ) { + if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { + return [ null, null, null, rgba[ 3 ] ]; + } + var r = rgba[ 0 ] / 255, + g = rgba[ 1 ] / 255, + b = rgba[ 2 ] / 255, + a = rgba[ 3 ], + max = Math.max( r, g, b ), + min = Math.min( r, g, b ), + diff = max - min, + add = max + min, + l = add * 0.5, + h, s; + + if ( min === max ) { + h = 0; + } else if ( r === max ) { + h = ( 60 * ( g - b ) / diff ) + 360; + } else if ( g === max ) { + h = ( 60 * ( b - r ) / diff ) + 120; + } else { + h = ( 60 * ( r - g ) / diff ) + 240; + } + + if ( l === 0 || l === 1 ) { + s = l; + } else if ( l <= 0.5 ) { + s = diff / add; + } else { + s = diff / ( 2 - add ); + } + return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; +}; + +spaces.hsla.from = function ( hsla ) { + if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { + return [ null, null, null, hsla[ 3 ] ]; + } + var h = hsla[ 0 ] / 360, + s = hsla[ 1 ], + l = hsla[ 2 ], + a = hsla[ 3 ], + q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, + p = 2 * l - q; + + return [ + Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), + Math.round( hue2rgb( p, q, h ) * 255 ), + Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), + a + ]; +}; + + +each( spaces, function( spaceName, space ) { + var props = space.props, + cache = space.cache, + to = space.to, + from = space.from; + + // makes rgba() and hsla() + color.fn[ spaceName ] = function( value ) { + + // generate a cache for this space if it doesn't exist + if ( to && !this[ cache ] ) { + this[ cache ] = to( this._rgba ); + } + if ( value === undefined ) { + return this[ cache ].slice(); + } + + var ret, + type = jQuery.type( value ), + arr = ( type === "array" || type === "object" ) ? value : arguments, + local = this[ cache ].slice(); + + each( props, function( key, prop ) { + var val = arr[ type === "object" ? key : prop.idx ]; + if ( val == null ) { + val = local[ prop.idx ]; + } + local[ prop.idx ] = clamp( val, prop ); + }); + + if ( from ) { + ret = color( from( local ) ); + ret[ cache ] = local; + return ret; + } else { + return color( local ); + } + }; + + // makes red() green() blue() alpha() hue() saturation() lightness() + each( props, function( key, prop ) { + // alpha is included in more than one space + if ( color.fn[ key ] ) { + return; + } + color.fn[ key ] = function( value ) { + var vtype = jQuery.type( value ), + fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), + local = this[ fn ](), + cur = local[ prop.idx ], + match; + + if ( vtype === "undefined" ) { + return cur; + } + + if ( vtype === "function" ) { + value = value.call( this, cur ); + vtype = jQuery.type( value ); + } + if ( value == null && prop.empty ) { + return this; + } + if ( vtype === "string" ) { + match = rplusequals.exec( value ); + if ( match ) { + value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); + } + } + local[ prop.idx ] = value; + return this[ fn ]( local ); + }; + }); +}); + +// add .fx.step functions +each( stepHooks, function( i, hook ) { + jQuery.cssHooks[ hook ] = { + set: function( elem, value ) { + var parsed, curElem, + backgroundColor = ""; + + if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { + value = color( parsed || value ); + if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { + curElem = hook === "backgroundColor" ? elem.parentNode : elem; + while ( + (backgroundColor === "" || backgroundColor === "transparent") && + curElem && curElem.style + ) { + try { + backgroundColor = jQuery.css( curElem, "backgroundColor" ); + curElem = curElem.parentNode; + } catch ( e ) { + } + } + + value = value.blend( backgroundColor && backgroundColor !== "transparent" ? + backgroundColor : + "_default" ); + } + + value = value.toRgbaString(); + } + try { + elem.style[ hook ] = value; + } catch( error ) { + // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' + } + } + }; + jQuery.fx.step[ hook ] = function( fx ) { + if ( !fx.colorInit ) { + fx.start = color( fx.elem, hook ); + fx.end = color( fx.end ); + fx.colorInit = true; + } + jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); + }; +}); + +jQuery.cssHooks.borderColor = { + expand: function( value ) { + var expanded = {}; + + each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { + expanded[ "border" + part + "Color" ] = value; + }); + return expanded; + } +}; + +// Basic color names only. +// Usage of any of the other color names requires adding yourself or including +// jquery.color.svg-names.js. +colors = jQuery.Color.names = { + // 4.1. Basic color keywords + aqua: "#00ffff", + black: "#000000", + blue: "#0000ff", + fuchsia: "#ff00ff", + gray: "#808080", + green: "#008000", + lime: "#00ff00", + maroon: "#800000", + navy: "#000080", + olive: "#808000", + purple: "#800080", + red: "#ff0000", + silver: "#c0c0c0", + teal: "#008080", + white: "#ffffff", + yellow: "#ffff00", + + // 4.2.3. "transparent" color keyword + transparent: [ null, null, null, 0 ], + + _default: "#ffffff" +}; + +})( jQuery ); + + + +/******************************************************************************/ +/****************************** CLASS ANIMATIONS ******************************/ +/******************************************************************************/ +(function() { + +var classAnimationActions = [ "add", "remove", "toggle" ], + shorthandStyles = { + border: 1, + borderBottom: 1, + borderColor: 1, + borderLeft: 1, + borderRight: 1, + borderTop: 1, + borderWidth: 1, + margin: 1, + padding: 1 + }; + +$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { + $.fx.step[ prop ] = function( fx ) { + if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { + jQuery.style( fx.elem, prop, fx.end ); + fx.setAttr = true; + } + }; +}); + +function getElementStyles() { + var style = this.ownerDocument.defaultView ? + this.ownerDocument.defaultView.getComputedStyle( this, null ) : + this.currentStyle, + newStyle = {}, + key, + len; + + // webkit enumerates style porperties + if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { + len = style.length; + while ( len-- ) { + key = style[ len ]; + if ( typeof style[ key ] === "string" ) { + newStyle[ $.camelCase( key ) ] = style[ key ]; + } + } + } else { + for ( key in style ) { + if ( typeof style[ key ] === "string" ) { + newStyle[ key ] = style[ key ]; + } + } + } + + return newStyle; +} + + +function styleDifference( oldStyle, newStyle ) { + var diff = {}, + name, value; + + for ( name in newStyle ) { + value = newStyle[ name ]; + if ( oldStyle[ name ] !== value ) { + if ( !shorthandStyles[ name ] ) { + if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { + diff[ name ] = value; + } + } + } + } + + return diff; +} + +$.effects.animateClass = function( value, duration, easing, callback ) { + var o = $.speed( duration, easing, callback ); + + return this.queue( function() { + var animated = $( this ), + baseClass = animated.attr( "class" ) || "", + applyClassChange, + allAnimations = o.children ? animated.find( "*" ).andSelf() : animated; + + // map the animated objects to store the original styles. + allAnimations = allAnimations.map(function() { + var el = $( this ); + return { + el: el, + start: getElementStyles.call( this ) + }; + }); + + // apply class change + applyClassChange = function() { + $.each( classAnimationActions, function(i, action) { + if ( value[ action ] ) { + animated[ action + "Class" ]( value[ action ] ); + } + }); + }; + applyClassChange(); + + // map all animated objects again - calculate new styles and diff + allAnimations = allAnimations.map(function() { + this.end = getElementStyles.call( this.el[ 0 ] ); + this.diff = styleDifference( this.start, this.end ); + return this; + }); + + // apply original class + animated.attr( "class", baseClass ); + + // map all animated objects again - this time collecting a promise + allAnimations = allAnimations.map(function() { + var styleInfo = this, + dfd = $.Deferred(), + opts = jQuery.extend({}, o, { + queue: false, + complete: function() { + dfd.resolve( styleInfo ); + } + }); + + this.el.animate( this.diff, opts ); + return dfd.promise(); + }); + + // once all animations have completed: + $.when.apply( $, allAnimations.get() ).done(function() { + + // set the final class + applyClassChange(); + + // for each animated element, + // clear all css properties that were animated + $.each( arguments, function() { + var el = this.el; + $.each( this.diff, function(key) { + el.css( key, '' ); + }); + }); + + // this is guarnteed to be there if you use jQuery.speed() + // it also handles dequeuing the next anim... + o.complete.call( animated[ 0 ] ); + }); + }); +}; + +$.fn.extend({ + _addClass: $.fn.addClass, + addClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { add: classNames }, speed, easing, callback ) : + this._addClass( classNames ); + }, + + _removeClass: $.fn.removeClass, + removeClass: function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { remove: classNames }, speed, easing, callback ) : + this._removeClass( classNames ); + }, + + _toggleClass: $.fn.toggleClass, + toggleClass: function( classNames, force, speed, easing, callback ) { + if ( typeof force === "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter + return this._toggleClass( classNames, force ); + } else { + return $.effects.animateClass.call( this, + (force ? { add: classNames } : { remove: classNames }), + speed, easing, callback ); + } + } else { + // without force parameter + return $.effects.animateClass.call( this, + { toggle: classNames }, force, speed, easing ); + } + }, + + switchClass: function( remove, add, speed, easing, callback) { + return $.effects.animateClass.call( this, { + add: add, + remove: remove + }, speed, easing, callback ); + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EFFECTS **********************************/ +/******************************************************************************/ + +(function() { + +$.extend( $.effects, { + version: "1.9.2", + + // Saves a set of properties in a data storage + save: function( element, set ) { + for( var i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); + } + } + }, + + // Restores a set of previously saved properties from a data storage + restore: function( element, set ) { + var val, i; + for( i=0; i < set.length; i++ ) { + if ( set[ i ] !== null ) { + val = element.data( dataSpace + set[ i ] ); + // support: jQuery 1.6.2 + // http://bugs.jquery.com/ticket/9917 + // jQuery 1.6.2 incorrectly returns undefined for any falsy value. + // We can't differentiate between "" and 0 here, so we just assume + // empty string since it's likely to be a more common value... + if ( val === undefined ) { + val = ""; + } + element.css( set[ i ], val ); + } + } + }, + + setMode: function( el, mode ) { + if (mode === "toggle") { + mode = el.is( ":hidden" ) ? "show" : "hide"; + } + return mode; + }, + + // Translates a [top,left] array into a baseline value + // this should be a little more flexible in the future to handle a string & hash + getBaseline: function( origin, original ) { + var y, x; + switch ( origin[ 0 ] ) { + case "top": y = 0; break; + case "middle": y = 0.5; break; + case "bottom": y = 1; break; + default: y = origin[ 0 ] / original.height; + } + switch ( origin[ 1 ] ) { + case "left": x = 0; break; + case "center": x = 0.5; break; + case "right": x = 1; break; + default: x = origin[ 1 ] / original.width; + } + return { + x: x, + y: y + }; + }, + + // Wraps the element around a wrapper that copies position properties + createWrapper: function( element ) { + + // if the element is already wrapped, return it + if ( element.parent().is( ".ui-effects-wrapper" )) { + return element.parent(); + } + + // wrap the element + var props = { + width: element.outerWidth(true), + height: element.outerHeight(true), + "float": element.css( "float" ) + }, + wrapper = $( "<div></div>" ) + .addClass( "ui-effects-wrapper" ) + .css({ + fontSize: "100%", + background: "transparent", + border: "none", + margin: 0, + padding: 0 + }), + // Store the size in case width/height are defined in % - Fixes #5245 + size = { + width: element.width(), + height: element.height() + }, + active = document.activeElement; + + // support: Firefox + // Firefox incorrectly exposes anonymous content + // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 + try { + active.id; + } catch( e ) { + active = document.body; + } + + element.wrap( wrapper ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + + wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element + + // transfer positioning properties to the wrapper + if ( element.css( "position" ) === "static" ) { + wrapper.css({ position: "relative" }); + element.css({ position: "relative" }); + } else { + $.extend( props, { + position: element.css( "position" ), + zIndex: element.css( "z-index" ) + }); + $.each([ "top", "left", "bottom", "right" ], function(i, pos) { + props[ pos ] = element.css( pos ); + if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { + props[ pos ] = "auto"; + } + }); + element.css({ + position: "relative", + top: 0, + left: 0, + right: "auto", + bottom: "auto" + }); + } + element.css(size); + + return wrapper.css( props ).show(); + }, + + removeWrapper: function( element ) { + var active = document.activeElement; + + if ( element.parent().is( ".ui-effects-wrapper" ) ) { + element.parent().replaceWith( element ); + + // Fixes #7595 - Elements lose focus when wrapped. + if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { + $( active ).focus(); + } + } + + + return element; + }, + + setTransition: function( element, list, factor, value ) { + value = value || {}; + $.each( list, function( i, x ) { + var unit = element.cssUnit( x ); + if ( unit[ 0 ] > 0 ) { + value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; + } + }); + return value; + } +}); + +// return an effect options object for the given parameters: +function _normalizeArguments( effect, options, speed, callback ) { + + // allow passing all options as the first parameter + if ( $.isPlainObject( effect ) ) { + options = effect; + effect = effect.effect; + } + + // convert to an object + effect = { effect: effect }; + + // catch (effect, null, ...) + if ( options == null ) { + options = {}; + } + + // catch (effect, callback) + if ( $.isFunction( options ) ) { + callback = options; + speed = null; + options = {}; + } + + // catch (effect, speed, ?) + if ( typeof options === "number" || $.fx.speeds[ options ] ) { + callback = speed; + speed = options; + options = {}; + } + + // catch (effect, options, callback) + if ( $.isFunction( speed ) ) { + callback = speed; + speed = null; + } + + // add options to effect + if ( options ) { + $.extend( effect, options ); + } + + speed = speed || options.duration; + effect.duration = $.fx.off ? 0 : + typeof speed === "number" ? speed : + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; + + effect.complete = callback || options.complete; + + return effect; +} + +function standardSpeed( speed ) { + // valid standard speeds + if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { + return true; + } + + // invalid strings - treat as "normal" speed + if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { + // TODO: remove in 2.0 (#7115) + if ( backCompat && $.effects[ speed ] ) { + return false; + } + return true; + } + + return false; +} + +$.fn.extend({ + effect: function( /* effect, options, speed, callback */ ) { + var args = _normalizeArguments.apply( this, arguments ), + mode = args.mode, + queue = args.queue, + effectMethod = $.effects.effect[ args.effect ], + + // DEPRECATED: remove in 2.0 (#7115) + oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + + if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { + // delegate to the original method (e.g., .show()) if possible + if ( mode ) { + return this[ mode ]( args.duration, args.complete ); + } else { + return this.each( function() { + if ( args.complete ) { + args.complete.call( this ); + } + }); + } + } + + function run( next ) { + var elem = $( this ), + complete = args.complete, + mode = args.mode; + + function done() { + if ( $.isFunction( complete ) ) { + complete.call( elem[0] ); + } + if ( $.isFunction( next ) ) { + next(); + } + } + + // if the element is hiddden and mode is hide, + // or element is visible and mode is show + if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { + done(); + } else { + effectMethod.call( elem[0], args, done ); + } + } + + // TODO: remove this check in 2.0, effectMethod will always be true + if ( effectMethod ) { + return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); + } else { + // DEPRECATED: remove in 2.0 (#7115) + return oldEffectMethod.call(this, { + options: args, + duration: args.duration, + callback: args.complete, + mode: args.mode + }); + } + }, + + _show: $.fn.show, + show: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._show.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "show"; + return this.effect.call( this, args ); + } + }, + + _hide: $.fn.hide, + hide: function( speed ) { + if ( standardSpeed( speed ) ) { + return this._hide.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "hide"; + return this.effect.call( this, args ); + } + }, + + // jQuery core overloads toggle and creates _toggle + __toggle: $.fn.toggle, + toggle: function( speed ) { + if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { + return this.__toggle.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "toggle"; + return this.effect.call( this, args ); + } + }, + + // helper functions + cssUnit: function(key) { + var style = this.css( key ), + val = []; + + $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { + if ( style.indexOf( unit ) > 0 ) { + val = [ parseFloat( style ), unit ]; + } + }); + return val; + } +}); + +})(); + +/******************************************************************************/ +/*********************************** EASING ***********************************/ +/******************************************************************************/ + +(function() { + +// based on easing equations from Robert Penner (http://www.robertpenner.com/easing) + +var baseEasings = {}; + +$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { + baseEasings[ name ] = function( p ) { + return Math.pow( p, i + 2 ); + }; +}); + +$.extend( baseEasings, { + Sine: function ( p ) { + return 1 - Math.cos( p * Math.PI / 2 ); + }, + Circ: function ( p ) { + return 1 - Math.sqrt( 1 - p * p ); + }, + Elastic: function( p ) { + return p === 0 || p === 1 ? p : + -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); + }, + Back: function( p ) { + return p * p * ( 3 * p - 2 ); + }, + Bounce: function ( p ) { + var pow2, + bounce = 4; + + while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} + return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); + } +}); + +$.each( baseEasings, function( name, easeIn ) { + $.easing[ "easeIn" + name ] = easeIn; + $.easing[ "easeOut" + name ] = function( p ) { + return 1 - easeIn( 1 - p ); + }; + $.easing[ "easeInOut" + name ] = function( p ) { + return p < 0.5 ? + easeIn( p * 2 ) / 2 : + 1 - easeIn( p * -2 + 2 ) / 2; + }; +}); + +})(); + +})(jQuery)); + +(function( $, undefined ) { + +var uid = 0, + hideProps = {}, + showProps = {}; + +hideProps.height = hideProps.paddingTop = hideProps.paddingBottom = + hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide"; +showProps.height = showProps.paddingTop = showProps.paddingBottom = + showProps.borderTopWidth = showProps.borderBottomWidth = "show"; + +$.widget( "ui.accordion", { + version: "1.9.2", + options: { + active: 0, + animate: {}, + collapsible: false, + event: "click", + header: "> li > :first-child,> :not(li):even", + heightStyle: "auto", + icons: { + activeHeader: "ui-icon-triangle-1-s", + header: "ui-icon-triangle-1-e" + }, + + // callbacks + activate: null, + beforeActivate: null + }, + + _create: function() { + var accordionId = this.accordionId = "ui-accordion-" + + (this.element.attr( "id" ) || ++uid), + options = this.options; + + this.prevShow = this.prevHide = $(); + this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); + + this.headers = this.element.find( options.header ) + .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); + this._hoverable( this.headers ); + this._focusable( this.headers ); + + this.headers.next() + .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) + .hide(); + + // don't allow collapsible: false and active: false / null + if ( !options.collapsible && (options.active === false || options.active == null) ) { + options.active = 0; + } + // handle negative values + if ( options.active < 0 ) { + options.active += this.headers.length; + } + this.active = this._findActive( options.active ) + .addClass( "ui-accordion-header-active ui-state-active" ) + .toggleClass( "ui-corner-all ui-corner-top" ); + this.active.next() + .addClass( "ui-accordion-content-active" ) + .show(); + + this._createIcons(); + this.refresh(); + + // ARIA + this.element.attr( "role", "tablist" ); + + this.headers + .attr( "role", "tab" ) + .each(function( i ) { + var header = $( this ), + headerId = header.attr( "id" ), + panel = header.next(), + panelId = panel.attr( "id" ); + if ( !headerId ) { + headerId = accordionId + "-header-" + i; + header.attr( "id", headerId ); + } + if ( !panelId ) { + panelId = accordionId + "-panel-" + i; + panel.attr( "id", panelId ); + } + header.attr( "aria-controls", panelId ); + panel.attr( "aria-labelledby", headerId ); + }) + .next() + .attr( "role", "tabpanel" ); + + this.headers + .not( this.active ) + .attr({ + "aria-selected": "false", + tabIndex: -1 + }) + .next() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }) + .hide(); + + // make sure at least one header is in the tab order + if ( !this.active.length ) { + this.headers.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active.attr({ + "aria-selected": "true", + tabIndex: 0 + }) + .next() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + } + + this._on( this.headers, { keydown: "_keydown" }); + this._on( this.headers.next(), { keydown: "_panelKeyDown" }); + this._setupEvents( options.event ); + }, + + _getCreateEventData: function() { + return { + header: this.active, + content: !this.active.length ? $() : this.active.next() + }; + }, + + _createIcons: function() { + var icons = this.options.icons; + if ( icons ) { + $( "<span>" ) + .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) + .prependTo( this.headers ); + this.active.children( ".ui-accordion-header-icon" ) + .removeClass( icons.header ) + .addClass( icons.activeHeader ); + this.headers.addClass( "ui-accordion-icons" ); + } + }, + + _destroyIcons: function() { + this.headers + .removeClass( "ui-accordion-icons" ) + .children( ".ui-accordion-header-icon" ) + .remove(); + }, + + _destroy: function() { + var contents; + + // clean up main element + this.element + .removeClass( "ui-accordion ui-widget ui-helper-reset" ) + .removeAttr( "role" ); + + // clean up headers + this.headers + .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) + .removeAttr( "role" ) + .removeAttr( "aria-selected" ) + .removeAttr( "aria-controls" ) + .removeAttr( "tabIndex" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); + this._destroyIcons(); + + // clean up content panels + contents = this.headers.next() + .css( "display", "" ) + .removeAttr( "role" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-labelledby" ) + .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ) + .each(function() { + if ( /^ui-accordion/.test( this.id ) ) { + this.removeAttribute( "id" ); + } + }); + if ( this.options.heightStyle !== "content" ) { + contents.css( "height", "" ); + } + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "event" ) { + if ( this.options.event ) { + this._off( this.headers, this.options.event ); + } + this._setupEvents( value ); + } + + this._super( key, value ); + + // setting collapsible: false while collapsed; open first panel + if ( key === "collapsible" && !value && this.options.active === false ) { + this._activate( 0 ); + } + + if ( key === "icons" ) { + this._destroyIcons(); + if ( value ) { + this._createIcons(); + } + } + + // #5332 - opacity doesn't cascade to positioned elements in IE + // so we need to add the disabled class to the headers and panels + if ( key === "disabled" ) { + this.headers.add( this.headers.next() ) + .toggleClass( "ui-state-disabled", !!value ); + } + }, + + _keydown: function( event ) { + if ( event.altKey || event.ctrlKey ) { + return; + } + + var keyCode = $.ui.keyCode, + length = this.headers.length, + currentIndex = this.headers.index( event.target ), + toFocus = false; + + switch ( event.keyCode ) { + case keyCode.RIGHT: + case keyCode.DOWN: + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; + break; + case keyCode.LEFT: + case keyCode.UP: + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; + break; + case keyCode.SPACE: + case keyCode.ENTER: + this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; + } + + if ( toFocus ) { + $( event.target ).attr( "tabIndex", -1 ); + $( toFocus ).attr( "tabIndex", 0 ); + toFocus.focus(); + event.preventDefault(); + } + }, + + _panelKeyDown : function( event ) { + if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { + $( event.currentTarget ).prev().focus(); + } + }, + + refresh: function() { + var maxHeight, overflow, + heightStyle = this.options.heightStyle, + parent = this.element.parent(); + + + if ( heightStyle === "fill" ) { + // IE 6 treats height like minHeight, so we need to turn off overflow + // in order to get a reliable height + // we use the minHeight support test because we assume that only + // browsers that don't support minHeight will treat height as minHeight + if ( !$.support.minHeight ) { + overflow = parent.css( "overflow" ); + parent.css( "overflow", "hidden"); + } + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + }); + if ( overflow ) { + parent.css( "overflow", overflow ); + } + + this.headers.each(function() { + maxHeight -= $( this ).outerHeight( true ); + }); + + this.headers.next() + .each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.headers.next() + .each(function() { + maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); + }) + .height( maxHeight ); + } + }, + + _activate: function( index ) { + var active = this._findActive( index )[ 0 ]; + + // trying to activate the already active panel + if ( active === this.active[ 0 ] ) { + return; + } + + // trying to collapse, simulate a click on the currently active header + active = active || this.active[ 0 ]; + + this._eventHandler({ + target: active, + currentTarget: active, + preventDefault: $.noop + }); + }, + + _findActive: function( selector ) { + return typeof selector === "number" ? this.headers.eq( selector ) : $(); + }, + + _setupEvents: function( event ) { + var events = {}; + if ( !event ) { + return; + } + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); + this._on( this.headers, events ); + }, + + _eventHandler: function( event ) { + var options = this.options, + active = this.active, + clicked = $( event.currentTarget ), + clickedIsActive = clicked[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : clicked.next(), + toHide = active.next(), + eventData = { + oldHeader: active, + oldPanel: toHide, + newHeader: collapsing ? $() : clicked, + newPanel: toShow + }; + + event.preventDefault(); + + if ( + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.headers.index( clicked ); + + // when the call to ._toggle() comes after the class changes + // it causes a very odd bug in IE 8 (see #6720) + this.active = clickedIsActive ? $() : clicked; + this._toggle( eventData ); + + // switch classes + // corner classes on the previously active header stay after the animation + active.removeClass( "ui-accordion-header-active ui-state-active" ); + if ( options.icons ) { + active.children( ".ui-accordion-header-icon" ) + .removeClass( options.icons.activeHeader ) + .addClass( options.icons.header ); + } + + if ( !clickedIsActive ) { + clicked + .removeClass( "ui-corner-all" ) + .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); + if ( options.icons ) { + clicked.children( ".ui-accordion-header-icon" ) + .removeClass( options.icons.header ) + .addClass( options.icons.activeHeader ); + } + + clicked + .next() + .addClass( "ui-accordion-content-active" ); + } + }, + + _toggle: function( data ) { + var toShow = data.newPanel, + toHide = this.prevShow.length ? this.prevShow : data.oldPanel; + + // handle activating a panel during the animation for another activation + this.prevShow.add( this.prevHide ).stop( true, true ); + this.prevShow = toShow; + this.prevHide = toHide; + + if ( this.options.animate ) { + this._animate( toShow, toHide, data ); + } else { + toHide.hide(); + toShow.show(); + this._toggleComplete( data ); + } + + toHide.attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + toHide.prev().attr( "aria-selected", "false" ); + // if we're switching panels, remove the old header from the tab order + // if we're opening from collapsed state, remove the previous header from the tab order + // if we're collapsing, then keep the collapsing header in the tab order + if ( toShow.length && toHide.length ) { + toHide.prev().attr( "tabIndex", -1 ); + } else if ( toShow.length ) { + this.headers.filter(function() { + return $( this ).attr( "tabIndex" ) === 0; + }) + .attr( "tabIndex", -1 ); + } + + toShow + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }) + .prev() + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); + }, + + _animate: function( toShow, toHide, data ) { + var total, easing, duration, + that = this, + adjust = 0, + down = toShow.length && + ( !toHide.length || ( toShow.index() < toHide.index() ) ), + animate = this.options.animate || {}, + options = down && animate.down || animate, + complete = function() { + that._toggleComplete( data ); + }; + + if ( typeof options === "number" ) { + duration = options; + } + if ( typeof options === "string" ) { + easing = options; + } + // fall back from options to animation in case of partial down settings + easing = easing || options.easing || animate.easing; + duration = duration || options.duration || animate.duration; + + if ( !toHide.length ) { + return toShow.animate( showProps, duration, easing, complete ); + } + if ( !toShow.length ) { + return toHide.animate( hideProps, duration, easing, complete ); + } + + total = toShow.show().outerHeight(); + toHide.animate( hideProps, { + duration: duration, + easing: easing, + step: function( now, fx ) { + fx.now = Math.round( now ); + } + }); + toShow + .hide() + .animate( showProps, { + duration: duration, + easing: easing, + complete: complete, + step: function( now, fx ) { + fx.now = Math.round( now ); + if ( fx.prop !== "height" ) { + adjust += fx.now; + } else if ( that.options.heightStyle !== "content" ) { + fx.now = Math.round( total - toHide.outerHeight() - adjust ); + adjust = 0; + } + } + }); + }, + + _toggleComplete: function( data ) { + var toHide = data.oldPanel; + + toHide + .removeClass( "ui-accordion-content-active" ) + .prev() + .removeClass( "ui-corner-top" ) + .addClass( "ui-corner-all" ); + + // Work around for rendering bug in IE (#5421) + if ( toHide.length ) { + toHide.parent()[0].className = toHide.parent()[0].className; + } + + this._trigger( "activate", null, data ); + } +}); + + + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + // navigation options + (function( $, prototype ) { + $.extend( prototype.options, { + navigation: false, + navigationFilter: function() { + return this.href.toLowerCase() === location.href.toLowerCase(); + } + }); + + var _create = prototype._create; + prototype._create = function() { + if ( this.options.navigation ) { + var that = this, + headers = this.element.find( this.options.header ), + content = headers.next(), + current = headers.add( content ) + .find( "a" ) + .filter( this.options.navigationFilter ) + [ 0 ]; + if ( current ) { + headers.add( content ).each( function( index ) { + if ( $.contains( this, current ) ) { + that.options.active = Math.floor( index / 2 ); + return false; + } + }); + } + } + _create.call( this ); + }; + }( jQuery, jQuery.ui.accordion.prototype ) ); + + // height options + (function( $, prototype ) { + $.extend( prototype.options, { + heightStyle: null, // remove default so we fall back to old values + autoHeight: true, // use heightStyle: "auto" + clearStyle: false, // use heightStyle: "content" + fillSpace: false // use heightStyle: "fill" + }); + + var _create = prototype._create, + _setOption = prototype._setOption; + + $.extend( prototype, { + _create: function() { + this.options.heightStyle = this.options.heightStyle || + this._mergeHeightStyle(); + + _create.call( this ); + }, + + _setOption: function( key ) { + if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) { + this.options.heightStyle = this._mergeHeightStyle(); + } + _setOption.apply( this, arguments ); + }, + + _mergeHeightStyle: function() { + var options = this.options; + + if ( options.fillSpace ) { + return "fill"; + } + + if ( options.clearStyle ) { + return "content"; + } + + if ( options.autoHeight ) { + return "auto"; + } + } + }); + }( jQuery, jQuery.ui.accordion.prototype ) ); + + // icon options + (function( $, prototype ) { + $.extend( prototype.options.icons, { + activeHeader: null, // remove default so we fall back to old values + headerSelected: "ui-icon-triangle-1-s" + }); + + var _createIcons = prototype._createIcons; + prototype._createIcons = function() { + if ( this.options.icons ) { + this.options.icons.activeHeader = this.options.icons.activeHeader || + this.options.icons.headerSelected; + } + _createIcons.call( this ); + }; + }( jQuery, jQuery.ui.accordion.prototype ) ); + + // expanded active option, activate method + (function( $, prototype ) { + prototype.activate = prototype._activate; + + var _findActive = prototype._findActive; + prototype._findActive = function( index ) { + if ( index === -1 ) { + index = false; + } + if ( index && typeof index !== "number" ) { + index = this.headers.index( this.headers.filter( index ) ); + if ( index === -1 ) { + index = false; + } + } + return _findActive.call( this, index ); + }; + }( jQuery, jQuery.ui.accordion.prototype ) ); + + // resize method + jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh; + + // change events + (function( $, prototype ) { + $.extend( prototype.options, { + change: null, + changestart: null + }); + + var _trigger = prototype._trigger; + prototype._trigger = function( type, event, data ) { + var ret = _trigger.apply( this, arguments ); + if ( !ret ) { + return false; + } + + if ( type === "beforeActivate" ) { + ret = _trigger.call( this, "changestart", event, { + oldHeader: data.oldHeader, + oldContent: data.oldPanel, + newHeader: data.newHeader, + newContent: data.newPanel + }); + } else if ( type === "activate" ) { + ret = _trigger.call( this, "change", event, { + oldHeader: data.oldHeader, + oldContent: data.oldPanel, + newHeader: data.newHeader, + newContent: data.newPanel + }); + } + return ret; + }; + }( jQuery, jQuery.ui.accordion.prototype ) ); + + // animated option + // NOTE: this only provides support for "slide", "bounceslide", and easings + // not the full $.ui.accordion.animations API + (function( $, prototype ) { + $.extend( prototype.options, { + animate: null, + animated: "slide" + }); + + var _create = prototype._create; + prototype._create = function() { + var options = this.options; + if ( options.animate === null ) { + if ( !options.animated ) { + options.animate = false; + } else if ( options.animated === "slide" ) { + options.animate = 300; + } else if ( options.animated === "bounceslide" ) { + options.animate = { + duration: 200, + down: { + easing: "easeOutBounce", + duration: 1000 + } + }; + } else { + options.animate = options.animated; + } + } + + _create.call( this ); + }; + }( jQuery, jQuery.ui.accordion.prototype ) ); +} + +})( jQuery ); + +(function( $, undefined ) { + +// used to prevent race conditions with remote data sources +var requestIndex = 0; + +$.widget( "ui.autocomplete", { + version: "1.9.2", + defaultElement: "<input>", + options: { + appendTo: "body", + autoFocus: false, + delay: 300, + minLength: 1, + position: { + my: "left top", + at: "left bottom", + collision: "none" + }, + source: null, + + // callbacks + change: null, + close: null, + focus: null, + open: null, + response: null, + search: null, + select: null + }, + + pending: 0, + + _create: function() { + // Some browsers only repeat keydown events, not keypress events, + // so we use the suppressKeyPress flag to determine if we've already + // handled the keydown event. #7269 + // Unfortunately the code for & in keypress is the same as the up arrow, + // so we use the suppressKeyPressRepeat flag to avoid handling keypress + // events when we know the keydown event was used to modify the + // search term. #7799 + var suppressKeyPress, suppressKeyPressRepeat, suppressInput; + + this.isMultiLine = this._isMultiLine(); + this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ]; + this.isNewMenu = true; + + this.element + .addClass( "ui-autocomplete-input" ) + .attr( "autocomplete", "off" ); + + this._on( this.element, { + keydown: function( event ) { + if ( this.element.prop( "readOnly" ) ) { + suppressKeyPress = true; + suppressInput = true; + suppressKeyPressRepeat = true; + return; + } + + suppressKeyPress = false; + suppressInput = false; + suppressKeyPressRepeat = false; + var keyCode = $.ui.keyCode; + switch( event.keyCode ) { + case keyCode.PAGE_UP: + suppressKeyPress = true; + this._move( "previousPage", event ); + break; + case keyCode.PAGE_DOWN: + suppressKeyPress = true; + this._move( "nextPage", event ); + break; + case keyCode.UP: + suppressKeyPress = true; + this._keyEvent( "previous", event ); + break; + case keyCode.DOWN: + suppressKeyPress = true; + this._keyEvent( "next", event ); + break; + case keyCode.ENTER: + case keyCode.NUMPAD_ENTER: + // when menu is open and has focus + if ( this.menu.active ) { + // #6055 - Opera still allows the keypress to occur + // which causes forms to submit + suppressKeyPress = true; + event.preventDefault(); + this.menu.select( event ); + } + break; + case keyCode.TAB: + if ( this.menu.active ) { + this.menu.select( event ); + } + break; + case keyCode.ESCAPE: + if ( this.menu.element.is( ":visible" ) ) { + this._value( this.term ); + this.close( event ); + // Different browsers have different default behavior for escape + // Single press can mean undo or clear + // Double press in IE means clear the whole form + event.preventDefault(); + } + break; + default: + suppressKeyPressRepeat = true; + // search timeout should be triggered before the input value is changed + this._searchTimeout( event ); + break; + } + }, + keypress: function( event ) { + if ( suppressKeyPress ) { + suppressKeyPress = false; + event.preventDefault(); + return; + } + if ( suppressKeyPressRepeat ) { + return; + } + + // replicate some key handlers to allow them to repeat in Firefox and Opera + var keyCode = $.ui.keyCode; + switch( event.keyCode ) { + case keyCode.PAGE_UP: + this._move( "previousPage", event ); + break; + case keyCode.PAGE_DOWN: + this._move( "nextPage", event ); + break; + case keyCode.UP: + this._keyEvent( "previous", event ); + break; + case keyCode.DOWN: + this._keyEvent( "next", event ); + break; + } + }, + input: function( event ) { + if ( suppressInput ) { + suppressInput = false; + event.preventDefault(); + return; + } + this._searchTimeout( event ); + }, + focus: function() { + this.selectedItem = null; + this.previous = this._value(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + clearTimeout( this.searching ); + this.close( event ); + this._change( event ); + } + }); + + this._initSource(); + this.menu = $( "<ul>" ) + .addClass( "ui-autocomplete" ) + .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] ) + .menu({ + // custom key handling for now + input: $(), + // disable ARIA support, the live region takes care of that + role: null + }) + .zIndex( this.element.zIndex() + 1 ) + .hide() + .data( "menu" ); + + this._on( this.menu.element, { + mousedown: function( event ) { + // prevent moving focus out of the text field + event.preventDefault(); + + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + this.cancelBlur = true; + this._delay(function() { + delete this.cancelBlur; + }); + + // clicking on the scrollbar causes focus to shift to the body + // but we can't detect a mouseup or a click immediately afterward + // so we have to track the next mousedown and close the menu if + // the user clicks somewhere outside of the autocomplete + var menuElement = this.menu.element[ 0 ]; + if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { + this._delay(function() { + var that = this; + this.document.one( "mousedown", function( event ) { + if ( event.target !== that.element[ 0 ] && + event.target !== menuElement && + !$.contains( menuElement, event.target ) ) { + that.close(); + } + }); + }); + } + }, + menufocus: function( event, ui ) { + // #7024 - Prevent accidental activation of menu items in Firefox + if ( this.isNewMenu ) { + this.isNewMenu = false; + if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { + this.menu.blur(); + + this.document.one( "mousemove", function() { + $( event.target ).trigger( event.originalEvent ); + }); + + return; + } + } + + // back compat for _renderItem using item.autocomplete, via #7810 + // TODO remove the fallback, see #8156 + var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ); + if ( false !== this._trigger( "focus", event, { item: item } ) ) { + // use value to match what will end up in the input, if it was a key event + if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { + this._value( item.value ); + } + } else { + // Normally the input is populated with the item's value as the + // menu is navigated, causing screen readers to notice a change and + // announce the item. Since the focus event was canceled, this doesn't + // happen, so we update the live region so that screen readers can + // still notice the change and announce it. + this.liveRegion.text( item.value ); + } + }, + menuselect: function( event, ui ) { + // back compat for _renderItem using item.autocomplete, via #7810 + // TODO remove the fallback, see #8156 + var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ), + previous = this.previous; + + // only trigger when focus was lost (click on menu) + if ( this.element[0] !== this.document[0].activeElement ) { + this.element.focus(); + this.previous = previous; + // #6109 - IE triggers two focus events and the second + // is asynchronous, so we need to reset the previous + // term synchronously and asynchronously :-( + this._delay(function() { + this.previous = previous; + this.selectedItem = item; + }); + } + + if ( false !== this._trigger( "select", event, { item: item } ) ) { + this._value( item.value ); + } + // reset the term after the select event + // this allows custom select handling to work properly + this.term = this._value(); + + this.close( event ); + this.selectedItem = item; + } + }); + + this.liveRegion = $( "<span>", { + role: "status", + "aria-live": "polite" + }) + .addClass( "ui-helper-hidden-accessible" ) + .insertAfter( this.element ); + + if ( $.fn.bgiframe ) { + this.menu.element.bgiframe(); + } + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); + }, + + _destroy: function() { + clearTimeout( this.searching ); + this.element + .removeClass( "ui-autocomplete-input" ) + .removeAttr( "autocomplete" ); + this.menu.element.remove(); + this.liveRegion.remove(); + }, + + _setOption: function( key, value ) { + this._super( key, value ); + if ( key === "source" ) { + this._initSource(); + } + if ( key === "appendTo" ) { + this.menu.element.appendTo( this.document.find( value || "body" )[0] ); + } + if ( key === "disabled" && value && this.xhr ) { + this.xhr.abort(); + } + }, + + _isMultiLine: function() { + // Textareas are always multi-line + if ( this.element.is( "textarea" ) ) { + return true; + } + // Inputs are always single-line, even if inside a contentEditable element + // IE also treats inputs as contentEditable + if ( this.element.is( "input" ) ) { + return false; + } + // All other element types are determined by whether or not they're contentEditable + return this.element.prop( "isContentEditable" ); + }, + + _initSource: function() { + var array, url, + that = this; + if ( $.isArray(this.options.source) ) { + array = this.options.source; + this.source = function( request, response ) { + response( $.ui.autocomplete.filter( array, request.term ) ); + }; + } else if ( typeof this.options.source === "string" ) { + url = this.options.source; + this.source = function( request, response ) { + if ( that.xhr ) { + that.xhr.abort(); + } + that.xhr = $.ajax({ + url: url, + data: request, + dataType: "json", + success: function( data ) { + response( data ); + }, + error: function() { + response( [] ); + } + }); + }; + } else { + this.source = this.options.source; + } + }, + + _searchTimeout: function( event ) { + clearTimeout( this.searching ); + this.searching = this._delay(function() { + // only search if the value has changed + if ( this.term !== this._value() ) { + this.selectedItem = null; + this.search( null, event ); + } + }, this.options.delay ); + }, + + search: function( value, event ) { + value = value != null ? value : this._value(); + + // always save the actual value, not the one passed as an argument + this.term = this._value(); + + if ( value.length < this.options.minLength ) { + return this.close( event ); + } + + if ( this._trigger( "search", event ) === false ) { + return; + } + + return this._search( value ); + }, + + _search: function( value ) { + this.pending++; + this.element.addClass( "ui-autocomplete-loading" ); + this.cancelSearch = false; + + this.source( { term: value }, this._response() ); + }, + + _response: function() { + var that = this, + index = ++requestIndex; + + return function( content ) { + if ( index === requestIndex ) { + that.__response( content ); + } + + that.pending--; + if ( !that.pending ) { + that.element.removeClass( "ui-autocomplete-loading" ); + } + }; + }, + + __response: function( content ) { + if ( content ) { + content = this._normalize( content ); + } + this._trigger( "response", null, { content: content } ); + if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { + this._suggest( content ); + this._trigger( "open" ); + } else { + // use ._close() instead of .close() so we don't cancel future searches + this._close(); + } + }, + + close: function( event ) { + this.cancelSearch = true; + this._close( event ); + }, + + _close: function( event ) { + if ( this.menu.element.is( ":visible" ) ) { + this.menu.element.hide(); + this.menu.blur(); + this.isNewMenu = true; + this._trigger( "close", event ); + } + }, + + _change: function( event ) { + if ( this.previous !== this._value() ) { + this._trigger( "change", event, { item: this.selectedItem } ); + } + }, + + _normalize: function( items ) { + // assume all items have the right format when the first item is complete + if ( items.length && items[0].label && items[0].value ) { + return items; + } + return $.map( items, function( item ) { + if ( typeof item === "string" ) { + return { + label: item, + value: item + }; + } + return $.extend({ + label: item.label || item.value, + value: item.value || item.label + }, item ); + }); + }, + + _suggest: function( items ) { + var ul = this.menu.element + .empty() + .zIndex( this.element.zIndex() + 1 ); + this._renderMenu( ul, items ); + this.menu.refresh(); + + // size and position menu + ul.show(); + this._resizeMenu(); + ul.position( $.extend({ + of: this.element + }, this.options.position )); + + if ( this.options.autoFocus ) { + this.menu.next(); + } + }, + + _resizeMenu: function() { + var ul = this.menu.element; + ul.outerWidth( Math.max( + // Firefox wraps long text (possibly a rounding bug) + // so we add 1px to avoid the wrapping (#7513) + ul.width( "" ).outerWidth() + 1, + this.element.outerWidth() + ) ); + }, + + _renderMenu: function( ul, items ) { + var that = this; + $.each( items, function( index, item ) { + that._renderItemData( ul, item ); + }); + }, + + _renderItemData: function( ul, item ) { + return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); + }, + + _renderItem: function( ul, item ) { + return $( "<li>" ) + .append( $( "<a>" ).text( item.label ) ) + .appendTo( ul ); + }, + + _move: function( direction, event ) { + if ( !this.menu.element.is( ":visible" ) ) { + this.search( null, event ); + return; + } + if ( this.menu.isFirstItem() && /^previous/.test( direction ) || + this.menu.isLastItem() && /^next/.test( direction ) ) { + this._value( this.term ); + this.menu.blur(); + return; + } + this.menu[ direction ]( event ); + }, + + widget: function() { + return this.menu.element; + }, + + _value: function() { + return this.valueMethod.apply( this.element, arguments ); + }, + + _keyEvent: function( keyEvent, event ) { + if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { + this._move( keyEvent, event ); + + // prevents moving cursor to beginning/end of the text field in some browsers + event.preventDefault(); + } + } +}); + +$.extend( $.ui.autocomplete, { + escapeRegex: function( value ) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + }, + filter: function(array, term) { + var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); + return $.grep( array, function(value) { + return matcher.test( value.label || value.value || value ); + }); + } +}); + + +// live region extension, adding a `messages` option +// NOTE: This is an experimental API. We are still investigating +// a full solution for string manipulation and internationalization. +$.widget( "ui.autocomplete", $.ui.autocomplete, { + options: { + messages: { + noResults: "No search results.", + results: function( amount ) { + return amount + ( amount > 1 ? " results are" : " result is" ) + + " available, use up and down arrow keys to navigate."; + } + } + }, + + __response: function( content ) { + var message; + this._superApply( arguments ); + if ( this.options.disabled || this.cancelSearch ) { + return; + } + if ( content && content.length ) { + message = this.options.messages.results( content.length ); + } else { + message = this.options.messages.noResults; + } + this.liveRegion.text( message ); + } +}); + + +}( jQuery )); + +(function( $, undefined ) { + +var lastActive, startXPos, startYPos, clickDragged, + baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", + stateClasses = "ui-state-hover ui-state-active ", + typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", + formResetHandler = function() { + var buttons = $( this ).find( ":ui-button" ); + setTimeout(function() { + buttons.button( "refresh" ); + }, 1 ); + }, + radioGroup = function( radio ) { + var name = radio.name, + form = radio.form, + radios = $( [] ); + if ( name ) { + if ( form ) { + radios = $( form ).find( "[name='" + name + "']" ); + } else { + radios = $( "[name='" + name + "']", radio.ownerDocument ) + .filter(function() { + return !this.form; + }); + } + } + return radios; + }; + +$.widget( "ui.button", { + version: "1.9.2", + defaultElement: "<button>", + options: { + disabled: null, + text: true, + label: null, + icons: { + primary: null, + secondary: null + } + }, + _create: function() { + this.element.closest( "form" ) + .unbind( "reset" + this.eventNamespace ) + .bind( "reset" + this.eventNamespace, formResetHandler ); + + if ( typeof this.options.disabled !== "boolean" ) { + this.options.disabled = !!this.element.prop( "disabled" ); + } else { + this.element.prop( "disabled", this.options.disabled ); + } + + this._determineButtonType(); + this.hasTitle = !!this.buttonElement.attr( "title" ); + + var that = this, + options = this.options, + toggleButton = this.type === "checkbox" || this.type === "radio", + activeClass = !toggleButton ? "ui-state-active" : "", + focusClass = "ui-state-focus"; + + if ( options.label === null ) { + options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); + } + + this._hoverable( this.buttonElement ); + + this.buttonElement + .addClass( baseClasses ) + .attr( "role", "button" ) + .bind( "mouseenter" + this.eventNamespace, function() { + if ( options.disabled ) { + return; + } + if ( this === lastActive ) { + $( this ).addClass( "ui-state-active" ); + } + }) + .bind( "mouseleave" + this.eventNamespace, function() { + if ( options.disabled ) { + return; + } + $( this ).removeClass( activeClass ); + }) + .bind( "click" + this.eventNamespace, function( event ) { + if ( options.disabled ) { + event.preventDefault(); + event.stopImmediatePropagation(); + } + }); + + this.element + .bind( "focus" + this.eventNamespace, function() { + // no need to check disabled, focus won't be triggered anyway + that.buttonElement.addClass( focusClass ); + }) + .bind( "blur" + this.eventNamespace, function() { + that.buttonElement.removeClass( focusClass ); + }); + + if ( toggleButton ) { + this.element.bind( "change" + this.eventNamespace, function() { + if ( clickDragged ) { + return; + } + that.refresh(); + }); + // if mouse moves between mousedown and mouseup (drag) set clickDragged flag + // prevents issue where button state changes but checkbox/radio checked state + // does not in Firefox (see ticket #6970) + this.buttonElement + .bind( "mousedown" + this.eventNamespace, function( event ) { + if ( options.disabled ) { + return; + } + clickDragged = false; + startXPos = event.pageX; + startYPos = event.pageY; + }) + .bind( "mouseup" + this.eventNamespace, function( event ) { + if ( options.disabled ) { + return; + } + if ( startXPos !== event.pageX || startYPos !== event.pageY ) { + clickDragged = true; + } + }); + } + + if ( this.type === "checkbox" ) { + this.buttonElement.bind( "click" + this.eventNamespace, function() { + if ( options.disabled || clickDragged ) { + return false; + } + $( this ).toggleClass( "ui-state-active" ); + that.buttonElement.attr( "aria-pressed", that.element[0].checked ); + }); + } else if ( this.type === "radio" ) { + this.buttonElement.bind( "click" + this.eventNamespace, function() { + if ( options.disabled || clickDragged ) { + return false; + } + $( this ).addClass( "ui-state-active" ); + that.buttonElement.attr( "aria-pressed", "true" ); + + var radio = that.element[ 0 ]; + radioGroup( radio ) + .not( radio ) + .map(function() { + return $( this ).button( "widget" )[ 0 ]; + }) + .removeClass( "ui-state-active" ) + .attr( "aria-pressed", "false" ); + }); + } else { + this.buttonElement + .bind( "mousedown" + this.eventNamespace, function() { + if ( options.disabled ) { + return false; + } + $( this ).addClass( "ui-state-active" ); + lastActive = this; + that.document.one( "mouseup", function() { + lastActive = null; + }); + }) + .bind( "mouseup" + this.eventNamespace, function() { + if ( options.disabled ) { + return false; + } + $( this ).removeClass( "ui-state-active" ); + }) + .bind( "keydown" + this.eventNamespace, function(event) { + if ( options.disabled ) { + return false; + } + if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) { + $( this ).addClass( "ui-state-active" ); + } + }) + .bind( "keyup" + this.eventNamespace, function() { + $( this ).removeClass( "ui-state-active" ); + }); + + if ( this.buttonElement.is("a") ) { + this.buttonElement.keyup(function(event) { + if ( event.keyCode === $.ui.keyCode.SPACE ) { + // TODO pass through original event correctly (just as 2nd argument doesn't work) + $( this ).click(); + } + }); + } + } + + // TODO: pull out $.Widget's handling for the disabled option into + // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can + // be overridden by individual plugins + this._setOption( "disabled", options.disabled ); + this._resetButton(); + }, + + _determineButtonType: function() { + var ancestor, labelSelector, checked; + + if ( this.element.is("[type=checkbox]") ) { + this.type = "checkbox"; + } else if ( this.element.is("[type=radio]") ) { + this.type = "radio"; + } else if ( this.element.is("input") ) { + this.type = "input"; + } else { + this.type = "button"; + } + + if ( this.type === "checkbox" || this.type === "radio" ) { + // we don't search against the document in case the element + // is disconnected from the DOM + ancestor = this.element.parents().last(); + labelSelector = "label[for='" + this.element.attr("id") + "']"; + this.buttonElement = ancestor.find( labelSelector ); + if ( !this.buttonElement.length ) { + ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); + this.buttonElement = ancestor.filter( labelSelector ); + if ( !this.buttonElement.length ) { + this.buttonElement = ancestor.find( labelSelector ); + } + } + this.element.addClass( "ui-helper-hidden-accessible" ); + + checked = this.element.is( ":checked" ); + if ( checked ) { + this.buttonElement.addClass( "ui-state-active" ); + } + this.buttonElement.prop( "aria-pressed", checked ); + } else { + this.buttonElement = this.element; + } + }, + + widget: function() { + return this.buttonElement; + }, + + _destroy: function() { + this.element + .removeClass( "ui-helper-hidden-accessible" ); + this.buttonElement + .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) + .removeAttr( "role" ) + .removeAttr( "aria-pressed" ) + .html( this.buttonElement.find(".ui-button-text").html() ); + + if ( !this.hasTitle ) { + this.buttonElement.removeAttr( "title" ); + } + }, + + _setOption: function( key, value ) { + this._super( key, value ); + if ( key === "disabled" ) { + if ( value ) { + this.element.prop( "disabled", true ); + } else { + this.element.prop( "disabled", false ); + } + return; + } + this._resetButton(); + }, + + refresh: function() { + //See #8237 & #8828 + var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" ); + + if ( isDisabled !== this.options.disabled ) { + this._setOption( "disabled", isDisabled ); + } + if ( this.type === "radio" ) { + radioGroup( this.element[0] ).each(function() { + if ( $( this ).is( ":checked" ) ) { + $( this ).button( "widget" ) + .addClass( "ui-state-active" ) + .attr( "aria-pressed", "true" ); + } else { + $( this ).button( "widget" ) + .removeClass( "ui-state-active" ) + .attr( "aria-pressed", "false" ); + } + }); + } else if ( this.type === "checkbox" ) { + if ( this.element.is( ":checked" ) ) { + this.buttonElement + .addClass( "ui-state-active" ) + .attr( "aria-pressed", "true" ); + } else { + this.buttonElement + .removeClass( "ui-state-active" ) + .attr( "aria-pressed", "false" ); + } + } + }, + + _resetButton: function() { + if ( this.type === "input" ) { + if ( this.options.label ) { + this.element.val( this.options.label ); + } + return; + } + var buttonElement = this.buttonElement.removeClass( typeClasses ), + buttonText = $( "<span></span>", this.document[0] ) + .addClass( "ui-button-text" ) + .html( this.options.label ) + .appendTo( buttonElement.empty() ) + .text(), + icons = this.options.icons, + multipleIcons = icons.primary && icons.secondary, + buttonClasses = []; + + if ( icons.primary || icons.secondary ) { + if ( this.options.text ) { + buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); + } + + if ( icons.primary ) { + buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); + } + + if ( icons.secondary ) { + buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); + } + + if ( !this.options.text ) { + buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); + + if ( !this.hasTitle ) { + buttonElement.attr( "title", $.trim( buttonText ) ); + } + } + } else { + buttonClasses.push( "ui-button-text-only" ); + } + buttonElement.addClass( buttonClasses.join( " " ) ); + } +}); + +$.widget( "ui.buttonset", { + version: "1.9.2", + options: { + items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)" + }, + + _create: function() { + this.element.addClass( "ui-buttonset" ); + }, + + _init: function() { + this.refresh(); + }, + + _setOption: function( key, value ) { + if ( key === "disabled" ) { + this.buttons.button( "option", key, value ); + } + + this._super( key, value ); + }, + + refresh: function() { + var rtl = this.element.css( "direction" ) === "rtl"; + + this.buttons = this.element.find( this.options.items ) + .filter( ":ui-button" ) + .button( "refresh" ) + .end() + .not( ":ui-button" ) + .button() + .end() + .map(function() { + return $( this ).button( "widget" )[ 0 ]; + }) + .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) + .filter( ":first" ) + .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) + .end() + .filter( ":last" ) + .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) + .end() + .end(); + }, + + _destroy: function() { + this.element.removeClass( "ui-buttonset" ); + this.buttons + .map(function() { + return $( this ).button( "widget" )[ 0 ]; + }) + .removeClass( "ui-corner-left ui-corner-right" ) + .end() + .button( "destroy" ); + } +}); + +}( jQuery ) ); + +(function( $, undefined ) { + +$.extend($.ui, { datepicker: { version: "1.9.2" } }); + +var PROP_NAME = 'datepicker'; +var dpuuid = new Date().getTime(); +var instActive; + +/* Date picker manager. + Use the singleton instance of this class, $.datepicker, to interact with the date picker. + Settings for (groups of) date pickers are maintained in an instance object, + allowing multiple different settings on the same page. */ + +function Datepicker() { + this.debug = false; // Change this to true to start debugging + this._curInst = null; // The current instance in use + this._keyEvent = false; // If the last event was a key event + this._disabledInputs = []; // List of date picker inputs that have been disabled + this._datepickerShowing = false; // True if the popup picker is showing , false if not + this._inDialog = false; // True if showing within a "dialog", false if not + this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division + this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class + this._appendClass = 'ui-datepicker-append'; // The name of the append marker class + this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class + this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class + this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class + this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class + this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class + this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + closeText: 'Done', // Display text for close link + prevText: 'Prev', // Display text for previous month link + nextText: 'Next', // Display text for next month link + currentText: 'Today', // Display text for current month link + monthNames: ['January','February','March','April','May','June', + 'July','August','September','October','November','December'], // Names of months for drop-down and formatting + monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting + dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting + dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting + dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday + weekHeader: 'Wk', // Column header for week of the year + dateFormat: 'mm/dd/yy', // See format options on parseDate + firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... + isRTL: false, // True if right-to-left language, false if left-to-right + showMonthAfterYear: false, // True if the year select precedes month, false for month then year + yearSuffix: '' // Additional text to append to the year in the month headers + }; + this._defaults = { // Global defaults for all the date picker instances + showOn: 'focus', // 'focus' for popup on focus, + // 'button' for trigger button, or 'both' for either + showAnim: 'fadeIn', // Name of jQuery animation for popup + showOptions: {}, // Options for enhanced animations + defaultDate: null, // Used when field is blank: actual date, + // +/-number for offset from today, null for today + appendText: '', // Display text following the input box, e.g. showing the format + buttonText: '...', // Text for trigger button + buttonImage: '', // URL for trigger button image + buttonImageOnly: false, // True if the image appears alone, false if it appears on a button + hideIfNoPrevNext: false, // True to hide next/previous month links + // if not applicable, false to just disable them + navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + gotoCurrent: false, // True if today link goes back to current selection instead + changeMonth: false, // True if month can be selected directly, false if only prev/next + changeYear: false, // True if year can be selected directly, false if only prev/next + yearRange: 'c-10:c+10', // Range of years to display in drop-down, + // either relative to today's year (-nn:+nn), relative to currently displayed year + // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) + showOtherMonths: false, // True to show dates in other months, false to leave blank + selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable + showWeek: false, // True to show week of the year, false to not show it + calculateWeek: this.iso8601Week, // How to calculate the week of the year, + // takes a Date and returns the number of the week for it + shortYearCutoff: '+10', // Short year values < this are in the current century, + // > this are in the previous century, + // string value starting with '+' for current year + value + minDate: null, // The earliest selectable date, or null for no limit + maxDate: null, // The latest selectable date, or null for no limit + duration: 'fast', // Duration of display/closure + beforeShowDay: null, // Function that takes a date and returns an array with + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', + // [2] = cell title (optional), e.g. $.datepicker.noWeekends + beforeShow: null, // Function that takes an input field and + // returns a set of custom settings for the date picker + onSelect: null, // Define a callback function when a date is selected + onChangeMonthYear: null, // Define a callback function when the month or year is changed + onClose: null, // Define a callback function when the datepicker is closed + numberOfMonths: 1, // Number of months to show at a time + showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) + stepMonths: 1, // Number of months to step back/forward + stepBigMonths: 12, // Number of months to step back/forward for the big links + altField: '', // Selector for an alternate field to store selected dates into + altFormat: '', // The date format to use for the alternate field + constrainInput: true, // The input is constrained by the current date format + showButtonPanel: false, // True to show button panel, false to not show it + autoSize: false, // True to size the input for the date format, false to leave as is + disabled: false // The initial disabled state + }; + $.extend(this._defaults, this.regional['']); + this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')); +} + +$.extend(Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ + markerClassName: 'hasDatepicker', + + //Keep track of the maximum number of rows displayed (see #7043) + maxRows: 4, + + /* Debug logging (if enabled). */ + log: function () { + if (this.debug) + console.log.apply('', arguments); + }, + + // TODO rename to "widget" when switching to widget factory + _widgetDatepicker: function() { + return this.dpDiv; + }, + + /* Override the default settings for all instances of the date picker. + @param settings object - the new settings to use as defaults (anonymous object) + @return the manager object */ + setDefaults: function(settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* Attach the date picker to a jQuery selection. + @param target element - the target input field or division or span + @param settings object - the new settings to use for this date picker instance (anonymous) */ + _attachDatepicker: function(target, settings) { + // check for settings on the control itself - in namespace 'date:' + var inlineSettings = null; + for (var attrName in this._defaults) { + var attrValue = target.getAttribute('date:' + attrName); + if (attrValue) { + inlineSettings = inlineSettings || {}; + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + var nodeName = target.nodeName.toLowerCase(); + var inline = (nodeName == 'div' || nodeName == 'span'); + if (!target.id) { + this.uuid += 1; + target.id = 'dp' + this.uuid; + } + var inst = this._newInst($(target), inline); + inst.settings = $.extend({}, settings || {}, inlineSettings || {}); + if (nodeName == 'input') { + this._connectDatepicker(target, inst); + } else if (inline) { + this._inlineDatepicker(target, inst); + } + }, + + /* Create a new instance object. */ + _newInst: function(target, inline) { + var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars + return {id: id, input: target, // associated target + selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection + drawMonth: 0, drawYear: 0, // month being drawn + inline: inline, // is datepicker inline or not + dpDiv: (!inline ? this.dpDiv : // presentation div + bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}; + }, + + /* Attach the date picker to an input field. */ + _connectDatepicker: function(target, inst) { + var input = $(target); + inst.append = $([]); + inst.trigger = $([]); + if (input.hasClass(this.markerClassName)) + return; + this._attachments(input, inst); + input.addClass(this.markerClassName).keydown(this._doKeyDown). + keypress(this._doKeyPress).keyup(this._doKeyUp). + bind("setData.datepicker", function(event, key, value) { + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key) { + return this._get(inst, key); + }); + this._autoSize(inst); + $.data(target, PROP_NAME, inst); + //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) + if( inst.settings.disabled ) { + this._disableDatepicker( target ); + } + }, + + /* Make attachments based on settings. */ + _attachments: function(input, inst) { + var appendText = this._get(inst, 'appendText'); + var isRTL = this._get(inst, 'isRTL'); + if (inst.append) + inst.append.remove(); + if (appendText) { + inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); + input[isRTL ? 'before' : 'after'](inst.append); + } + input.unbind('focus', this._showDatepicker); + if (inst.trigger) + inst.trigger.remove(); + var showOn = this._get(inst, 'showOn'); + if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field + input.focus(this._showDatepicker); + if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked + var buttonText = this._get(inst, 'buttonText'); + var buttonImage = this._get(inst, 'buttonImage'); + inst.trigger = $(this._get(inst, 'buttonImageOnly') ? + $('<img/>').addClass(this._triggerClass). + attr({ src: buttonImage, alt: buttonText, title: buttonText }) : + $('<button type="button"></button>').addClass(this._triggerClass). + html(buttonImage == '' ? buttonText : $('<img/>').attr( + { src:buttonImage, alt:buttonText, title:buttonText }))); + input[isRTL ? 'before' : 'after'](inst.trigger); + inst.trigger.click(function() { + if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) + $.datepicker._hideDatepicker(); + else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { + $.datepicker._hideDatepicker(); + $.datepicker._showDatepicker(input[0]); + } else + $.datepicker._showDatepicker(input[0]); + return false; + }); + } + }, + + /* Apply the maximum length for the date format. */ + _autoSize: function(inst) { + if (this._get(inst, 'autoSize') && !inst.inline) { + var date = new Date(2009, 12 - 1, 20); // Ensure double digits + var dateFormat = this._get(inst, 'dateFormat'); + if (dateFormat.match(/[DM]/)) { + var findMax = function(names) { + var max = 0; + var maxI = 0; + for (var i = 0; i < names.length; i++) { + if (names[i].length > max) { + max = names[i].length; + maxI = i; + } + } + return maxI; + }; + date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? + 'monthNames' : 'monthNamesShort')))); + date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? + 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); + } + inst.input.attr('size', this._formatDate(inst, date).length); + } + }, + + /* Attach an inline date picker to a div. */ + _inlineDatepicker: function(target, inst) { + var divSpan = $(target); + if (divSpan.hasClass(this.markerClassName)) + return; + divSpan.addClass(this.markerClassName).append(inst.dpDiv). + bind("setData.datepicker", function(event, key, value){ + inst.settings[key] = value; + }).bind("getData.datepicker", function(event, key){ + return this._get(inst, key); + }); + $.data(target, PROP_NAME, inst); + this._setDate(inst, this._getDefaultDate(inst), true); + this._updateDatepicker(inst); + this._updateAlternate(inst); + //If disabled option is true, disable the datepicker before showing it (see ticket #5665) + if( inst.settings.disabled ) { + this._disableDatepicker( target ); + } + // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements + // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height + inst.dpDiv.css( "display", "block" ); + }, + + /* Pop-up the date picker in a "dialog" box. + @param input element - ignored + @param date string or Date - the initial date to display + @param onSelect function - the function to call when a date is selected + @param settings object - update the dialog date picker instance's settings (anonymous object) + @param pos int[2] - coordinates for the dialog's position within the screen or + event - with x/y coordinates or + leave empty for default (screen centre) + @return the manager object */ + _dialogDatepicker: function(input, date, onSelect, settings, pos) { + var inst = this._dialogInst; // internal instance + if (!inst) { + this.uuid += 1; + var id = 'dp' + this.uuid; + this._dialogInput = $('<input type="text" id="' + id + + '" style="position: absolute; top: -100px; width: 0px;"/>'); + this._dialogInput.keydown(this._doKeyDown); + $('body').append(this._dialogInput); + inst = this._dialogInst = this._newInst(this._dialogInput, false); + inst.settings = {}; + $.data(this._dialogInput[0], PROP_NAME, inst); + } + extendRemove(inst.settings, settings || {}); + date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); + this._dialogInput.val(date); + + this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); + if (!this._pos) { + var browserWidth = document.documentElement.clientWidth; + var browserHeight = document.documentElement.clientHeight; + var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + var scrollY = document.documentElement.scrollTop || document.body.scrollTop; + this._pos = // should use actual width/height below + [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; + } + + // move input on screen for focus, but hidden behind dialog + this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); + inst.settings.onSelect = onSelect; + this._inDialog = true; + this.dpDiv.addClass(this._dialogClass); + this._showDatepicker(this._dialogInput[0]); + if ($.blockUI) + $.blockUI(this.dpDiv); + $.data(this._dialogInput[0], PROP_NAME, inst); + return this; + }, + + /* Detach a datepicker from its control. + @param target element - the target input field or division or span */ + _destroyDatepicker: function(target) { + var $target = $(target); + var inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + $.removeData(target, PROP_NAME); + if (nodeName == 'input') { + inst.append.remove(); + inst.trigger.remove(); + $target.removeClass(this.markerClassName). + unbind('focus', this._showDatepicker). + unbind('keydown', this._doKeyDown). + unbind('keypress', this._doKeyPress). + unbind('keyup', this._doKeyUp); + } else if (nodeName == 'div' || nodeName == 'span') + $target.removeClass(this.markerClassName).empty(); + }, + + /* Enable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _enableDatepicker: function(target) { + var $target = $(target); + var inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + if (nodeName == 'input') { + target.disabled = false; + inst.trigger.filter('button'). + each(function() { this.disabled = false; }).end(). + filter('img').css({opacity: '1.0', cursor: ''}); + } + else if (nodeName == 'div' || nodeName == 'span') { + var inline = $target.children('.' + this._inlineClass); + inline.children().removeClass('ui-state-disabled'); + inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). + prop("disabled", false); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + }, + + /* Disable the date picker to a jQuery selection. + @param target element - the target input field or division or span */ + _disableDatepicker: function(target) { + var $target = $(target); + var inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { + return; + } + var nodeName = target.nodeName.toLowerCase(); + if (nodeName == 'input') { + target.disabled = true; + inst.trigger.filter('button'). + each(function() { this.disabled = true; }).end(). + filter('img').css({opacity: '0.5', cursor: 'default'}); + } + else if (nodeName == 'div' || nodeName == 'span') { + var inline = $target.children('.' + this._inlineClass); + inline.children().addClass('ui-state-disabled'); + inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). + prop("disabled", true); + } + this._disabledInputs = $.map(this._disabledInputs, + function(value) { return (value == target ? null : value); }); // delete entry + this._disabledInputs[this._disabledInputs.length] = target; + }, + + /* Is the first field in a jQuery collection disabled as a datepicker? + @param target element - the target input field or division or span + @return boolean - true if disabled, false if enabled */ + _isDisabledDatepicker: function(target) { + if (!target) { + return false; + } + for (var i = 0; i < this._disabledInputs.length; i++) { + if (this._disabledInputs[i] == target) + return true; + } + return false; + }, + + /* Retrieve the instance data for the target control. + @param target element - the target input field or division or span + @return object - the associated instance data + @throws error if a jQuery problem getting data */ + _getInst: function(target) { + try { + return $.data(target, PROP_NAME); + } + catch (err) { + throw 'Missing instance data for this datepicker'; + } + }, + + /* Update or retrieve the settings for a date picker attached to an input field or division. + @param target element - the target input field or division or span + @param name object - the new settings to update or + string - the name of the setting to change or retrieve, + when retrieving also 'all' for all instance settings or + 'defaults' for all global defaults + @param value any - the new value for the setting + (omit if above is an object or to retrieve a value) */ + _optionDatepicker: function(target, name, value) { + var inst = this._getInst(target); + if (arguments.length == 2 && typeof name == 'string') { + return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : + (inst ? (name == 'all' ? $.extend({}, inst.settings) : + this._get(inst, name)) : null)); + } + var settings = name || {}; + if (typeof name == 'string') { + settings = {}; + settings[name] = value; + } + if (inst) { + if (this._curInst == inst) { + this._hideDatepicker(); + } + var date = this._getDateDatepicker(target, true); + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + extendRemove(inst.settings, settings); + // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided + if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) + inst.settings.minDate = this._formatDate(inst, minDate); + if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) + inst.settings.maxDate = this._formatDate(inst, maxDate); + this._attachments($(target), inst); + this._autoSize(inst); + this._setDate(inst, date); + this._updateAlternate(inst); + this._updateDatepicker(inst); + } + }, + + // change method deprecated + _changeDatepicker: function(target, name, value) { + this._optionDatepicker(target, name, value); + }, + + /* Redraw the date picker attached to an input field or division. + @param target element - the target input field or division or span */ + _refreshDatepicker: function(target) { + var inst = this._getInst(target); + if (inst) { + this._updateDatepicker(inst); + } + }, + + /* Set the dates for a jQuery selection. + @param target element - the target input field or division or span + @param date Date - the new date */ + _setDateDatepicker: function(target, date) { + var inst = this._getInst(target); + if (inst) { + this._setDate(inst, date); + this._updateDatepicker(inst); + this._updateAlternate(inst); + } + }, + + /* Get the date(s) for the first entry in a jQuery selection. + @param target element - the target input field or division or span + @param noDefault boolean - true if no default date is to be used + @return Date - the current date */ + _getDateDatepicker: function(target, noDefault) { + var inst = this._getInst(target); + if (inst && !inst.inline) + this._setDateFromField(inst, noDefault); + return (inst ? this._getDate(inst) : null); + }, + + /* Handle keystrokes. */ + _doKeyDown: function(event) { + var inst = $.datepicker._getInst(event.target); + var handled = true; + var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); + inst._keyEvent = true; + if ($.datepicker._datepickerShowing) + switch (event.keyCode) { + case 9: $.datepicker._hideDatepicker(); + handled = false; + break; // hide on tab out + case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + + $.datepicker._currentClass + ')', inst.dpDiv); + if (sel[0]) + $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); + var onSelect = $.datepicker._get(inst, 'onSelect'); + if (onSelect) { + var dateStr = $.datepicker._formatDate(inst); + + // trigger custom callback + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); + } + else + $.datepicker._hideDatepicker(); + return false; // don't submit the form + break; // select the value on enter + case 27: $.datepicker._hideDatepicker(); + break; // hide on escape + case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, 'stepBigMonths') : + -$.datepicker._get(inst, 'stepMonths')), 'M'); + break; // previous month/year on page up/+ ctrl + case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, 'stepBigMonths') : + +$.datepicker._get(inst, 'stepMonths')), 'M'); + break; // next month/year on page down/+ ctrl + case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); + handled = event.ctrlKey || event.metaKey; + break; // clear on ctrl or command +end + case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); + handled = event.ctrlKey || event.metaKey; + break; // current on ctrl or command +home + case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); + handled = event.ctrlKey || event.metaKey; + // -1 day on ctrl or command +left + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, 'stepBigMonths') : + -$.datepicker._get(inst, 'stepMonths')), 'M'); + // next month/year on alt +left on Mac + break; + case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); + handled = event.ctrlKey || event.metaKey; + break; // -1 week on ctrl or command +up + case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); + handled = event.ctrlKey || event.metaKey; + // +1 day on ctrl or command +right + if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, 'stepBigMonths') : + +$.datepicker._get(inst, 'stepMonths')), 'M'); + // next month/year on alt +right + break; + case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); + handled = event.ctrlKey || event.metaKey; + break; // +1 week on ctrl or command +down + default: handled = false; + } + else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home + $.datepicker._showDatepicker(this); + else { + handled = false; + } + if (handled) { + event.preventDefault(); + event.stopPropagation(); + } + }, + + /* Filter entered characters - based on date format. */ + _doKeyPress: function(event) { + var inst = $.datepicker._getInst(event.target); + if ($.datepicker._get(inst, 'constrainInput')) { + var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); + var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); + return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); + } + }, + + /* Synchronise manual entry and field/alternate field. */ + _doKeyUp: function(event) { + var inst = $.datepicker._getInst(event.target); + if (inst.input.val() != inst.lastVal) { + try { + var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), + (inst.input ? inst.input.val() : null), + $.datepicker._getFormatConfig(inst)); + if (date) { // only if valid + $.datepicker._setDateFromField(inst); + $.datepicker._updateAlternate(inst); + $.datepicker._updateDatepicker(inst); + } + } + catch (err) { + $.datepicker.log(err); + } + } + return true; + }, + + /* Pop-up the date picker for a given input field. + If false returned from beforeShow event handler do not show. + @param input element - the input field attached to the date picker or + event - if triggered by focus */ + _showDatepicker: function(input) { + input = input.target || input; + if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger + input = $('input', input.parentNode)[0]; + if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here + return; + var inst = $.datepicker._getInst(input); + if ($.datepicker._curInst && $.datepicker._curInst != inst) { + $.datepicker._curInst.dpDiv.stop(true, true); + if ( inst && $.datepicker._datepickerShowing ) { + $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); + } + } + var beforeShow = $.datepicker._get(inst, 'beforeShow'); + var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; + if(beforeShowSettings === false){ + //false + return; + } + extendRemove(inst.settings, beforeShowSettings); + inst.lastVal = null; + $.datepicker._lastInput = input; + $.datepicker._setDateFromField(inst); + if ($.datepicker._inDialog) // hide cursor + input.value = ''; + if (!$.datepicker._pos) { // position below input + $.datepicker._pos = $.datepicker._findPos(input); + $.datepicker._pos[1] += input.offsetHeight; // add the height + } + var isFixed = false; + $(input).parents().each(function() { + isFixed |= $(this).css('position') == 'fixed'; + return !isFixed; + }); + var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; + $.datepicker._pos = null; + //to avoid flashes on Firefox + inst.dpDiv.empty(); + // determine sizing offscreen + inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); + $.datepicker._updateDatepicker(inst); + // fix width for dynamic number of date pickers + // and adjust position before showing + offset = $.datepicker._checkOffset(inst, offset, isFixed); + inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? + 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', + left: offset.left + 'px', top: offset.top + 'px'}); + if (!inst.inline) { + var showAnim = $.datepicker._get(inst, 'showAnim'); + var duration = $.datepicker._get(inst, 'duration'); + var postProcess = function() { + var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only + if( !! cover.length ){ + var borders = $.datepicker._getBorders(inst.dpDiv); + cover.css({left: -borders[0], top: -borders[1], + width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); + } + }; + inst.dpDiv.zIndex($(input).zIndex()+1); + $.datepicker._datepickerShowing = true; + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) + inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); + else + inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); + if (!showAnim || !duration) + postProcess(); + if (inst.input.is(':visible') && !inst.input.is(':disabled')) + inst.input.focus(); + $.datepicker._curInst = inst; + } + }, + + /* Generate the date picker content. */ + _updateDatepicker: function(inst) { + this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) + var borders = $.datepicker._getBorders(inst.dpDiv); + instActive = inst; // for delegate hover events + inst.dpDiv.empty().append(this._generateHTML(inst)); + this._attachHandlers(inst); + var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only + if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 + cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) + } + inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); + var numMonths = this._getNumberOfMonths(inst); + var cols = numMonths[1]; + var width = 17; + inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); + if (cols > 1) + inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); + inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + + 'Class']('ui-datepicker-multi'); + inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + + 'Class']('ui-datepicker-rtl'); + if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) + inst.input.focus(); + // deffered render of the years select (to avoid flashes on Firefox) + if( inst.yearshtml ){ + var origyearshtml = inst.yearshtml; + setTimeout(function(){ + //assure that inst.yearshtml didn't change. + if( origyearshtml === inst.yearshtml && inst.yearshtml ){ + inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); + } + origyearshtml = inst.yearshtml = null; + }, 0); + } + }, + + /* Retrieve the size of left and top borders for an element. + @param elem (jQuery object) the element of interest + @return (number[2]) the left and top borders */ + _getBorders: function(elem) { + var convert = function(value) { + return {thin: 1, medium: 2, thick: 3}[value] || value; + }; + return [parseFloat(convert(elem.css('border-left-width'))), + parseFloat(convert(elem.css('border-top-width')))]; + }, + + /* Check positioning to remain on screen. */ + _checkOffset: function(inst, offset, isFixed) { + var dpWidth = inst.dpDiv.outerWidth(); + var dpHeight = inst.dpDiv.outerHeight(); + var inputWidth = inst.input ? inst.input.outerWidth() : 0; + var inputHeight = inst.input ? inst.input.outerHeight() : 0; + var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); + var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); + + offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); + offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; + offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; + + // now check if datepicker is showing outside window viewport - move to a better place if so. + offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? + Math.abs(offset.left + dpWidth - viewWidth) : 0); + offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? + Math.abs(dpHeight + inputHeight) : 0); + + return offset; + }, + + /* Find an object's position on the screen. */ + _findPos: function(obj) { + var inst = this._getInst(obj); + var isRTL = this._get(inst, 'isRTL'); + while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { + obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; + } + var position = $(obj).offset(); + return [position.left, position.top]; + }, + + /* Hide the date picker from view. + @param input element - the input field attached to the date picker */ + _hideDatepicker: function(input) { + var inst = this._curInst; + if (!inst || (input && inst != $.data(input, PROP_NAME))) + return; + if (this._datepickerShowing) { + var showAnim = this._get(inst, 'showAnim'); + var duration = this._get(inst, 'duration'); + var postProcess = function() { + $.datepicker._tidyDialog(inst); + }; + + // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) + inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); + else + inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : + (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); + if (!showAnim) + postProcess(); + this._datepickerShowing = false; + var onClose = this._get(inst, 'onClose'); + if (onClose) + onClose.apply((inst.input ? inst.input[0] : null), + [(inst.input ? inst.input.val() : ''), inst]); + this._lastInput = null; + if (this._inDialog) { + this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); + if ($.blockUI) { + $.unblockUI(); + $('body').append(this.dpDiv); + } + } + this._inDialog = false; + } + }, + + /* Tidy up after a dialog display. */ + _tidyDialog: function(inst) { + inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); + }, + + /* Close date picker if clicked elsewhere. */ + _checkExternalClick: function(event) { + if (!$.datepicker._curInst) + return; + + var $target = $(event.target), + inst = $.datepicker._getInst($target[0]); + + if ( ( ( $target[0].id != $.datepicker._mainDivId && + $target.parents('#' + $.datepicker._mainDivId).length == 0 && + !$target.hasClass($.datepicker.markerClassName) && + !$target.closest("." + $.datepicker._triggerClass).length && + $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || + ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) ) + $.datepicker._hideDatepicker(); + }, + + /* Adjust one of the date sub-fields. */ + _adjustDate: function(id, offset, period) { + var target = $(id); + var inst = this._getInst(target[0]); + if (this._isDisabledDatepicker(target[0])) { + return; + } + this._adjustInstDate(inst, offset + + (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning + period); + this._updateDatepicker(inst); + }, + + /* Action for current link. */ + _gotoToday: function(id) { + var target = $(id); + var inst = this._getInst(target[0]); + if (this._get(inst, 'gotoCurrent') && inst.currentDay) { + inst.selectedDay = inst.currentDay; + inst.drawMonth = inst.selectedMonth = inst.currentMonth; + inst.drawYear = inst.selectedYear = inst.currentYear; + } + else { + var date = new Date(); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + } + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Action for selecting a new month/year. */ + _selectMonthYear: function(id, select, period) { + var target = $(id); + var inst = this._getInst(target[0]); + inst['selected' + (period == 'M' ? 'Month' : 'Year')] = + inst['draw' + (period == 'M' ? 'Month' : 'Year')] = + parseInt(select.options[select.selectedIndex].value,10); + this._notifyChange(inst); + this._adjustDate(target); + }, + + /* Action for selecting a day. */ + _selectDay: function(id, month, year, td) { + var target = $(id); + if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { + return; + } + var inst = this._getInst(target[0]); + inst.selectedDay = inst.currentDay = $('a', td).html(); + inst.selectedMonth = inst.currentMonth = month; + inst.selectedYear = inst.currentYear = year; + this._selectDate(id, this._formatDate(inst, + inst.currentDay, inst.currentMonth, inst.currentYear)); + }, + + /* Erase the input field and hide the date picker. */ + _clearDate: function(id) { + var target = $(id); + var inst = this._getInst(target[0]); + this._selectDate(target, ''); + }, + + /* Update the input field with the selected date. */ + _selectDate: function(id, dateStr) { + var target = $(id); + var inst = this._getInst(target[0]); + dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); + if (inst.input) + inst.input.val(dateStr); + this._updateAlternate(inst); + var onSelect = this._get(inst, 'onSelect'); + if (onSelect) + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback + else if (inst.input) + inst.input.trigger('change'); // fire the change event + if (inst.inline) + this._updateDatepicker(inst); + else { + this._hideDatepicker(); + this._lastInput = inst.input[0]; + if (typeof(inst.input[0]) != 'object') + inst.input.focus(); // restore focus + this._lastInput = null; + } + }, + + /* Update any alternate field to synchronise with the main field. */ + _updateAlternate: function(inst) { + var altField = this._get(inst, 'altField'); + if (altField) { // update alternate field too + var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); + var date = this._getDate(inst); + var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); + $(altField).each(function() { $(this).val(dateStr); }); + } + }, + + /* Set as beforeShowDay function to prevent selection of weekends. + @param date Date - the date to customise + @return [boolean, string] - is this date selectable?, what is its CSS class? */ + noWeekends: function(date) { + var day = date.getDay(); + return [(day > 0 && day < 6), '']; + }, + + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. + @param date Date - the date to get the week for + @return number - the number of the week within the year that contains this date */ + iso8601Week: function(date) { + var checkDate = new Date(date.getTime()); + // Find Thursday of this week starting on Monday + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); + var time = checkDate.getTime(); + checkDate.setMonth(0); // Compare with Jan 1 + checkDate.setDate(1); + return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; + }, + + /* Parse a string value into a date object. + See formatDate below for the possible formats. + + @param format string - the expected format of the date + @param value string - the date in the above format + @param settings Object - attributes include: + shortYearCutoff number - the cutoff year for determining the century (optional) + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return Date - the extracted date value or null if value is blank */ + parseDate: function (format, value, settings) { + if (format == null || value == null) + throw 'Invalid arguments'; + value = (typeof value == 'object' ? value.toString() : value + ''); + if (value == '') + return null; + var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + var year = -1; + var month = -1; + var day = -1; + var doy = -1; + var literal = false; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Extract a number from the string value + var getNumber = function(match) { + var isDoubled = lookAhead(match); + var size = (match == '@' ? 14 : (match == '!' ? 20 : + (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); + var digits = new RegExp('^\\d{1,' + size + '}'); + var num = value.substring(iValue).match(digits); + if (!num) + throw 'Missing number at position ' + iValue; + iValue += num[0].length; + return parseInt(num[0], 10); + }; + // Extract a name from the string value and convert to an index + var getName = function(match, shortNames, longNames) { + var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { + return [ [k, v] ]; + }).sort(function (a, b) { + return -(a[1].length - b[1].length); + }); + var index = -1; + $.each(names, function (i, pair) { + var name = pair[1]; + if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) { + index = pair[0]; + iValue += name.length; + return false; + } + }); + if (index != -1) + return index + 1; + else + throw 'Unknown name at position ' + iValue; + }; + // Confirm that a literal character matches the string value + var checkLiteral = function() { + if (value.charAt(iValue) != format.charAt(iFormat)) + throw 'Unexpected literal at position ' + iValue; + iValue++; + }; + var iValue = 0; + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + checkLiteral(); + else + switch (format.charAt(iFormat)) { + case 'd': + day = getNumber('d'); + break; + case 'D': + getName('D', dayNamesShort, dayNames); + break; + case 'o': + doy = getNumber('o'); + break; + case 'm': + month = getNumber('m'); + break; + case 'M': + month = getName('M', monthNamesShort, monthNames); + break; + case 'y': + year = getNumber('y'); + break; + case '@': + var date = new Date(getNumber('@')); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case '!': + var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); + year = date.getFullYear(); + month = date.getMonth() + 1; + day = date.getDate(); + break; + case "'": + if (lookAhead("'")) + checkLiteral(); + else + literal = true; + break; + default: + checkLiteral(); + } + } + if (iValue < value.length){ + var extra = value.substr(iValue); + if (!/^\s+/.test(extra)) { + throw "Extra/unparsed characters found in date: " + extra; + } + } + if (year == -1) + year = new Date().getFullYear(); + else if (year < 100) + year += new Date().getFullYear() - new Date().getFullYear() % 100 + + (year <= shortYearCutoff ? 0 : -100); + if (doy > -1) { + month = 1; + day = doy; + do { + var dim = this._getDaysInMonth(year, month - 1); + if (day <= dim) + break; + month++; + day -= dim; + } while (true); + } + var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); + if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) + throw 'Invalid date'; // E.g. 31/02/00 + return date; + }, + + /* Standard date formats. */ + ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) + COOKIE: 'D, dd M yy', + ISO_8601: 'yy-mm-dd', + RFC_822: 'D, d M y', + RFC_850: 'DD, dd-M-y', + RFC_1036: 'D, d M y', + RFC_1123: 'D, d M yy', + RFC_2822: 'D, d M yy', + RSS: 'D, d M y', // RFC 822 + TICKS: '!', + TIMESTAMP: '@', + W3C: 'yy-mm-dd', // ISO 8601 + + _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), + + /* Format a date object into a string value. + The format can be combinations of the following: + d - day of month (no leading zero) + dd - day of month (two digit) + o - day of year (no leading zeros) + oo - day of year (three digit) + D - day name short + DD - day name long + m - month of year (no leading zero) + mm - month of year (two digit) + M - month name short + MM - month name long + y - year (two digit) + yy - year (four digit) + @ - Unix timestamp (ms since 01/01/1970) + ! - Windows ticks (100ns since 01/01/0001) + '...' - literal text + '' - single quote + + @param format string - the desired format of the date + @param date Date - the date value to format + @param settings Object - attributes include: + dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + dayNames string[7] - names of the days from Sunday (optional) + monthNamesShort string[12] - abbreviated names of the months (optional) + monthNames string[12] - names of the months (optional) + @return string - the date in the above format */ + formatDate: function (format, date, settings) { + if (!date) + return ''; + var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; + var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; + var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; + var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + // Format a number, with leading zero if necessary + var formatNumber = function(match, value, len) { + var num = '' + value; + if (lookAhead(match)) + while (num.length < len) + num = '0' + num; + return num; + }; + // Format a name, short or long as requested + var formatName = function(match, value, shortNames, longNames) { + return (lookAhead(match) ? longNames[value] : shortNames[value]); + }; + var output = ''; + var literal = false; + if (date) + for (var iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + output += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': + output += formatNumber('d', date.getDate(), 2); + break; + case 'D': + output += formatName('D', date.getDay(), dayNamesShort, dayNames); + break; + case 'o': + output += formatNumber('o', + Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); + break; + case 'm': + output += formatNumber('m', date.getMonth() + 1, 2); + break; + case 'M': + output += formatName('M', date.getMonth(), monthNamesShort, monthNames); + break; + case 'y': + output += (lookAhead('y') ? date.getFullYear() : + (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); + break; + case '@': + output += date.getTime(); + break; + case '!': + output += date.getTime() * 10000 + this._ticksTo1970; + break; + case "'": + if (lookAhead("'")) + output += "'"; + else + literal = true; + break; + default: + output += format.charAt(iFormat); + } + } + return output; + }, + + /* Extract all possible characters from the date format. */ + _possibleChars: function (format) { + var chars = ''; + var literal = false; + // Check whether a format character is doubled + var lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); + if (matches) + iFormat++; + return matches; + }; + for (var iFormat = 0; iFormat < format.length; iFormat++) + if (literal) + if (format.charAt(iFormat) == "'" && !lookAhead("'")) + literal = false; + else + chars += format.charAt(iFormat); + else + switch (format.charAt(iFormat)) { + case 'd': case 'm': case 'y': case '@': + chars += '0123456789'; + break; + case 'D': case 'M': + return null; // Accept anything + case "'": + if (lookAhead("'")) + chars += "'"; + else + literal = true; + break; + default: + chars += format.charAt(iFormat); + } + return chars; + }, + + /* Get a setting value, defaulting if necessary. */ + _get: function(inst, name) { + return inst.settings[name] !== undefined ? + inst.settings[name] : this._defaults[name]; + }, + + /* Parse existing date and initialise date picker. */ + _setDateFromField: function(inst, noDefault) { + if (inst.input.val() == inst.lastVal) { + return; + } + var dateFormat = this._get(inst, 'dateFormat'); + var dates = inst.lastVal = inst.input ? inst.input.val() : null; + var date, defaultDate; + date = defaultDate = this._getDefaultDate(inst); + var settings = this._getFormatConfig(inst); + try { + date = this.parseDate(dateFormat, dates, settings) || defaultDate; + } catch (event) { + this.log(event); + dates = (noDefault ? '' : dates); + } + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + inst.currentDay = (dates ? date.getDate() : 0); + inst.currentMonth = (dates ? date.getMonth() : 0); + inst.currentYear = (dates ? date.getFullYear() : 0); + this._adjustInstDate(inst); + }, + + /* Retrieve the default date shown on opening. */ + _getDefaultDate: function(inst) { + return this._restrictMinMax(inst, + this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); + }, + + /* A date may be specified as an exact value or a relative one. */ + _determineDate: function(inst, date, defaultDate) { + var offsetNumeric = function(offset) { + var date = new Date(); + date.setDate(date.getDate() + offset); + return date; + }; + var offsetString = function(offset) { + try { + return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), + offset, $.datepicker._getFormatConfig(inst)); + } + catch (e) { + // Ignore + } + var date = (offset.toLowerCase().match(/^c/) ? + $.datepicker._getDate(inst) : null) || new Date(); + var year = date.getFullYear(); + var month = date.getMonth(); + var day = date.getDate(); + var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; + var matches = pattern.exec(offset); + while (matches) { + switch (matches[2] || 'd') { + case 'd' : case 'D' : + day += parseInt(matches[1],10); break; + case 'w' : case 'W' : + day += parseInt(matches[1],10) * 7; break; + case 'm' : case 'M' : + month += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + case 'y': case 'Y' : + year += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + } + matches = pattern.exec(offset); + } + return new Date(year, month, day); + }; + var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : + (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); + newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); + if (newDate) { + newDate.setHours(0); + newDate.setMinutes(0); + newDate.setSeconds(0); + newDate.setMilliseconds(0); + } + return this._daylightSavingAdjust(newDate); + }, + + /* Handle switch to/from daylight saving. + Hours may be non-zero on daylight saving cut-over: + > 12 when midnight changeover, but then cannot generate + midnight datetime, so jump to 1AM, otherwise reset. + @param date (Date) the date to check + @return (Date) the corrected date */ + _daylightSavingAdjust: function(date) { + if (!date) return null; + date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); + return date; + }, + + /* Set the date(s) directly. */ + _setDate: function(inst, date, noChange) { + var clear = !date; + var origMonth = inst.selectedMonth; + var origYear = inst.selectedYear; + var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); + inst.selectedDay = inst.currentDay = newDate.getDate(); + inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); + inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); + if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) + this._notifyChange(inst); + this._adjustInstDate(inst); + if (inst.input) { + inst.input.val(clear ? '' : this._formatDate(inst)); + } + }, + + /* Retrieve the date(s) directly. */ + _getDate: function(inst) { + var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : + this._daylightSavingAdjust(new Date( + inst.currentYear, inst.currentMonth, inst.currentDay))); + return startDate; + }, + + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _attachHandlers: function(inst) { + var stepMonths = this._get(inst, 'stepMonths'); + var id = '#' + inst.id.replace( /\\\\/g, "\\" ); + inst.dpDiv.find('[data-handler]').map(function () { + var handler = { + prev: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); + }, + next: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); + }, + hide: function () { + window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); + }, + today: function () { + window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); + }, + selectDay: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); + return false; + }, + selectMonth: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); + return false; + }, + selectYear: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); + return false; + } + }; + $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); + }); + }, + + /* Generate the HTML for the current state of the date picker. */ + _generateHTML: function(inst) { + var today = new Date(); + today = this._daylightSavingAdjust( + new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time + var isRTL = this._get(inst, 'isRTL'); + var showButtonPanel = this._get(inst, 'showButtonPanel'); + var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); + var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); + var numMonths = this._getNumberOfMonths(inst); + var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); + var stepMonths = this._get(inst, 'stepMonths'); + var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); + var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + var drawMonth = inst.drawMonth - showCurrentAtPos; + var drawYear = inst.drawYear; + if (drawMonth < 0) { + drawMonth += 12; + drawYear--; + } + if (maxDate) { + var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), + maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); + maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); + while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { + drawMonth--; + if (drawMonth < 0) { + drawMonth = 11; + drawYear--; + } + } + } + inst.drawMonth = drawMonth; + inst.drawYear = drawYear; + var prevText = this._get(inst, 'prevText'); + prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), + this._getFormatConfig(inst))); + var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' + + ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : + (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); + var nextText = this._get(inst, 'nextText'); + nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, + this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), + this._getFormatConfig(inst))); + var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? + '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' + + ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : + (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); + var currentText = this._get(inst, 'currentText'); + var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); + currentText = (!navigationAsDateFormat ? currentText : + this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); + var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' + + this._get(inst, 'closeText') + '</button>' : ''); + var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + + (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' + + '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; + var firstDay = parseInt(this._get(inst, 'firstDay'),10); + firstDay = (isNaN(firstDay) ? 0 : firstDay); + var showWeek = this._get(inst, 'showWeek'); + var dayNames = this._get(inst, 'dayNames'); + var dayNamesShort = this._get(inst, 'dayNamesShort'); + var dayNamesMin = this._get(inst, 'dayNamesMin'); + var monthNames = this._get(inst, 'monthNames'); + var monthNamesShort = this._get(inst, 'monthNamesShort'); + var beforeShowDay = this._get(inst, 'beforeShowDay'); + var showOtherMonths = this._get(inst, 'showOtherMonths'); + var selectOtherMonths = this._get(inst, 'selectOtherMonths'); + var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; + var defaultDate = this._getDefaultDate(inst); + var html = ''; + for (var row = 0; row < numMonths[0]; row++) { + var group = ''; + this.maxRows = 4; + for (var col = 0; col < numMonths[1]; col++) { + var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); + var cornerClass = ' ui-corner-all'; + var calender = ''; + if (isMultiMonth) { + calender += '<div class="ui-datepicker-group'; + if (numMonths[1] > 1) + switch (col) { + case 0: calender += ' ui-datepicker-group-first'; + cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; + case numMonths[1]-1: calender += ' ui-datepicker-group-last'; + cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; + default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break; + } + calender += '">'; + } + calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + + (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + + (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, + row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers + '</div><table class="ui-datepicker-calendar"><thead>' + + '<tr>'; + var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); + for (var dow = 0; dow < 7; dow++) { // days of the week + var day = (dow + firstDay) % 7; + thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + + '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; + } + calender += thead + '</tr></thead><tbody>'; + var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); + if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) + inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); + var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; + var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate + var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) + this.maxRows = numRows; + var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); + for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows + calender += '<tr>'; + var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + + this._get(inst, 'calculateWeek')(printDate) + '</td>'); + for (var dow = 0; dow < 7; dow++) { // create date picker days + var daySettings = (beforeShowDay ? + beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); + var otherMonth = (printDate.getMonth() != drawMonth); + var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || + (minDate && printDate < minDate) || (maxDate && printDate > maxDate); + tbody += '<td class="' + + ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends + (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months + ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key + (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? + // or defaultDate is current printedDate and defaultDate is selectedDate + ' ' + this._dayOverClass : '') + // highlight selected day + (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days + (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates + (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day + (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) + ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title + (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions + (otherMonth && !showOtherMonths ? ' ' : // display for other months + (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + + (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + + (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day + (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months + '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date + printDate.setDate(printDate.getDate() + 1); + printDate = this._daylightSavingAdjust(printDate); + } + calender += tbody + '</tr>'; + } + drawMonth++; + if (drawMonth > 11) { + drawMonth = 0; + drawYear++; + } + calender += '</tbody></table>' + (isMultiMonth ? '</div>' + + ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); + group += calender; + } + html += group; + } + html += buttonPanel + ($.ui.ie6 && !inst.inline ? + '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); + inst._keyEvent = false; + return html; + }, + + /* Generate the month and year header. */ + _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, + secondary, monthNames, monthNamesShort) { + var changeMonth = this._get(inst, 'changeMonth'); + var changeYear = this._get(inst, 'changeYear'); + var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); + var html = '<div class="ui-datepicker-title">'; + var monthHtml = ''; + // month selection + if (secondary || !changeMonth) + monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>'; + else { + var inMinYear = (minDate && minDate.getFullYear() == drawYear); + var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); + monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">'; + for (var month = 0; month < 12; month++) { + if ((!inMinYear || month >= minDate.getMonth()) && + (!inMaxYear || month <= maxDate.getMonth())) + monthHtml += '<option value="' + month + '"' + + (month == drawMonth ? ' selected="selected"' : '') + + '>' + monthNamesShort[month] + '</option>'; + } + monthHtml += '</select>'; + } + if (!showMonthAfterYear) + html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); + // year selection + if ( !inst.yearshtml ) { + inst.yearshtml = ''; + if (secondary || !changeYear) + html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; + else { + // determine range of years to display + var years = this._get(inst, 'yearRange').split(':'); + var thisYear = new Date().getFullYear(); + var determineYear = function(value) { + var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : + (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : + parseInt(value, 10))); + return (isNaN(year) ? thisYear : year); + }; + var year = determineYear(years[0]); + var endYear = Math.max(year, determineYear(years[1] || '')); + year = (minDate ? Math.max(year, minDate.getFullYear()) : year); + endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); + inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">'; + for (; year <= endYear; year++) { + inst.yearshtml += '<option value="' + year + '"' + + (year == drawYear ? ' selected="selected"' : '') + + '>' + year + '</option>'; + } + inst.yearshtml += '</select>'; + + html += inst.yearshtml; + inst.yearshtml = null; + } + } + html += this._get(inst, 'yearSuffix'); + if (showMonthAfterYear) + html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; + html += '</div>'; // Close datepicker_header + return html; + }, + + /* Adjust one of the date sub-fields. */ + _adjustInstDate: function(inst, offset, period) { + var year = inst.drawYear + (period == 'Y' ? offset : 0); + var month = inst.drawMonth + (period == 'M' ? offset : 0); + var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + + (period == 'D' ? offset : 0); + var date = this._restrictMinMax(inst, + this._daylightSavingAdjust(new Date(year, month, day))); + inst.selectedDay = date.getDate(); + inst.drawMonth = inst.selectedMonth = date.getMonth(); + inst.drawYear = inst.selectedYear = date.getFullYear(); + if (period == 'M' || period == 'Y') + this._notifyChange(inst); + }, + + /* Ensure a date is within any min/max bounds. */ + _restrictMinMax: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + var newDate = (minDate && date < minDate ? minDate : date); + newDate = (maxDate && newDate > maxDate ? maxDate : newDate); + return newDate; + }, + + /* Notify change of month/year. */ + _notifyChange: function(inst) { + var onChange = this._get(inst, 'onChangeMonthYear'); + if (onChange) + onChange.apply((inst.input ? inst.input[0] : null), + [inst.selectedYear, inst.selectedMonth + 1, inst]); + }, + + /* Determine the number of months to show. */ + _getNumberOfMonths: function(inst) { + var numMonths = this._get(inst, 'numberOfMonths'); + return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + }, + + /* Determine the current maximum date - ensure no time components are set. */ + _getMinMaxDate: function(inst, minMax) { + return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); + }, + + /* Find the number of days in a given month. */ + _getDaysInMonth: function(year, month) { + return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); + }, + + /* Find the day of the week of the first of a month. */ + _getFirstDayOfMonth: function(year, month) { + return new Date(year, month, 1).getDay(); + }, + + /* Determines if we should allow a "next/prev" month display change. */ + _canAdjustMonth: function(inst, offset, curYear, curMonth) { + var numMonths = this._getNumberOfMonths(inst); + var date = this._daylightSavingAdjust(new Date(curYear, + curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); + if (offset < 0) + date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + return this._isInRange(inst, date); + }, + + /* Is the given date in the accepted range? */ + _isInRange: function(inst, date) { + var minDate = this._getMinMaxDate(inst, 'min'); + var maxDate = this._getMinMaxDate(inst, 'max'); + return ((!minDate || date.getTime() >= minDate.getTime()) && + (!maxDate || date.getTime() <= maxDate.getTime())); + }, + + /* Provide the configuration settings for formatting/parsing. */ + _getFormatConfig: function(inst) { + var shortYearCutoff = this._get(inst, 'shortYearCutoff'); + shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); + return {shortYearCutoff: shortYearCutoff, + dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), + monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + }, + + /* Format the given date for display. */ + _formatDate: function(inst, day, month, year) { + if (!day) { + inst.currentDay = inst.selectedDay; + inst.currentMonth = inst.selectedMonth; + inst.currentYear = inst.selectedYear; + } + var date = (day ? (typeof day == 'object' ? day : + this._daylightSavingAdjust(new Date(year, month, day))) : + this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); + return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + } +}); + +/* + * Bind hover events for datepicker elements. + * Done via delegate so the binding only occurs once in the lifetime of the parent div. + * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. + */ +function bindHover(dpDiv) { + var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; + return dpDiv.delegate(selector, 'mouseout', function() { + $(this).removeClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + }) + .delegate(selector, 'mouseover', function(){ + if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { + $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); + $(this).addClass('ui-state-hover'); + if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + } + }); +} + +/* jQuery extend now ignores nulls! */ +function extendRemove(target, props) { + $.extend(target, props); + for (var name in props) + if (props[name] == null || props[name] == undefined) + target[name] = props[name]; + return target; +}; + +/* Invoke the datepicker functionality. + @param options string - a command, optionally followed by additional parameters or + Object - settings for attaching new datepicker functionality + @return jQuery object */ +$.fn.datepicker = function(options){ + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + + /* Initialise the date picker. */ + if (!$.datepicker.initialized) { + $(document).mousedown($.datepicker._checkExternalClick). + find(document.body).append($.datepicker.dpDiv); + $.datepicker.initialized = true; + } + + var otherArgs = Array.prototype.slice.call(arguments, 1); + if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') + return $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this[0]].concat(otherArgs)); + return this.each(function() { + typeof options == 'string' ? + $.datepicker['_' + options + 'Datepicker']. + apply($.datepicker, [this].concat(otherArgs)) : + $.datepicker._attachDatepicker(this, options); + }); +}; + +$.datepicker = new Datepicker(); // singleton instance +$.datepicker.initialized = false; +$.datepicker.uuid = new Date().getTime(); +$.datepicker.version = "1.9.2"; + +// Workaround for #4055 +// Add another global to avoid noConflict issues with inline event handlers +window['DP_jQuery_' + dpuuid] = $; + +})(jQuery); + +(function( $, undefined ) { + +var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", + sizeRelatedOptions = { + buttons: true, + height: true, + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true, + width: true + }, + resizableRelatedOptions = { + maxHeight: true, + maxWidth: true, + minHeight: true, + minWidth: true + }; + +$.widget("ui.dialog", { + version: "1.9.2", + options: { + autoOpen: true, + buttons: {}, + closeOnEscape: true, + closeText: "close", + dialogClass: "", + draggable: true, + hide: null, + height: "auto", + maxHeight: false, + maxWidth: false, + minHeight: 150, + minWidth: 150, + modal: false, + position: { + my: "center", + at: "center", + of: window, + collision: "fit", + // ensure that the titlebar is never outside the document + using: function( pos ) { + var topOffset = $( this ).css( pos ).offset().top; + if ( topOffset < 0 ) { + $( this ).css( "top", pos.top - topOffset ); + } + } + }, + resizable: true, + show: null, + stack: true, + title: "", + width: 300, + zIndex: 1000 + }, + + _create: function() { + this.originalTitle = this.element.attr( "title" ); + // #5742 - .attr() might return a DOMElement + if ( typeof this.originalTitle !== "string" ) { + this.originalTitle = ""; + } + this.oldPosition = { + parent: this.element.parent(), + index: this.element.parent().children().index( this.element ) + }; + this.options.title = this.options.title || this.originalTitle; + var that = this, + options = this.options, + + title = options.title || " ", + uiDialog, + uiDialogTitlebar, + uiDialogTitlebarClose, + uiDialogTitle, + uiDialogButtonPane; + + uiDialog = ( this.uiDialog = $( "<div>" ) ) + .addClass( uiDialogClasses + options.dialogClass ) + .css({ + display: "none", + outline: 0, // TODO: move to stylesheet + zIndex: options.zIndex + }) + // setting tabIndex makes the div focusable + .attr( "tabIndex", -1) + .keydown(function( event ) { + if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + that.close( event ); + event.preventDefault(); + } + }) + .mousedown(function( event ) { + that.moveToTop( false, event ); + }) + .appendTo( "body" ); + + this.element + .show() + .removeAttr( "title" ) + .addClass( "ui-dialog-content ui-widget-content" ) + .appendTo( uiDialog ); + + uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) ) + .addClass( "ui-dialog-titlebar ui-widget-header " + + "ui-corner-all ui-helper-clearfix" ) + .bind( "mousedown", function() { + // Dialog isn't getting focus when dragging (#8063) + uiDialog.focus(); + }) + .prependTo( uiDialog ); + + uiDialogTitlebarClose = $( "<a href='#'></a>" ) + .addClass( "ui-dialog-titlebar-close ui-corner-all" ) + .attr( "role", "button" ) + .click(function( event ) { + event.preventDefault(); + that.close( event ); + }) + .appendTo( uiDialogTitlebar ); + + ( this.uiDialogTitlebarCloseText = $( "<span>" ) ) + .addClass( "ui-icon ui-icon-closethick" ) + .text( options.closeText ) + .appendTo( uiDialogTitlebarClose ); + + uiDialogTitle = $( "<span>" ) + .uniqueId() + .addClass( "ui-dialog-title" ) + .html( title ) + .prependTo( uiDialogTitlebar ); + + uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) ) + .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); + + ( this.uiButtonSet = $( "<div>" ) ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); + + uiDialog.attr({ + role: "dialog", + "aria-labelledby": uiDialogTitle.attr( "id" ) + }); + + uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); + this._hoverable( uiDialogTitlebarClose ); + this._focusable( uiDialogTitlebarClose ); + + if ( options.draggable && $.fn.draggable ) { + this._makeDraggable(); + } + if ( options.resizable && $.fn.resizable ) { + this._makeResizable(); + } + + this._createButtons( options.buttons ); + this._isOpen = false; + + if ( $.fn.bgiframe ) { + uiDialog.bgiframe(); + } + + // prevent tabbing out of modal dialogs + this._on( uiDialog, { keydown: function( event ) { + if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) { + return; + } + + var tabbables = $( ":tabbable", uiDialog ), + first = tabbables.filter( ":first" ), + last = tabbables.filter( ":last" ); + + if ( event.target === last[0] && !event.shiftKey ) { + first.focus( 1 ); + return false; + } else if ( event.target === first[0] && event.shiftKey ) { + last.focus( 1 ); + return false; + } + }}); + }, + + _init: function() { + if ( this.options.autoOpen ) { + this.open(); + } + }, + + _destroy: function() { + var next, + oldPosition = this.oldPosition; + + if ( this.overlay ) { + this.overlay.destroy(); + } + this.uiDialog.hide(); + this.element + .removeClass( "ui-dialog-content ui-widget-content" ) + .hide() + .appendTo( "body" ); + this.uiDialog.remove(); + + if ( this.originalTitle ) { + this.element.attr( "title", this.originalTitle ); + } + + next = oldPosition.parent.children().eq( oldPosition.index ); + // Don't try to place the dialog next to itself (#8613) + if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { + next.before( this.element ); + } else { + oldPosition.parent.append( this.element ); + } + }, + + widget: function() { + return this.uiDialog; + }, + + close: function( event ) { + var that = this, + maxZ, thisZ; + + if ( !this._isOpen ) { + return; + } + + if ( false === this._trigger( "beforeClose", event ) ) { + return; + } + + this._isOpen = false; + + if ( this.overlay ) { + this.overlay.destroy(); + } + + if ( this.options.hide ) { + this._hide( this.uiDialog, this.options.hide, function() { + that._trigger( "close", event ); + }); + } else { + this.uiDialog.hide(); + this._trigger( "close", event ); + } + + $.ui.dialog.overlay.resize(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + if ( this.options.modal ) { + maxZ = 0; + $( ".ui-dialog" ).each(function() { + if ( this !== that.uiDialog[0] ) { + thisZ = $( this ).css( "z-index" ); + if ( !isNaN( thisZ ) ) { + maxZ = Math.max( maxZ, thisZ ); + } + } + }); + $.ui.dialog.maxZ = maxZ; + } + + return this; + }, + + isOpen: function() { + return this._isOpen; + }, + + // the force parameter allows us to move modal dialogs to their correct + // position on open + moveToTop: function( force, event ) { + var options = this.options, + saveScroll; + + if ( ( options.modal && !force ) || + ( !options.stack && !options.modal ) ) { + return this._trigger( "focus", event ); + } + + if ( options.zIndex > $.ui.dialog.maxZ ) { + $.ui.dialog.maxZ = options.zIndex; + } + if ( this.overlay ) { + $.ui.dialog.maxZ += 1; + $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ; + this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ ); + } + + // Save and then restore scroll + // Opera 9.5+ resets when parent z-index is changed. + // http://bugs.jqueryui.com/ticket/3193 + saveScroll = { + scrollTop: this.element.scrollTop(), + scrollLeft: this.element.scrollLeft() + }; + $.ui.dialog.maxZ += 1; + this.uiDialog.css( "z-index", $.ui.dialog.maxZ ); + this.element.attr( saveScroll ); + this._trigger( "focus", event ); + + return this; + }, + + open: function() { + if ( this._isOpen ) { + return; + } + + var hasFocus, + options = this.options, + uiDialog = this.uiDialog; + + this._size(); + this._position( options.position ); + uiDialog.show( options.show ); + this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null; + this.moveToTop( true ); + + // set focus to the first tabbable element in the content area or the first button + // if there are no tabbable elements, set focus on the dialog itself + hasFocus = this.element.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); + if ( !hasFocus.length ) { + hasFocus = uiDialog; + } + } + hasFocus.eq( 0 ).focus(); + + this._isOpen = true; + this._trigger( "open" ); + + return this; + }, + + _createButtons: function( buttons ) { + var that = this, + hasButtons = false; + + // if we already have a button pane, remove it + this.uiDialogButtonPane.remove(); + this.uiButtonSet.empty(); + + if ( typeof buttons === "object" && buttons !== null ) { + $.each( buttons, function() { + return !(hasButtons = true); + }); + } + if ( hasButtons ) { + $.each( buttons, function( name, props ) { + var button, click; + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + // Change the context for the click callback to be the main element + click = props.click; + props.click = function() { + click.apply( that.element[0], arguments ); + }; + button = $( "<button></button>", props ) + .appendTo( that.uiButtonSet ); + if ( $.fn.button ) { + button.button(); + } + }); + this.uiDialog.addClass( "ui-dialog-buttons" ); + this.uiDialogButtonPane.appendTo( this.uiDialog ); + } else { + this.uiDialog.removeClass( "ui-dialog-buttons" ); + } + }, + + _makeDraggable: function() { + var that = this, + options = this.options; + + function filteredUi( ui ) { + return { + position: ui.position, + offset: ui.offset + }; + } + + this.uiDialog.draggable({ + cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", + handle: ".ui-dialog-titlebar", + containment: "document", + start: function( event, ui ) { + $( this ) + .addClass( "ui-dialog-dragging" ); + that._trigger( "dragStart", event, filteredUi( ui ) ); + }, + drag: function( event, ui ) { + that._trigger( "drag", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + options.position = [ + ui.position.left - that.document.scrollLeft(), + ui.position.top - that.document.scrollTop() + ]; + $( this ) + .removeClass( "ui-dialog-dragging" ); + that._trigger( "dragStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }); + }, + + _makeResizable: function( handles ) { + handles = (handles === undefined ? this.options.resizable : handles); + var that = this, + options = this.options, + // .ui-resizable has position: relative defined in the stylesheet + // but dialogs have to use absolute or fixed positioning + position = this.uiDialog.css( "position" ), + resizeHandles = typeof handles === 'string' ? + handles : + "n,e,s,w,se,sw,ne,nw"; + + function filteredUi( ui ) { + return { + originalPosition: ui.originalPosition, + originalSize: ui.originalSize, + position: ui.position, + size: ui.size + }; + } + + this.uiDialog.resizable({ + cancel: ".ui-dialog-content", + containment: "document", + alsoResize: this.element, + maxWidth: options.maxWidth, + maxHeight: options.maxHeight, + minWidth: options.minWidth, + minHeight: this._minHeight(), + handles: resizeHandles, + start: function( event, ui ) { + $( this ).addClass( "ui-dialog-resizing" ); + that._trigger( "resizeStart", event, filteredUi( ui ) ); + }, + resize: function( event, ui ) { + that._trigger( "resize", event, filteredUi( ui ) ); + }, + stop: function( event, ui ) { + $( this ).removeClass( "ui-dialog-resizing" ); + options.height = $( this ).height(); + options.width = $( this ).width(); + that._trigger( "resizeStop", event, filteredUi( ui ) ); + $.ui.dialog.overlay.resize(); + } + }) + .css( "position", position ) + .find( ".ui-resizable-se" ) + .addClass( "ui-icon ui-icon-grip-diagonal-se" ); + }, + + _minHeight: function() { + var options = this.options; + + if ( options.height === "auto" ) { + return options.minHeight; + } else { + return Math.min( options.minHeight, options.height ); + } + }, + + _position: function( position ) { + var myAt = [], + offset = [ 0, 0 ], + isVisible; + + if ( position ) { + // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( + // if (typeof position == 'string' || $.isArray(position)) { + // myAt = $.isArray(position) ? position : position.split(' '); + + if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { + myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ]; + if ( myAt.length === 1 ) { + myAt[ 1 ] = myAt[ 0 ]; + } + + $.each( [ "left", "top" ], function( i, offsetPosition ) { + if ( +myAt[ i ] === myAt[ i ] ) { + offset[ i ] = myAt[ i ]; + myAt[ i ] = offsetPosition; + } + }); + + position = { + my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + + myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), + at: myAt.join( " " ) + }; + } + + position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); + } else { + position = $.ui.dialog.prototype.options.position; + } + + // need to show the dialog to get the actual offset in the position plugin + isVisible = this.uiDialog.is( ":visible" ); + if ( !isVisible ) { + this.uiDialog.show(); + } + this.uiDialog.position( position ); + if ( !isVisible ) { + this.uiDialog.hide(); + } + }, + + _setOptions: function( options ) { + var that = this, + resizableOptions = {}, + resize = false; + + $.each( options, function( key, value ) { + that._setOption( key, value ); + + if ( key in sizeRelatedOptions ) { + resize = true; + } + if ( key in resizableRelatedOptions ) { + resizableOptions[ key ] = value; + } + }); + + if ( resize ) { + this._size(); + } + if ( this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", resizableOptions ); + } + }, + + _setOption: function( key, value ) { + var isDraggable, isResizable, + uiDialog = this.uiDialog; + + switch ( key ) { + case "buttons": + this._createButtons( value ); + break; + case "closeText": + // ensure that we always pass a string + this.uiDialogTitlebarCloseText.text( "" + value ); + break; + case "dialogClass": + uiDialog + .removeClass( this.options.dialogClass ) + .addClass( uiDialogClasses + value ); + break; + case "disabled": + if ( value ) { + uiDialog.addClass( "ui-dialog-disabled" ); + } else { + uiDialog.removeClass( "ui-dialog-disabled" ); + } + break; + case "draggable": + isDraggable = uiDialog.is( ":data(draggable)" ); + if ( isDraggable && !value ) { + uiDialog.draggable( "destroy" ); + } + + if ( !isDraggable && value ) { + this._makeDraggable(); + } + break; + case "position": + this._position( value ); + break; + case "resizable": + // currently resizable, becoming non-resizable + isResizable = uiDialog.is( ":data(resizable)" ); + if ( isResizable && !value ) { + uiDialog.resizable( "destroy" ); + } + + // currently resizable, changing handles + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); + } + + // currently non-resizable, becoming resizable + if ( !isResizable && value !== false ) { + this._makeResizable( value ); + } + break; + case "title": + // convert whatever was passed in o a string, for html() to not throw up + $( ".ui-dialog-title", this.uiDialogTitlebar ) + .html( "" + ( value || " " ) ); + break; + } + + this._super( key, value ); + }, + + _size: function() { + /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + * divs will both have width and height set, so we need to reset them + */ + var nonContentHeight, minContentHeight, autoHeight, + options = this.options, + isVisible = this.uiDialog.is( ":visible" ); + + // reset content sizing + this.element.show().css({ + width: "auto", + minHeight: 0, + height: 0 + }); + + if ( options.minWidth > options.width ) { + options.width = options.minWidth; + } + + // reset wrapper sizing + // determine the height of all the non-content elements + nonContentHeight = this.uiDialog.css({ + height: "auto", + width: options.width + }) + .outerHeight(); + minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); + + if ( options.height === "auto" ) { + // only needed for IE6 support + if ( $.support.minHeight ) { + this.element.css({ + minHeight: minContentHeight, + height: "auto" + }); + } else { + this.uiDialog.show(); + autoHeight = this.element.css( "height", "auto" ).height(); + if ( !isVisible ) { + this.uiDialog.hide(); + } + this.element.height( Math.max( autoHeight, minContentHeight ) ); + } + } else { + this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); + } + + if (this.uiDialog.is( ":data(resizable)" ) ) { + this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); + } + } +}); + +$.extend($.ui.dialog, { + uuid: 0, + maxZ: 0, + + getTitleId: function($el) { + var id = $el.attr( "id" ); + if ( !id ) { + this.uuid += 1; + id = this.uuid; + } + return "ui-dialog-title-" + id; + }, + + overlay: function( dialog ) { + this.$el = $.ui.dialog.overlay.create( dialog ); + } +}); + +$.extend( $.ui.dialog.overlay, { + instances: [], + // reuse old instances due to IE memory leak with alpha transparency (see #5185) + oldInstances: [], + maxZ: 0, + events: $.map( + "focus,mousedown,mouseup,keydown,keypress,click".split( "," ), + function( event ) { + return event + ".dialog-overlay"; + } + ).join( " " ), + create: function( dialog ) { + if ( this.instances.length === 0 ) { + // prevent use of anchors and inputs + // we use a setTimeout in case the overlay is created from an + // event that we're going to be cancelling (see #2804) + setTimeout(function() { + // handle $(el).dialog().dialog('close') (see #4065) + if ( $.ui.dialog.overlay.instances.length ) { + $( document ).bind( $.ui.dialog.overlay.events, function( event ) { + // stop events if the z-index of the target is < the z-index of the overlay + // we cannot return true when we don't want to cancel the event (#3523) + if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { + return false; + } + }); + } + }, 1 ); + + // handle window resize + $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize ); + } + + var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) ); + + // allow closing by pressing the escape key + $( document ).bind( "keydown.dialog-overlay", function( event ) { + var instances = $.ui.dialog.overlay.instances; + // only react to the event if we're the top overlay + if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el && + dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + + dialog.close( event ); + event.preventDefault(); + } + }); + + $el.appendTo( document.body ).css({ + width: this.width(), + height: this.height() + }); + + if ( $.fn.bgiframe ) { + $el.bgiframe(); + } + + this.instances.push( $el ); + return $el; + }, + + destroy: function( $el ) { + var indexOf = $.inArray( $el, this.instances ), + maxZ = 0; + + if ( indexOf !== -1 ) { + this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); + } + + if ( this.instances.length === 0 ) { + $( [ document, window ] ).unbind( ".dialog-overlay" ); + } + + $el.height( 0 ).width( 0 ).remove(); + + // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) + $.each( this.instances, function() { + maxZ = Math.max( maxZ, this.css( "z-index" ) ); + }); + this.maxZ = maxZ; + }, + + height: function() { + var scrollHeight, + offsetHeight; + // handle IE + if ( $.ui.ie ) { + scrollHeight = Math.max( + document.documentElement.scrollHeight, + document.body.scrollHeight + ); + offsetHeight = Math.max( + document.documentElement.offsetHeight, + document.body.offsetHeight + ); + + if ( scrollHeight < offsetHeight ) { + return $( window ).height() + "px"; + } else { + return scrollHeight + "px"; + } + // handle "good" browsers + } else { + return $( document ).height() + "px"; + } + }, + + width: function() { + var scrollWidth, + offsetWidth; + // handle IE + if ( $.ui.ie ) { + scrollWidth = Math.max( + document.documentElement.scrollWidth, + document.body.scrollWidth + ); + offsetWidth = Math.max( + document.documentElement.offsetWidth, + document.body.offsetWidth + ); + + if ( scrollWidth < offsetWidth ) { + return $( window ).width() + "px"; + } else { + return scrollWidth + "px"; + } + // handle "good" browsers + } else { + return $( document ).width() + "px"; + } + }, + + resize: function() { + /* If the dialog is draggable and the user drags it past the + * right edge of the window, the document becomes wider so we + * need to stretch the overlay. If the user then drags the + * dialog back to the left, the document will become narrower, + * so we need to shrink the overlay to the appropriate size. + * This is handled by shrinking the overlay before setting it + * to the full document size. + */ + var $overlays = $( [] ); + $.each( $.ui.dialog.overlay.instances, function() { + $overlays = $overlays.add( this ); + }); + + $overlays.css({ + width: 0, + height: 0 + }).css({ + width: $.ui.dialog.overlay.width(), + height: $.ui.dialog.overlay.height() + }); + } +}); + +$.extend( $.ui.dialog.overlay.prototype, { + destroy: function() { + $.ui.dialog.overlay.destroy( this.$el ); + } +}); + +}( jQuery ) ); + +(function( $, undefined ) { + +var rvertical = /up|down|vertical/, + rpositivemotion = /up|left|vertical|horizontal/; + +$.effects.effect.blind = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + direction = o.direction || "up", + vertical = rvertical.test( direction ), + ref = vertical ? "height" : "width", + ref2 = vertical ? "top" : "left", + motion = rpositivemotion.test( direction ), + animation = {}, + show = mode === "show", + wrapper, distance, margin; + + // if already wrapped, the wrapper's properties are my property. #6245 + if ( el.parent().is( ".ui-effects-wrapper" ) ) { + $.effects.save( el.parent(), props ); + } else { + $.effects.save( el, props ); + } + el.show(); + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + distance = wrapper[ ref ](); + margin = parseFloat( wrapper.css( ref2 ) ) || 0; + + animation[ ref ] = show ? distance : 0; + if ( !motion ) { + el + .css( vertical ? "bottom" : "right", 0 ) + .css( vertical ? "top" : "left", "auto" ) + .css({ position: "absolute" }); + + animation[ ref2 ] = show ? margin : distance + margin; + } + + // start at 0 if we are showing + if ( show ) { + wrapper.css( ref, 0 ); + if ( ! motion ) { + wrapper.css( ref2, margin + distance ); + } + } + + // Animate + wrapper.animate( animation, { + duration: o.duration, + easing: o.easing, + queue: false, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.bounce = function( o, done ) { + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + + // defaults: + mode = $.effects.setMode( el, o.mode || "effect" ), + hide = mode === "hide", + show = mode === "show", + direction = o.direction || "up", + distance = o.distance, + times = o.times || 5, + + // number of internal animations + anims = times * 2 + ( show || hide ? 1 : 0 ), + speed = o.duration / anims, + easing = o.easing, + + // utility: + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ), + i, + upAnim, + downAnim, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + // Avoid touching opacity to prevent clearType and PNG issues in IE + if ( show || hide ) { + props.push( "opacity" ); + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); // Create Wrapper + + // default distance for the BIGGEST bounce is the outer Distance / 3 + if ( !distance ) { + distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; + } + + if ( show ) { + downAnim = { opacity: 1 }; + downAnim[ ref ] = 0; + + // if we are showing, force opacity 0 and set the initial position + // then do the "first" animation + el.css( "opacity", 0 ) + .css( ref, motion ? -distance * 2 : distance * 2 ) + .animate( downAnim, speed, easing ); + } + + // start at the smallest distance if we are hiding + if ( hide ) { + distance = distance / Math.pow( 2, times - 1 ); + } + + downAnim = {}; + downAnim[ ref ] = 0; + // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here + for ( i = 0; i < times; i++ ) { + upAnim = {}; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ) + .animate( downAnim, speed, easing ); + + distance = hide ? distance * 2 : distance / 2; + } + + // Last Bounce when Hiding + if ( hide ) { + upAnim = { opacity: 0 }; + upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; + + el.animate( upAnim, speed, easing ); + } + + el.queue(function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.clip = function( o, done ) { + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "vertical", + vert = direction === "vertical", + size = vert ? "height" : "width", + position = vert ? "top" : "left", + animation = {}, + wrapper, animate, distance; + + // Save & Show + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + animate = ( el[0].tagName === "IMG" ) ? wrapper : el; + distance = animate[ size ](); + + // Shift + if ( show ) { + animate.css( size, 0 ); + animate.css( position, distance / 2 ); + } + + // Create Animation Object: + animation[ size ] = show ? distance : 0; + animation[ position ] = show ? 0 : distance / 2; + + // Animate + animate.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( !show ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.drop = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + direction = o.direction || "left", + ref = ( direction === "up" || direction === "down" ) ? "top" : "left", + motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", + animation = { + opacity: show ? 1 : 0 + }, + distance; + + // Adjust + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; + + if ( show ) { + el + .css( "opacity", 0 ) + .css( ref, motion === "pos" ? -distance : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( motion === "pos" ? "+=" : "-=" ) : + ( motion === "pos" ? "-=" : "+=" ) ) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.explode = function( o, done ) { + + var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, + cells = rows, + el = $( this ), + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + + // show and then visibility:hidden the element before calculating offset + offset = el.show().css( "visibility", "hidden" ).offset(), + + // width and height of a piece + width = Math.ceil( el.outerWidth() / cells ), + height = Math.ceil( el.outerHeight() / rows ), + pieces = [], + + // loop + i, j, left, top, mx, my; + + // children animate complete: + function childComplete() { + pieces.push( this ); + if ( pieces.length === rows * cells ) { + animComplete(); + } + } + + // clone the element for each row and cell. + for( i = 0; i < rows ; i++ ) { // ===> + top = offset.top + i * height; + my = i - ( rows - 1 ) / 2 ; + + for( j = 0; j < cells ; j++ ) { // ||| + left = offset.left + j * width; + mx = j - ( cells - 1 ) / 2 ; + + // Create a clone of the now hidden main element that will be absolute positioned + // within a wrapper div off the -left and -top equal to size of our pieces + el + .clone() + .appendTo( "body" ) + .wrap( "<div></div>" ) + .css({ + position: "absolute", + visibility: "visible", + left: -j * width, + top: -i * height + }) + + // select the wrapper - make it overflow: hidden and absolute positioned based on + // where the original was located +left and +top equal to the size of pieces + .parent() + .addClass( "ui-effects-explode" ) + .css({ + position: "absolute", + overflow: "hidden", + width: width, + height: height, + left: left + ( show ? mx * width : 0 ), + top: top + ( show ? my * height : 0 ), + opacity: show ? 0 : 1 + }).animate({ + left: left + ( show ? 0 : mx * width ), + top: top + ( show ? 0 : my * height ), + opacity: show ? 1 : 0 + }, o.duration || 500, o.easing, childComplete ); + } + } + + function animComplete() { + el.css({ + visibility: "visible" + }); + $( pieces ).remove(); + if ( !show ) { + el.hide(); + } + done(); + } +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.fade = function( o, done ) { + var el = $( this ), + mode = $.effects.setMode( el, o.mode || "toggle" ); + + el.animate({ + opacity: mode + }, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: done + }); +}; + +})( jQuery ); + +(function( $, undefined ) { + +$.effects.effect.fold = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "hide" ), + show = mode === "show", + hide = mode === "hide", + size = o.size || 15, + percent = /([0-9]+)%/.exec( size ), + horizFirst = !!o.horizFirst, + widthFirst = show !== horizFirst, + ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], + duration = o.duration / 2, + wrapper, distance, + animation1 = {}, + animation2 = {}; + + $.effects.save( el, props ); + el.show(); + + // Create Wrapper + wrapper = $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + distance = widthFirst ? + [ wrapper.width(), wrapper.height() ] : + [ wrapper.height(), wrapper.width() ]; + + if ( percent ) { + size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; + } + if ( show ) { + wrapper.css( horizFirst ? { + height: 0, + width: size + } : { + height: size, + width: 0 + }); + } + + // Animation + animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; + animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; + + // Animate + wrapper + .animate( animation1, duration, o.easing ) + .animate( animation2, duration, o.easing, function() { + if ( hide ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.highlight = function( o, done ) { + var elem = $( this ), + props = [ "backgroundImage", "backgroundColor", "opacity" ], + mode = $.effects.setMode( elem, o.mode || "show" ), + animation = { + backgroundColor: elem.css( "backgroundColor" ) + }; + + if (mode === "hide") { + animation.opacity = 0; + } + + $.effects.save( elem, props ); + + elem + .show() + .css({ + backgroundImage: "none", + backgroundColor: o.color || "#ffff99" + }) + .animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + elem.hide(); + } + $.effects.restore( elem, props ); + done(); + } + }); +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.pulsate = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "show" ), + show = mode === "show", + hide = mode === "hide", + showhide = ( show || mode === "hide" ), + + // showing or hiding leaves of the "last" animation + anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), + duration = o.duration / anims, + animateTo = 0, + queue = elem.queue(), + queuelen = queue.length, + i; + + if ( show || !elem.is(":visible")) { + elem.css( "opacity", 0 ).show(); + animateTo = 1; + } + + // anims - 1 opacity "toggles" + for ( i = 1; i < anims; i++ ) { + elem.animate({ + opacity: animateTo + }, duration, o.easing ); + animateTo = 1 - animateTo; + } + + elem.animate({ + opacity: animateTo + }, duration, o.easing); + + elem.queue(function() { + if ( hide ) { + elem.hide(); + } + done(); + }); + + // We just queued up "anims" animations, we need to put them next in the queue + if ( queuelen > 1 ) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + elem.dequeue(); +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.puff = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "hide" ), + hide = mode === "hide", + percent = parseInt( o.percent, 10 ) || 150, + factor = percent / 100, + original = { + height: elem.height(), + width: elem.width(), + outerHeight: elem.outerHeight(), + outerWidth: elem.outerWidth() + }; + + $.extend( o, { + effect: "scale", + queue: false, + fade: true, + mode: mode, + complete: done, + percent: hide ? percent : 100, + from: hide ? + original : + { + height: original.height * factor, + width: original.width * factor, + outerHeight: original.outerHeight * factor, + outerWidth: original.outerWidth * factor + } + }); + + elem.effect( o ); +}; + +$.effects.effect.scale = function( o, done ) { + + // Create element + var el = $( this ), + options = $.extend( true, {}, o ), + mode = $.effects.setMode( el, o.mode || "effect" ), + percent = parseInt( o.percent, 10 ) || + ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), + direction = o.direction || "both", + origin = o.origin, + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }, + factor = { + y: direction !== "horizontal" ? (percent / 100) : 1, + x: direction !== "vertical" ? (percent / 100) : 1 + }; + + // We are going to pass this effect to the size effect: + options.effect = "size"; + options.queue = false; + options.complete = done; + + // Set default origin and restore for show/hide + if ( mode !== "effect" ) { + options.origin = origin || ["middle","center"]; + options.restore = true; + } + + options.from = o.from || ( mode === "show" ? { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + } : original ); + options.to = { + height: original.height * factor.y, + width: original.width * factor.x, + outerHeight: original.outerHeight * factor.y, + outerWidth: original.outerWidth * factor.x + }; + + // Fade option to support puff + if ( options.fade ) { + if ( mode === "show" ) { + options.from.opacity = 0; + options.to.opacity = 1; + } + if ( mode === "hide" ) { + options.from.opacity = 1; + options.to.opacity = 0; + } + } + + // Animate + el.effect( options ); + +}; + +$.effects.effect.size = function( o, done ) { + + // Create element + var original, baseline, factor, + el = $( this ), + props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], + + // Always restore + props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], + + // Copy for children + props2 = [ "width", "height", "overflow" ], + cProps = [ "fontSize" ], + vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], + hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], + + // Set options + mode = $.effects.setMode( el, o.mode || "effect" ), + restore = o.restore || mode !== "effect", + scale = o.scale || "both", + origin = o.origin || [ "middle", "center" ], + position = el.css( "position" ), + props = restore ? props0 : props1, + zero = { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + }; + + if ( mode === "show" ) { + el.show(); + } + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }; + + if ( o.mode === "toggle" && mode === "show" ) { + el.from = o.to || zero; + el.to = o.from || original; + } else { + el.from = o.from || ( mode === "show" ? zero : original ); + el.to = o.to || ( mode === "hide" ? zero : original ); + } + + // Set scaling factor + factor = { + from: { + y: el.from.height / original.height, + x: el.from.width / original.width + }, + to: { + y: el.to.height / original.height, + x: el.to.width / original.width + } + }; + + // Scale the css box + if ( scale === "box" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( vProps ); + el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + props = props.concat( hProps ); + el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); + el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); + } + } + + // Scale the content + if ( scale === "content" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( cProps ).concat( props2 ); + el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); + } + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + el.css( "overflow", "hidden" ).css( el.from ); + + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + + // Animate + if ( scale === "content" || scale === "both" ) { // Scale the children + + // Add margins/font-size + vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); + hProps = hProps.concat([ "marginLeft", "marginRight" ]); + props2 = props0.concat(vProps).concat(hProps); + + el.find( "*[width]" ).each( function(){ + var child = $( this ), + c_original = { + height: child.height(), + width: child.width(), + outerHeight: child.outerHeight(), + outerWidth: child.outerWidth() + }; + if (restore) { + $.effects.save(child, props2); + } + + child.from = { + height: c_original.height * factor.from.y, + width: c_original.width * factor.from.x, + outerHeight: c_original.outerHeight * factor.from.y, + outerWidth: c_original.outerWidth * factor.from.x + }; + child.to = { + height: c_original.height * factor.to.y, + width: c_original.width * factor.to.x, + outerHeight: c_original.height * factor.to.y, + outerWidth: c_original.width * factor.to.x + }; + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); + child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); + child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); + } + + // Animate children + child.css( child.from ); + child.animate( child.to, o.duration, o.easing, function() { + + // Restore children + if ( restore ) { + $.effects.restore( child, props2 ); + } + }); + }); + } + + // Animate + el.animate( el.to, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( el.to.opacity === 0 ) { + el.css( "opacity", el.from.opacity ); + } + if( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + if ( !restore ) { + + // we need to calculate our new positioning based on the scaling + if ( position === "static" ) { + el.css({ + position: "relative", + top: el.to.top, + left: el.to.left + }); + } else { + $.each([ "top", "left" ], function( idx, pos ) { + el.css( pos, function( _, str ) { + var val = parseInt( str, 10 ), + toRef = idx ? el.to.left : el.to.top; + + // if original was "auto", recalculate the new value from wrapper + if ( str === "auto" ) { + return toRef + "px"; + } + + return val + toRef + "px"; + }); + }); + } + } + + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.shake = function( o, done ) { + + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "height", "width" ], + mode = $.effects.setMode( el, o.mode || "effect" ), + direction = o.direction || "left", + distance = o.distance || 20, + times = o.times || 3, + anims = times * 2 + 1, + speed = Math.round(o.duration/anims), + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + animation = {}, + animation1 = {}, + animation2 = {}, + i, + + // we will need to re-assemble the queue to stack our animations in place + queue = el.queue(), + queuelen = queue.length; + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + + // Animation + animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; + animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; + animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; + + // Animate + el.animate( animation, speed, o.easing ); + + // Shakes + for ( i = 1; i < times; i++ ) { + el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); + } + el + .animate( animation1, speed, o.easing ) + .animate( animation, speed / 2, o.easing ) + .queue(function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + }); + + // inject all the animations we just queued to be first in line (after "inprogress") + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); + } + el.dequeue(); + +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.slide = function( o, done ) { + + // Create element + var el = $( this ), + props = [ "position", "top", "bottom", "left", "right", "width", "height" ], + mode = $.effects.setMode( el, o.mode || "show" ), + show = mode === "show", + direction = o.direction || "left", + ref = (direction === "up" || direction === "down") ? "top" : "left", + positiveMotion = (direction === "up" || direction === "left"), + distance, + animation = {}; + + // Adjust + $.effects.save( el, props ); + el.show(); + distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); + + $.effects.createWrapper( el ).css({ + overflow: "hidden" + }); + + if ( show ) { + el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); + } + + // Animation + animation[ ref ] = ( show ? + ( positiveMotion ? "+=" : "-=") : + ( positiveMotion ? "-=" : "+=")) + + distance; + + // Animate + el.animate( animation, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + $.effects.removeWrapper( el ); + done(); + } + }); +}; + +})(jQuery); + +(function( $, undefined ) { + +$.effects.effect.transfer = function( o, done ) { + var elem = $( this ), + target = $( o.to ), + targetFixed = target.css( "position" ) === "fixed", + body = $("body"), + fixTop = targetFixed ? body.scrollTop() : 0, + fixLeft = targetFixed ? body.scrollLeft() : 0, + endPosition = target.offset(), + animation = { + top: endPosition.top - fixTop , + left: endPosition.left - fixLeft , + height: target.innerHeight(), + width: target.innerWidth() + }, + startPosition = elem.offset(), + transfer = $( '<div class="ui-effects-transfer"></div>' ) + .appendTo( document.body ) + .addClass( o.className ) + .css({ + top: startPosition.top - fixTop , + left: startPosition.left - fixLeft , + height: elem.innerHeight(), + width: elem.innerWidth(), + position: targetFixed ? "fixed" : "absolute" + }) + .animate( animation, o.duration, o.easing, function() { + transfer.remove(); + done(); + }); +}; + +})(jQuery); + +(function( $, undefined ) { + +var mouseHandled = false; + +$.widget( "ui.menu", { + version: "1.9.2", + defaultElement: "<ul>", + delay: 300, + options: { + icons: { + submenu: "ui-icon-carat-1-e" + }, + menus: "ul", + position: { + my: "left top", + at: "right top" + }, + role: "menu", + + // callbacks + blur: null, + focus: null, + select: null + }, + + _create: function() { + this.activeMenu = this.element; + this.element + .uniqueId() + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) + .attr({ + role: this.options.role, + tabIndex: 0 + }) + // need to catch all clicks on disabled menu + // not possible through _on + .bind( "click" + this.eventNamespace, $.proxy(function( event ) { + if ( this.options.disabled ) { + event.preventDefault(); + } + }, this )); + + if ( this.options.disabled ) { + this.element + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } + + this._on({ + // Prevent focus from sticking to links inside menu after clicking + // them (focus should always stay on UL during navigation). + "mousedown .ui-menu-item > a": function( event ) { + event.preventDefault(); + }, + "click .ui-state-disabled > a": function( event ) { + event.preventDefault(); + }, + "click .ui-menu-item:has(a)": function( event ) { + var target = $( event.target ).closest( ".ui-menu-item" ); + if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) { + mouseHandled = true; + + this.select( event ); + // Open submenu on click + if ( target.has( ".ui-menu" ).length ) { + this.expand( event ); + } else if ( !this.element.is( ":focus" ) ) { + // Redirect focus to the menu + this.element.trigger( "focus", [ true ] ); + + // If the active item is on the top level, let it stay active. + // Otherwise, blur the active item since it is no longer visible. + if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { + clearTimeout( this.timer ); + } + } + } + }, + "mouseenter .ui-menu-item": function( event ) { + var target = $( event.currentTarget ); + // Remove ui-state-active class from siblings of the newly focused menu item + // to avoid a jump caused by adjacent elements both having a class with a border + target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" ); + this.focus( event, target ); + }, + mouseleave: "collapseAll", + "mouseleave .ui-menu": "collapseAll", + focus: function( event, keepActiveItem ) { + // If there's already an active item, keep it active + // If not, activate the first item + var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 ); + + if ( !keepActiveItem ) { + this.focus( event, item ); + } + }, + blur: function( event ) { + this._delay(function() { + if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { + this.collapseAll( event ); + } + }); + }, + keydown: "_keydown" + }); + + this.refresh(); + + // Clicks outside of a menu collapse any open menus + this._on( this.document, { + click: function( event ) { + if ( !$( event.target ).closest( ".ui-menu" ).length ) { + this.collapseAll( event ); + } + + // Reset the mouseHandled flag + mouseHandled = false; + } + }); + }, + + _destroy: function() { + // Destroy (sub)menus + this.element + .removeAttr( "aria-activedescendant" ) + .find( ".ui-menu" ).andSelf() + .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-disabled" ) + .removeUniqueId() + .show(); + + // Destroy menu items + this.element.find( ".ui-menu-item" ) + .removeClass( "ui-menu-item" ) + .removeAttr( "role" ) + .removeAttr( "aria-disabled" ) + .children( "a" ) + .removeUniqueId() + .removeClass( "ui-corner-all ui-state-hover" ) + .removeAttr( "tabIndex" ) + .removeAttr( "role" ) + .removeAttr( "aria-haspopup" ) + .children().each( function() { + var elem = $( this ); + if ( elem.data( "ui-menu-submenu-carat" ) ) { + elem.remove(); + } + }); + + // Destroy menu dividers + this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); + }, + + _keydown: function( event ) { + var match, prev, character, skip, regex, + preventDefault = true; + + function escape( value ) { + return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.PAGE_UP: + this.previousPage( event ); + break; + case $.ui.keyCode.PAGE_DOWN: + this.nextPage( event ); + break; + case $.ui.keyCode.HOME: + this._move( "first", "first", event ); + break; + case $.ui.keyCode.END: + this._move( "last", "last", event ); + break; + case $.ui.keyCode.UP: + this.previous( event ); + break; + case $.ui.keyCode.DOWN: + this.next( event ); + break; + case $.ui.keyCode.LEFT: + this.collapse( event ); + break; + case $.ui.keyCode.RIGHT: + if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { + this.expand( event ); + } + break; + case $.ui.keyCode.ENTER: + case $.ui.keyCode.SPACE: + this._activate( event ); + break; + case $.ui.keyCode.ESCAPE: + this.collapse( event ); + break; + default: + preventDefault = false; + prev = this.previousFilter || ""; + character = String.fromCharCode( event.keyCode ); + skip = false; + + clearTimeout( this.filterTimer ); + + if ( character === prev ) { + skip = true; + } else { + character = prev + character; + } + + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + match = skip && match.index( this.active.next() ) !== -1 ? + this.active.nextAll( ".ui-menu-item" ) : + match; + + // If no matches on the current filter, reset to the last character pressed + // to move down the menu to the first item that starts with that character + if ( !match.length ) { + character = String.fromCharCode( event.keyCode ); + regex = new RegExp( "^" + escape( character ), "i" ); + match = this.activeMenu.children( ".ui-menu-item" ).filter(function() { + return regex.test( $( this ).children( "a" ).text() ); + }); + } + + if ( match.length ) { + this.focus( event, match ); + if ( match.length > 1 ) { + this.previousFilter = character; + this.filterTimer = this._delay(function() { + delete this.previousFilter; + }, 1000 ); + } else { + delete this.previousFilter; + } + } else { + delete this.previousFilter; + } + } + + if ( preventDefault ) { + event.preventDefault(); + } + }, + + _activate: function( event ) { + if ( !this.active.is( ".ui-state-disabled" ) ) { + if ( this.active.children( "a[aria-haspopup='true']" ).length ) { + this.expand( event ); + } else { + this.select( event ); + } + } + }, + + refresh: function() { + var menus, + icon = this.options.icons.submenu, + submenus = this.element.find( this.options.menus ); + + // Initialize nested menus + submenus.filter( ":not(.ui-menu)" ) + .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) + .hide() + .attr({ + role: this.options.role, + "aria-hidden": "true", + "aria-expanded": "false" + }) + .each(function() { + var menu = $( this ), + item = menu.prev( "a" ), + submenuCarat = $( "<span>" ) + .addClass( "ui-menu-icon ui-icon " + icon ) + .data( "ui-menu-submenu-carat", true ); + + item + .attr( "aria-haspopup", "true" ) + .prepend( submenuCarat ); + menu.attr( "aria-labelledby", item.attr( "id" ) ); + }); + + menus = submenus.add( this.element ); + + // Don't refresh list items that are already adapted + menus.children( ":not(.ui-menu-item):has(a)" ) + .addClass( "ui-menu-item" ) + .attr( "role", "presentation" ) + .children( "a" ) + .uniqueId() + .addClass( "ui-corner-all" ) + .attr({ + tabIndex: -1, + role: this._itemRole() + }); + + // Initialize unlinked menu-items containing spaces and/or dashes only as dividers + menus.children( ":not(.ui-menu-item)" ).each(function() { + var item = $( this ); + // hyphen, em dash, en dash + if ( !/[^\-—–\s]/.test( item.text() ) ) { + item.addClass( "ui-widget-content ui-menu-divider" ); + } + }); + + // Add aria-disabled attribute to any disabled menu item + menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); + + // If the active item has been removed, blur the menu + if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + this.blur(); + } + }, + + _itemRole: function() { + return { + menu: "menuitem", + listbox: "option" + }[ this.options.role ]; + }, + + focus: function( event, item ) { + var nested, focused; + this.blur( event, event && event.type === "focus" ); + + this._scrollIntoView( item ); + + this.active = item.first(); + focused = this.active.children( "a" ).addClass( "ui-state-focus" ); + // Only update aria-activedescendant if there's a role + // otherwise we assume focus is managed elsewhere + if ( this.options.role ) { + this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); + } + + // Highlight active parent menu item, if any + this.active + .parent() + .closest( ".ui-menu-item" ) + .children( "a:first" ) + .addClass( "ui-state-active" ); + + if ( event && event.type === "keydown" ) { + this._close(); + } else { + this.timer = this._delay(function() { + this._close(); + }, this.delay ); + } + + nested = item.children( ".ui-menu" ); + if ( nested.length && ( /^mouse/.test( event.type ) ) ) { + this._startOpening(nested); + } + this.activeMenu = item.parent(); + + this._trigger( "focus", event, { item: item } ); + }, + + _scrollIntoView: function( item ) { + var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; + if ( this._hasScroll() ) { + borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; + paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; + scroll = this.activeMenu.scrollTop(); + elementHeight = this.activeMenu.height(); + itemHeight = item.height(); + + if ( offset < 0 ) { + this.activeMenu.scrollTop( scroll + offset ); + } else if ( offset + itemHeight > elementHeight ) { + this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); + } + } + }, + + blur: function( event, fromFocus ) { + if ( !fromFocus ) { + clearTimeout( this.timer ); + } + + if ( !this.active ) { + return; + } + + this.active.children( "a" ).removeClass( "ui-state-focus" ); + this.active = null; + + this._trigger( "blur", event, { item: this.active } ); + }, + + _startOpening: function( submenu ) { + clearTimeout( this.timer ); + + // Don't open if already open fixes a Firefox bug that caused a .5 pixel + // shift in the submenu position when mousing over the carat icon + if ( submenu.attr( "aria-hidden" ) !== "true" ) { + return; + } + + this.timer = this._delay(function() { + this._close(); + this._open( submenu ); + }, this.delay ); + }, + + _open: function( submenu ) { + var position = $.extend({ + of: this.active + }, this.options.position ); + + clearTimeout( this.timer ); + this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) + .hide() + .attr( "aria-hidden", "true" ); + + submenu + .show() + .removeAttr( "aria-hidden" ) + .attr( "aria-expanded", "true" ) + .position( position ); + }, + + collapseAll: function( event, all ) { + clearTimeout( this.timer ); + this.timer = this._delay(function() { + // If we were passed an event, look for the submenu that contains the event + var currentMenu = all ? this.element : + $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); + + // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway + if ( !currentMenu.length ) { + currentMenu = this.element; + } + + this._close( currentMenu ); + + this.blur( event ); + this.activeMenu = currentMenu; + }, this.delay ); + }, + + // With no arguments, closes the currently active menu - if nothing is active + // it closes all menus. If passed an argument, it will search for menus BELOW + _close: function( startMenu ) { + if ( !startMenu ) { + startMenu = this.active ? this.active.parent() : this.element; + } + + startMenu + .find( ".ui-menu" ) + .hide() + .attr( "aria-hidden", "true" ) + .attr( "aria-expanded", "false" ) + .end() + .find( "a.ui-state-active" ) + .removeClass( "ui-state-active" ); + }, + + collapse: function( event ) { + var newItem = this.active && + this.active.parent().closest( ".ui-menu-item", this.element ); + if ( newItem && newItem.length ) { + this._close(); + this.focus( event, newItem ); + } + }, + + expand: function( event ) { + var newItem = this.active && + this.active + .children( ".ui-menu " ) + .children( ".ui-menu-item" ) + .first(); + + if ( newItem && newItem.length ) { + this._open( newItem.parent() ); + + // Delay so Firefox will not hide activedescendant change in expanding submenu from AT + this._delay(function() { + this.focus( event, newItem ); + }); + } + }, + + next: function( event ) { + this._move( "next", "first", event ); + }, + + previous: function( event ) { + this._move( "prev", "last", event ); + }, + + isFirstItem: function() { + return this.active && !this.active.prevAll( ".ui-menu-item" ).length; + }, + + isLastItem: function() { + return this.active && !this.active.nextAll( ".ui-menu-item" ).length; + }, + + _move: function( direction, filter, event ) { + var next; + if ( this.active ) { + if ( direction === "first" || direction === "last" ) { + next = this.active + [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) + .eq( -1 ); + } else { + next = this.active + [ direction + "All" ]( ".ui-menu-item" ) + .eq( 0 ); + } + } + if ( !next || !next.length || !this.active ) { + next = this.activeMenu.children( ".ui-menu-item" )[ filter ](); + } + + this.focus( event, next ); + }, + + nextPage: function( event ) { + var item, base, height; + + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isLastItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.nextAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base - height < 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ) + [ !this.active ? "first" : "last" ]() ); + } + }, + + previousPage: function( event ) { + var item, base, height; + if ( !this.active ) { + this.next( event ); + return; + } + if ( this.isFirstItem() ) { + return; + } + if ( this._hasScroll() ) { + base = this.active.offset().top; + height = this.element.height(); + this.active.prevAll( ".ui-menu-item" ).each(function() { + item = $( this ); + return item.offset().top - base + height > 0; + }); + + this.focus( event, item ); + } else { + this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() ); + } + }, + + _hasScroll: function() { + return this.element.outerHeight() < this.element.prop( "scrollHeight" ); + }, + + select: function( event ) { + // TODO: It should never be possible to not have an active item at this + // point, but the tests don't trigger mouseenter before click. + this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); + var ui = { item: this.active }; + if ( !this.active.has( ".ui-menu" ).length ) { + this.collapseAll( event, true ); + } + this._trigger( "select", event, ui ); + } +}); + +}( jQuery )); + +(function( $, undefined ) { + +$.ui = $.ui || {}; + +var cachedScrollbarWidth, + max = Math.max, + abs = Math.abs, + round = Math.round, + rhorizontal = /left|center|right/, + rvertical = /top|center|bottom/, + roffset = /[\+\-]\d+%?/, + rposition = /^\w+/, + rpercent = /%$/, + _position = $.fn.position; + +function getOffsets( offsets, width, height ) { + return [ + parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), + parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) + ]; +} +function parseCss( element, property ) { + return parseInt( $.css( element, property ), 10 ) || 0; +} + +$.position = { + scrollbarWidth: function() { + if ( cachedScrollbarWidth !== undefined ) { + return cachedScrollbarWidth; + } + var w1, w2, + div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), + innerDiv = div.children()[0]; + + $( "body" ).append( div ); + w1 = innerDiv.offsetWidth; + div.css( "overflow", "scroll" ); + + w2 = innerDiv.offsetWidth; + + if ( w1 === w2 ) { + w2 = div[0].clientWidth; + } + + div.remove(); + + return (cachedScrollbarWidth = w1 - w2); + }, + getScrollInfo: function( within ) { + var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), + overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), + hasOverflowX = overflowX === "scroll" || + ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), + hasOverflowY = overflowY === "scroll" || + ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); + return { + width: hasOverflowX ? $.position.scrollbarWidth() : 0, + height: hasOverflowY ? $.position.scrollbarWidth() : 0 + }; + }, + getWithinInfo: function( element ) { + var withinElement = $( element || window ), + isWindow = $.isWindow( withinElement[0] ); + return { + element: withinElement, + isWindow: isWindow, + offset: withinElement.offset() || { left: 0, top: 0 }, + scrollLeft: withinElement.scrollLeft(), + scrollTop: withinElement.scrollTop(), + width: isWindow ? withinElement.width() : withinElement.outerWidth(), + height: isWindow ? withinElement.height() : withinElement.outerHeight() + }; + } +}; + +$.fn.position = function( options ) { + if ( !options || !options.of ) { + return _position.apply( this, arguments ); + } + + // make a copy, we don't want to modify arguments + options = $.extend( {}, options ); + + var atOffset, targetWidth, targetHeight, targetOffset, basePosition, + target = $( options.of ), + within = $.position.getWithinInfo( options.within ), + scrollInfo = $.position.getScrollInfo( within ), + targetElem = target[0], + collision = ( options.collision || "flip" ).split( " " ), + offsets = {}; + + if ( targetElem.nodeType === 9 ) { + targetWidth = target.width(); + targetHeight = target.height(); + targetOffset = { top: 0, left: 0 }; + } else if ( $.isWindow( targetElem ) ) { + targetWidth = target.width(); + targetHeight = target.height(); + targetOffset = { top: target.scrollTop(), left: target.scrollLeft() }; + } else if ( targetElem.preventDefault ) { + // force left top to allow flipping + options.at = "left top"; + targetWidth = targetHeight = 0; + targetOffset = { top: targetElem.pageY, left: targetElem.pageX }; + } else { + targetWidth = target.outerWidth(); + targetHeight = target.outerHeight(); + targetOffset = target.offset(); + } + // clone to reuse original targetOffset later + basePosition = $.extend( {}, targetOffset ); + + // force my and at to have valid horizontal and vertical positions + // if a value is missing or invalid, it will be converted to center + $.each( [ "my", "at" ], function() { + var pos = ( options[ this ] || "" ).split( " " ), + horizontalOffset, + verticalOffset; + + if ( pos.length === 1) { + pos = rhorizontal.test( pos[ 0 ] ) ? + pos.concat( [ "center" ] ) : + rvertical.test( pos[ 0 ] ) ? + [ "center" ].concat( pos ) : + [ "center", "center" ]; + } + pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; + pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; + + // calculate offsets + horizontalOffset = roffset.exec( pos[ 0 ] ); + verticalOffset = roffset.exec( pos[ 1 ] ); + offsets[ this ] = [ + horizontalOffset ? horizontalOffset[ 0 ] : 0, + verticalOffset ? verticalOffset[ 0 ] : 0 + ]; + + // reduce to just the positions without the offsets + options[ this ] = [ + rposition.exec( pos[ 0 ] )[ 0 ], + rposition.exec( pos[ 1 ] )[ 0 ] + ]; + }); + + // normalize collision option + if ( collision.length === 1 ) { + collision[ 1 ] = collision[ 0 ]; + } + + if ( options.at[ 0 ] === "right" ) { + basePosition.left += targetWidth; + } else if ( options.at[ 0 ] === "center" ) { + basePosition.left += targetWidth / 2; + } + + if ( options.at[ 1 ] === "bottom" ) { + basePosition.top += targetHeight; + } else if ( options.at[ 1 ] === "center" ) { + basePosition.top += targetHeight / 2; + } + + atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); + basePosition.left += atOffset[ 0 ]; + basePosition.top += atOffset[ 1 ]; + + return this.each(function() { + var collisionPosition, using, + elem = $( this ), + elemWidth = elem.outerWidth(), + elemHeight = elem.outerHeight(), + marginLeft = parseCss( this, "marginLeft" ), + marginTop = parseCss( this, "marginTop" ), + collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, + collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, + position = $.extend( {}, basePosition ), + myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); + + if ( options.my[ 0 ] === "right" ) { + position.left -= elemWidth; + } else if ( options.my[ 0 ] === "center" ) { + position.left -= elemWidth / 2; + } + + if ( options.my[ 1 ] === "bottom" ) { + position.top -= elemHeight; + } else if ( options.my[ 1 ] === "center" ) { + position.top -= elemHeight / 2; + } + + position.left += myOffset[ 0 ]; + position.top += myOffset[ 1 ]; + + // if the browser doesn't support fractions, then round for consistent results + if ( !$.support.offsetFractions ) { + position.left = round( position.left ); + position.top = round( position.top ); + } + + collisionPosition = { + marginLeft: marginLeft, + marginTop: marginTop + }; + + $.each( [ "left", "top" ], function( i, dir ) { + if ( $.ui.position[ collision[ i ] ] ) { + $.ui.position[ collision[ i ] ][ dir ]( position, { + targetWidth: targetWidth, + targetHeight: targetHeight, + elemWidth: elemWidth, + elemHeight: elemHeight, + collisionPosition: collisionPosition, + collisionWidth: collisionWidth, + collisionHeight: collisionHeight, + offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], + my: options.my, + at: options.at, + within: within, + elem : elem + }); + } + }); + + if ( $.fn.bgiframe ) { + elem.bgiframe(); + } + + if ( options.using ) { + // adds feedback as second argument to using callback, if present + using = function( props ) { + var left = targetOffset.left - position.left, + right = left + targetWidth - elemWidth, + top = targetOffset.top - position.top, + bottom = top + targetHeight - elemHeight, + feedback = { + target: { + element: target, + left: targetOffset.left, + top: targetOffset.top, + width: targetWidth, + height: targetHeight + }, + element: { + element: elem, + left: position.left, + top: position.top, + width: elemWidth, + height: elemHeight + }, + horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", + vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" + }; + if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { + feedback.horizontal = "center"; + } + if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { + feedback.vertical = "middle"; + } + if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { + feedback.important = "horizontal"; + } else { + feedback.important = "vertical"; + } + options.using.call( this, props, feedback ); + }; + } + + elem.offset( $.extend( position, { using: using } ) ); + }); +}; + +$.ui.position = { + fit: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, + outerWidth = within.width, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = withinOffset - collisionPosLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, + newOverRight; + + // element is wider than within + if ( data.collisionWidth > outerWidth ) { + // element is initially over the left side of within + if ( overLeft > 0 && overRight <= 0 ) { + newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; + position.left += overLeft - newOverRight; + // element is initially over right side of within + } else if ( overRight > 0 && overLeft <= 0 ) { + position.left = withinOffset; + // element is initially over both left and right sides of within + } else { + if ( overLeft > overRight ) { + position.left = withinOffset + outerWidth - data.collisionWidth; + } else { + position.left = withinOffset; + } + } + // too far left -> align with left edge + } else if ( overLeft > 0 ) { + position.left += overLeft; + // too far right -> align with right edge + } else if ( overRight > 0 ) { + position.left -= overRight; + // adjust based on position and margin + } else { + position.left = max( position.left - collisionPosLeft, position.left ); + } + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollTop : within.offset.top, + outerHeight = data.within.height, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = withinOffset - collisionPosTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, + newOverBottom; + + // element is taller than within + if ( data.collisionHeight > outerHeight ) { + // element is initially over the top of within + if ( overTop > 0 && overBottom <= 0 ) { + newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; + position.top += overTop - newOverBottom; + // element is initially over bottom of within + } else if ( overBottom > 0 && overTop <= 0 ) { + position.top = withinOffset; + // element is initially over both top and bottom of within + } else { + if ( overTop > overBottom ) { + position.top = withinOffset + outerHeight - data.collisionHeight; + } else { + position.top = withinOffset; + } + } + // too far up -> align with top + } else if ( overTop > 0 ) { + position.top += overTop; + // too far down -> align with bottom edge + } else if ( overBottom > 0 ) { + position.top -= overBottom; + // adjust based on position and margin + } else { + position.top = max( position.top - collisionPosTop, position.top ); + } + } + }, + flip: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.offset.left + within.scrollLeft, + outerWidth = within.width, + offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = collisionPosLeft - offsetLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, + myOffset = data.my[ 0 ] === "left" ? + -data.elemWidth : + data.my[ 0 ] === "right" ? + data.elemWidth : + 0, + atOffset = data.at[ 0 ] === "left" ? + data.targetWidth : + data.at[ 0 ] === "right" ? + -data.targetWidth : + 0, + offset = -2 * data.offset[ 0 ], + newOverRight, + newOverLeft; + + if ( overLeft < 0 ) { + newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; + if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { + position.left += myOffset + atOffset + offset; + } + } + else if ( overRight > 0 ) { + newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; + if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { + position.left += myOffset + atOffset + offset; + } + } + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.offset.top + within.scrollTop, + outerHeight = within.height, + offsetTop = within.isWindow ? within.scrollTop : within.offset.top, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = collisionPosTop - offsetTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, + top = data.my[ 1 ] === "top", + myOffset = top ? + -data.elemHeight : + data.my[ 1 ] === "bottom" ? + data.elemHeight : + 0, + atOffset = data.at[ 1 ] === "top" ? + data.targetHeight : + data.at[ 1 ] === "bottom" ? + -data.targetHeight : + 0, + offset = -2 * data.offset[ 1 ], + newOverTop, + newOverBottom; + if ( overTop < 0 ) { + newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; + if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { + position.top += myOffset + atOffset + offset; + } + } + else if ( overBottom > 0 ) { + newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; + if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { + position.top += myOffset + atOffset + offset; + } + } + } + }, + flipfit: { + left: function() { + $.ui.position.flip.left.apply( this, arguments ); + $.ui.position.fit.left.apply( this, arguments ); + }, + top: function() { + $.ui.position.flip.top.apply( this, arguments ); + $.ui.position.fit.top.apply( this, arguments ); + } + } +}; + +// fraction support test +(function () { + var testElement, testElementParent, testElementStyle, offsetLeft, i, + body = document.getElementsByTagName( "body" )[ 0 ], + div = document.createElement( "div" ); + + //Create a "fake body" for testing based on method used in jQuery.support + testElement = document.createElement( body ? "div" : "body" ); + testElementStyle = { + visibility: "hidden", + width: 0, + height: 0, + border: 0, + margin: 0, + background: "none" + }; + if ( body ) { + $.extend( testElementStyle, { + position: "absolute", + left: "-1000px", + top: "-1000px" + }); + } + for ( i in testElementStyle ) { + testElement.style[ i ] = testElementStyle[ i ]; + } + testElement.appendChild( div ); + testElementParent = body || document.documentElement; + testElementParent.insertBefore( testElement, testElementParent.firstChild ); + + div.style.cssText = "position: absolute; left: 10.7432222px;"; + + offsetLeft = $( div ).offset().left; + $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; + + testElement.innerHTML = ""; + testElementParent.removeChild( testElement ); +})(); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + // offset option + (function( $ ) { + var _position = $.fn.position; + $.fn.position = function( options ) { + if ( !options || !options.offset ) { + return _position.call( this, options ); + } + var offset = options.offset.split( " " ), + at = options.at.split( " " ); + if ( offset.length === 1 ) { + offset[ 1 ] = offset[ 0 ]; + } + if ( /^\d/.test( offset[ 0 ] ) ) { + offset[ 0 ] = "+" + offset[ 0 ]; + } + if ( /^\d/.test( offset[ 1 ] ) ) { + offset[ 1 ] = "+" + offset[ 1 ]; + } + if ( at.length === 1 ) { + if ( /left|center|right/.test( at[ 0 ] ) ) { + at[ 1 ] = "center"; + } else { + at[ 1 ] = at[ 0 ]; + at[ 0 ] = "center"; + } + } + return _position.call( this, $.extend( options, { + at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ], + offset: undefined + } ) ); + }; + }( jQuery ) ); +} + +}( jQuery ) ); + +(function( $, undefined ) { + +$.widget( "ui.progressbar", { + version: "1.9.2", + options: { + value: 0, + max: 100 + }, + + min: 0, + + _create: function() { + this.element + .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .attr({ + role: "progressbar", + "aria-valuemin": this.min, + "aria-valuemax": this.options.max, + "aria-valuenow": this._value() + }); + + this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) + .appendTo( this.element ); + + this.oldValue = this._value(); + this._refreshValue(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + + this.valueDiv.remove(); + }, + + value: function( newValue ) { + if ( newValue === undefined ) { + return this._value(); + } + + this._setOption( "value", newValue ); + return this; + }, + + _setOption: function( key, value ) { + if ( key === "value" ) { + this.options.value = value; + this._refreshValue(); + if ( this._value() === this.options.max ) { + this._trigger( "complete" ); + } + } + + this._super( key, value ); + }, + + _value: function() { + var val = this.options.value; + // normalize invalid value + if ( typeof val !== "number" ) { + val = 0; + } + return Math.min( this.options.max, Math.max( this.min, val ) ); + }, + + _percentage: function() { + return 100 * this._value() / this.options.max; + }, + + _refreshValue: function() { + var value = this.value(), + percentage = this._percentage(); + + if ( this.oldValue !== value ) { + this.oldValue = value; + this._trigger( "change" ); + } + + this.valueDiv + .toggle( value > this.min ) + .toggleClass( "ui-corner-right", value === this.options.max ) + .width( percentage.toFixed(0) + "%" ); + this.element.attr( "aria-valuenow", value ); + } +}); + +})( jQuery ); + +(function( $, undefined ) { + +// number of pages in a slider +// (how many times can you page up/down to go through the whole range) +var numPages = 5; + +$.widget( "ui.slider", $.ui.mouse, { + version: "1.9.2", + widgetEventPrefix: "slide", + + options: { + animate: false, + distance: 0, + max: 100, + min: 0, + orientation: "horizontal", + range: false, + step: 1, + value: 0, + values: null + }, + + _create: function() { + var i, handleCount, + o = this.options, + existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), + handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", + handles = []; + + this._keySliding = false; + this._mouseSliding = false; + this._animateOff = true; + this._handleIndex = null; + this._detectOrientation(); + this._mouseInit(); + + this.element + .addClass( "ui-slider" + + " ui-slider-" + this.orientation + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" + + ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); + + this.range = $([]); + + if ( o.range ) { + if ( o.range === true ) { + if ( !o.values ) { + o.values = [ this._valueMin(), this._valueMin() ]; + } + if ( o.values.length && o.values.length !== 2 ) { + o.values = [ o.values[0], o.values[0] ]; + } + } + + this.range = $( "<div></div>" ) + .appendTo( this.element ) + .addClass( "ui-slider-range" + + // note: this isn't the most fittingly semantic framework class for this element, + // but worked best visually with a variety of themes + " ui-widget-header" + + ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); + } + + handleCount = ( o.values && o.values.length ) || 1; + + for ( i = existingHandles.length; i < handleCount; i++ ) { + handles.push( handle ); + } + + this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); + + this.handle = this.handles.eq( 0 ); + + this.handles.add( this.range ).filter( "a" ) + .click(function( event ) { + event.preventDefault(); + }) + .mouseenter(function() { + if ( !o.disabled ) { + $( this ).addClass( "ui-state-hover" ); + } + }) + .mouseleave(function() { + $( this ).removeClass( "ui-state-hover" ); + }) + .focus(function() { + if ( !o.disabled ) { + $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); + $( this ).addClass( "ui-state-focus" ); + } else { + $( this ).blur(); + } + }) + .blur(function() { + $( this ).removeClass( "ui-state-focus" ); + }); + + this.handles.each(function( i ) { + $( this ).data( "ui-slider-handle-index", i ); + }); + + this._on( this.handles, { + keydown: function( event ) { + var allowed, curVal, newVal, step, + index = $( event.target ).data( "ui-slider-handle-index" ); + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + case $.ui.keyCode.END: + case $.ui.keyCode.PAGE_UP: + case $.ui.keyCode.PAGE_DOWN: + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + event.preventDefault(); + if ( !this._keySliding ) { + this._keySliding = true; + $( event.target ).addClass( "ui-state-active" ); + allowed = this._start( event, index ); + if ( allowed === false ) { + return; + } + } + break; + } + + step = this.options.step; + if ( this.options.values && this.options.values.length ) { + curVal = newVal = this.values( index ); + } else { + curVal = newVal = this.value(); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + newVal = this._valueMin(); + break; + case $.ui.keyCode.END: + newVal = this._valueMax(); + break; + case $.ui.keyCode.PAGE_UP: + newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.PAGE_DOWN: + newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + if ( curVal === this._valueMax() ) { + return; + } + newVal = this._trimAlignValue( curVal + step ); + break; + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + if ( curVal === this._valueMin() ) { + return; + } + newVal = this._trimAlignValue( curVal - step ); + break; + } + + this._slide( event, index, newVal ); + }, + keyup: function( event ) { + var index = $( event.target ).data( "ui-slider-handle-index" ); + + if ( this._keySliding ) { + this._keySliding = false; + this._stop( event, index ); + this._change( event, index ); + $( event.target ).removeClass( "ui-state-active" ); + } + } + }); + + this._refreshValue(); + + this._animateOff = false; + }, + + _destroy: function() { + this.handles.remove(); + this.range.remove(); + + this.element + .removeClass( "ui-slider" + + " ui-slider-horizontal" + + " ui-slider-vertical" + + " ui-slider-disabled" + + " ui-widget" + + " ui-widget-content" + + " ui-corner-all" ); + + this._mouseDestroy(); + }, + + _mouseCapture: function( event ) { + var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, + that = this, + o = this.options; + + if ( o.disabled ) { + return false; + } + + this.elementSize = { + width: this.element.outerWidth(), + height: this.element.outerHeight() + }; + this.elementOffset = this.element.offset(); + + position = { x: event.pageX, y: event.pageY }; + normValue = this._normValueFromMouse( position ); + distance = this._valueMax() - this._valueMin() + 1; + this.handles.each(function( i ) { + var thisDistance = Math.abs( normValue - that.values(i) ); + if ( distance > thisDistance ) { + distance = thisDistance; + closestHandle = $( this ); + index = i; + } + }); + + // workaround for bug #3736 (if both handles of a range are at 0, + // the first is always used as the one with least distance, + // and moving it is obviously prevented by preventing negative ranges) + if( o.range === true && this.values(1) === o.min ) { + index += 1; + closestHandle = $( this.handles[index] ); + } + + allowed = this._start( event, index ); + if ( allowed === false ) { + return false; + } + this._mouseSliding = true; + + this._handleIndex = index; + + closestHandle + .addClass( "ui-state-active" ) + .focus(); + + offset = closestHandle.offset(); + mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); + this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { + left: event.pageX - offset.left - ( closestHandle.width() / 2 ), + top: event.pageY - offset.top - + ( closestHandle.height() / 2 ) - + ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - + ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + + ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) + }; + + if ( !this.handles.hasClass( "ui-state-hover" ) ) { + this._slide( event, index, normValue ); + } + this._animateOff = true; + return true; + }, + + _mouseStart: function() { + return true; + }, + + _mouseDrag: function( event ) { + var position = { x: event.pageX, y: event.pageY }, + normValue = this._normValueFromMouse( position ); + + this._slide( event, this._handleIndex, normValue ); + + return false; + }, + + _mouseStop: function( event ) { + this.handles.removeClass( "ui-state-active" ); + this._mouseSliding = false; + + this._stop( event, this._handleIndex ); + this._change( event, this._handleIndex ); + + this._handleIndex = null; + this._clickOffset = null; + this._animateOff = false; + + return false; + }, + + _detectOrientation: function() { + this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; + }, + + _normValueFromMouse: function( position ) { + var pixelTotal, + pixelMouse, + percentMouse, + valueTotal, + valueMouse; + + if ( this.orientation === "horizontal" ) { + pixelTotal = this.elementSize.width; + pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); + } else { + pixelTotal = this.elementSize.height; + pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); + } + + percentMouse = ( pixelMouse / pixelTotal ); + if ( percentMouse > 1 ) { + percentMouse = 1; + } + if ( percentMouse < 0 ) { + percentMouse = 0; + } + if ( this.orientation === "vertical" ) { + percentMouse = 1 - percentMouse; + } + + valueTotal = this._valueMax() - this._valueMin(); + valueMouse = this._valueMin() + percentMouse * valueTotal; + + return this._trimAlignValue( valueMouse ); + }, + + _start: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + return this._trigger( "start", event, uiHash ); + }, + + _slide: function( event, index, newVal ) { + var otherVal, + newValues, + allowed; + + if ( this.options.values && this.options.values.length ) { + otherVal = this.values( index ? 0 : 1 ); + + if ( ( this.options.values.length === 2 && this.options.range === true ) && + ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) + ) { + newVal = otherVal; + } + + if ( newVal !== this.values( index ) ) { + newValues = this.values(); + newValues[ index ] = newVal; + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal, + values: newValues + } ); + otherVal = this.values( index ? 0 : 1 ); + if ( allowed !== false ) { + this.values( index, newVal, true ); + } + } + } else { + if ( newVal !== this.value() ) { + // A slide can be canceled by returning false from the slide callback + allowed = this._trigger( "slide", event, { + handle: this.handles[ index ], + value: newVal + } ); + if ( allowed !== false ) { + this.value( newVal ); + } + } + } + }, + + _stop: function( event, index ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "stop", event, uiHash ); + }, + + _change: function( event, index ) { + if ( !this._keySliding && !this._mouseSliding ) { + var uiHash = { + handle: this.handles[ index ], + value: this.value() + }; + if ( this.options.values && this.options.values.length ) { + uiHash.value = this.values( index ); + uiHash.values = this.values(); + } + + this._trigger( "change", event, uiHash ); + } + }, + + value: function( newValue ) { + if ( arguments.length ) { + this.options.value = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, 0 ); + return; + } + + return this._value(); + }, + + values: function( index, newValue ) { + var vals, + newValues, + i; + + if ( arguments.length > 1 ) { + this.options.values[ index ] = this._trimAlignValue( newValue ); + this._refreshValue(); + this._change( null, index ); + return; + } + + if ( arguments.length ) { + if ( $.isArray( arguments[ 0 ] ) ) { + vals = this.options.values; + newValues = arguments[ 0 ]; + for ( i = 0; i < vals.length; i += 1 ) { + vals[ i ] = this._trimAlignValue( newValues[ i ] ); + this._change( null, i ); + } + this._refreshValue(); + } else { + if ( this.options.values && this.options.values.length ) { + return this._values( index ); + } else { + return this.value(); + } + } + } else { + return this._values(); + } + }, + + _setOption: function( key, value ) { + var i, + valsLength = 0; + + if ( $.isArray( this.options.values ) ) { + valsLength = this.options.values.length; + } + + $.Widget.prototype._setOption.apply( this, arguments ); + + switch ( key ) { + case "disabled": + if ( value ) { + this.handles.filter( ".ui-state-focus" ).blur(); + this.handles.removeClass( "ui-state-hover" ); + this.handles.prop( "disabled", true ); + this.element.addClass( "ui-disabled" ); + } else { + this.handles.prop( "disabled", false ); + this.element.removeClass( "ui-disabled" ); + } + break; + case "orientation": + this._detectOrientation(); + this.element + .removeClass( "ui-slider-horizontal ui-slider-vertical" ) + .addClass( "ui-slider-" + this.orientation ); + this._refreshValue(); + break; + case "value": + this._animateOff = true; + this._refreshValue(); + this._change( null, 0 ); + this._animateOff = false; + break; + case "values": + this._animateOff = true; + this._refreshValue(); + for ( i = 0; i < valsLength; i += 1 ) { + this._change( null, i ); + } + this._animateOff = false; + break; + case "min": + case "max": + this._animateOff = true; + this._refreshValue(); + this._animateOff = false; + break; + } + }, + + //internal value getter + // _value() returns value trimmed by min and max, aligned by step + _value: function() { + var val = this.options.value; + val = this._trimAlignValue( val ); + + return val; + }, + + //internal values getter + // _values() returns array of values trimmed by min and max, aligned by step + // _values( index ) returns single value trimmed by min and max, aligned by step + _values: function( index ) { + var val, + vals, + i; + + if ( arguments.length ) { + val = this.options.values[ index ]; + val = this._trimAlignValue( val ); + + return val; + } else { + // .slice() creates a copy of the array + // this copy gets trimmed by min and max and then returned + vals = this.options.values.slice(); + for ( i = 0; i < vals.length; i+= 1) { + vals[ i ] = this._trimAlignValue( vals[ i ] ); + } + + return vals; + } + }, + + // returns the step-aligned value that val is closest to, between (inclusive) min and max + _trimAlignValue: function( val ) { + if ( val <= this._valueMin() ) { + return this._valueMin(); + } + if ( val >= this._valueMax() ) { + return this._valueMax(); + } + var step = ( this.options.step > 0 ) ? this.options.step : 1, + valModStep = (val - this._valueMin()) % step, + alignValue = val - valModStep; + + if ( Math.abs(valModStep) * 2 >= step ) { + alignValue += ( valModStep > 0 ) ? step : ( -step ); + } + + // Since JavaScript has problems with large floats, round + // the final value to 5 digits after the decimal point (see #4124) + return parseFloat( alignValue.toFixed(5) ); + }, + + _valueMin: function() { + return this.options.min; + }, + + _valueMax: function() { + return this.options.max; + }, + + _refreshValue: function() { + var lastValPercent, valPercent, value, valueMin, valueMax, + oRange = this.options.range, + o = this.options, + that = this, + animate = ( !this._animateOff ) ? o.animate : false, + _set = {}; + + if ( this.options.values && this.options.values.length ) { + this.handles.each(function( i ) { + valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; + _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + if ( that.options.range === true ) { + if ( that.orientation === "horizontal" ) { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } else { + if ( i === 0 ) { + that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); + } + if ( i === 1 ) { + that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + lastValPercent = valPercent; + }); + } else { + value = this.value(); + valueMin = this._valueMin(); + valueMax = this._valueMax(); + valPercent = ( valueMax !== valueMin ) ? + ( value - valueMin ) / ( valueMax - valueMin ) * 100 : + 0; + _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; + this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); + + if ( oRange === "min" && this.orientation === "horizontal" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "horizontal" ) { + this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + if ( oRange === "min" && this.orientation === "vertical" ) { + this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); + } + if ( oRange === "max" && this.orientation === "vertical" ) { + this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); + } + } + } + +}); + +}(jQuery)); + +(function( $ ) { + +function modifier( fn ) { + return function() { + var previous = this.element.val(); + fn.apply( this, arguments ); + this._refresh(); + if ( previous !== this.element.val() ) { + this._trigger( "change" ); + } + }; +} + +$.widget( "ui.spinner", { + version: "1.9.2", + defaultElement: "<input>", + widgetEventPrefix: "spin", + options: { + culture: null, + icons: { + down: "ui-icon-triangle-1-s", + up: "ui-icon-triangle-1-n" + }, + incremental: true, + max: null, + min: null, + numberFormat: null, + page: 10, + step: 1, + + change: null, + spin: null, + start: null, + stop: null + }, + + _create: function() { + // handle string values that need to be parsed + this._setOption( "max", this.options.max ); + this._setOption( "min", this.options.min ); + this._setOption( "step", this.options.step ); + + // format the value, but don't constrain + this._value( this.element.val(), true ); + + this._draw(); + this._on( this._events ); + this._refresh(); + + // turning off autocomplete prevents the browser from remembering the + // value when navigating through history, so we re-enable autocomplete + // if the page is unloaded before the widget is destroyed. #7790 + this._on( this.window, { + beforeunload: function() { + this.element.removeAttr( "autocomplete" ); + } + }); + }, + + _getCreateOptions: function() { + var options = {}, + element = this.element; + + $.each( [ "min", "max", "step" ], function( i, option ) { + var value = element.attr( option ); + if ( value !== undefined && value.length ) { + options[ option ] = value; + } + }); + + return options; + }, + + _events: { + keydown: function( event ) { + if ( this._start( event ) && this._keydown( event ) ) { + event.preventDefault(); + } + }, + keyup: "_stop", + focus: function() { + this.previous = this.element.val(); + }, + blur: function( event ) { + if ( this.cancelBlur ) { + delete this.cancelBlur; + return; + } + + this._refresh(); + if ( this.previous !== this.element.val() ) { + this._trigger( "change", event ); + } + }, + mousewheel: function( event, delta ) { + if ( !delta ) { + return; + } + if ( !this.spinning && !this._start( event ) ) { + return false; + } + + this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); + clearTimeout( this.mousewheelTimer ); + this.mousewheelTimer = this._delay(function() { + if ( this.spinning ) { + this._stop( event ); + } + }, 100 ); + event.preventDefault(); + }, + "mousedown .ui-spinner-button": function( event ) { + var previous; + + // We never want the buttons to have focus; whenever the user is + // interacting with the spinner, the focus should be on the input. + // If the input is focused then this.previous is properly set from + // when the input first received focus. If the input is not focused + // then we need to set this.previous based on the value before spinning. + previous = this.element[0] === this.document[0].activeElement ? + this.previous : this.element.val(); + function checkFocus() { + var isActive = this.element[0] === this.document[0].activeElement; + if ( !isActive ) { + this.element.focus(); + this.previous = previous; + // support: IE + // IE sets focus asynchronously, so we need to check if focus + // moved off of the input because the user clicked on the button. + this._delay(function() { + this.previous = previous; + }); + } + } + + // ensure focus is on (or stays on) the text field + event.preventDefault(); + checkFocus.call( this ); + + // support: IE + // IE doesn't prevent moving focus even with event.preventDefault() + // so we set a flag to know when we should ignore the blur event + // and check (again) if focus moved off of the input. + this.cancelBlur = true; + this._delay(function() { + delete this.cancelBlur; + checkFocus.call( this ); + }); + + if ( this._start( event ) === false ) { + return; + } + + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + "mouseup .ui-spinner-button": "_stop", + "mouseenter .ui-spinner-button": function( event ) { + // button will add ui-state-active if mouse was down while mouseleave and kept down + if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { + return; + } + + if ( this._start( event ) === false ) { + return false; + } + this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); + }, + // TODO: do we really want to consider this a stop? + // shouldn't we just stop the repeater and wait until mouseup before + // we trigger the stop event? + "mouseleave .ui-spinner-button": "_stop" + }, + + _draw: function() { + var uiSpinner = this.uiSpinner = this.element + .addClass( "ui-spinner-input" ) + .attr( "autocomplete", "off" ) + .wrap( this._uiSpinnerHtml() ) + .parent() + // add buttons + .append( this._buttonHtml() ); + + this.element.attr( "role", "spinbutton" ); + + // button bindings + this.buttons = uiSpinner.find( ".ui-spinner-button" ) + .attr( "tabIndex", -1 ) + .button() + .removeClass( "ui-corner-all" ); + + // IE 6 doesn't understand height: 50% for the buttons + // unless the wrapper has an explicit height + if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && + uiSpinner.height() > 0 ) { + uiSpinner.height( uiSpinner.height() ); + } + + // disable spinner if element was already disabled + if ( this.options.disabled ) { + this.disable(); + } + }, + + _keydown: function( event ) { + var options = this.options, + keyCode = $.ui.keyCode; + + switch ( event.keyCode ) { + case keyCode.UP: + this._repeat( null, 1, event ); + return true; + case keyCode.DOWN: + this._repeat( null, -1, event ); + return true; + case keyCode.PAGE_UP: + this._repeat( null, options.page, event ); + return true; + case keyCode.PAGE_DOWN: + this._repeat( null, -options.page, event ); + return true; + } + + return false; + }, + + _uiSpinnerHtml: function() { + return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"; + }, + + _buttonHtml: function() { + return "" + + "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" + + "<span class='ui-icon " + this.options.icons.up + "'>▲</span>" + + "</a>" + + "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" + + "<span class='ui-icon " + this.options.icons.down + "'>▼</span>" + + "</a>"; + }, + + _start: function( event ) { + if ( !this.spinning && this._trigger( "start", event ) === false ) { + return false; + } + + if ( !this.counter ) { + this.counter = 1; + } + this.spinning = true; + return true; + }, + + _repeat: function( i, steps, event ) { + i = i || 500; + + clearTimeout( this.timer ); + this.timer = this._delay(function() { + this._repeat( 40, steps, event ); + }, i ); + + this._spin( steps * this.options.step, event ); + }, + + _spin: function( step, event ) { + var value = this.value() || 0; + + if ( !this.counter ) { + this.counter = 1; + } + + value = this._adjustValue( value + step * this._increment( this.counter ) ); + + if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { + this._value( value ); + this.counter++; + } + }, + + _increment: function( i ) { + var incremental = this.options.incremental; + + if ( incremental ) { + return $.isFunction( incremental ) ? + incremental( i ) : + Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 ); + } + + return 1; + }, + + _precision: function() { + var precision = this._precisionOf( this.options.step ); + if ( this.options.min !== null ) { + precision = Math.max( precision, this._precisionOf( this.options.min ) ); + } + return precision; + }, + + _precisionOf: function( num ) { + var str = num.toString(), + decimal = str.indexOf( "." ); + return decimal === -1 ? 0 : str.length - decimal - 1; + }, + + _adjustValue: function( value ) { + var base, aboveMin, + options = this.options; + + // make sure we're at a valid step + // - find out where we are relative to the base (min or 0) + base = options.min !== null ? options.min : 0; + aboveMin = value - base; + // - round to the nearest step + aboveMin = Math.round(aboveMin / options.step) * options.step; + // - rounding is based on 0, so adjust back to our base + value = base + aboveMin; + + // fix precision from bad JS floating point math + value = parseFloat( value.toFixed( this._precision() ) ); + + // clamp the value + if ( options.max !== null && value > options.max) { + return options.max; + } + if ( options.min !== null && value < options.min ) { + return options.min; + } + + return value; + }, + + _stop: function( event ) { + if ( !this.spinning ) { + return; + } + + clearTimeout( this.timer ); + clearTimeout( this.mousewheelTimer ); + this.counter = 0; + this.spinning = false; + this._trigger( "stop", event ); + }, + + _setOption: function( key, value ) { + if ( key === "culture" || key === "numberFormat" ) { + var prevValue = this._parse( this.element.val() ); + this.options[ key ] = value; + this.element.val( this._format( prevValue ) ); + return; + } + + if ( key === "max" || key === "min" || key === "step" ) { + if ( typeof value === "string" ) { + value = this._parse( value ); + } + } + + this._super( key, value ); + + if ( key === "disabled" ) { + if ( value ) { + this.element.prop( "disabled", true ); + this.buttons.button( "disable" ); + } else { + this.element.prop( "disabled", false ); + this.buttons.button( "enable" ); + } + } + }, + + _setOptions: modifier(function( options ) { + this._super( options ); + this._value( this.element.val() ); + }), + + _parse: function( val ) { + if ( typeof val === "string" && val !== "" ) { + val = window.Globalize && this.options.numberFormat ? + Globalize.parseFloat( val, 10, this.options.culture ) : +val; + } + return val === "" || isNaN( val ) ? null : val; + }, + + _format: function( value ) { + if ( value === "" ) { + return ""; + } + return window.Globalize && this.options.numberFormat ? + Globalize.format( value, this.options.numberFormat, this.options.culture ) : + value; + }, + + _refresh: function() { + this.element.attr({ + "aria-valuemin": this.options.min, + "aria-valuemax": this.options.max, + // TODO: what should we do with values that can't be parsed? + "aria-valuenow": this._parse( this.element.val() ) + }); + }, + + // update the value without triggering change + _value: function( value, allowAny ) { + var parsed; + if ( value !== "" ) { + parsed = this._parse( value ); + if ( parsed !== null ) { + if ( !allowAny ) { + parsed = this._adjustValue( parsed ); + } + value = this._format( parsed ); + } + } + this.element.val( value ); + this._refresh(); + }, + + _destroy: function() { + this.element + .removeClass( "ui-spinner-input" ) + .prop( "disabled", false ) + .removeAttr( "autocomplete" ) + .removeAttr( "role" ) + .removeAttr( "aria-valuemin" ) + .removeAttr( "aria-valuemax" ) + .removeAttr( "aria-valuenow" ); + this.uiSpinner.replaceWith( this.element ); + }, + + stepUp: modifier(function( steps ) { + this._stepUp( steps ); + }), + _stepUp: function( steps ) { + this._spin( (steps || 1) * this.options.step ); + }, + + stepDown: modifier(function( steps ) { + this._stepDown( steps ); + }), + _stepDown: function( steps ) { + this._spin( (steps || 1) * -this.options.step ); + }, + + pageUp: modifier(function( pages ) { + this._stepUp( (pages || 1) * this.options.page ); + }), + + pageDown: modifier(function( pages ) { + this._stepDown( (pages || 1) * this.options.page ); + }), + + value: function( newVal ) { + if ( !arguments.length ) { + return this._parse( this.element.val() ); + } + modifier( this._value ).call( this, newVal ); + }, + + widget: function() { + return this.uiSpinner; + } +}); + +}( jQuery ) ); + +(function( $, undefined ) { + +var tabId = 0, + rhash = /#.*$/; + +function getNextTabId() { + return ++tabId; +} + +function isLocal( anchor ) { + return anchor.hash.length > 1 && + anchor.href.replace( rhash, "" ) === + location.href.replace( rhash, "" ) + // support: Safari 5.1 + // Safari 5.1 doesn't encode spaces in window.location + // but it does encode spaces from anchors (#8777) + .replace( /\s/g, "%20" ); +} + +$.widget( "ui.tabs", { + version: "1.9.2", + delay: 300, + options: { + active: null, + collapsible: false, + event: "click", + heightStyle: "content", + hide: null, + show: null, + + // callbacks + activate: null, + beforeActivate: null, + beforeLoad: null, + load: null + }, + + _create: function() { + var that = this, + options = this.options, + active = options.active, + locationHash = location.hash.substring( 1 ); + + this.running = false; + + this.element + .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) + .toggleClass( "ui-tabs-collapsible", options.collapsible ) + // Prevent users from focusing disabled tabs via click + .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) { + if ( $( this ).is( ".ui-state-disabled" ) ) { + event.preventDefault(); + } + }) + // support: IE <9 + // Preventing the default action in mousedown doesn't prevent IE + // from focusing the element, so if the anchor gets focused, blur. + // We don't have to worry about focusing the previously focused + // element since clicking on a non-focusable element should focus + // the body anyway. + .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { + if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { + this.blur(); + } + }); + + this._processTabs(); + + if ( active === null ) { + // check the fragment identifier in the URL + if ( locationHash ) { + this.tabs.each(function( i, tab ) { + if ( $( tab ).attr( "aria-controls" ) === locationHash ) { + active = i; + return false; + } + }); + } + + // check for a tab marked active via a class + if ( active === null ) { + active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); + } + + // no active tab, set to false + if ( active === null || active === -1 ) { + active = this.tabs.length ? 0 : false; + } + } + + // handle numbers: negative, out of range + if ( active !== false ) { + active = this.tabs.index( this.tabs.eq( active ) ); + if ( active === -1 ) { + active = options.collapsible ? false : 0; + } + } + options.active = active; + + // don't allow collapsible: false and active: false + if ( !options.collapsible && options.active === false && this.anchors.length ) { + options.active = 0; + } + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + }) + ) ).sort(); + } + + // check for length avoids error when initializing empty list + if ( this.options.active !== false && this.anchors.length ) { + this.active = this._findActive( this.options.active ); + } else { + this.active = $(); + } + + this._refresh(); + + if ( this.active.length ) { + this.load( options.active ); + } + }, + + _getCreateEventData: function() { + return { + tab: this.active, + panel: !this.active.length ? $() : this._getPanelForTab( this.active ) + }; + }, + + _tabKeydown: function( event ) { + var focusedTab = $( this.document[0].activeElement ).closest( "li" ), + selectedIndex = this.tabs.index( focusedTab ), + goingForward = true; + + if ( this._handlePageNav( event ) ) { + return; + } + + switch ( event.keyCode ) { + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + selectedIndex++; + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.LEFT: + goingForward = false; + selectedIndex--; + break; + case $.ui.keyCode.END: + selectedIndex = this.anchors.length - 1; + break; + case $.ui.keyCode.HOME: + selectedIndex = 0; + break; + case $.ui.keyCode.SPACE: + // Activate only, no collapsing + event.preventDefault(); + clearTimeout( this.activating ); + this._activate( selectedIndex ); + return; + case $.ui.keyCode.ENTER: + // Toggle (cancel delayed activation, allow collapsing) + event.preventDefault(); + clearTimeout( this.activating ); + // Determine if we should collapse or activate + this._activate( selectedIndex === this.options.active ? false : selectedIndex ); + return; + default: + return; + } + + // Focus the appropriate tab, based on which key was pressed + event.preventDefault(); + clearTimeout( this.activating ); + selectedIndex = this._focusNextTab( selectedIndex, goingForward ); + + // Navigating with control key will prevent automatic activation + if ( !event.ctrlKey ) { + // Update aria-selected immediately so that AT think the tab is already selected. + // Otherwise AT may confuse the user by stating that they need to activate the tab, + // but the tab will already be activated by the time the announcement finishes. + focusedTab.attr( "aria-selected", "false" ); + this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); + + this.activating = this._delay(function() { + this.option( "active", selectedIndex ); + }, this.delay ); + } + }, + + _panelKeydown: function( event ) { + if ( this._handlePageNav( event ) ) { + return; + } + + // Ctrl+up moves focus to the current tab + if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { + event.preventDefault(); + this.active.focus(); + } + }, + + // Alt+page up/down moves focus to the previous/next tab (and activates) + _handlePageNav: function( event ) { + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { + this._activate( this._focusNextTab( this.options.active - 1, false ) ); + return true; + } + if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { + this._activate( this._focusNextTab( this.options.active + 1, true ) ); + return true; + } + }, + + _findNextTab: function( index, goingForward ) { + var lastTabIndex = this.tabs.length - 1; + + function constrain() { + if ( index > lastTabIndex ) { + index = 0; + } + if ( index < 0 ) { + index = lastTabIndex; + } + return index; + } + + while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { + index = goingForward ? index + 1 : index - 1; + } + + return index; + }, + + _focusNextTab: function( index, goingForward ) { + index = this._findNextTab( index, goingForward ); + this.tabs.eq( index ).focus(); + return index; + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "disabled" ) { + // don't use the widget factory's disabled handling + this._setupDisabled( value ); + return; + } + + this._super( key, value); + + if ( key === "collapsible" ) { + this.element.toggleClass( "ui-tabs-collapsible", value ); + // Setting collapsible: false while collapsed; open first panel + if ( !value && this.options.active === false ) { + this._activate( 0 ); + } + } + + if ( key === "event" ) { + this._setupEvents( value ); + } + + if ( key === "heightStyle" ) { + this._setupHeightStyle( value ); + } + }, + + _tabId: function( tab ) { + return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId(); + }, + + _sanitizeSelector: function( hash ) { + return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; + }, + + refresh: function() { + var options = this.options, + lis = this.tablist.children( ":has(a[href])" ); + + // get disabled tabs from class attribute from HTML + // this will get converted to a boolean if needed in _refresh() + options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { + return lis.index( tab ); + }); + + this._processTabs(); + + // was collapsed or no tabs + if ( options.active === false || !this.anchors.length ) { + options.active = false; + this.active = $(); + // was active, but active tab is gone + } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { + // all remaining tabs are disabled + if ( this.tabs.length === options.disabled.length ) { + options.active = false; + this.active = $(); + // activate previous tab + } else { + this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); + } + // was active, active tab still exists + } else { + // make sure active index is correct + options.active = this.tabs.index( this.active ); + } + + this._refresh(); + }, + + _refresh: function() { + this._setupDisabled( this.options.disabled ); + this._setupEvents( this.options.event ); + this._setupHeightStyle( this.options.heightStyle ); + + this.tabs.not( this.active ).attr({ + "aria-selected": "false", + tabIndex: -1 + }); + this.panels.not( this._getPanelForTab( this.active ) ) + .hide() + .attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + + // Make sure one tab is in the tab order + if ( !this.active.length ) { + this.tabs.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active + .addClass( "ui-tabs-active ui-state-active" ) + .attr({ + "aria-selected": "true", + tabIndex: 0 + }); + this._getPanelForTab( this.active ) + .show() + .attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + } + }, + + _processTabs: function() { + var that = this; + + this.tablist = this._getList() + .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .attr( "role", "tablist" ); + + this.tabs = this.tablist.find( "> li:has(a[href])" ) + .addClass( "ui-state-default ui-corner-top" ) + .attr({ + role: "tab", + tabIndex: -1 + }); + + this.anchors = this.tabs.map(function() { + return $( "a", this )[ 0 ]; + }) + .addClass( "ui-tabs-anchor" ) + .attr({ + role: "presentation", + tabIndex: -1 + }); + + this.panels = $(); + + this.anchors.each(function( i, anchor ) { + var selector, panel, panelId, + anchorId = $( anchor ).uniqueId().attr( "id" ), + tab = $( anchor ).closest( "li" ), + originalAriaControls = tab.attr( "aria-controls" ); + + // inline tab + if ( isLocal( anchor ) ) { + selector = anchor.hash; + panel = that.element.find( that._sanitizeSelector( selector ) ); + // remote tab + } else { + panelId = that._tabId( tab ); + selector = "#" + panelId; + panel = that.element.find( selector ); + if ( !panel.length ) { + panel = that._createPanel( panelId ); + panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); + } + panel.attr( "aria-live", "polite" ); + } + + if ( panel.length) { + that.panels = that.panels.add( panel ); + } + if ( originalAriaControls ) { + tab.data( "ui-tabs-aria-controls", originalAriaControls ); + } + tab.attr({ + "aria-controls": selector.substring( 1 ), + "aria-labelledby": anchorId + }); + panel.attr( "aria-labelledby", anchorId ); + }); + + this.panels + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .attr( "role", "tabpanel" ); + }, + + // allow overriding how to find the list for rare usage scenarios (#7715) + _getList: function() { + return this.element.find( "ol,ul" ).eq( 0 ); + }, + + _createPanel: function( id ) { + return $( "<div>" ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + }, + + _setupDisabled: function( disabled ) { + if ( $.isArray( disabled ) ) { + if ( !disabled.length ) { + disabled = false; + } else if ( disabled.length === this.anchors.length ) { + disabled = true; + } + } + + // disable tabs + for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { + if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { + $( li ) + .addClass( "ui-state-disabled" ) + .attr( "aria-disabled", "true" ); + } else { + $( li ) + .removeClass( "ui-state-disabled" ) + .removeAttr( "aria-disabled" ); + } + } + + this.options.disabled = disabled; + }, + + _setupEvents: function( event ) { + var events = { + click: function( event ) { + event.preventDefault(); + } + }; + if ( event ) { + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); + } + + this._off( this.anchors.add( this.tabs ).add( this.panels ) ); + this._on( this.anchors, events ); + this._on( this.tabs, { keydown: "_tabKeydown" } ); + this._on( this.panels, { keydown: "_panelKeydown" } ); + + this._focusable( this.tabs ); + this._hoverable( this.tabs ); + }, + + _setupHeightStyle: function( heightStyle ) { + var maxHeight, overflow, + parent = this.element.parent(); + + if ( heightStyle === "fill" ) { + // IE 6 treats height like minHeight, so we need to turn off overflow + // in order to get a reliable height + // we use the minHeight support test because we assume that only + // browsers that don't support minHeight will treat height as minHeight + if ( !$.support.minHeight ) { + overflow = parent.css( "overflow" ); + parent.css( "overflow", "hidden"); + } + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + }); + if ( overflow ) { + parent.css( "overflow", overflow ); + } + + this.element.children().not( this.panels ).each(function() { + maxHeight -= $( this ).outerHeight( true ); + }); + + this.panels.each(function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + }) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.panels.each(function() { + maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); + }).height( maxHeight ); + } + }, + + _eventHandler: function( event ) { + var options = this.options, + active = this.active, + anchor = $( event.currentTarget ), + tab = anchor.closest( "li" ), + clickedIsActive = tab[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : this._getPanelForTab( tab ), + toHide = !active.length ? $() : this._getPanelForTab( active ), + eventData = { + oldTab: active, + oldPanel: toHide, + newTab: collapsing ? $() : tab, + newPanel: toShow + }; + + event.preventDefault(); + + if ( tab.hasClass( "ui-state-disabled" ) || + // tab is already loading + tab.hasClass( "ui-tabs-loading" ) || + // can't switch durning an animation + this.running || + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.tabs.index( tab ); + + this.active = clickedIsActive ? $() : tab; + if ( this.xhr ) { + this.xhr.abort(); + } + + if ( !toHide.length && !toShow.length ) { + $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); + } + + if ( toShow.length ) { + this.load( this.tabs.index( tab ), event ); + } + this._toggle( event, eventData ); + }, + + // handles show/hide for selecting tabs + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel; + + this.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && that.options.show ) { + that._show( toShow, that.options.show, complete ); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && this.options.hide ) { + this._hide( toHide, this.options.hide, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + + toHide.attr({ + "aria-expanded": "false", + "aria-hidden": "true" + }); + eventData.oldTab.attr( "aria-selected", "false" ); + // If we're switching tabs, remove the old tab from the tab order. + // If we're opening from collapsed state, remove the previous tab from the tab order. + // If we're collapsing, then keep the collapsing tab in the tab order. + if ( toShow.length && toHide.length ) { + eventData.oldTab.attr( "tabIndex", -1 ); + } else if ( toShow.length ) { + this.tabs.filter(function() { + return $( this ).attr( "tabIndex" ) === 0; + }) + .attr( "tabIndex", -1 ); + } + + toShow.attr({ + "aria-expanded": "true", + "aria-hidden": "false" + }); + eventData.newTab.attr({ + "aria-selected": "true", + tabIndex: 0 + }); + }, + + _activate: function( index ) { + var anchor, + active = this._findActive( index ); + + // trying to activate the already active panel + if ( active[ 0 ] === this.active[ 0 ] ) { + return; + } + + // trying to collapse, simulate a click on the current active header + if ( !active.length ) { + active = this.active; + } + + anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; + this._eventHandler({ + target: anchor, + currentTarget: anchor, + preventDefault: $.noop + }); + }, + + _findActive: function( index ) { + return index === false ? $() : this.tabs.eq( index ); + }, + + _getIndex: function( index ) { + // meta-function to give users option to provide a href string instead of a numerical index. + if ( typeof index === "string" ) { + index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); + } + + return index; + }, + + _destroy: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + + this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); + + this.tablist + .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) + .removeAttr( "role" ); + + this.anchors + .removeClass( "ui-tabs-anchor" ) + .removeAttr( "role" ) + .removeAttr( "tabIndex" ) + .removeData( "href.tabs" ) + .removeData( "load.tabs" ) + .removeUniqueId(); + + this.tabs.add( this.panels ).each(function() { + if ( $.data( this, "ui-tabs-destroy" ) ) { + $( this ).remove(); + } else { + $( this ) + .removeClass( "ui-state-default ui-state-active ui-state-disabled " + + "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) + .removeAttr( "tabIndex" ) + .removeAttr( "aria-live" ) + .removeAttr( "aria-busy" ) + .removeAttr( "aria-selected" ) + .removeAttr( "aria-labelledby" ) + .removeAttr( "aria-hidden" ) + .removeAttr( "aria-expanded" ) + .removeAttr( "role" ); + } + }); + + this.tabs.each(function() { + var li = $( this ), + prev = li.data( "ui-tabs-aria-controls" ); + if ( prev ) { + li.attr( "aria-controls", prev ); + } else { + li.removeAttr( "aria-controls" ); + } + }); + + this.panels.show(); + + if ( this.options.heightStyle !== "content" ) { + this.panels.css( "height", "" ); + } + }, + + enable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === false ) { + return; + } + + if ( index === undefined ) { + disabled = false; + } else { + index = this._getIndex( index ); + if ( $.isArray( disabled ) ) { + disabled = $.map( disabled, function( num ) { + return num !== index ? num : null; + }); + } else { + disabled = $.map( this.tabs, function( li, num ) { + return num !== index ? num : null; + }); + } + } + this._setupDisabled( disabled ); + }, + + disable: function( index ) { + var disabled = this.options.disabled; + if ( disabled === true ) { + return; + } + + if ( index === undefined ) { + disabled = true; + } else { + index = this._getIndex( index ); + if ( $.inArray( index, disabled ) !== -1 ) { + return; + } + if ( $.isArray( disabled ) ) { + disabled = $.merge( [ index ], disabled ).sort(); + } else { + disabled = [ index ]; + } + } + this._setupDisabled( disabled ); + }, + + load: function( index, event ) { + index = this._getIndex( index ); + var that = this, + tab = this.tabs.eq( index ), + anchor = tab.find( ".ui-tabs-anchor" ), + panel = this._getPanelForTab( tab ), + eventData = { + tab: tab, + panel: panel + }; + + // not remote + if ( isLocal( anchor[ 0 ] ) ) { + return; + } + + this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); + + // support: jQuery <1.8 + // jQuery <1.8 returns false if the request is canceled in beforeSend, + // but as of 1.8, $.ajax() always returns a jqXHR object. + if ( this.xhr && this.xhr.statusText !== "canceled" ) { + tab.addClass( "ui-tabs-loading" ); + panel.attr( "aria-busy", "true" ); + + this.xhr + .success(function( response ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + panel.html( response ); + that._trigger( "load", event, eventData ); + }, 1 ); + }) + .complete(function( jqXHR, status ) { + // support: jQuery <1.8 + // http://bugs.jquery.com/ticket/11778 + setTimeout(function() { + if ( status === "abort" ) { + that.panels.stop( false, true ); + } + + tab.removeClass( "ui-tabs-loading" ); + panel.removeAttr( "aria-busy" ); + + if ( jqXHR === that.xhr ) { + delete that.xhr; + } + }, 1 ); + }); + } + }, + + // TODO: Remove this function in 1.10 when ajaxOptions is removed + _ajaxSettings: function( anchor, event, eventData ) { + var that = this; + return { + url: anchor.attr( "href" ), + beforeSend: function( jqXHR, settings ) { + return that._trigger( "beforeLoad", event, + $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) ); + } + }; + }, + + _getPanelForTab: function( tab ) { + var id = $( tab ).attr( "aria-controls" ); + return this.element.find( this._sanitizeSelector( "#" + id ) ); + } +}); + +// DEPRECATED +if ( $.uiBackCompat !== false ) { + + // helper method for a lot of the back compat extensions + $.ui.tabs.prototype._ui = function( tab, panel ) { + return { + tab: tab, + panel: panel, + index: this.anchors.index( tab ) + }; + }; + + // url method + $.widget( "ui.tabs", $.ui.tabs, { + url: function( index, url ) { + this.anchors.eq( index ).attr( "href", url ); + } + }); + + // TODO: Remove _ajaxSettings() method when removing this extension + // ajaxOptions and cache options + $.widget( "ui.tabs", $.ui.tabs, { + options: { + ajaxOptions: null, + cache: false + }, + + _create: function() { + this._super(); + + var that = this; + + this._on({ tabsbeforeload: function( event, ui ) { + // tab is already cached + if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) { + event.preventDefault(); + return; + } + + ui.jqXHR.success(function() { + if ( that.options.cache ) { + $.data( ui.tab[ 0 ], "cache.tabs", true ); + } + }); + }}); + }, + + _ajaxSettings: function( anchor, event, ui ) { + var ajaxOptions = this.options.ajaxOptions; + return $.extend( {}, ajaxOptions, { + error: function( xhr, status ) { + try { + // Passing index avoid a race condition when this method is + // called after the user has selected another tab. + // Pass the anchor that initiated this request allows + // loadError to manipulate the tab content panel via $(a.hash) + ajaxOptions.error( + xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] ); + } + catch ( error ) {} + } + }, this._superApply( arguments ) ); + }, + + _setOption: function( key, value ) { + // reset cache if switching from cached to not cached + if ( key === "cache" && value === false ) { + this.anchors.removeData( "cache.tabs" ); + } + this._super( key, value ); + }, + + _destroy: function() { + this.anchors.removeData( "cache.tabs" ); + this._super(); + }, + + url: function( index ){ + this.anchors.eq( index ).removeData( "cache.tabs" ); + this._superApply( arguments ); + } + }); + + // abort method + $.widget( "ui.tabs", $.ui.tabs, { + abort: function() { + if ( this.xhr ) { + this.xhr.abort(); + } + } + }); + + // spinner + $.widget( "ui.tabs", $.ui.tabs, { + options: { + spinner: "<em>Loading…</em>" + }, + _create: function() { + this._super(); + this._on({ + tabsbeforeload: function( event, ui ) { + // Don't react to nested tabs or tabs that don't use a spinner + if ( event.target !== this.element[ 0 ] || + !this.options.spinner ) { + return; + } + + var span = ui.tab.find( "span" ), + html = span.html(); + span.html( this.options.spinner ); + ui.jqXHR.complete(function() { + span.html( html ); + }); + } + }); + } + }); + + // enable/disable events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + enable: null, + disable: null + }, + + enable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === true || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + }, + + disable: function( index ) { + var options = this.options, + trigger; + + if ( index && options.disabled === false || + ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) { + trigger = true; + } + + this._superApply( arguments ); + + if ( trigger ) { + this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + } + } + }); + + // add/remove methods and events + $.widget( "ui.tabs", $.ui.tabs, { + options: { + add: null, + remove: null, + tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>" + }, + + add: function( url, label, index ) { + if ( index === undefined ) { + index = this.anchors.length; + } + + var doInsertAfter, panel, + options = this.options, + li = $( options.tabTemplate + .replace( /#\{href\}/g, url ) + .replace( /#\{label\}/g, label ) ), + id = !url.indexOf( "#" ) ? + url.replace( "#", "" ) : + this._tabId( li ); + + li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); + li.attr( "aria-controls", id ); + + doInsertAfter = index >= this.tabs.length; + + // try to find an existing element before creating a new one + panel = this.element.find( "#" + id ); + if ( !panel.length ) { + panel = this._createPanel( id ); + if ( doInsertAfter ) { + if ( index > 0 ) { + panel.insertAfter( this.panels.eq( -1 ) ); + } else { + panel.appendTo( this.element ); + } + } else { + panel.insertBefore( this.panels[ index ] ); + } + } + panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide(); + + if ( doInsertAfter ) { + li.appendTo( this.tablist ); + } else { + li.insertBefore( this.tabs[ index ] ); + } + + options.disabled = $.map( options.disabled, function( n ) { + return n >= index ? ++n : n; + }); + + this.refresh(); + if ( this.tabs.length === 1 && options.active === false ) { + this.option( "active", 0 ); + } + + this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); + return this; + }, + + remove: function( index ) { + index = this._getIndex( index ); + var options = this.options, + tab = this.tabs.eq( index ).remove(), + panel = this._getPanelForTab( tab ).remove(); + + // If selected tab was removed focus tab to the right or + // in case the last tab was removed the tab to the left. + // We check for more than 2 tabs, because if there are only 2, + // then when we remove this tab, there will only be one tab left + // so we don't need to detect which tab to activate. + if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) { + this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); + } + + options.disabled = $.map( + $.grep( options.disabled, function( n ) { + return n !== index; + }), + function( n ) { + return n >= index ? --n : n; + }); + + this.refresh(); + + this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) ); + return this; + } + }); + + // length method + $.widget( "ui.tabs", $.ui.tabs, { + length: function() { + return this.anchors.length; + } + }); + + // panel ids (idPrefix option + title attribute) + $.widget( "ui.tabs", $.ui.tabs, { + options: { + idPrefix: "ui-tabs-" + }, + + _tabId: function( tab ) { + var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab; + a = a[0]; + return $( a ).closest( "li" ).attr( "aria-controls" ) || + a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) || + this.options.idPrefix + getNextTabId(); + } + }); + + // _createPanel method + $.widget( "ui.tabs", $.ui.tabs, { + options: { + panelTemplate: "<div></div>" + }, + + _createPanel: function( id ) { + return $( this.options.panelTemplate ) + .attr( "id", id ) + .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) + .data( "ui-tabs-destroy", true ); + } + }); + + // selected option + $.widget( "ui.tabs", $.ui.tabs, { + _create: function() { + var options = this.options; + if ( options.active === null && options.selected !== undefined ) { + options.active = options.selected === -1 ? false : options.selected; + } + this._super(); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _setOption: function( key, value ) { + if ( key !== "selected" ) { + return this._super( key, value ); + } + + var options = this.options; + this._super( "active", value === -1 ? false : value ); + options.selected = options.active; + if ( options.selected === false ) { + options.selected = -1; + } + }, + + _eventHandler: function() { + this._superApply( arguments ); + this.options.selected = this.options.active; + if ( this.options.selected === false ) { + this.options.selected = -1; + } + } + }); + + // show and select event + $.widget( "ui.tabs", $.ui.tabs, { + options: { + show: null, + select: null + }, + _create: function() { + this._super(); + if ( this.options.active !== false ) { + this._trigger( "show", null, this._ui( + this.active.find( ".ui-tabs-anchor" )[ 0 ], + this._getPanelForTab( this.active )[ 0 ] ) ); + } + }, + _trigger: function( type, event, data ) { + var tab, panel, + ret = this._superApply( arguments ); + + if ( !ret ) { + return false; + } + + if ( type === "beforeActivate" ) { + tab = data.newTab.length ? data.newTab : data.oldTab; + panel = data.newPanel.length ? data.newPanel : data.oldPanel; + ret = this._super( "select", event, { + tab: tab.find( ".ui-tabs-anchor" )[ 0], + panel: panel[ 0 ], + index: tab.closest( "li" ).index() + }); + } else if ( type === "activate" && data.newTab.length ) { + ret = this._super( "show", event, { + tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ], + panel: data.newPanel[ 0 ], + index: data.newTab.closest( "li" ).index() + }); + } + return ret; + } + }); + + // select method + $.widget( "ui.tabs", $.ui.tabs, { + select: function( index ) { + index = this._getIndex( index ); + if ( index === -1 ) { + if ( this.options.collapsible && this.options.selected !== -1 ) { + index = this.options.selected; + } else { + return; + } + } + this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace ); + } + }); + + // cookie option + (function() { + + var listId = 0; + + $.widget( "ui.tabs", $.ui.tabs, { + options: { + cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } + }, + _create: function() { + var options = this.options, + active; + if ( options.active == null && options.cookie ) { + active = parseInt( this._cookie(), 10 ); + if ( active === -1 ) { + active = false; + } + options.active = active; + } + this._super(); + }, + _cookie: function( active ) { + var cookie = [ this.cookie || + ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; + if ( arguments.length ) { + cookie.push( active === false ? -1 : active ); + cookie.push( this.options.cookie ); + } + return $.cookie.apply( null, cookie ); + }, + _refresh: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _eventHandler: function() { + this._superApply( arguments ); + if ( this.options.cookie ) { + this._cookie( this.options.active, this.options.cookie ); + } + }, + _destroy: function() { + this._super(); + if ( this.options.cookie ) { + this._cookie( null, this.options.cookie ); + } + } + }); + + })(); + + // load event + $.widget( "ui.tabs", $.ui.tabs, { + _trigger: function( type, event, data ) { + var _data = $.extend( {}, data ); + if ( type === "load" ) { + _data.panel = _data.panel[ 0 ]; + _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ]; + } + return this._super( type, event, _data ); + } + }); + + // fx option + // The new animation options (show, hide) conflict with the old show callback. + // The old fx option wins over show/hide anyway (always favor back-compat). + // If a user wants to use the new animation API, they must give up the old API. + $.widget( "ui.tabs", $.ui.tabs, { + options: { + fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 } + }, + + _getFx: function() { + var hide, show, + fx = this.options.fx; + + if ( fx ) { + if ( $.isArray( fx ) ) { + hide = fx[ 0 ]; + show = fx[ 1 ]; + } else { + hide = show = fx; + } + } + + return fx ? { show: show, hide: hide } : null; + }, + + _toggle: function( event, eventData ) { + var that = this, + toShow = eventData.newPanel, + toHide = eventData.oldPanel, + fx = this._getFx(); + + if ( !fx ) { + return this._super( event, eventData ); + } + + that.running = true; + + function complete() { + that.running = false; + that._trigger( "activate", event, eventData ); + } + + function show() { + eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); + + if ( toShow.length && fx.show ) { + toShow + .animate( fx.show, fx.show.duration, function() { + complete(); + }); + } else { + toShow.show(); + complete(); + } + } + + // start out by hiding, then showing, then completing + if ( toHide.length && fx.hide ) { + toHide.animate( fx.hide, fx.hide.duration, function() { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + show(); + }); + } else { + eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); + toHide.hide(); + show(); + } + } + }); +} + +})( jQuery ); + +(function( $ ) { + +var increments = 0; + +function addDescribedBy( elem, id ) { + var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); + describedby.push( id ); + elem + .data( "ui-tooltip-id", id ) + .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); +} + +function removeDescribedBy( elem ) { + var id = elem.data( "ui-tooltip-id" ), + describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), + index = $.inArray( id, describedby ); + if ( index !== -1 ) { + describedby.splice( index, 1 ); + } + + elem.removeData( "ui-tooltip-id" ); + describedby = $.trim( describedby.join( " " ) ); + if ( describedby ) { + elem.attr( "aria-describedby", describedby ); + } else { + elem.removeAttr( "aria-describedby" ); + } +} + +$.widget( "ui.tooltip", { + version: "1.9.2", + options: { + content: function() { + return $( this ).attr( "title" ); + }, + hide: true, + // Disabled elements have inconsistent behavior across browsers (#8661) + items: "[title]:not([disabled])", + position: { + my: "left top+15", + at: "left bottom", + collision: "flipfit flip" + }, + show: true, + tooltipClass: null, + track: false, + + // callbacks + close: null, + open: null + }, + + _create: function() { + this._on({ + mouseover: "open", + focusin: "open" + }); + + // IDs of generated tooltips, needed for destroy + this.tooltips = {}; + // IDs of parent tooltips where we removed the title attribute + this.parents = {}; + + if ( this.options.disabled ) { + this._disable(); + } + }, + + _setOption: function( key, value ) { + var that = this; + + if ( key === "disabled" ) { + this[ value ? "_disable" : "_enable" ](); + this.options[ key ] = value; + // disable element style changes + return; + } + + this._super( key, value ); + + if ( key === "content" ) { + $.each( this.tooltips, function( id, element ) { + that._updateContent( element ); + }); + } + }, + + _disable: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + }); + + // remove title attributes to prevent native tooltips + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.is( "[title]" ) ) { + element + .data( "ui-tooltip-title", element.attr( "title" ) ) + .attr( "title", "" ); + } + }); + }, + + _enable: function() { + // restore title attributes + this.element.find( this.options.items ).andSelf().each(function() { + var element = $( this ); + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + } + }); + }, + + open: function( event ) { + var that = this, + target = $( event ? event.target : this.element ) + // we need closest here due to mouseover bubbling, + // but always pointing at the same event target + .closest( this.options.items ); + + // No element to show a tooltip for or the tooltip is already open + if ( !target.length || target.data( "ui-tooltip-id" ) ) { + return; + } + + if ( target.attr( "title" ) ) { + target.data( "ui-tooltip-title", target.attr( "title" ) ); + } + + target.data( "ui-tooltip-open", true ); + + // kill parent tooltips, custom or native, for hover + if ( event && event.type === "mouseover" ) { + target.parents().each(function() { + var parent = $( this ), + blurEvent; + if ( parent.data( "ui-tooltip-open" ) ) { + blurEvent = $.Event( "blur" ); + blurEvent.target = blurEvent.currentTarget = this; + that.close( blurEvent, true ); + } + if ( parent.attr( "title" ) ) { + parent.uniqueId(); + that.parents[ this.id ] = { + element: this, + title: parent.attr( "title" ) + }; + parent.attr( "title", "" ); + } + }); + } + + this._updateContent( target, event ); + }, + + _updateContent: function( target, event ) { + var content, + contentOption = this.options.content, + that = this, + eventType = event ? event.type : null; + + if ( typeof contentOption === "string" ) { + return this._open( event, target, contentOption ); + } + + content = contentOption.call( target[0], function( response ) { + // ignore async response if tooltip was closed already + if ( !target.data( "ui-tooltip-open" ) ) { + return; + } + // IE may instantly serve a cached response for ajax requests + // delay this call to _open so the other call to _open runs first + that._delay(function() { + // jQuery creates a special event for focusin when it doesn't + // exist natively. To improve performance, the native event + // object is reused and the type is changed. Therefore, we can't + // rely on the type being correct after the event finished + // bubbling, so we set it back to the previous value. (#8740) + if ( event ) { + event.type = eventType; + } + this._open( event, target, response ); + }); + }); + if ( content ) { + this._open( event, target, content ); + } + }, + + _open: function( event, target, content ) { + var tooltip, events, delayedShow, + positionOption = $.extend( {}, this.options.position ); + + if ( !content ) { + return; + } + + // Content can be updated multiple times. If the tooltip already + // exists, then just update the content and bail. + tooltip = this._find( target ); + if ( tooltip.length ) { + tooltip.find( ".ui-tooltip-content" ).html( content ); + return; + } + + // if we have a title, clear it to prevent the native tooltip + // we have to check first to avoid defining a title if none exists + // (we don't want to cause an element to start matching [title]) + // + // We use removeAttr only for key events, to allow IE to export the correct + // accessible attributes. For mouse events, set to empty string to avoid + // native tooltip showing up (happens only when removing inside mouseover). + if ( target.is( "[title]" ) ) { + if ( event && event.type === "mouseover" ) { + target.attr( "title", "" ); + } else { + target.removeAttr( "title" ); + } + } + + tooltip = this._tooltip( target ); + addDescribedBy( target, tooltip.attr( "id" ) ); + tooltip.find( ".ui-tooltip-content" ).html( content ); + + function position( event ) { + positionOption.of = event; + if ( tooltip.is( ":hidden" ) ) { + return; + } + tooltip.position( positionOption ); + } + if ( this.options.track && event && /^mouse/.test( event.type ) ) { + this._on( this.document, { + mousemove: position + }); + // trigger once to override element-relative positioning + position( event ); + } else { + tooltip.position( $.extend({ + of: target + }, this.options.position ) ); + } + + tooltip.hide(); + + this._show( tooltip, this.options.show ); + // Handle tracking tooltips that are shown with a delay (#8644). As soon + // as the tooltip is visible, position the tooltip using the most recent + // event. + if ( this.options.show && this.options.show.delay ) { + delayedShow = setInterval(function() { + if ( tooltip.is( ":visible" ) ) { + position( positionOption.of ); + clearInterval( delayedShow ); + } + }, $.fx.interval ); + } + + this._trigger( "open", event, { tooltip: tooltip } ); + + events = { + keyup: function( event ) { + if ( event.keyCode === $.ui.keyCode.ESCAPE ) { + var fakeEvent = $.Event(event); + fakeEvent.currentTarget = target[0]; + this.close( fakeEvent, true ); + } + }, + remove: function() { + this._removeTooltip( tooltip ); + } + }; + if ( !event || event.type === "mouseover" ) { + events.mouseleave = "close"; + } + if ( !event || event.type === "focusin" ) { + events.focusout = "close"; + } + this._on( true, target, events ); + }, + + close: function( event ) { + var that = this, + target = $( event ? event.currentTarget : this.element ), + tooltip = this._find( target ); + + // disabling closes the tooltip, so we need to track when we're closing + // to avoid an infinite loop in case the tooltip becomes disabled on close + if ( this.closing ) { + return; + } + + // only set title if we had one before (see comment in _open()) + if ( target.data( "ui-tooltip-title" ) ) { + target.attr( "title", target.data( "ui-tooltip-title" ) ); + } + + removeDescribedBy( target ); + + tooltip.stop( true ); + this._hide( tooltip, this.options.hide, function() { + that._removeTooltip( $( this ) ); + }); + + target.removeData( "ui-tooltip-open" ); + this._off( target, "mouseleave focusout keyup" ); + // Remove 'remove' binding only on delegated targets + if ( target[0] !== this.element[0] ) { + this._off( target, "remove" ); + } + this._off( this.document, "mousemove" ); + + if ( event && event.type === "mouseleave" ) { + $.each( this.parents, function( id, parent ) { + $( parent.element ).attr( "title", parent.title ); + delete that.parents[ id ]; + }); + } + + this.closing = true; + this._trigger( "close", event, { tooltip: tooltip } ); + this.closing = false; + }, + + _tooltip: function( element ) { + var id = "ui-tooltip-" + increments++, + tooltip = $( "<div>" ) + .attr({ + id: id, + role: "tooltip" + }) + .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + + ( this.options.tooltipClass || "" ) ); + $( "<div>" ) + .addClass( "ui-tooltip-content" ) + .appendTo( tooltip ); + tooltip.appendTo( this.document[0].body ); + if ( $.fn.bgiframe ) { + tooltip.bgiframe(); + } + this.tooltips[ id ] = element; + return tooltip; + }, + + _find: function( target ) { + var id = target.data( "ui-tooltip-id" ); + return id ? $( "#" + id ) : $(); + }, + + _removeTooltip: function( tooltip ) { + tooltip.remove(); + delete this.tooltips[ tooltip.attr( "id" ) ]; + }, + + _destroy: function() { + var that = this; + + // close open tooltips + $.each( this.tooltips, function( id, element ) { + // Delegate to close method to handle common cleanup + var event = $.Event( "blur" ); + event.target = event.currentTarget = element[0]; + that.close( event, true ); + + // Remove immediately; destroying an open tooltip doesn't use the + // hide animation + $( "#" + id ).remove(); + + // Restore the title + if ( element.data( "ui-tooltip-title" ) ) { + element.attr( "title", element.data( "ui-tooltip-title" ) ); + element.removeData( "ui-tooltip-title" ); + } + }); + } +}); + +}( jQuery ) ); diff --git a/pub/lib/jquery/jquery-ui.js b/pub/lib/jquery/jquery-ui.js index d556f0d7f605fcc1ab4dad10ebd7ee6d3e5bc35c..676e1f0cf3da91b7e50e5eb12265a6ae3276f4bf 100644 --- a/pub/lib/jquery/jquery-ui.js +++ b/pub/lib/jquery/jquery-ui.js @@ -1,23 +1,17 @@ -/*! jQuery UI - v1.9.2 - 2012-11-23 +/*! jQuery UI - v1.10.4 - 2014-01-17 * http://jqueryui.com * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js -* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */ - +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ (function( $, undefined ) { var uuid = 0, runiqueId = /^ui-id-\d+$/; -// prevent duplicate loading -// this is only a problem because we proxy existing functions -// and we don't want to double proxy them +// $.ui might exist from components with no dependencies, e.g., $.ui.position $.ui = $.ui || {}; -if ( $.ui.version ) { - return; -} $.extend( $.ui, { - version: "1.9.2", + version: "1.10.4", keyCode: { BACKSPACE: 8, @@ -47,34 +41,35 @@ $.extend( $.ui, { // plugins $.fn.extend({ - _focus: $.fn.focus, - focus: function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - this._focus.apply( this, arguments ); - }, + focus: (function( orig ) { + return function( delay, fn ) { + return typeof delay === "number" ? + this.each(function() { + var elem = this; + setTimeout(function() { + $( elem ).focus(); + if ( fn ) { + fn.call( elem ); + } + }, delay ); + }) : + orig.apply( this, arguments ); + }; + })( $.fn.focus ), scrollParent: function() { var scrollParent; - if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { + if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { scrollParent = this.parents().filter(function() { - return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); + return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); }).eq(0); } else { scrollParent = this.parents().filter(function() { - return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); + return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x")); }).eq(0); } - return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; + return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent; }, zIndex: function( zIndex ) { @@ -147,7 +142,7 @@ function focusable( element, isTabIndexNotNaN ) { function visible( element ) { return $.expr.filters.visible( element ) && - !$( element ).parents().andSelf().filter(function() { + !$( element ).parents().addBack().filter(function() { return $.css( this, "visibility" ) === "hidden"; }).length; } @@ -175,31 +170,6 @@ $.extend( $.expr[ ":" ], { } }); -// support -$(function() { - var body = document.body, - div = body.appendChild( div = document.createElement( "div" ) ); - - // access offsetHeight before setting the style to prevent a layout bug - // in IE 9 which causes the element to continue to take up space even - // after it is removed from the DOM (#8026) - div.offsetHeight; - - $.extend( div.style, { - minHeight: "100px", - height: "auto", - padding: 0, - borderWidth: 0 - }); - - $.support.minHeight = div.offsetHeight === 100; - $.support.selectstart = "onselectstart" in div; - - // set display to none to avoid a layout bug in IE - // http://dev.jquery.com/ticket/4014 - body.removeChild( div ).style.display = "none"; -}); - // support: jQuery <1.8 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { $.each( [ "Width", "Height" ], function( i, name ) { @@ -247,6 +217,15 @@ if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { }); } +// support: jQuery <1.8 +if ( !$.fn.addBack ) { + $.fn.addBack = function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + }; +} + // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { $.fn.removeData = (function( removeData ) { @@ -265,13 +244,9 @@ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { // deprecated +$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); -(function() { - var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || []; - $.ui.ie = uaMatch.length ? true : false; - $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6; -})(); - +$.support.selectstart = "onselectstart" in document.createElement( "div" ); $.fn.extend({ disableSelection: function() { return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + @@ -286,7 +261,7 @@ $.fn.extend({ }); $.extend( $.ui, { - // $.ui.plugin is deprecated. Use the proxy pattern instead. + // $.ui.plugin is deprecated. Use $.widget() extensions instead. plugin: { add: function( module, option, set ) { var i, @@ -311,8 +286,6 @@ $.extend( $.ui, { } }, - contains: $.contains, - // only used by resizable hasScroll: function( el, a ) { @@ -335,16 +308,6 @@ $.extend( $.ui, { has = ( el[ scroll ] > 0 ); el[ scroll ] = 0; return has; - }, - - // these are odd functions, fix the API or move into individual plugins - isOverAxis: function( x, reference, size ) { - //Determines when x coordinate is over "b" element axis - return ( x > reference ) && ( x < ( reference + size ) ); - }, - isOver: function( y, x, top, left, height, width ) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); } }); @@ -367,6 +330,9 @@ $.cleanData = function( elems ) { $.widget = function( name, base, prototype ) { var fullName, existingConstructor, constructor, basePrototype, + // proxiedPrototype allows the provided prototype to remain unmodified + // so that it can be used as a mixin for multiple widgets (#8876) + proxiedPrototype = {}, namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; @@ -413,43 +379,43 @@ $.widget = function( name, base, prototype ) { // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { - if ( $.isFunction( value ) ) { - prototype[ prop ] = (function() { - var _super = function() { - return base.prototype[ prop ].apply( this, arguments ); - }, - _superApply = function( args ) { - return base.prototype[ prop ].apply( this, args ); - }; - return function() { - var __super = this._super, - __superApply = this._superApply, - returnValue; + if ( !$.isFunction( value ) ) { + proxiedPrototype[ prop ] = value; + return; + } + proxiedPrototype[ prop ] = (function() { + var _super = function() { + return base.prototype[ prop ].apply( this, arguments ); + }, + _superApply = function( args ) { + return base.prototype[ prop ].apply( this, args ); + }; + return function() { + var __super = this._super, + __superApply = this._superApply, + returnValue; - this._super = _super; - this._superApply = _superApply; + this._super = _super; + this._superApply = _superApply; - returnValue = value.apply( this, arguments ); + returnValue = value.apply( this, arguments ); - this._super = __super; - this._superApply = __superApply; + this._super = __super; + this._superApply = __superApply; - return returnValue; - }; - })(); - } + return returnValue; + }; + })(); }); constructor.prototype = $.widget.extend( basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name - }, prototype, { + widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name + }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, - // TODO remove widgetBaseClass, see #8155 - widgetBaseClass: fullName, widgetFullName: fullName }); @@ -575,9 +541,6 @@ $.Widget.prototype = { this.focusable = $(); if ( element !== this ) { - // 1.9 BC for #7810 - // TODO remove dual storage - $.data( element, this.widgetName, this ); $.data( element, this.widgetFullName, this ); this._on( true, this.element, { remove: function( event ) { @@ -657,12 +620,12 @@ $.Widget.prototype = { curOption = curOption[ parts[ i ] ]; } key = parts.pop(); - if ( value === undefined ) { + if ( arguments.length === 1 ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { - if ( value === undefined ) { + if ( arguments.length === 1 ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; @@ -844,7 +807,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { if ( options.delay ) { element.delay( options.delay ); } - if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) { + if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { element[ method ]( options ); } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); @@ -860,26 +823,19 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { }; }); -// DEPRECATED -if ( $.uiBackCompat !== false ) { - $.Widget.prototype._getCreateOptions = function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }; -} - })( jQuery ); (function( $, undefined ) { var mouseHandled = false; -$( document ).mouseup( function( e ) { +$( document ).mouseup( function() { mouseHandled = false; }); $.widget("ui.mouse", { - version: "1.9.2", + version: "1.10.4", options: { - cancel: 'input,textarea,button,select,option', + cancel: "input,textarea,button,select,option", distance: 1, delay: 0 }, @@ -887,12 +843,12 @@ $.widget("ui.mouse", { var that = this; this.element - .bind('mousedown.'+this.widgetName, function(event) { + .bind("mousedown."+this.widgetName, function(event) { return that._mouseDown(event); }) - .bind('click.'+this.widgetName, function(event) { - if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) { - $.removeData(event.target, that.widgetName + '.preventClickEvent'); + .bind("click."+this.widgetName, function(event) { + if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { + $.removeData(event.target, that.widgetName + ".preventClickEvent"); event.stopImmediatePropagation(); return false; } @@ -904,11 +860,11 @@ $.widget("ui.mouse", { // TODO: make sure destroying one instance of mouse doesn't mess with // other instances of mouse _mouseDestroy: function() { - this.element.unbind('.'+this.widgetName); + this.element.unbind("."+this.widgetName); if ( this._mouseMoveDelegate ) { $(document) - .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) + .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); } }, @@ -946,8 +902,8 @@ $.widget("ui.mouse", { } // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { - $.removeData(event.target, this.widgetName + '.preventClickEvent'); + if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { + $.removeData(event.target, this.widgetName + ".preventClickEvent"); } // these delegates are required to keep context @@ -958,8 +914,8 @@ $.widget("ui.mouse", { return that._mouseUp(event); }; $(document) - .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); + .bind("mousemove."+this.widgetName, this._mouseMoveDelegate) + .bind("mouseup."+this.widgetName, this._mouseUpDelegate); event.preventDefault(); @@ -969,7 +925,7 @@ $.widget("ui.mouse", { _mouseMove: function(event) { // IE mouseup check - mouseup happened when mouse was out of window - if ($.ui.ie && !(document.documentMode >= 9) && !event.button) { + if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { return this._mouseUp(event); } @@ -989,14 +945,14 @@ $.widget("ui.mouse", { _mouseUp: function(event) { $(document) - .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); + .unbind("mousemove."+this.widgetName, this._mouseMoveDelegate) + .unbind("mouseup."+this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; if (event.target === this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + '.preventClickEvent', true); + $.data(event.target, this.widgetName + ".preventClickEvent", true); } this._mouseStop(event); @@ -1013,15 +969,15 @@ $.widget("ui.mouse", { ); }, - _mouseDelayMet: function(event) { + _mouseDelayMet: function(/* event */) { return this.mouseDelayMet; }, // These are placeholder methods, to be overridden by extending plugin - _mouseStart: function(event) {}, - _mouseDrag: function(event) {}, - _mouseStop: function(event) {}, - _mouseCapture: function(event) { return true; } + _mouseStart: function(/* event */) {}, + _mouseDrag: function(/* event */) {}, + _mouseStop: function(/* event */) {}, + _mouseCapture: function(/* event */) { return true; } }); })(jQuery); @@ -1029,7 +985,7 @@ $.widget("ui.mouse", { (function( $, undefined ) { $.widget("ui.draggable", $.ui.mouse, { - version: "1.9.2", + version: "1.10.4", widgetEventPrefix: "drag", options: { addClasses: true, @@ -1055,15 +1011,24 @@ $.widget("ui.draggable", $.ui.mouse, { snapMode: "both", snapTolerance: 20, stack: false, - zIndex: false + zIndex: false, + + // callbacks + drag: null, + start: null, + stop: null }, _create: function() { - if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) - this.element[0].style.position = 'relative'; - - (this.options.addClasses && this.element.addClass("ui-draggable")); - (this.options.disabled && this.element.addClass("ui-draggable-disabled")); + if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { + this.element[0].style.position = "relative"; + } + if (this.options.addClasses){ + this.element.addClass("ui-draggable"); + } + if (this.options.disabled){ + this.element.addClass("ui-draggable-disabled"); + } this._mouseInit(); @@ -1079,16 +1044,18 @@ $.widget("ui.draggable", $.ui.mouse, { var o = this.options; // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) + if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { return false; + } //Quit if we're not on a valid handle this.handle = this._getHandle(event); - if (!this.handle) + if (!this.handle) { return false; + } $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { - $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') + $("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>") .css({ width: this.offsetWidth+"px", height: this.offsetHeight+"px", position: "absolute", opacity: "0.001", zIndex: 1000 @@ -1114,8 +1081,9 @@ $.widget("ui.draggable", $.ui.mouse, { this._cacheHelperProportions(); //If ddmanager is used for droppables, set the global draggable - if($.ui.ddmanager) + if($.ui.ddmanager) { $.ui.ddmanager.current = this; + } /* * - Position generation - @@ -1126,8 +1094,10 @@ $.widget("ui.draggable", $.ui.mouse, { this._cacheMargins(); //Store the helper's css position - this.cssPosition = this.helper.css("position"); + this.cssPosition = this.helper.css( "position" ); this.scrollParent = this.helper.scrollParent(); + this.offsetParent = this.helper.offsetParent(); + this.offsetParentCssPosition = this.offsetParent.css( "position" ); //The element's absolute position on the page minus margins this.offset = this.positionAbs = this.element.offset(); @@ -1136,6 +1106,9 @@ $.widget("ui.draggable", $.ui.mouse, { left: this.offset.left - this.margins.left }; + //Reset scroll cache + this.offset.scroll = false; + $.extend(this.offset, { click: { //Where the click happened, relative to the element left: event.pageX - this.offset.left, @@ -1150,12 +1123,11 @@ $.widget("ui.draggable", $.ui.mouse, { this.originalPageX = event.pageX; this.originalPageY = event.pageY; - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); //Set a containment if given in the options - if(o.containment) - this._setContainment(); + this._setContainment(); //Trigger event + callbacks if(this._trigger("start", event) === false) { @@ -1167,19 +1139,26 @@ $.widget("ui.draggable", $.ui.mouse, { this._cacheHelperProportions(); //Prepare the droppable offsets - if ($.ui.ddmanager && !o.dropBehaviour) + if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); + } this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) - if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); + if ( $.ui.ddmanager ) { + $.ui.ddmanager.dragStart(this, event); + } return true; }, _mouseDrag: function(event, noPropagation) { + // reset any necessary cached properties (see #5009) + if ( this.offsetParentCssPosition === "fixed" ) { + this.offset.parent = this._getParentOffset(); + } //Compute the helpers position this.position = this._generatePosition(event); @@ -1188,16 +1167,22 @@ $.widget("ui.draggable", $.ui.mouse, { //Call plugins and callbacks and use the resulting position if something is returned if (!noPropagation) { var ui = this._uiHash(); - if(this._trigger('drag', event, ui) === false) { + if(this._trigger("drag", event, ui) === false) { this._mouseUp({}); return false; } this.position = ui.position; } - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + if(!this.options.axis || this.options.axis !== "y") { + this.helper[0].style.left = this.position.left+"px"; + } + if(!this.options.axis || this.options.axis !== "x") { + this.helper[0].style.top = this.position.top+"px"; + } + if($.ui.ddmanager) { + $.ui.ddmanager.drag(this, event); + } return false; }, @@ -1205,9 +1190,11 @@ $.widget("ui.draggable", $.ui.mouse, { _mouseStop: function(event) { //If we are using droppables, inform the manager about the drop - var dropped = false; - if ($.ui.ddmanager && !this.options.dropBehaviour) + var that = this, + dropped = false; + if ($.ui.ddmanager && !this.options.dropBehaviour) { dropped = $.ui.ddmanager.drop(this, event); + } //if a drop comes from outside (a sortable) if(this.dropped) { @@ -1216,17 +1203,11 @@ $.widget("ui.draggable", $.ui.mouse, { } //if the original element is no longer in the DOM don't bother to continue (see #8269) - var element = this.element[0], elementInDom = false; - while ( element && (element = element.parentNode) ) { - if (element == document ) { - elementInDom = true; - } - } - if ( !elementInDom && this.options.helper === "original" ) + if ( this.options.helper === "original" && !$.contains( this.element[ 0 ].ownerDocument, this.element[ 0 ] ) ) { return false; + } - if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { - var that = this; + if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { if(that._trigger("stop", event) !== false) { that._clear(); @@ -1248,7 +1229,9 @@ $.widget("ui.draggable", $.ui.mouse, { }); //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) - if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); + if( $.ui.ddmanager ) { + $.ui.ddmanager.dragStop(this, event); + } return $.ui.mouse.prototype._mouseUp.call(this, event); }, @@ -1266,51 +1249,45 @@ $.widget("ui.draggable", $.ui.mouse, { }, _getHandle: function(event) { - - var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; - $(this.options.handle, this.element) - .find("*") - .andSelf() - .each(function() { - if(this == event.target) handle = true; - }); - - return handle; - + return this.options.handle ? + !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : + true; }, _createHelper: function(event) { - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); + var o = this.options, + helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element); - if(!helper.parents('body').length) - helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); + if(!helper.parents("body").length) { + helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); + } - if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) + if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { helper.css("position", "absolute"); + } return helper; }, _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); + if (typeof obj === "string") { + obj = obj.split(" "); } if ($.isArray(obj)) { obj = {left: +obj[0], top: +obj[1] || 0}; } - if ('left' in obj) { + if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left; } - if ('right' in obj) { + if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; } - if ('top' in obj) { + if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top; } - if ('bottom' in obj) { + if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; } }, @@ -1318,21 +1295,23 @@ $.widget("ui.draggable", $.ui.mouse, { _getParentOffset: function() { //Get the offsetParent and cache its position - this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + //This needs to be actually done for all browsers, since pageX/pageY includes this information + //Ugly IE fix + if((this.offsetParent[0] === document.body) || + (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { po = { top: 0, left: 0 }; + } return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), @@ -1343,7 +1322,7 @@ $.widget("ui.draggable", $.ui.mouse, { _getRelativeOffset: function() { - if(this.cssPosition == "relative") { + if(this.cssPosition === "relative") { var p = this.element.position(); return { top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), @@ -1373,53 +1352,87 @@ $.widget("ui.draggable", $.ui.mouse, { _setContainment: function() { - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, - o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, - (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; + var over, c, ce, + o = this.options; + + if ( !o.containment ) { + this.containment = null; + return; + } - if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { - var c = $(o.containment); - var ce = c[0]; if(!ce) return; - var co = c.offset(); - var over = ($(ce).css("overflow") != 'hidden'); + if ( o.containment === "window" ) { + this.containment = [ + $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, + $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, + $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left, + $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top + ]; + return; + } + if ( o.containment === "document") { this.containment = [ - (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), - (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), - (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, - (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom + 0, + 0, + $( document ).width() - this.helperProportions.width - this.margins.left, + ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top ]; - this.relative_container = c; + return; + } - } else if(o.containment.constructor == Array) { + if ( o.containment.constructor === Array ) { this.containment = o.containment; + return; } + if ( o.containment === "parent" ) { + o.containment = this.helper[ 0 ].parentNode; + } + + c = $( o.containment ); + ce = c[ 0 ]; + + if( !ce ) { + return; + } + + over = c.css( "overflow" ) !== "hidden"; + + this.containment = [ + ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), + ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ) , + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right, + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom + ]; + this.relative_container = c; }, _convertPositionTo: function(d, pos) { - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + if(!pos) { + pos = this.position; + } + + var mod = d === "absolute" ? 1 : -1, + scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent; + + //Cache the scroll + if (!this.offset.scroll) { + this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; + } return { top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + pos.top + // The absolute mouse position + this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) * mod ) ), left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + pos.left + // The absolute mouse position + this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) * mod ) ) }; @@ -1427,60 +1440,77 @@ $.widget("ui.draggable", $.ui.mouse, { _generatePosition: function(event) { - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - var pageX = event.pageX; - var pageY = event.pageY; + var containment, co, top, left, + o = this.options, + scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent, + pageX = event.pageX, + pageY = event.pageY; + + //Cache the scroll + if (!this.offset.scroll) { + this.offset.scroll = {top : scroll.scrollTop(), left : scroll.scrollLeft()}; + } /* * - Position constraining - * Constrain the position to a mix of grid, containment. */ - if(this.originalPosition) { //If we are not dragging yet, we won't check for options - var containment; - if(this.containment) { - if (this.relative_container){ - var co = this.relative_container.offset(); - containment = [ this.containment[0] + co.left, - this.containment[1] + co.top, - this.containment[2] + co.left, - this.containment[3] + co.top ]; - } - else { - containment = this.containment; - } + // If we are not dragging yet, we won't check for options + if ( this.originalPosition ) { + if ( this.containment ) { + if ( this.relative_container ){ + co = this.relative_container.offset(); + containment = [ + this.containment[ 0 ] + co.left, + this.containment[ 1 ] + co.top, + this.containment[ 2 ] + co.left, + this.containment[ 3 ] + co.top + ]; + } + else { + containment = this.containment; + } - if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; + if(event.pageX - this.offset.click.left < containment[0]) { + pageX = containment[0] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top < containment[1]) { + pageY = containment[1] + this.offset.click.top; + } + if(event.pageX - this.offset.click.left > containment[2]) { + pageX = containment[2] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top > containment[3]) { + pageY = containment[3] + this.offset.click.top; + } } if(o.grid) { //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) - var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; - pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; + pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; - pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; + pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } } return { top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + pageY - // The absolute mouse position + this.offset.click.top - // Click offset (relative to the element) + this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top + // The offsetParent's offset without borders (offset + border) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : this.offset.scroll.top ) ), left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + pageX - // The absolute mouse position + this.offset.click.left - // Click offset (relative to the element) + this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left + // The offsetParent's offset without borders (offset + border) + ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : this.offset.scroll.left ) ) }; @@ -1488,8 +1518,9 @@ $.widget("ui.draggable", $.ui.mouse, { _clear: function() { this.helper.removeClass("ui-draggable-dragging"); - if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); - //if($.ui.ddmanager) $.ui.ddmanager.current = null; + if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { + this.helper.remove(); + } this.helper = null; this.cancelHelperRemoval = false; }, @@ -1499,13 +1530,16 @@ $.widget("ui.draggable", $.ui.mouse, { _trigger: function(type, event, ui) { ui = ui || this._uiHash(); $.ui.plugin.call(this, type, [event, ui]); - if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins + //The absolute position has to be recalculated after plugins + if(type === "drag") { + this.positionAbs = this._convertPositionTo("absolute"); + } return $.Widget.prototype._trigger.call(this, type, event, ui); }, plugins: {}, - _uiHash: function(event) { + _uiHash: function() { return { helper: this.helper, position: this.position, @@ -1519,11 +1553,11 @@ $.widget("ui.draggable", $.ui.mouse, { $.ui.plugin.add("draggable", "connectToSortable", { start: function(event, ui) { - var inst = $(this).data("draggable"), o = inst.options, + var inst = $(this).data("ui-draggable"), o = inst.options, uiSortable = $.extend({}, ui, { item: inst.element }); inst.sortables = []; $(o.connectToSortable).each(function() { - var sortable = $.data(this, 'sortable'); + var sortable = $.data(this, "ui-sortable"); if (sortable && !sortable.options.disabled) { inst.sortables.push({ instance: sortable, @@ -1538,7 +1572,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { stop: function(event, ui) { //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper - var inst = $(this).data("draggable"), + var inst = $(this).data("ui-draggable"), uiSortable = $.extend({}, ui, { item: inst.element }); $.each(inst.sortables, function() { @@ -1549,8 +1583,10 @@ $.ui.plugin.add("draggable", "connectToSortable", { inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) - //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' - if(this.shouldRevert) this.instance.options.revert = true; + //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid" + if(this.shouldRevert) { + this.instance.options.revert = this.shouldRevert; + } //Trigger the stop of the sortable this.instance._mouseStop(event); @@ -1558,8 +1594,9 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.options.helper = this.instance.options._helper; //If the helper has been the original item, restore properties in the sortable - if(inst.options.helper == 'original') - this.instance.currentItem.css({ top: 'auto', left: 'auto' }); + if(inst.options.helper === "original") { + this.instance.currentItem.css({ top: "auto", left: "auto" }); + } } else { this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance @@ -1571,21 +1608,13 @@ $.ui.plugin.add("draggable", "connectToSortable", { }, drag: function(event, ui) { - var inst = $(this).data("draggable"), that = this; - - var checkPos = function(o) { - var dyClick = this.offset.click.top, dxClick = this.offset.click.left; - var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; - var itemHeight = o.height, itemWidth = o.width; - var itemTop = o.top, itemLeft = o.left; + var inst = $(this).data("ui-draggable"), that = this; - return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); - }; + $.each(inst.sortables, function() { - $.each(inst.sortables, function(i) { + var innermostIntersecting = false, + thisSortable = this; - var innermostIntersecting = false; - var thisSortable = this; //Copy over some variables to allow calling the sortable's native _intersectsWith this.instance.positionAbs = inst.positionAbs; this.instance.helperProportions = inst.helperProportions; @@ -1597,11 +1626,13 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.positionAbs = inst.positionAbs; this.instance.helperProportions = inst.helperProportions; this.instance.offset.click = inst.offset.click; - if (this != thisSortable - && this.instance._intersectsWith(this.instance.containerCache) - && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])) + if (this !== thisSortable && + this.instance._intersectsWith(this.instance.containerCache) && + $.contains(thisSortable.instance.element[0], this.instance.element[0]) + ) { innermostIntersecting = false; - return innermostIntersecting; + } + return innermostIntersecting; }); } @@ -1614,7 +1645,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { //Now we fake the start of dragging for the sortable instance, //by cloning the list group item, appending it to the sortable and using it as inst.currentItem //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) - this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); + this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true); this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it this.instance.options.helper = function() { return ui.helper[0]; }; @@ -1637,7 +1668,9 @@ $.ui.plugin.add("draggable", "connectToSortable", { } //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable - if(this.instance.currentItem) this.instance._mouseDrag(event); + if(this.instance.currentItem) { + this.instance._mouseDrag(event); + } } else { @@ -1652,20 +1685,22 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.options.revert = false; // The out event needs to be triggered independently - this.instance._trigger('out', event, this.instance._uiHash(this.instance)); + this.instance._trigger("out", event, this.instance._uiHash(this.instance)); this.instance._mouseStop(event, true); this.instance.options.helper = this.instance.options._helper; //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size this.instance.currentItem.remove(); - if(this.instance.placeholder) this.instance.placeholder.remove(); + if(this.instance.placeholder) { + this.instance.placeholder.remove(); + } inst._trigger("fromSortable", event); inst.dropped = false; //draggable revert needs that } - }; + } }); @@ -1673,176 +1708,219 @@ $.ui.plugin.add("draggable", "connectToSortable", { }); $.ui.plugin.add("draggable", "cursor", { - start: function(event, ui) { - var t = $('body'), o = $(this).data('draggable').options; - if (t.css("cursor")) o._cursor = t.css("cursor"); + start: function() { + var t = $("body"), o = $(this).data("ui-draggable").options; + if (t.css("cursor")) { + o._cursor = t.css("cursor"); + } t.css("cursor", o.cursor); }, - stop: function(event, ui) { - var o = $(this).data('draggable').options; - if (o._cursor) $('body').css("cursor", o._cursor); + stop: function() { + var o = $(this).data("ui-draggable").options; + if (o._cursor) { + $("body").css("cursor", o._cursor); + } } }); $.ui.plugin.add("draggable", "opacity", { start: function(event, ui) { - var t = $(ui.helper), o = $(this).data('draggable').options; - if(t.css("opacity")) o._opacity = t.css("opacity"); - t.css('opacity', o.opacity); + var t = $(ui.helper), o = $(this).data("ui-draggable").options; + if(t.css("opacity")) { + o._opacity = t.css("opacity"); + } + t.css("opacity", o.opacity); }, stop: function(event, ui) { - var o = $(this).data('draggable').options; - if(o._opacity) $(ui.helper).css('opacity', o._opacity); + var o = $(this).data("ui-draggable").options; + if(o._opacity) { + $(ui.helper).css("opacity", o._opacity); + } } }); $.ui.plugin.add("draggable", "scroll", { - start: function(event, ui) { - var i = $(this).data("draggable"); - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); + start: function() { + var i = $(this).data("ui-draggable"); + if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { + i.overflowOffset = i.scrollParent.offset(); + } }, - drag: function(event, ui) { + drag: function( event ) { - var i = $(this).data("draggable"), o = i.options, scrolled = false; + var i = $(this).data("ui-draggable"), o = i.options, scrolled = false; - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { + if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") { - if(!o.axis || o.axis != 'x') { - if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + if(!o.axis || o.axis !== "x") { + if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) + } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) { i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; + } } - if(!o.axis || o.axis != 'y') { - if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + if(!o.axis || o.axis !== "y") { + if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) + } else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) { i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; + } } } else { - if(!o.axis || o.axis != 'x') { - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + if(!o.axis || o.axis !== "x") { + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } } - if(!o.axis || o.axis != 'y') { - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + if(!o.axis || o.axis !== "y") { + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } } } - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(i, event); + } } }); $.ui.plugin.add("draggable", "snap", { - start: function(event, ui) { + start: function() { + + var i = $(this).data("ui-draggable"), + o = i.options; - var i = $(this).data("draggable"), o = i.options; i.snapElements = []; - $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { - var $t = $(this); var $o = $t.offset(); - if(this != i.element[0]) i.snapElements.push({ - item: this, - width: $t.outerWidth(), height: $t.outerHeight(), - top: $o.top, left: $o.left - }); + $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { + var $t = $(this), + $o = $t.offset(); + if(this !== i.element[0]) { + i.snapElements.push({ + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + }); + } }); }, drag: function(event, ui) { - var inst = $(this).data("draggable"), o = inst.options; - var d = o.snapTolerance; - - var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + var ts, bs, ls, rs, l, r, t, b, i, first, + inst = $(this).data("ui-draggable"), + o = inst.options, + d = o.snapTolerance, + x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; - for (var i = inst.snapElements.length - 1; i >= 0; i--){ + for (i = inst.snapElements.length - 1; i >= 0; i--){ - var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, - t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; + l = inst.snapElements[i].left; + r = l + inst.snapElements[i].width; + t = inst.snapElements[i].top; + b = t + inst.snapElements[i].height; - //Yes, I know, this is insane ;) - if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { - if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { + if(inst.snapElements[i].snapping) { + (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + } inst.snapElements[i].snapping = false; continue; } - if(o.snapMode != 'inner') { - var ts = Math.abs(t - y2) <= d; - var bs = Math.abs(b - y1) <= d; - var ls = Math.abs(l - x2) <= d; - var rs = Math.abs(r - x1) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + if(o.snapMode !== "inner") { + ts = Math.abs(t - y2) <= d; + bs = Math.abs(b - y1) <= d; + ls = Math.abs(l - x2) <= d; + rs = Math.abs(r - x1) <= d; + if(ts) { + ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + } + if(bs) { + ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; + } + if(ls) { + ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; + } + if(rs) { + ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; + } } - var first = (ts || bs || ls || rs); + first = (ts || bs || ls || rs); - if(o.snapMode != 'outer') { - var ts = Math.abs(t - y1) <= d; - var bs = Math.abs(b - y2) <= d; - var ls = Math.abs(l - x1) <= d; - var rs = Math.abs(r - x2) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + if(o.snapMode !== "outer") { + ts = Math.abs(t - y1) <= d; + bs = Math.abs(b - y2) <= d; + ls = Math.abs(l - x1) <= d; + rs = Math.abs(r - x2) <= d; + if(ts) { + ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; + } + if(bs) { + ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; + } + if(ls) { + ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; + } + if(rs) { + ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; + } } - if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) + if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); + } inst.snapElements[i].snapping = (ts || bs || ls || rs || first); - }; + } } }); $.ui.plugin.add("draggable", "stack", { - start: function(event, ui) { - - var o = $(this).data("draggable").options; + start: function() { + var min, + o = this.data("ui-draggable").options, + group = $.makeArray($(o.stack)).sort(function(a,b) { + return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); + }); - var group = $.makeArray($(o.stack)).sort(function(a,b) { - return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); - }); if (!group.length) { return; } - var min = parseInt(group[0].style.zIndex) || 0; + min = parseInt($(group[0]).css("zIndex"), 10) || 0; $(group).each(function(i) { - this.style.zIndex = min + i; + $(this).css("zIndex", min + i); }); - - this[0].style.zIndex = min + group.length; - + this.css("zIndex", (min + group.length)); } }); $.ui.plugin.add("draggable", "zIndex", { start: function(event, ui) { - var t = $(ui.helper), o = $(this).data("draggable").options; - if(t.css("zIndex")) o._zIndex = t.css("zIndex"); - t.css('zIndex', o.zIndex); + var t = $(ui.helper), o = $(this).data("ui-draggable").options; + if(t.css("zIndex")) { + o._zIndex = t.css("zIndex"); + } + t.css("zIndex", o.zIndex); }, stop: function(event, ui) { - var o = $(this).data("draggable").options; - if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); + var o = $(this).data("ui-draggable").options; + if(o._zIndex) { + $(ui.helper).css("zIndex", o._zIndex); + } } }); @@ -1850,29 +1928,56 @@ $.ui.plugin.add("draggable", "zIndex", { (function( $, undefined ) { +function isOverAxis( x, reference, size ) { + return ( x > reference ) && ( x < ( reference + size ) ); +} + $.widget("ui.droppable", { - version: "1.9.2", + version: "1.10.4", widgetEventPrefix: "drop", options: { - accept: '*', + accept: "*", activeClass: false, addClasses: true, greedy: false, hoverClass: false, - scope: 'default', - tolerance: 'intersect' + scope: "default", + tolerance: "intersect", + + // callbacks + activate: null, + deactivate: null, + drop: null, + out: null, + over: null }, _create: function() { - var o = this.options, accept = o.accept; - this.isover = 0; this.isout = 1; + var proportions, + o = this.options, + accept = o.accept; + + this.isover = false; + this.isout = true; this.accept = $.isFunction(accept) ? accept : function(d) { return d.is(accept); }; - //Store the droppable's proportions - this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; + this.proportions = function( /* valueToWrite */ ) { + if ( arguments.length ) { + // Store the droppable's proportions + proportions = arguments[ 0 ]; + } else { + // Retrieve or derive the droppable's proportions + return proportions ? + proportions : + proportions = { + width: this.element[ 0 ].offsetWidth, + height: this.element[ 0 ].offsetHeight + }; + } + }; // Add the reference and positions to the manager $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; @@ -1883,17 +1988,21 @@ $.widget("ui.droppable", { }, _destroy: function() { - var drop = $.ui.ddmanager.droppables[this.options.scope]; - for ( var i = 0; i < drop.length; i++ ) - if ( drop[i] == this ) + var i = 0, + drop = $.ui.ddmanager.droppables[this.options.scope]; + + for ( ; i < drop.length; i++ ) { + if ( drop[i] === this ) { drop.splice(i, 1); + } + } this.element.removeClass("ui-droppable ui-droppable-disabled"); }, _setOption: function(key, value) { - if(key == 'accept') { + if(key === "accept") { this.accept = $.isFunction(value) ? value : function(d) { return d.is(value); }; @@ -1903,24 +2012,38 @@ $.widget("ui.droppable", { _activate: function(event) { var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.addClass(this.options.activeClass); - (draggable && this._trigger('activate', event, this.ui(draggable))); + if(this.options.activeClass) { + this.element.addClass(this.options.activeClass); + } + if(draggable){ + this._trigger("activate", event, this.ui(draggable)); + } }, _deactivate: function(event) { var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - (draggable && this._trigger('deactivate', event, this.ui(draggable))); + if(this.options.activeClass) { + this.element.removeClass(this.options.activeClass); + } + if(draggable){ + this._trigger("deactivate", event, this.ui(draggable)); + } }, _over: function(event) { var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + // Bail if draggable and droppable are same element + if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { + return; + } if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); - this._trigger('over', event, this.ui(draggable)); + if(this.options.hoverClass) { + this.element.addClass(this.options.hoverClass); + } + this._trigger("over", event, this.ui(draggable)); } }, @@ -1928,37 +2051,53 @@ $.widget("ui.droppable", { _out: function(event) { var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element + + // Bail if draggable and droppable are same element + if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { + return; + } if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('out', event, this.ui(draggable)); + if(this.options.hoverClass) { + this.element.removeClass(this.options.hoverClass); + } + this._trigger("out", event, this.ui(draggable)); } }, _drop: function(event,custom) { - var draggable = custom || $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element + var draggable = custom || $.ui.ddmanager.current, + childrenIntersection = false; + + // Bail if draggable and droppable are same element + if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) { + return false; + } - var childrenIntersection = false; - this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { - var inst = $.data(this, 'droppable'); + this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { + var inst = $.data(this, "ui-droppable"); if( - inst.options.greedy - && !inst.options.disabled - && inst.options.scope == draggable.options.scope - && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) - && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) + inst.options.greedy && + !inst.options.disabled && + inst.options.scope === draggable.options.scope && + inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) && + $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) ) { childrenIntersection = true; return false; } }); - if(childrenIntersection) return false; + if(childrenIntersection) { + return false; + } if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('drop', event, this.ui(draggable)); + if(this.options.activeClass) { + this.element.removeClass(this.options.activeClass); + } + if(this.options.hoverClass) { + this.element.removeClass(this.options.hoverClass); + } + this._trigger("drop", event, this.ui(draggable)); return this.element; } @@ -1979,44 +2118,44 @@ $.widget("ui.droppable", { $.ui.intersect = function(draggable, droppable, toleranceMode) { - if (!droppable.offset) return false; + if (!droppable.offset) { + return false; + } - var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, - y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; - var l = droppable.offset.left, r = l + droppable.proportions.width, - t = droppable.offset.top, b = t + droppable.proportions.height; + var draggableLeft, draggableTop, + x1 = (draggable.positionAbs || draggable.position.absolute).left, + y1 = (draggable.positionAbs || draggable.position.absolute).top, + x2 = x1 + draggable.helperProportions.width, + y2 = y1 + draggable.helperProportions.height, + l = droppable.offset.left, + t = droppable.offset.top, + r = l + droppable.proportions().width, + b = t + droppable.proportions().height; switch (toleranceMode) { - case 'fit': - return (l <= x1 && x2 <= r - && t <= y1 && y2 <= b); - break; - case 'intersect': - return (l < x1 + (draggable.helperProportions.width / 2) // Right Half - && x2 - (draggable.helperProportions.width / 2) < r // Left Half - && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half - && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - break; - case 'pointer': - var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), - draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), - isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); - return isOver; - break; - case 'touch': + case "fit": + return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); + case "intersect": + return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half + x2 - (draggable.helperProportions.width / 2) < r && // Left Half + t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half + y2 - (draggable.helperProportions.height / 2) < b ); // Top Half + case "pointer": + draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left); + draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top); + return isOverAxis( draggableTop, t, droppable.proportions().height ) && isOverAxis( draggableLeft, l, droppable.proportions().width ); + case "touch": return ( - (y1 >= t && y1 <= b) || // Top edge touching - (y2 >= t && y2 <= b) || // Bottom edge touching - (y1 < t && y2 > b) // Surrounded vertically - ) && ( - (x1 >= l && x1 <= r) || // Left edge touching - (x2 >= l && x2 <= r) || // Right edge touching - (x1 < l && x2 > r) // Surrounded horizontally - ); - break; + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); default: return false; - break; } }; @@ -2026,23 +2165,41 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { */ $.ui.ddmanager = { current: null, - droppables: { 'default': [] }, + droppables: { "default": [] }, prepareOffsets: function(t, event) { - var m = $.ui.ddmanager.droppables[t.options.scope] || []; - var type = event ? event.type : null; // workaround for #2317 - var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); + var i, j, + m = $.ui.ddmanager.droppables[t.options.scope] || [], + type = event ? event.type : null, // workaround for #2317 + list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); + + droppablesLoop: for (i = 0; i < m.length; i++) { + + //No disabled and non-accepted + if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) { + continue; + } - droppablesLoop: for (var i = 0; i < m.length; i++) { + // Filter out elements in the current dragged item + for (j=0; j < list.length; j++) { + if(list[j] === m[i].element[0]) { + m[i].proportions().height = 0; + continue droppablesLoop; + } + } - if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted - for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item - m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + m[i].visible = m[i].element.css("display") !== "none"; + if(!m[i].visible) { + continue; + } - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables + //Activate the droppable if used directly from draggables + if(type === "mousedown") { + m[i]._activate.call(m[i], event); + } - m[i].offset = m[i].element.offset(); - m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; + m[ i ].offset = m[ i ].element.offset(); + m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight }); } @@ -2050,14 +2207,19 @@ $.ui.ddmanager = { drop: function(draggable, event) { var dropped = false; - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { + // Create a copy of the droppables in case the list changes during the drop (#9116) + $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function() { - if(!this.options) return; - if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) + if(!this.options) { + return; + } + if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) { dropped = this._drop.call(this, event) || dropped; + } if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - this.isout = 1; this.isover = 0; + this.isout = true; + this.isover = false; this._deactivate.call(this, event); } @@ -2068,51 +2230,60 @@ $.ui.ddmanager = { dragStart: function( draggable, event ) { //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { - if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + if( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } }); }, drag: function(draggable, event) { //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. - if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); + if(draggable.options.refreshPositions) { + $.ui.ddmanager.prepareOffsets(draggable, event); + } //Run through all droppables and check their positions based on specific tolerance options $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - if(this.options.disabled || this.greedyChild || !this.visible) return; - var intersects = $.ui.intersect(draggable, this, this.options.tolerance); + if(this.options.disabled || this.greedyChild || !this.visible) { + return; + } - var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); - if(!c) return; + var parentInstance, scope, parent, + intersects = $.ui.intersect(draggable, this, this.options.tolerance), + c = !intersects && this.isover ? "isout" : (intersects && !this.isover ? "isover" : null); + if(!c) { + return; + } - var parentInstance; if (this.options.greedy) { // find droppable parents with same scope - var scope = this.options.scope; - var parent = this.element.parents(':data(droppable)').filter(function () { - return $.data(this, 'droppable').options.scope === scope; + scope = this.options.scope; + parent = this.element.parents(":data(ui-droppable)").filter(function () { + return $.data(this, "ui-droppable").options.scope === scope; }); if (parent.length) { - parentInstance = $.data(parent[0], 'droppable'); - parentInstance.greedyChild = (c == 'isover' ? 1 : 0); + parentInstance = $.data(parent[0], "ui-droppable"); + parentInstance.greedyChild = (c === "isover"); } } // we just moved into a greedy child - if (parentInstance && c == 'isover') { - parentInstance['isover'] = 0; - parentInstance['isout'] = 1; + if (parentInstance && c === "isover") { + parentInstance.isover = false; + parentInstance.isout = true; parentInstance._out.call(parentInstance, event); } - this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; - this[c == "isover" ? "_over" : "_out"].call(this, event); + this[c] = true; + this[c === "isout" ? "isover" : "isout"] = false; + this[c === "isover" ? "_over" : "_out"].call(this, event); // we just moved out of a greedy child - if (parentInstance && c == 'isout') { - parentInstance['isout'] = 0; - parentInstance['isover'] = 1; + if (parentInstance && c === "isout") { + parentInstance.isout = false; + parentInstance.isover = true; parentInstance._over.call(parentInstance, event); } }); @@ -2121,7 +2292,9 @@ $.ui.ddmanager = { dragStop: function( draggable, event ) { draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) - if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); + if( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } } }; @@ -2129,8 +2302,16 @@ $.ui.ddmanager = { (function( $, undefined ) { +function num(v) { + return parseInt(v, 10) || 0; +} + +function isNumber(value) { + return !isNaN(parseInt(value, 10)); +} + $.widget("ui.resizable", $.ui.mouse, { - version: "1.9.2", + version: "1.10.4", widgetEventPrefix: "resize", options: { alsoResize: false, @@ -2144,16 +2325,23 @@ $.widget("ui.resizable", $.ui.mouse, { grid: false, handles: "e,s,se", helper: false, - iframeFix: false, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, - zIndex: 1000 + // See #7960 + zIndex: 90, + + // callbacks + resize: null, + start: null, + stop: null }, _create: function() { - var that = this, o = this.options; + var n, i, handle, axis, hname, + that = this, + o = this.options; this.element.addClass("ui-resizable"); $.extend(this, { @@ -2161,7 +2349,7 @@ $.widget("ui.resizable", $.ui.mouse, { aspectRatio: o.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], - _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null + _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null }); //Wrap the element if it cannot hold child nodes @@ -2169,18 +2357,18 @@ $.widget("ui.resizable", $.ui.mouse, { //Create a wrapper element and set the wrapper to the new current internal element this.element.wrap( - $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({ - position: this.element.css('position'), + $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ + position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), - top: this.element.css('top'), - left: this.element.css('left') + top: this.element.css("top"), + left: this.element.css("left") }) ); //Overwrite the original this.element this.element = this.element.parent().data( - "resizable", this.element.data('resizable') + "ui-resizable", this.element.data("ui-resizable") ); this.elementIsWrapper = true; @@ -2190,41 +2378,46 @@ $.widget("ui.resizable", $.ui.mouse, { this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); //Prevent Safari textarea resize - this.originalResizeStyle = this.originalElement.css('resize'); - this.originalElement.css('resize', 'none'); + this.originalResizeStyle = this.originalElement.css("resize"); + this.originalElement.css("resize", "none"); //Push the actual element to our proportionallyResize internal array - this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); + this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" })); // avoid IE jump (hard set the margin) - this.originalElement.css({ margin: this.originalElement.css('margin') }); + this.originalElement.css({ margin: this.originalElement.css("margin") }); // fix handlers offset this._proportionallyResize(); } - this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); - if(this.handles.constructor == String) { + this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" }); + if(this.handles.constructor === String) { + + if ( this.handles === "all") { + this.handles = "n,e,s,w,se,sw,ne,nw"; + } - if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; - var n = this.handles.split(","); this.handles = {}; + n = this.handles.split(","); + this.handles = {}; - for(var i = 0; i < n.length; i++) { + for(i = 0; i < n.length; i++) { - var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; - var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>'); + handle = $.trim(n[i]); + hname = "ui-resizable-"+handle; + axis = $("<div class='ui-resizable-handle " + hname + "'></div>"); // Apply zIndex to all handles - see #7960 axis.css({ zIndex: o.zIndex }); //TODO : What's going on here? - if ('se' == handle) { - axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); - }; + if ("se" === handle) { + axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se"); + } //Insert into internal handles object and append to element - this.handles[handle] = '.ui-resizable-'+handle; + this.handles[handle] = ".ui-resizable-"+handle; this.element.append(axis); } @@ -2232,26 +2425,29 @@ $.widget("ui.resizable", $.ui.mouse, { this._renderAxis = function(target) { + var i, axis, padPos, padWrapper; + target = target || this.element; - for(var i in this.handles) { + for(i in this.handles) { - if(this.handles[i].constructor == String) + if(this.handles[i].constructor === String) { this.handles[i] = $(this.handles[i], this.element).show(); + } //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { - var axis = $(this.handles[i], this.element), padWrapper = 0; + axis = $(this.handles[i], this.element); //Checking the correct pad and border padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); //The padding type i have to apply... - var padPos = [ 'padding', - /ne|nw|n/.test(i) ? 'Top' : - /se|sw|s/.test(i) ? 'Bottom' : - /^e$/.test(i) ? 'Right' : 'Left' ].join(""); + padPos = [ "padding", + /ne|nw|n/.test(i) ? "Top" : + /se|sw|s/.test(i) ? "Bottom" : + /^e$/.test(i) ? "Right" : "Left" ].join(""); target.css(padPos, padWrapper); @@ -2260,25 +2456,26 @@ $.widget("ui.resizable", $.ui.mouse, { } //TODO: What's that good for? There's not anything to be executed left - if(!$(this.handles[i]).length) + if(!$(this.handles[i]).length) { continue; - + } } }; //TODO: make renderAxis a prototype function this._renderAxis(this.element); - this._handles = $('.ui-resizable-handle', this.element) + this._handles = $(".ui-resizable-handle", this.element) .disableSelection(); //Matching axis name this._handles.mouseover(function() { if (!that.resizing) { - if (this.className) - var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + if (this.className) { + axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); + } //Axis, default = se - that.axis = axis && axis[1] ? axis[1] : 'se'; + that.axis = axis && axis[1] ? axis[1] : "se"; } }); @@ -2288,12 +2485,16 @@ $.widget("ui.resizable", $.ui.mouse, { $(this.element) .addClass("ui-resizable-autohide") .mouseenter(function() { - if (o.disabled) return; + if (o.disabled) { + return; + } $(this).removeClass("ui-resizable-autohide"); that._handles.show(); }) .mouseleave(function(){ - if (o.disabled) return; + if (o.disabled) { + return; + } if (!that.resizing) { $(this).addClass("ui-resizable-autohide"); that._handles.hide(); @@ -2310,57 +2511,66 @@ $.widget("ui.resizable", $.ui.mouse, { this._mouseDestroy(); - var _destroy = function(exp) { - $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") - .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); - }; + var wrapper, + _destroy = function(exp) { + $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") + .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove(); + }; //TODO: Unwrap at same DOM position if (this.elementIsWrapper) { _destroy(this.element); - var wrapper = this.element; + wrapper = this.element; this.originalElement.css({ - position: wrapper.css('position'), + position: wrapper.css("position"), width: wrapper.outerWidth(), height: wrapper.outerHeight(), - top: wrapper.css('top'), - left: wrapper.css('left') + top: wrapper.css("top"), + left: wrapper.css("left") }).insertAfter( wrapper ); wrapper.remove(); } - this.originalElement.css('resize', this.originalResizeStyle); + this.originalElement.css("resize", this.originalResizeStyle); _destroy(this.originalElement); return this; }, _mouseCapture: function(event) { - var handle = false; - for (var i in this.handles) { - if ($(this.handles[i])[0] == event.target) { - handle = true; + var i, handle, + capture = false; + + for (i in this.handles) { + handle = $(this.handles[i])[0]; + if (handle === event.target || $.contains(handle, event.target)) { + capture = true; } } - return !this.options.disabled && handle; + return !this.options.disabled && capture; }, _mouseStart: function(event) { - var o = this.options, iniPos = this.element.position(), el = this.element; + var curleft, curtop, cursor, + o = this.options, + iniPos = this.element.position(), + el = this.element; this.resizing = true; - this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; // bugfix for http://dev.jquery.com/ticket/1749 - if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { - el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); + if ( (/absolute/).test( el.css("position") ) ) { + el.css({ position: "absolute", top: el.css("top"), left: el.css("left") }); + } else if (el.is(".ui-draggable")) { + el.css({ position: "absolute", top: iniPos.top, left: iniPos.left }); } this._renderProxy(); - var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); + curleft = num(this.helper.css("left")); + curtop = num(this.helper.css("top")); if (o.containment) { curleft += $(o.containment).scrollLeft() || 0; @@ -2370,17 +2580,17 @@ $.widget("ui.resizable", $.ui.mouse, { //Store needed variables this.offset = this.helper.offset(); this.position = { left: curleft, top: curtop }; - this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; + this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() }; this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; this.originalPosition = { left: curleft, top: curtop }; this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; this.originalMousePosition = { left: event.pageX, top: event.pageY }; //Aspect Ratio - this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); + this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); - var cursor = $('.ui-resizable-' + this.axis).css('cursor'); - $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + cursor = $(".ui-resizable-" + this.axis).css("cursor"); + $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); el.addClass("ui-resizable-resizing"); this._propagate("start", event); @@ -2390,38 +2600,60 @@ $.widget("ui.resizable", $.ui.mouse, { _mouseDrag: function(event) { //Increase performance, avoid regex - var el = this.helper, o = this.options, props = {}, - that = this, smp = this.originalMousePosition, a = this.axis; - - var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; - var trigger = this._change[a]; - if (!trigger) return false; + var data, + el = this.helper, props = {}, + smp = this.originalMousePosition, + a = this.axis, + prevTop = this.position.top, + prevLeft = this.position.left, + prevWidth = this.size.width, + prevHeight = this.size.height, + dx = (event.pageX-smp.left)||0, + dy = (event.pageY-smp.top)||0, + trigger = this._change[a]; + + if (!trigger) { + return false; + } // Calculate the attrs that will be change - var data = trigger.apply(this, [event, dx, dy]); + data = trigger.apply(this, [event, dx, dy]); // Put this in the mouseDrag handler since the user can start pressing shift while resizing this._updateVirtualBoundaries(event.shiftKey); - if (this._aspectRatio || event.shiftKey) + if (this._aspectRatio || event.shiftKey) { data = this._updateRatio(data, event); + } data = this._respectSize(data, event); + this._updateCache(data); + // plugins callbacks need to be called first this._propagate("resize", event); - el.css({ - top: this.position.top + "px", left: this.position.left + "px", - width: this.size.width + "px", height: this.size.height + "px" - }); + if (this.position.top !== prevTop) { + props.top = this.position.top + "px"; + } + if (this.position.left !== prevLeft) { + props.left = this.position.left + "px"; + } + if (this.size.width !== prevWidth) { + props.width = this.size.width + "px"; + } + if (this.size.height !== prevHeight) { + props.height = this.size.height + "px"; + } + el.css(props); - if (!this._helper && this._proportionallyResizeElements.length) + if (!this._helper && this._proportionallyResizeElements.length) { this._proportionallyResize(); + } - this._updateCache(data); - - // calling the user callback at the end - this._trigger('resize', event, this.ui()); + // Call the user callback if the element was resized + if ( ! $.isEmptyObject(props) ) { + this._trigger("resize", event, this.ui()); + } return false; }, @@ -2429,39 +2661,49 @@ $.widget("ui.resizable", $.ui.mouse, { _mouseStop: function(event) { this.resizing = false; - var o = this.options, that = this; + var pr, ista, soffseth, soffsetw, s, left, top, + o = this.options, that = this; if(this._helper) { - var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, - soffsetw = ista ? 0 : that.sizeDiff.width; - var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }, - left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, - top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + pr = this._proportionallyResizeElements; + ista = pr.length && (/textarea/i).test(pr[0].nodeName); + soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height; + soffsetw = ista ? 0 : that.sizeDiff.width; + + s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }; + left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null; + top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; - if (!o.animate) + if (!o.animate) { this.element.css($.extend(s, { top: top, left: left })); + } that.helper.height(that.size.height); that.helper.width(that.size.width); - if (this._helper && !o.animate) this._proportionallyResize(); + if (this._helper && !o.animate) { + this._proportionallyResize(); + } } - $('body').css('cursor', 'auto'); + $("body").css("cursor", "auto"); this.element.removeClass("ui-resizable-resizing"); this._propagate("stop", event); - if (this._helper) this.helper.remove(); + if (this._helper) { + this.helper.remove(); + } + return false; }, _updateVirtualBoundaries: function(forceAspectRatio) { - var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, + o = this.options; b = { minWidth: isNumber(o.minWidth) ? o.minWidth : 0, @@ -2478,35 +2720,55 @@ $.widget("ui.resizable", $.ui.mouse, { pMaxWidth = b.maxHeight * this.aspectRatio; pMaxHeight = b.maxWidth / this.aspectRatio; - if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; - if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; - if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; - if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + if(pMinWidth > b.minWidth) { + b.minWidth = pMinWidth; + } + if(pMinHeight > b.minHeight) { + b.minHeight = pMinHeight; + } + if(pMaxWidth < b.maxWidth) { + b.maxWidth = pMaxWidth; + } + if(pMaxHeight < b.maxHeight) { + b.maxHeight = pMaxHeight; + } } this._vBoundaries = b; }, _updateCache: function(data) { - var o = this.options; this.offset = this.helper.offset(); - if (isNumber(data.left)) this.position.left = data.left; - if (isNumber(data.top)) this.position.top = data.top; - if (isNumber(data.height)) this.size.height = data.height; - if (isNumber(data.width)) this.size.width = data.width; + if (isNumber(data.left)) { + this.position.left = data.left; + } + if (isNumber(data.top)) { + this.position.top = data.top; + } + if (isNumber(data.height)) { + this.size.height = data.height; + } + if (isNumber(data.width)) { + this.size.width = data.width; + } }, - _updateRatio: function(data, event) { + _updateRatio: function( data ) { - var o = this.options, cpos = this.position, csize = this.size, a = this.axis; + var cpos = this.position, + csize = this.size, + a = this.axis; - if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); - else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); + if (isNumber(data.height)) { + data.width = (data.height * this.aspectRatio); + } else if (isNumber(data.width)) { + data.height = (data.width / this.aspectRatio); + } - if (a == 'sw') { + if (a === "sw") { data.left = cpos.left + (csize.width - data.width); data.top = null; } - if (a == 'nw') { + if (a === "nw") { data.top = cpos.top + (csize.height - data.height); data.left = cpos.left + (csize.width - data.width); } @@ -2514,51 +2776,72 @@ $.widget("ui.resizable", $.ui.mouse, { return data; }, - _respectSize: function(data, event) { - - var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, - ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), - isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); + _respectSize: function( data ) { - if (isminw) data.width = o.minWidth; - if (isminh) data.height = o.minHeight; - if (ismaxw) data.width = o.maxWidth; - if (ismaxh) data.height = o.maxHeight; - - var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; - var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + var o = this._vBoundaries, + a = this.axis, + ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), + isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height), + dw = this.originalPosition.left + this.originalSize.width, + dh = this.position.top + this.size.height, + cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); + if (isminw) { + data.width = o.minWidth; + } + if (isminh) { + data.height = o.minHeight; + } + if (ismaxw) { + data.width = o.maxWidth; + } + if (ismaxh) { + data.height = o.maxHeight; + } - if (isminw && cw) data.left = dw - o.minWidth; - if (ismaxw && cw) data.left = dw - o.maxWidth; - if (isminh && ch) data.top = dh - o.minHeight; - if (ismaxh && ch) data.top = dh - o.maxHeight; + if (isminw && cw) { + data.left = dw - o.minWidth; + } + if (ismaxw && cw) { + data.left = dw - o.maxWidth; + } + if (isminh && ch) { + data.top = dh - o.minHeight; + } + if (ismaxh && ch) { + data.top = dh - o.maxHeight; + } // fixing jump error on top/left - bug #2330 - var isNotwh = !data.width && !data.height; - if (isNotwh && !data.left && data.top) data.top = null; - else if (isNotwh && !data.top && data.left) data.left = null; + if (!data.width && !data.height && !data.left && data.top) { + data.top = null; + } else if (!data.width && !data.height && !data.top && data.left) { + data.left = null; + } return data; }, _proportionallyResize: function() { - var o = this.options; - if (!this._proportionallyResizeElements.length) return; - var element = this.helper || this.element; + if (!this._proportionallyResizeElements.length) { + return; + } - for (var i=0; i < this._proportionallyResizeElements.length; i++) { + var i, j, borders, paddings, prel, + element = this.helper || this.element; - var prel = this._proportionallyResizeElements[i]; + for ( i=0; i < this._proportionallyResizeElements.length; i++) { + + prel = this._proportionallyResizeElements[i]; if (!this.borderDif) { - var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], - p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; + this.borderDif = []; + borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")]; + paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")]; - this.borderDif = $.map(b, function(v, i) { - var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; - return border + padding; - }); + for ( j = 0; j < borders.length; j++ ) { + this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 ); + } } prel.css({ @@ -2566,7 +2849,7 @@ $.widget("ui.resizable", $.ui.mouse, { width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 }); - }; + } }, @@ -2577,18 +2860,14 @@ $.widget("ui.resizable", $.ui.mouse, { if(this._helper) { - this.helper = this.helper || $('<div style="overflow:hidden;"></div>'); - - // fix ie6 offset TODO: This seems broken - var ie6offset = ($.ui.ie6 ? 1 : 0), - pxyoffset = ( $.ui.ie6 ? 2 : -1 ); + this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); this.helper.addClass(this._helper).css({ - width: this.element.outerWidth() + pxyoffset, - height: this.element.outerHeight() + pxyoffset, - position: 'absolute', - left: this.elementOffset.left - ie6offset +'px', - top: this.elementOffset.top - ie6offset +'px', + width: this.element.outerWidth() - 1, + height: this.element.outerHeight() - 1, + position: "absolute", + left: this.elementOffset.left +"px", + top: this.elementOffset.top +"px", zIndex: ++o.zIndex //TODO: Don't modify option }); @@ -2603,15 +2882,15 @@ $.widget("ui.resizable", $.ui.mouse, { }, _change: { - e: function(event, dx, dy) { + e: function(event, dx) { return { width: this.originalSize.width + dx }; }, - w: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; + w: function(event, dx) { + var cs = this.originalSize, sp = this.originalPosition; return { left: sp.left + dx, width: cs.width - dx }; }, n: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; + var cs = this.originalSize, sp = this.originalPosition; return { top: sp.top + dy, height: cs.height - dy }; }, s: function(event, dx, dy) { @@ -2633,7 +2912,7 @@ $.widget("ui.resizable", $.ui.mouse, { _propagate: function(n, event) { $.ui.plugin.call(this, n, [event, this.ui()]); - (n != "resize" && this._trigger(n, event, this.ui())); + (n !== "resize" && this._trigger(n, event, this.ui())); }, plugins: {}, @@ -2656,76 +2935,18 @@ $.widget("ui.resizable", $.ui.mouse, { * Resizable Extensions */ -$.ui.plugin.add("resizable", "alsoResize", { - - start: function (event, ui) { - var that = $(this).data("resizable"), o = that.options; - - var _store = function (exp) { - $(exp).each(function() { - var el = $(this); - el.data("resizable-alsoresize", { - width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), - left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) - }); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } - else { $.each(o.alsoResize, function (exp) { _store(exp); }); } - }else{ - _store(o.alsoResize); - } - }, - - resize: function (event, ui) { - var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition; - - var delta = { - height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, - top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 - }, - - _alsoResize = function (exp, c) { - $(exp).each(function() { - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, - css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; - - $.each(css, function (i, prop) { - var sum = (start[prop]||0) + (delta[prop]||0); - if (sum && sum >= 0) - style[prop] = sum || null; - }); - - el.css(style); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); - }else{ - _alsoResize(o.alsoResize); - } - }, - - stop: function (event, ui) { - $(this).removeData("resizable-alsoresize"); - } -}); - $.ui.plugin.add("resizable", "animate", { - stop: function(event, ui) { - var that = $(this).data("resizable"), o = that.options; - - var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, - soffsetw = ista ? 0 : that.sizeDiff.width; - - var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, - left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, - top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; + stop: function( event ) { + var that = $(this).data("ui-resizable"), + o = that.options, + pr = that._proportionallyResizeElements, + ista = pr.length && (/textarea/i).test(pr[0].nodeName), + soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width, + style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, + left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null, + top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; that.element.animate( $.extend(style, top && left ? { top: top, left: left } : {}), { @@ -2734,13 +2955,15 @@ $.ui.plugin.add("resizable", "animate", { step: function() { var data = { - width: parseInt(that.element.css('width'), 10), - height: parseInt(that.element.css('height'), 10), - top: parseInt(that.element.css('top'), 10), - left: parseInt(that.element.css('left'), 10) + width: parseInt(that.element.css("width"), 10), + height: parseInt(that.element.css("height"), 10), + top: parseInt(that.element.css("top"), 10), + left: parseInt(that.element.css("left"), 10) }; - if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); + if (pr && pr.length) { + $(pr[0]).css({ width: data.width, height: data.height }); + } // propagating resize, and updating values for each animation step that._updateCache(data); @@ -2755,14 +2978,21 @@ $.ui.plugin.add("resizable", "animate", { $.ui.plugin.add("resizable", "containment", { - start: function(event, ui) { - var that = $(this).data("resizable"), o = that.options, el = that.element; - var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; - if (!ce) return; + start: function() { + var element, p, co, ch, cw, width, height, + that = $(this).data("ui-resizable"), + o = that.options, + el = that.element, + oc = o.containment, + ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; + + if (!ce) { + return; + } that.containerElement = $(ce); - if (/document/.test(oc) || oc == document) { + if (/document/.test(oc) || oc === document) { that.containerOffset = { left: 0, top: 0 }; that.containerPosition = { left: 0, top: 0 }; @@ -2774,15 +3004,19 @@ $.ui.plugin.add("resizable", "containment", { // i'm a node, so compute top, left, right, bottom else { - var element = $(ce), p = []; + element = $(ce); + p = []; $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); that.containerOffset = element.offset(); that.containerPosition = element.position(); that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; - var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width, - width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); + co = that.containerOffset; + ch = that.containerSize.height; + cw = that.containerSize.width; + width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ); + height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); that.parentData = { element: ce, left: co.left, top: co.top, width: width, height: height @@ -2790,177 +3024,280 @@ $.ui.plugin.add("resizable", "containment", { } }, - resize: function(event, ui) { - var that = $(this).data("resizable"), o = that.options, - ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position, - pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement; + resize: function( event ) { + var woset, hoset, isParent, isOffsetRelative, + that = $(this).data("ui-resizable"), + o = that.options, + co = that.containerOffset, cp = that.position, + pRatio = that._aspectRatio || event.shiftKey, + cop = { top:0, left:0 }, ce = that.containerElement; - if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; + if (ce[0] !== document && (/static/).test(ce.css("position"))) { + cop = co; + } if (cp.left < (that._helper ? co.left : 0)) { that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); - if (pRatio) that.size.height = that.size.width / that.aspectRatio; + if (pRatio) { + that.size.height = that.size.width / that.aspectRatio; + } that.position.left = o.helper ? co.left : 0; } if (cp.top < (that._helper ? co.top : 0)) { that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); - if (pRatio) that.size.width = that.size.height * that.aspectRatio; + if (pRatio) { + that.size.width = that.size.height * that.aspectRatio; + } that.position.top = that._helper ? co.top : 0; } that.offset.left = that.parentData.left+that.position.left; that.offset.top = that.parentData.top+that.position.top; - var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ), - hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); + woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ); + hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); - var isParent = that.containerElement.get(0) == that.element.parent().get(0), - isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position')); + isParent = that.containerElement.get(0) === that.element.parent().get(0); + isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position")); - if(isParent && isOffsetRelative) woset -= that.parentData.left; + if ( isParent && isOffsetRelative ) { + woset -= Math.abs( that.parentData.left ); + } if (woset + that.size.width >= that.parentData.width) { that.size.width = that.parentData.width - woset; - if (pRatio) that.size.height = that.size.width / that.aspectRatio; + if (pRatio) { + that.size.height = that.size.width / that.aspectRatio; + } } if (hoset + that.size.height >= that.parentData.height) { that.size.height = that.parentData.height - hoset; - if (pRatio) that.size.width = that.size.height * that.aspectRatio; + if (pRatio) { + that.size.width = that.size.height * that.aspectRatio; + } } }, - stop: function(event, ui){ - var that = $(this).data("resizable"), o = that.options, cp = that.position, - co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement; + stop: function(){ + var that = $(this).data("ui-resizable"), + o = that.options, + co = that.containerOffset, + cop = that.containerPosition, + ce = that.containerElement, + helper = $(that.helper), + ho = helper.offset(), + w = helper.outerWidth() - that.sizeDiff.width, + h = helper.outerHeight() - that.sizeDiff.height; - var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; - - if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) + if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) { $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + } - if (that._helper && !o.animate && (/static/).test(ce.css('position'))) + if (that._helper && !o.animate && (/static/).test(ce.css("position"))) { $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); + } + + } +}); + +$.ui.plugin.add("resizable", "alsoResize", { + + start: function () { + var that = $(this).data("ui-resizable"), + o = that.options, + _store = function (exp) { + $(exp).each(function() { + var el = $(this); + el.data("ui-resizable-alsoresize", { + width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), + left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10) + }); + }); + }; + + if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { + if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } + else { $.each(o.alsoResize, function (exp) { _store(exp); }); } + }else{ + _store(o.alsoResize); + } + }, + + resize: function (event, ui) { + var that = $(this).data("ui-resizable"), + o = that.options, + os = that.originalSize, + op = that.originalPosition, + delta = { + height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, + top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 + }, + + _alsoResize = function (exp, c) { + $(exp).each(function() { + var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, + css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"]; + + $.each(css, function (i, prop) { + var sum = (start[prop]||0) + (delta[prop]||0); + if (sum && sum >= 0) { + style[prop] = sum || null; + } + }); + + el.css(style); + }); + }; + + if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { + $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); + }else{ + _alsoResize(o.alsoResize); + } + }, + stop: function () { + $(this).removeData("resizable-alsoresize"); } }); $.ui.plugin.add("resizable", "ghost", { - start: function(event, ui) { + start: function() { - var that = $(this).data("resizable"), o = that.options, cs = that.size; + var that = $(this).data("ui-resizable"), o = that.options, cs = that.size; that.ghost = that.originalElement.clone(); that.ghost - .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) - .addClass('ui-resizable-ghost') - .addClass(typeof o.ghost == 'string' ? o.ghost : ''); + .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) + .addClass("ui-resizable-ghost") + .addClass(typeof o.ghost === "string" ? o.ghost : ""); that.ghost.appendTo(that.helper); }, - resize: function(event, ui){ - var that = $(this).data("resizable"), o = that.options; - if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width }); + resize: function(){ + var that = $(this).data("ui-resizable"); + if (that.ghost) { + that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width }); + } }, - stop: function(event, ui){ - var that = $(this).data("resizable"), o = that.options; - if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0)); + stop: function() { + var that = $(this).data("ui-resizable"); + if (that.ghost && that.helper) { + that.helper.get(0).removeChild(that.ghost.get(0)); + } } }); $.ui.plugin.add("resizable", "grid", { - resize: function(event, ui) { - var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey; - o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; - var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); + resize: function() { + var that = $(this).data("ui-resizable"), + o = that.options, + cs = that.size, + os = that.originalSize, + op = that.originalPosition, + a = that.axis, + grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid, + gridX = (grid[0]||1), + gridY = (grid[1]||1), + ox = Math.round((cs.width - os.width) / gridX) * gridX, + oy = Math.round((cs.height - os.height) / gridY) * gridY, + newWidth = os.width + ox, + newHeight = os.height + oy, + isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), + isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), + isMinWidth = o.minWidth && (o.minWidth > newWidth), + isMinHeight = o.minHeight && (o.minHeight > newHeight); + + o.grid = grid; + + if (isMinWidth) { + newWidth = newWidth + gridX; + } + if (isMinHeight) { + newHeight = newHeight + gridY; + } + if (isMaxWidth) { + newWidth = newWidth - gridX; + } + if (isMaxHeight) { + newHeight = newHeight - gridY; + } if (/^(se|s|e)$/.test(a)) { - that.size.width = os.width + ox; - that.size.height = os.height + oy; - } - else if (/^(ne)$/.test(a)) { - that.size.width = os.width + ox; - that.size.height = os.height + oy; - that.position.top = op.top - oy; - } - else if (/^(sw)$/.test(a)) { - that.size.width = os.width + ox; - that.size.height = os.height + oy; - that.position.left = op.left - ox; - } - else { - that.size.width = os.width + ox; - that.size.height = os.height + oy; + that.size.width = newWidth; + that.size.height = newHeight; + } else if (/^(ne)$/.test(a)) { + that.size.width = newWidth; + that.size.height = newHeight; that.position.top = op.top - oy; + } else if (/^(sw)$/.test(a)) { + that.size.width = newWidth; + that.size.height = newHeight; that.position.left = op.left - ox; + } else { + if ( newHeight - gridY > 0 ) { + that.size.height = newHeight; + that.position.top = op.top - oy; + } else { + that.size.height = gridY; + that.position.top = op.top + os.height - gridY; + } + if ( newWidth - gridX > 0 ) { + that.size.width = newWidth; + that.position.left = op.left - ox; + } else { + that.size.width = gridX; + that.position.left = op.left + os.width - gridX; + } } } }); -$.ui.plugin.add("resizable", "iframeFix", { - start: function (event, ui) { - var o = $(this).data('resizable').options; - $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function () { - $('<div class="ui-resizable-iframeFix" style="background: #fff;"></div>') - .css({ - width: this.offsetWidth + "px", height: this.offsetHeight + "px", - position: "absolute", opacity: "0.001", zIndex: 1000 - }) - .css($(this).offset()) - .appendTo("body"); - }); - }, - stop: function (event, ui) { - $("div.ui-resizable-iframeFix").each(function () { - this.parentNode.removeChild(this); - }); - } -}); - -var num = function(v) { - return parseInt(v, 10) || 0; -}; - -var isNumber = function(value) { - return !isNaN(parseInt(value, 10)); -}; - })(jQuery); (function( $, undefined ) { $.widget("ui.selectable", $.ui.mouse, { - version: "1.9.2", + version: "1.10.4", options: { - appendTo: 'body', + appendTo: "body", autoRefresh: true, distance: 0, - filter: '*', - tolerance: 'touch' + filter: "*", + tolerance: "touch", + + // callbacks + selected: null, + selecting: null, + start: null, + stop: null, + unselected: null, + unselecting: null }, _create: function() { - var that = this; + var selectees, + that = this; this.element.addClass("ui-selectable"); this.dragged = false; // cache selectee children based on filter - var selectees; this.refresh = function() { selectees = $(that.options.filter, that.element[0]); selectees.addClass("ui-selectee"); selectees.each(function() { - var $this = $(this); - var pos = $this.offset(); + var $this = $(this), + pos = $this.offset(); $.data(this, "selectable-item", { element: this, $element: $this, @@ -2969,9 +3306,9 @@ $.widget("ui.selectable", $.ui.mouse, { right: pos.left + $this.outerWidth(), bottom: pos.top + $this.outerHeight(), startselected: false, - selected: $this.hasClass('ui-selected'), - selecting: $this.hasClass('ui-selecting'), - unselecting: $this.hasClass('ui-unselecting') + selected: $this.hasClass("ui-selected"), + selecting: $this.hasClass("ui-selecting"), + unselecting: $this.hasClass("ui-unselecting") }); }); }; @@ -2994,14 +3331,14 @@ $.widget("ui.selectable", $.ui.mouse, { }, _mouseStart: function(event) { - var that = this; + var that = this, + options = this.options; this.opos = [event.pageX, event.pageY]; - if (this.options.disabled) + if (this.options.disabled) { return; - - var options = this.options; + } this.selectees = $(options.filter, this.element[0]); @@ -3010,8 +3347,8 @@ $.widget("ui.selectable", $.ui.mouse, { $(options.appendTo).append(this.helper); // position helper (lasso) this.helper.css({ - "left": event.clientX, - "top": event.clientY, + "left": event.pageX, + "top": event.pageY, "width": 0, "height": 0 }); @@ -3020,13 +3357,13 @@ $.widget("ui.selectable", $.ui.mouse, { this.refresh(); } - this.selectees.filter('.ui-selected').each(function() { + this.selectees.filter(".ui-selected").each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; if (!event.metaKey && !event.ctrlKey) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { @@ -3035,10 +3372,11 @@ $.widget("ui.selectable", $.ui.mouse, { } }); - $(event.target).parents().andSelf().each(function() { - var selectee = $.data(this, "selectable-item"); + $(event.target).parents().addBack().each(function() { + var doSelect, + selectee = $.data(this, "selectable-item"); if (selectee) { - var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); + doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected"); selectee.$element .removeClass(doSelect ? "ui-unselecting" : "ui-selected") .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); @@ -3062,43 +3400,52 @@ $.widget("ui.selectable", $.ui.mouse, { }, _mouseDrag: function(event) { - var that = this; + this.dragged = true; - if (this.options.disabled) + if (this.options.disabled) { return; + } - var options = this.options; + var tmp, + that = this, + options = this.options, + x1 = this.opos[0], + y1 = this.opos[1], + x2 = event.pageX, + y2 = event.pageY; - var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; - if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } - if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } + if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } + if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); this.selectees.each(function() { - var selectee = $.data(this, "selectable-item"); + var selectee = $.data(this, "selectable-item"), + hit = false; + //prevent helper from being selected if appendTo: selectable - if (!selectee || selectee.element == that.element[0]) + if (!selectee || selectee.element === that.element[0]) { return; - var hit = false; - if (options.tolerance == 'touch') { + } + + if (options.tolerance === "touch") { hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); - } else if (options.tolerance == 'fit') { + } else if (options.tolerance === "fit") { hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); } if (hit) { // SELECT if (selectee.selected) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; } if (selectee.unselecting) { - selectee.$element.removeClass('ui-unselecting'); + selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; } if (!selectee.selecting) { - selectee.$element.addClass('ui-selecting'); + selectee.$element.addClass("ui-selecting"); selectee.selecting = true; // selectable SELECTING callback that._trigger("selecting", event, { @@ -3109,15 +3456,15 @@ $.widget("ui.selectable", $.ui.mouse, { // UNSELECT if (selectee.selecting) { if ((event.metaKey || event.ctrlKey) && selectee.startselected) { - selectee.$element.removeClass('ui-selecting'); + selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; - selectee.$element.addClass('ui-selected'); + selectee.$element.addClass("ui-selected"); selectee.selected = true; } else { - selectee.$element.removeClass('ui-selecting'); + selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; if (selectee.startselected) { - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; } // selectable UNSELECTING callback @@ -3128,10 +3475,10 @@ $.widget("ui.selectable", $.ui.mouse, { } if (selectee.selected) { if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { - selectee.$element.removeClass('ui-selected'); + selectee.$element.removeClass("ui-selected"); selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); + selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { @@ -3150,20 +3497,18 @@ $.widget("ui.selectable", $.ui.mouse, { this.dragged = false; - var options = this.options; - - $('.ui-unselecting', this.element[0]).each(function() { + $(".ui-unselecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-unselecting'); + selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; selectee.startselected = false; that._trigger("unselected", event, { unselected: selectee.element }); }); - $('.ui-selecting', this.element[0]).each(function() { + $(".ui-selecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); + selectee.$element.removeClass("ui-selecting").addClass("ui-selected"); selectee.selecting = false; selectee.selected = true; selectee.startselected = true; @@ -3184,8 +3529,16 @@ $.widget("ui.selectable", $.ui.mouse, { (function( $, undefined ) { +function isOverAxis( x, reference, size ) { + return ( x > reference ) && ( x < ( reference + size ) ); +} + +function isFloating(item) { + return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display")); +} + $.widget("ui.sortable", $.ui.mouse, { - version: "1.9.2", + version: "1.10.4", widgetEventPrefix: "sort", ready: false, options: { @@ -3193,7 +3546,7 @@ $.widget("ui.sortable", $.ui.mouse, { axis: false, connectWith: false, containment: false, - cursor: 'auto', + cursor: "auto", cursorAt: false, dropOnEmpty: true, forcePlaceholderSize: false, @@ -3201,7 +3554,7 @@ $.widget("ui.sortable", $.ui.mouse, { grid: false, handle: false, helper: "original", - items: '> *', + items: "> *", opacity: false, placeholder: false, revert: false, @@ -3210,7 +3563,21 @@ $.widget("ui.sortable", $.ui.mouse, { scrollSpeed: 20, scope: "default", tolerance: "intersect", - zIndex: 1000 + zIndex: 1000, + + // callbacks + activate: null, + beforeStop: null, + change: null, + deactivate: null, + out: null, + over: null, + receive: null, + remove: null, + sort: null, + start: null, + stop: null, + update: null }, _create: function() { @@ -3222,7 +3589,7 @@ $.widget("ui.sortable", $.ui.mouse, { this.refresh(); //Let's determine if the items are being displayed horizontally - this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; + this.floating = this.items.length ? o.axis === "x" || isFloating(this.items[0].item) : false; //Let's determine the parent's offset this.offset = this.element.offset(); @@ -3231,7 +3598,7 @@ $.widget("ui.sortable", $.ui.mouse, { this._mouseInit(); //We're ready to go - this.ready = true + this.ready = true; }, @@ -3240,8 +3607,9 @@ $.widget("ui.sortable", $.ui.mouse, { .removeClass("ui-sortable ui-sortable-disabled"); this._mouseDestroy(); - for ( var i = this.items.length - 1; i >= 0; i-- ) + for ( var i = this.items.length - 1; i >= 0; i-- ) { this.items[i].item.removeData(this.widgetName + "-item"); + } return this; }, @@ -3258,32 +3626,44 @@ $.widget("ui.sortable", $.ui.mouse, { }, _mouseCapture: function(event, overrideHandle) { - var that = this; + var currentItem = null, + validHandle = false, + that = this; if (this.reverting) { return false; } - if(this.options.disabled || this.options.type == 'static') return false; + if(this.options.disabled || this.options.type === "static") { + return false; + } //We have to refresh the items data once first this._refreshItems(event); //Find out if the clicked node (or one of its parents) is a actual item in this.items - var currentItem = null, nodes = $(event.target).parents().each(function() { - if($.data(this, that.widgetName + '-item') == that) { + $(event.target).parents().each(function() { + if($.data(this, that.widgetName + "-item") === that) { currentItem = $(this); return false; } }); - if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target); + if($.data(event.target, that.widgetName + "-item") === that) { + currentItem = $(event.target); + } - if(!currentItem) return false; + if(!currentItem) { + return false; + } if(this.options.handle && !overrideHandle) { - var validHandle = false; - - $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); - if(!validHandle) return false; + $(this.options.handle, currentItem).find("*").addBack().each(function() { + if(this === event.target) { + validHandle = true; + } + }); + if(!validHandle) { + return false; + } } this.currentItem = currentItem; @@ -3294,7 +3674,9 @@ $.widget("ui.sortable", $.ui.mouse, { _mouseStart: function(event, overrideHandle, noActivation) { - var o = this.options; + var i, body, + o = this.options; + this.currentContainer = this; //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture @@ -3343,14 +3725,14 @@ $.widget("ui.sortable", $.ui.mouse, { this.originalPageX = event.pageX; this.originalPageY = event.pageY; - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); //Cache the former DOM position this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way - if(this.helper[0] != this.currentItem[0]) { + if(this.helper[0] !== this.currentItem[0]) { this.currentItem.hide(); } @@ -3358,47 +3740,63 @@ $.widget("ui.sortable", $.ui.mouse, { this._createPlaceholder(); //Set a containment if given in the options - if(o.containment) + if(o.containment) { this._setContainment(); + } - if(o.cursor) { // cursor option - if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); - $('body').css("cursor", o.cursor); + if( o.cursor && o.cursor !== "auto" ) { // cursor option + body = this.document.find( "body" ); + + // support: IE + this.storedCursor = body.css( "cursor" ); + body.css( "cursor", o.cursor ); + + this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body ); } if(o.opacity) { // opacity option - if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); + if (this.helper.css("opacity")) { + this._storedOpacity = this.helper.css("opacity"); + } this.helper.css("opacity", o.opacity); } if(o.zIndex) { // zIndex option - if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); + if (this.helper.css("zIndex")) { + this._storedZIndex = this.helper.css("zIndex"); + } this.helper.css("zIndex", o.zIndex); } //Prepare scrolling - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') + if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { this.overflowOffset = this.scrollParent.offset(); + } //Call callbacks this._trigger("start", event, this._uiHash()); //Recache the helper size - if(!this._preserveHelperProportions) + if(!this._preserveHelperProportions) { this._cacheHelperProportions(); + } - //Post 'activate' events to possible containers - if(!noActivation) { - for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); } + //Post "activate" events to possible containers + if( !noActivation ) { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); + } } //Prepare possible droppables - if($.ui.ddmanager) + if($.ui.ddmanager) { $.ui.ddmanager.current = this; + } - if ($.ui.ddmanager && !o.dropBehaviour) + if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); + } this.dragging = true; @@ -3409,6 +3807,9 @@ $.widget("ui.sortable", $.ui.mouse, { }, _mouseDrag: function(event) { + var i, item, itemElement, intersection, + o = this.options, + scrolled = false; //Compute the helpers position this.position = this._generatePosition(event); @@ -3420,70 +3821,86 @@ $.widget("ui.sortable", $.ui.mouse, { //Do scrolling if(this.options.scroll) { - var o = this.options, scrolled = false; - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { + if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) + if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) + } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; + } - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) + if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) + } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; + } } else { - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) + if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) + } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); + } - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) + if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) + } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); + } } - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) + if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); + } } //Regenerate the absolute position used for position checks this.positionAbs = this._convertPositionTo("absolute"); //Set the helper position - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; + if(!this.options.axis || this.options.axis !== "y") { + this.helper[0].style.left = this.position.left+"px"; + } + if(!this.options.axis || this.options.axis !== "x") { + this.helper[0].style.top = this.position.top+"px"; + } //Rearrange - for (var i = this.items.length - 1; i >= 0; i--) { + for (i = this.items.length - 1; i >= 0; i--) { //Cache variables and intersection, continue if no intersection - var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); - if (!intersection) continue; + item = this.items[i]; + itemElement = item.item[0]; + intersection = this._intersectsWithPointer(item); + if (!intersection) { + continue; + } // Only put the placeholder inside the current Container, skip all - // items form other containers. This works because when moving + // items from other containers. This works because when moving // an item from one container to another the // currentContainer is switched before the placeholder is moved. // - // Without this moving items in "sub-sortables" can cause the placeholder to jitter - // beetween the outer and inner container. - if (item.instance !== this.currentContainer) continue; - - if (itemElement != this.currentItem[0] //cannot intersect with itself - && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before - && !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked - && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true) - //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container + // Without this, moving items in "sub-sortables" can cause + // the placeholder to jitter beetween the outer and inner container. + if (item.instance !== this.currentContainer) { + continue; + } + + // cannot intersect with itself + // no useless actions that have been done before + // no action if the item moved is the parent of the item checked + if (itemElement !== this.currentItem[0] && + this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && + !$.contains(this.placeholder[0], itemElement) && + (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) ) { - this.direction = intersection == 1 ? "down" : "up"; + this.direction = intersection === 1 ? "down" : "up"; - if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { + if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { this._rearrange(event, item); } else { break; @@ -3498,10 +3915,12 @@ $.widget("ui.sortable", $.ui.mouse, { this._contactContainers(event); //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); + if($.ui.ddmanager) { + $.ui.ddmanager.drag(this, event); + } //Call callbacks - this._trigger('sort', event, this._uiHash()); + this._trigger("sort", event, this._uiHash()); this.lastPositionAbs = this.positionAbs; return false; @@ -3510,22 +3929,29 @@ $.widget("ui.sortable", $.ui.mouse, { _mouseStop: function(event, noPropagation) { - if(!event) return; + if(!event) { + return; + } //If we are using droppables, inform the manager about the drop - if ($.ui.ddmanager && !this.options.dropBehaviour) + if ($.ui.ddmanager && !this.options.dropBehaviour) { $.ui.ddmanager.drop(this, event); + } if(this.options.revert) { - var that = this; - var cur = this.placeholder.offset(); + var that = this, + cur = this.placeholder.offset(), + axis = this.options.axis, + animation = {}; + if ( !axis || axis === "x" ) { + animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft); + } + if ( !axis || axis === "y" ) { + animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop); + } this.reverting = true; - - $(this.helper).animate({ - left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), - top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) - }, parseInt(this.options.revert, 10) || 500, function() { + $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() { that._clear(event); }); } else { @@ -3542,10 +3968,11 @@ $.widget("ui.sortable", $.ui.mouse, { this._mouseUp({ target: null }); - if(this.options.helper == "original") + if(this.options.helper === "original") { this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); - else + } else { this.currentItem.show(); + } //Post deactivating events to containers for (var i = this.containers.length - 1; i >= 0; i--){ @@ -3560,8 +3987,12 @@ $.widget("ui.sortable", $.ui.mouse, { if (this.placeholder) { //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); + if(this.placeholder[0].parentNode) { + this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + } + if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { + this.helper.remove(); + } $.extend(this, { helper: null, @@ -3583,28 +4014,33 @@ $.widget("ui.sortable", $.ui.mouse, { serialize: function(o) { - var items = this._getItemsAsjQuery(o && o.connected); - var str = []; o = o || {}; + var items = this._getItemsAsjQuery(o && o.connected), + str = []; + o = o || {}; $(items).each(function() { - var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); - if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); + var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); + if (res) { + str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2])); + } }); if(!str.length && o.key) { - str.push(o.key + '='); + str.push(o.key + "="); } - return str.join('&'); + return str.join("&"); }, toArray: function(o) { - var items = this._getItemsAsjQuery(o && o.connected); - var ret = []; o = o || {}; + var items = this._getItemsAsjQuery(o && o.connected), + ret = []; - items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); + o = o || {}; + + items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); return ret; }, @@ -3615,73 +4051,73 @@ $.widget("ui.sortable", $.ui.mouse, { var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, y1 = this.positionAbs.top, - y2 = y1 + this.helperProportions.height; - - var l = item.left, + y2 = y1 + this.helperProportions.height, + l = item.left, r = l + item.width, t = item.top, - b = t + item.height; - - var dyClick = this.offset.click.top, - dxClick = this.offset.click.left; - - var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; - - if( this.options.tolerance == "pointer" - || this.options.forcePointerForContainers - || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) + b = t + item.height, + dyClick = this.offset.click.top, + dxClick = this.offset.click.left, + isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ), + isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ), + isOverElement = isOverElementHeight && isOverElementWidth; + + if ( this.options.tolerance === "pointer" || + this.options.forcePointerForContainers || + (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) ) { return isOverElement; } else { - return (l < x1 + (this.helperProportions.width / 2) // Right Half - && x2 - (this.helperProportions.width / 2) < r // Left Half - && t < y1 + (this.helperProportions.height / 2) // Bottom Half - && y2 - (this.helperProportions.height / 2) < b ); // Top Half + return (l < x1 + (this.helperProportions.width / 2) && // Right Half + x2 - (this.helperProportions.width / 2) < r && // Left Half + t < y1 + (this.helperProportions.height / 2) && // Bottom Half + y2 - (this.helperProportions.height / 2) < b ); // Top Half } }, _intersectsWithPointer: function(item) { - var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), - isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + var isOverElementHeight = (this.options.axis === "x") || isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === "y") || isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), isOverElement = isOverElementHeight && isOverElementWidth, verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); - if (!isOverElement) + if (!isOverElement) { return false; + } return this.floating ? - ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) - : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); + ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 ) + : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) ); }, _intersectsWithSides: function(item) { - var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), - isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), + var isOverBottomHalf = isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), + isOverRightHalf = isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); if (this.floating && horizontalDirection) { - return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); + return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); } else { - return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); + return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); } }, _getDragVerticalDirection: function() { var delta = this.positionAbs.top - this.lastPositionAbs.top; - return delta != 0 && (delta > 0 ? "down" : "up"); + return delta !== 0 && (delta > 0 ? "down" : "up"); }, _getDragHorizontalDirection: function() { var delta = this.positionAbs.left - this.lastPositionAbs.left; - return delta != 0 && (delta > 0 ? "right" : "left"); + return delta !== 0 && (delta > 0 ? "right" : "left"); }, refresh: function(event) { @@ -3692,36 +4128,36 @@ $.widget("ui.sortable", $.ui.mouse, { _connectWith: function() { var options = this.options; - return options.connectWith.constructor == String - ? [options.connectWith] - : options.connectWith; + return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; }, _getItemsAsjQuery: function(connected) { - var items = []; - var queries = []; - var connectWith = this._connectWith(); + var i, j, cur, inst, + items = [], + queries = [], + connectWith = this._connectWith(); if(connectWith && connected) { - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], this.widgetName); - if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); + for (i = connectWith.length - 1; i >= 0; i--){ + cur = $(connectWith[i]); + for ( j = cur.length - 1; j >= 0; j--){ + inst = $.data(cur[j], this.widgetFullName); + if(inst && inst !== this && !inst.options.disabled) { + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); } - }; - }; + } + } } - queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); - for (var i = queries.length - 1; i >= 0; i--){ - queries[i][0].each(function() { - items.push(this); - }); - }; + function addItems() { + items.push( this ); + } + for (i = queries.length - 1; i >= 0; i--){ + queries[i][0].each( addItems ); + } return $(items); @@ -3733,9 +4169,10 @@ $.widget("ui.sortable", $.ui.mouse, { this.items = $.grep(this.items, function (item) { for (var j=0; j < list.length; j++) { - if(list[j] == item.item[0]) + if(list[j] === item.item[0]) { return false; - }; + } + } return true; }); @@ -3745,31 +4182,33 @@ $.widget("ui.sortable", $.ui.mouse, { this.items = []; this.containers = [this]; - var items = this.items; - var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; - var connectWith = this._connectWith(); + + var i, j, cur, inst, targetData, _queries, item, queriesLength, + items = this.items, + queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], + connectWith = this._connectWith(); if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], this.widgetName); - if(inst && inst != this && !inst.options.disabled) { + for (i = connectWith.length - 1; i >= 0; i--){ + cur = $(connectWith[i]); + for (j = cur.length - 1; j >= 0; j--){ + inst = $.data(cur[j], this.widgetFullName); + if(inst && inst !== this && !inst.options.disabled) { queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); this.containers.push(inst); } - }; - }; + } + } } - for (var i = queries.length - 1; i >= 0; i--) { - var targetData = queries[i][1]; - var _queries = queries[i][0]; + for (i = queries.length - 1; i >= 0; i--) { + targetData = queries[i][1]; + _queries = queries[i][0]; - for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { - var item = $(_queries[j]); + for (j=0, queriesLength = _queries.length; j < queriesLength; j++) { + item = $(_queries[j]); - item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) + item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) items.push({ item: item, @@ -3777,8 +4216,8 @@ $.widget("ui.sortable", $.ui.mouse, { width: 0, height: 0, left: 0, top: 0 }); - }; - }; + } + } }, @@ -3789,35 +4228,38 @@ $.widget("ui.sortable", $.ui.mouse, { this.offset.parent = this._getParentOffset(); } - for (var i = this.items.length - 1; i >= 0; i--){ - var item = this.items[i]; + var i, item, t, p; + + for (i = this.items.length - 1; i >= 0; i--){ + item = this.items[i]; //We ignore calculating positions of all connected containers when we're not over them - if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { continue; + } - var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; + t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; if (!fast) { item.width = t.outerWidth(); item.height = t.outerHeight(); } - var p = t.offset(); + p = t.offset(); item.left = p.left; item.top = p.top; - }; + } if(this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call(this); } else { - for (var i = this.containers.length - 1; i >= 0; i--){ - var p = this.containers[i].element.offset(); + for (i = this.containers.length - 1; i >= 0; i--){ + p = this.containers[i].element.offset(); this.containers[i].containerCache.left = p.left; this.containers[i].containerCache.top = p.top; this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); - }; + } } return this; @@ -3825,31 +4267,46 @@ $.widget("ui.sortable", $.ui.mouse, { _createPlaceholder: function(that) { that = that || this; - var o = that.options; + var className, + o = that.options; - if(!o.placeholder || o.placeholder.constructor == String) { - var className = o.placeholder; + if(!o.placeholder || o.placeholder.constructor === String) { + className = o.placeholder; o.placeholder = { element: function() { - var el = $(document.createElement(that.currentItem[0].nodeName)) - .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") - .removeClass("ui-sortable-helper")[0]; + var nodeName = that.currentItem[0].nodeName.toLowerCase(), + element = $( "<" + nodeName + ">", that.document[0] ) + .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") + .removeClass("ui-sortable-helper"); + + if ( nodeName === "tr" ) { + that.currentItem.children().each(function() { + $( "<td> </td>", that.document[0] ) + .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) + .appendTo( element ); + }); + } else if ( nodeName === "img" ) { + element.attr( "src", that.currentItem.attr( "src" ) ); + } - if(!className) - el.style.visibility = "hidden"; + if ( !className ) { + element.css( "visibility", "hidden" ); + } - return el; + return element; }, update: function(container, p) { // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified - if(className && !o.forcePlaceholderSize) return; + if(className && !o.forcePlaceholderSize) { + return; + } //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item - if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); }; - if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); }; + if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); } + if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); } } }; } @@ -3866,22 +4323,24 @@ $.widget("ui.sortable", $.ui.mouse, { }, _contactContainers: function(event) { + var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating, + innermostContainer = null, + innermostIndex = null; // get innermost container that intersects with item - var innermostContainer = null, innermostIndex = null; - - - for (var i = this.containers.length - 1; i >= 0; i--){ + for (i = this.containers.length - 1; i >= 0; i--) { // never consider a container that's located within the item itself - if($.contains(this.currentItem[0], this.containers[i].element[0])) + if($.contains(this.currentItem[0], this.containers[i].element[0])) { continue; + } if(this._intersectsWith(this.containers[i].containerCache)) { // if we've already found a container and it's more "inner" than this, then continue - if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) + if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { continue; + } innermostContainer = this.containers[i]; innermostIndex = i; @@ -3897,24 +4356,37 @@ $.widget("ui.sortable", $.ui.mouse, { } // if no intersecting containers found, return - if(!innermostContainer) return; + if(!innermostContainer) { + return; + } // move the item into the container if it's not there already if(this.containers.length === 1) { - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); - this.containers[innermostIndex].containerCache.over = 1; + if (!this.containers[innermostIndex].containerCache.over) { + this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); + this.containers[innermostIndex].containerCache.over = 1; + } } else { //When entering a new container, we will find the item with the least distance and append our item near it - var dist = 10000; var itemWithLeastDistance = null; - var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top'; - var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height'; - var base = this.positionAbs[posProperty] + this.offset.click[posProperty]; - for (var j = this.items.length - 1; j >= 0; j--) { - if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; - if(this.items[j].item[0] == this.currentItem[0]) continue; - var cur = this.items[j].item.offset()[posProperty]; - var nearBottom = false; + dist = 10000; + itemWithLeastDistance = null; + floating = innermostContainer.floating || isFloating(this.currentItem); + posProperty = floating ? "left" : "top"; + sizeProperty = floating ? "width" : "height"; + base = this.positionAbs[posProperty] + this.offset.click[posProperty]; + for (j = this.items.length - 1; j >= 0; j--) { + if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { + continue; + } + if(this.items[j].item[0] === this.currentItem[0]) { + continue; + } + if (floating && !isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) { + continue; + } + cur = this.items[j].item.offset()[posProperty]; + nearBottom = false; if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){ nearBottom = true; cur += this.items[j][sizeProperty]; @@ -3926,13 +4398,19 @@ $.widget("ui.sortable", $.ui.mouse, { } } - if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled + //Check if dropOnEmpty is enabled + if(!itemWithLeastDistance && !this.options.dropOnEmpty) { return; + } + + if(this.currentContainer === this.containers[innermostIndex]) { + return; + } - this.currentContainer = this.containers[innermostIndex]; itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); this._trigger("change", event, this._uiHash()); this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); + this.currentContainer = this.containers[innermostIndex]; //Update the placeholder this.options.placeholder.update(this.currentContainer, this.placeholder); @@ -3946,39 +4424,46 @@ $.widget("ui.sortable", $.ui.mouse, { _createHelper: function(event) { - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); + var o = this.options, + helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); - if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already - $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + //Add the helper to the DOM if that didn't happen already + if(!helper.parents("body").length) { + $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); + } - if(helper[0] == this.currentItem[0]) + if(helper[0] === this.currentItem[0]) { this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; + } - if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); - if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); + if(!helper[0].style.width || o.forceHelperSize) { + helper.width(this.currentItem.width()); + } + if(!helper[0].style.height || o.forceHelperSize) { + helper.height(this.currentItem.height()); + } return helper; }, _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); + if (typeof obj === "string") { + obj = obj.split(" "); } if ($.isArray(obj)) { obj = {left: +obj[0], top: +obj[1] || 0}; } - if ('left' in obj) { + if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left; } - if ('right' in obj) { + if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; } - if ('top' in obj) { + if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top; } - if ('bottom' in obj) { + if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; } }, @@ -3994,14 +4479,16 @@ $.widget("ui.sortable", $.ui.mouse, { // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { + if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix + // This needs to be actually done for all browsers, since pageX/pageY includes this information + // with an ugly IE fix + if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { po = { top: 0, left: 0 }; + } return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), @@ -4012,7 +4499,7 @@ $.widget("ui.sortable", $.ui.mouse, { _getRelativeOffset: function() { - if(this.cssPosition == "relative") { + if(this.cssPosition === "relative") { var p = this.currentItem.position(); return { top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), @@ -4040,19 +4527,24 @@ $.widget("ui.sortable", $.ui.mouse, { _setContainment: function() { - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - 0 - this.offset.relative.left - this.offset.parent.left, - 0 - this.offset.relative.top - this.offset.parent.top, - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; + var ce, co, over, + o = this.options; + if(o.containment === "parent") { + o.containment = this.helper[0].parentNode; + } + if(o.containment === "document" || o.containment === "window") { + this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left, + ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top + ]; + } if(!(/^(document|window|parent)$/).test(o.containment)) { - var ce = $(o.containment)[0]; - var co = $(o.containment).offset(); - var over = ($(ce).css("overflow") != 'hidden'); + ce = $(o.containment)[0]; + co = $(o.containment).offset(); + over = ($(ce).css("overflow") !== "hidden"); this.containment = [ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, @@ -4066,22 +4558,25 @@ $.widget("ui.sortable", $.ui.mouse, { _convertPositionTo: function(d, pos) { - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + if(!pos) { + pos = this.position; + } + var mod = d === "absolute" ? 1 : -1, + scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, + scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); return { top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) + pos.top + // The absolute mouse position + this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) ), left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) + pos.left + // The absolute mouse position + this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) ) }; @@ -4089,19 +4584,20 @@ $.widget("ui.sortable", $.ui.mouse, { _generatePosition: function(event) { - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); + var top, left, + o = this.options, + pageX = event.pageX, + pageY = event.pageY, + scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); // This is another very weird special case that only happens for relative elements: // 1. If the css position is relative // 2. and the scroll parent is the document or similar to the offset parent // we have to refresh the relative offset during the scroll so there are no jumps - if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { + if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } - var pageX = event.pageX; - var pageY = event.pageY; - /* * - Position constraining - * Constrain the position to a mix of grid, containment. @@ -4110,36 +4606,44 @@ $.widget("ui.sortable", $.ui.mouse, { if(this.originalPosition) { //If we are not dragging yet, we won't check for options if(this.containment) { - if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; + if(event.pageX - this.offset.click.left < this.containment[0]) { + pageX = this.containment[0] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top < this.containment[1]) { + pageY = this.containment[1] + this.offset.click.top; + } + if(event.pageX - this.offset.click.left > this.containment[2]) { + pageX = this.containment[2] + this.offset.click.left; + } + if(event.pageY - this.offset.click.top > this.containment[3]) { + pageY = this.containment[3] + this.offset.click.top; + } } if(o.grid) { - var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; - pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; + top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; + pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; - pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; + left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; + pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } } return { top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) + pageY - // The absolute mouse position + this.offset.click.top - // Click offset (relative to the element) + this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.top + // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) ), left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) + pageX - // The absolute mouse position + this.offset.click.left - // Click offset (relative to the element) + this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.parent.left + // The offsetParent's offset without borders (offset + border) + ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) ) }; @@ -4147,7 +4651,7 @@ $.widget("ui.sortable", $.ui.mouse, { _rearrange: function(event, i, a, hardRefresh) { - a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); + a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); //Various things done here to improve the performance: // 1. we create a setTimeout, that calls refreshPositions @@ -4158,7 +4662,9 @@ $.widget("ui.sortable", $.ui.mouse, { var counter = this.counter; this._delay(function() { - if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + if(counter === this.counter) { + this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove + } }); }, @@ -4168,24 +4674,33 @@ $.widget("ui.sortable", $.ui.mouse, { this.reverting = false; // We delay all events that have to be triggered to after the point where the placeholder has been removed and // everything else normalized again - var delayedTriggers = []; + var i, + delayedTriggers = []; // We first have to update the dom position of the actual currentItem // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) - if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); + if(!this._noFinalSort && this.currentItem.parent().length) { + this.placeholder.before(this.currentItem); + } this._noFinalSort = null; - if(this.helper[0] == this.currentItem[0]) { - for(var i in this._storedCSS) { - if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; + if(this.helper[0] === this.currentItem[0]) { + for(i in this._storedCSS) { + if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { + this._storedCSS[i] = ""; + } } this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); } else { this.currentItem.show(); } - if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); - if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + if(this.fromOutside && !noPropagation) { + delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); + } + if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { + delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed + } // Check if the items Container has Changed and trigger appropriate // events. @@ -4199,24 +4714,40 @@ $.widget("ui.sortable", $.ui.mouse, { //Post events to containers - for (var i = this.containers.length - 1; i >= 0; i--){ - if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + function delayEvent( type, instance, container ) { + return function( event ) { + container._trigger( type, event, instance._uiHash( instance ) ); + }; + } + for (i = this.containers.length - 1; i >= 0; i--){ + if (!noPropagation) { + delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); + } if(this.containers[i].containerCache.over) { - delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); + delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); this.containers[i].containerCache.over = 0; } } //Do what was originally in plugins - if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor - if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity - if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index + if ( this.storedCursor ) { + this.document.find( "body" ).css( "cursor", this.storedCursor ); + this.storedStylesheet.remove(); + } + if(this._storedOpacity) { + this.helper.css("opacity", this._storedOpacity); + } + if(this._storedZIndex) { + this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); + } this.dragging = false; if(this.cancelHelperRemoval) { if(!noPropagation) { this._trigger("beforeStop", event, this._uiHash()); - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + for (i=0; i < delayedTriggers.length; i++) { + delayedTriggers[i].call(this, event); + } //Trigger all delayed events this._trigger("stop", event, this._uiHash()); } @@ -4224,15 +4755,22 @@ $.widget("ui.sortable", $.ui.mouse, { return false; } - if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); + if(!noPropagation) { + this._trigger("beforeStop", event, this._uiHash()); + } //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; + if(this.helper[0] !== this.currentItem[0]) { + this.helper.remove(); + } + this.helper = null; if(!noPropagation) { - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events + for (i=0; i < delayedTriggers.length; i++) { + delayedTriggers[i].call(this, event); + } //Trigger all delayed events this._trigger("stop", event, this._uiHash()); } @@ -4264,35 +4802,33 @@ $.widget("ui.sortable", $.ui.mouse, { })(jQuery); -;(jQuery.effects || (function($, undefined) { +(function($, undefined) { -var backCompat = $.uiBackCompat !== false, - // prefix used for storing data on .data() - dataSpace = "ui-effects-"; +var dataSpace = "ui-effects-"; $.effects = { effect: {} }; /*! - * jQuery Color Animations v2.0.0 - * http://jquery.com/ + * jQuery Color Animations v2.1.2 + * https://github.com/jquery/jquery-color * - * Copyright 2012 jQuery Foundation and other contributors + * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * - * Date: Mon Aug 13 13:41:02 2012 -0500 + * Date: Wed Jan 16 08:47:09 2013 -0600 */ (function( jQuery, undefined ) { - var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "), + var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", // plusequals test for += 100 -= 100 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, // a set of RE's that can match strings and generate color tuples. stringParsers = [{ - re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, parse: function( execResult ) { return [ execResult[ 1 ], @@ -4302,7 +4838,7 @@ $.effects = { ]; } }, { - re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, parse: function( execResult ) { return [ execResult[ 1 ] * 2.55, @@ -4332,7 +4868,7 @@ $.effects = { ]; } }, { - re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, + re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, space: "hsla", parse: function( execResult ) { return [ @@ -4549,7 +5085,7 @@ color.fn = jQuery.extend( color.prototype, { }); // everything defined but alpha? - if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { // use the default of 1 inst[ cache ][ 3 ] = 1; if ( space.from ) { @@ -4737,8 +5273,10 @@ spaces.hsla.to = function ( rgba ) { h = ( 60 * ( r - g ) / diff ) + 240; } - if ( l === 0 || l === 1 ) { - s = l; + // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% + // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) + if ( diff === 0 ) { + s = 0; } else if ( l <= 0.5 ) { s = diff / add; } else { @@ -4842,51 +5380,58 @@ each( spaces, function( spaceName, space ) { }); }); -// add .fx.step functions -each( stepHooks, function( i, hook ) { - jQuery.cssHooks[ hook ] = { - set: function( elem, value ) { - var parsed, curElem, - backgroundColor = ""; - - if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { - value = color( parsed || value ); - if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { - curElem = hook === "backgroundColor" ? elem.parentNode : elem; - while ( - (backgroundColor === "" || backgroundColor === "transparent") && - curElem && curElem.style - ) { - try { - backgroundColor = jQuery.css( curElem, "backgroundColor" ); - curElem = curElem.parentNode; - } catch ( e ) { +// add cssHook and .fx.step function for each named hook. +// accept a space separated string of properties +color.hook = function( hook ) { + var hooks = hook.split( " " ); + each( hooks, function( i, hook ) { + jQuery.cssHooks[ hook ] = { + set: function( elem, value ) { + var parsed, curElem, + backgroundColor = ""; + + if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { + value = color( parsed || value ); + if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { + curElem = hook === "backgroundColor" ? elem.parentNode : elem; + while ( + (backgroundColor === "" || backgroundColor === "transparent") && + curElem && curElem.style + ) { + try { + backgroundColor = jQuery.css( curElem, "backgroundColor" ); + curElem = curElem.parentNode; + } catch ( e ) { + } } + + value = value.blend( backgroundColor && backgroundColor !== "transparent" ? + backgroundColor : + "_default" ); } - value = value.blend( backgroundColor && backgroundColor !== "transparent" ? - backgroundColor : - "_default" ); + value = value.toRgbaString(); + } + try { + elem.style[ hook ] = value; + } catch( e ) { + // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' } - - value = value.toRgbaString(); } - try { - elem.style[ hook ] = value; - } catch( error ) { - // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' + }; + jQuery.fx.step[ hook ] = function( fx ) { + if ( !fx.colorInit ) { + fx.start = color( fx.elem, hook ); + fx.end = color( fx.end ); + fx.colorInit = true; } - } - }; - jQuery.fx.step[ hook ] = function( fx ) { - if ( !fx.colorInit ) { - fx.start = color( fx.elem, hook ); - fx.end = color( fx.end ); - fx.colorInit = true; - } - jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); - }; -}); + jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); + }; + }); + +}; + +color.hook( stepHooks ); jQuery.cssHooks.borderColor = { expand: function( value ) { @@ -4930,7 +5475,6 @@ colors = jQuery.Color.names = { })( jQuery ); - /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ @@ -4958,32 +5502,31 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS }; }); -function getElementStyles() { - var style = this.ownerDocument.defaultView ? - this.ownerDocument.defaultView.getComputedStyle( this, null ) : - this.currentStyle, - newStyle = {}, - key, - len; +function getElementStyles( elem ) { + var key, len, + style = elem.ownerDocument.defaultView ? + elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : + elem.currentStyle, + styles = {}; - // webkit enumerates style porperties if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { len = style.length; while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { - newStyle[ $.camelCase( key ) ] = style[ key ]; + styles[ $.camelCase( key ) ] = style[ key ]; } } + // support: Opera, IE <9 } else { for ( key in style ) { if ( typeof style[ key ] === "string" ) { - newStyle[ key ] = style[ key ]; + styles[ key ] = style[ key ]; } } } - return newStyle; + return styles; } @@ -5005,6 +5548,15 @@ function styleDifference( oldStyle, newStyle ) { return diff; } +// support: jQuery <1.8 +if ( !$.fn.addBack ) { + $.fn.addBack = function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + }; +} + $.effects.animateClass = function( value, duration, easing, callback ) { var o = $.speed( duration, easing, callback ); @@ -5012,14 +5564,14 @@ $.effects.animateClass = function( value, duration, easing, callback ) { var animated = $( this ), baseClass = animated.attr( "class" ) || "", applyClassChange, - allAnimations = o.children ? animated.find( "*" ).andSelf() : animated; + allAnimations = o.children ? animated.find( "*" ).addBack() : animated; // map the animated objects to store the original styles. allAnimations = allAnimations.map(function() { var el = $( this ); return { el: el, - start: getElementStyles.call( this ) + start: getElementStyles( this ) }; }); @@ -5035,7 +5587,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) { // map all animated objects again - calculate new styles and diff allAnimations = allAnimations.map(function() { - this.end = getElementStyles.call( this.el[ 0 ] ); + this.end = getElementStyles( this.el[ 0 ] ); this.diff = styleDifference( this.start, this.end ); return this; }); @@ -5047,7 +5599,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) { allAnimations = allAnimations.map(function() { var styleInfo = this, dfd = $.Deferred(), - opts = jQuery.extend({}, o, { + opts = $.extend({}, o, { queue: false, complete: function() { dfd.resolve( styleInfo ); @@ -5069,7 +5621,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) { $.each( arguments, function() { var el = this.el; $.each( this.diff, function(key) { - el.css( key, '' ); + el.css( key, "" ); }); }); @@ -5081,39 +5633,42 @@ $.effects.animateClass = function( value, duration, easing, callback ) { }; $.fn.extend({ - _addClass: $.fn.addClass, - addClass: function( classNames, speed, easing, callback ) { - return speed ? - $.effects.animateClass.call( this, - { add: classNames }, speed, easing, callback ) : - this._addClass( classNames ); - }, - - _removeClass: $.fn.removeClass, - removeClass: function( classNames, speed, easing, callback ) { - return speed ? - $.effects.animateClass.call( this, - { remove: classNames }, speed, easing, callback ) : - this._removeClass( classNames ); - }, - - _toggleClass: $.fn.toggleClass, - toggleClass: function( classNames, force, speed, easing, callback ) { - if ( typeof force === "boolean" || force === undefined ) { - if ( !speed ) { - // without speed parameter - return this._toggleClass( classNames, force ); + addClass: (function( orig ) { + return function( classNames, speed, easing, callback ) { + return speed ? + $.effects.animateClass.call( this, + { add: classNames }, speed, easing, callback ) : + orig.apply( this, arguments ); + }; + })( $.fn.addClass ), + + removeClass: (function( orig ) { + return function( classNames, speed, easing, callback ) { + return arguments.length > 1 ? + $.effects.animateClass.call( this, + { remove: classNames }, speed, easing, callback ) : + orig.apply( this, arguments ); + }; + })( $.fn.removeClass ), + + toggleClass: (function( orig ) { + return function( classNames, force, speed, easing, callback ) { + if ( typeof force === "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter + return orig.apply( this, arguments ); + } else { + return $.effects.animateClass.call( this, + (force ? { add: classNames } : { remove: classNames }), + speed, easing, callback ); + } } else { + // without force parameter return $.effects.animateClass.call( this, - (force ? { add: classNames } : { remove: classNames }), - speed, easing, callback ); + { toggle: classNames }, force, speed, easing ); } - } else { - // without force parameter - return $.effects.animateClass.call( this, - { toggle: classNames }, force, speed, easing ); - } - }, + }; + })( $.fn.toggleClass ), switchClass: function( remove, add, speed, easing, callback) { return $.effects.animateClass.call( this, { @@ -5132,7 +5687,7 @@ $.fn.extend({ (function() { $.extend( $.effects, { - version: "1.9.2", + version: "1.10.4", // Saves a set of properties in a data storage save: function( element, set ) { @@ -5348,21 +5903,28 @@ function _normalizeArguments( effect, options, speed, callback ) { return effect; } -function standardSpeed( speed ) { - // valid standard speeds - if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { +function standardAnimationOption( option ) { + // Valid standard speeds (nothing, number, named speed) + if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { return true; } - // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { - // TODO: remove in 2.0 (#7115) - if ( backCompat && $.effects[ speed ] ) { - return false; - } + // Invalid strings - treat as "normal" speed + if ( typeof option === "string" && !$.effects.effect[ option ] ) { + return true; + } + + // Complete callback + if ( $.isFunction( option ) ) { + return true; + } + + // Options hash (but not naming an effect) + if ( typeof option === "object" && !option.effect ) { return true; } + // Didn't match any standard API return false; } @@ -5371,12 +5933,9 @@ $.fn.extend({ var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, queue = args.queue, - effectMethod = $.effects.effect[ args.effect ], - - // DEPRECATED: remove in 2.0 (#7115) - oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; + effectMethod = $.effects.effect[ args.effect ]; - if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { + if ( $.fx.off || !effectMethod ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); @@ -5403,62 +5962,54 @@ $.fn.extend({ } } - // if the element is hiddden and mode is hide, - // or element is visible and mode is show + // If the element already has the correct final state, delegate to + // the core methods so the internal tracking of "olddisplay" works. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { + elem[ mode ](); done(); } else { effectMethod.call( elem[0], args, done ); } } - // TODO: remove this check in 2.0, effectMethod will always be true - if ( effectMethod ) { - return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); - } else { - // DEPRECATED: remove in 2.0 (#7115) - return oldEffectMethod.call(this, { - options: args, - duration: args.duration, - callback: args.complete, - mode: args.mode - }); - } + return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); }, - _show: $.fn.show, - show: function( speed ) { - if ( standardSpeed( speed ) ) { - return this._show.apply( this, arguments ); - } else { - var args = _normalizeArguments.apply( this, arguments ); - args.mode = "show"; - return this.effect.call( this, args ); - } - }, + show: (function( orig ) { + return function( option ) { + if ( standardAnimationOption( option ) ) { + return orig.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "show"; + return this.effect.call( this, args ); + } + }; + })( $.fn.show ), - _hide: $.fn.hide, - hide: function( speed ) { - if ( standardSpeed( speed ) ) { - return this._hide.apply( this, arguments ); - } else { - var args = _normalizeArguments.apply( this, arguments ); - args.mode = "hide"; - return this.effect.call( this, args ); - } - }, + hide: (function( orig ) { + return function( option ) { + if ( standardAnimationOption( option ) ) { + return orig.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "hide"; + return this.effect.call( this, args ); + } + }; + })( $.fn.hide ), - // jQuery core overloads toggle and creates _toggle - __toggle: $.fn.toggle, - toggle: function( speed ) { - if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { - return this.__toggle.apply( this, arguments ); - } else { - var args = _normalizeArguments.apply( this, arguments ); - args.mode = "toggle"; - return this.effect.call( this, args ); - } - }, + toggle: (function( orig ) { + return function( option ) { + if ( standardAnimationOption( option ) || typeof option === "boolean" ) { + return orig.apply( this, arguments ); + } else { + var args = _normalizeArguments.apply( this, arguments ); + args.mode = "toggle"; + return this.effect.call( this, args ); + } + }; + })( $.fn.toggle ), // helper functions cssUnit: function(key) { @@ -5529,7 +6080,7 @@ $.each( baseEasings, function( name, easeIn ) { })(); -})(jQuery)); +})(jQuery); (function( $, undefined ) { @@ -5543,7 +6094,7 @@ showProps.height = showProps.paddingTop = showProps.paddingBottom = showProps.borderTopWidth = showProps.borderBottomWidth = "show"; $.widget( "ui.accordion", { - version: "1.9.2", + version: "1.10.4", options: { active: 0, animate: {}, @@ -5562,100 +6113,29 @@ $.widget( "ui.accordion", { }, _create: function() { - var accordionId = this.accordionId = "ui-accordion-" + - (this.element.attr( "id" ) || ++uid), - options = this.options; - + var options = this.options; this.prevShow = this.prevHide = $(); - this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ); - - this.headers = this.element.find( options.header ) - .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); - this._hoverable( this.headers ); - this._focusable( this.headers ); - - this.headers.next() - .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) - .hide(); + this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) + // ARIA + .attr( "role", "tablist" ); // don't allow collapsible: false and active: false / null if ( !options.collapsible && (options.active === false || options.active == null) ) { options.active = 0; } + + this._processPanels(); // handle negative values if ( options.active < 0 ) { options.active += this.headers.length; } - this.active = this._findActive( options.active ) - .addClass( "ui-accordion-header-active ui-state-active" ) - .toggleClass( "ui-corner-all ui-corner-top" ); - this.active.next() - .addClass( "ui-accordion-content-active" ) - .show(); - - this._createIcons(); - this.refresh(); - - // ARIA - this.element.attr( "role", "tablist" ); - - this.headers - .attr( "role", "tab" ) - .each(function( i ) { - var header = $( this ), - headerId = header.attr( "id" ), - panel = header.next(), - panelId = panel.attr( "id" ); - if ( !headerId ) { - headerId = accordionId + "-header-" + i; - header.attr( "id", headerId ); - } - if ( !panelId ) { - panelId = accordionId + "-panel-" + i; - panel.attr( "id", panelId ); - } - header.attr( "aria-controls", panelId ); - panel.attr( "aria-labelledby", headerId ); - }) - .next() - .attr( "role", "tabpanel" ); - - this.headers - .not( this.active ) - .attr({ - "aria-selected": "false", - tabIndex: -1 - }) - .next() - .attr({ - "aria-expanded": "false", - "aria-hidden": "true" - }) - .hide(); - - // make sure at least one header is in the tab order - if ( !this.active.length ) { - this.headers.eq( 0 ).attr( "tabIndex", 0 ); - } else { - this.active.attr({ - "aria-selected": "true", - tabIndex: 0 - }) - .next() - .attr({ - "aria-expanded": "true", - "aria-hidden": "false" - }); - } - - this._on( this.headers, { keydown: "_keydown" }); - this._on( this.headers.next(), { keydown: "_panelKeyDown" }); - this._setupEvents( options.event ); + this._refresh(); }, _getCreateEventData: function() { return { header: this.active, + panel: !this.active.length ? $() : this.active.next(), content: !this.active.length ? $() : this.active.next() }; }, @@ -5692,6 +6172,7 @@ $.widget( "ui.accordion", { this.headers .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) + .removeAttr( "aria-expanded" ) .removeAttr( "aria-selected" ) .removeAttr( "aria-controls" ) .removeAttr( "tabIndex" ) @@ -5706,7 +6187,6 @@ $.widget( "ui.accordion", { contents = this.headers.next() .css( "display", "" ) .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) .removeAttr( "aria-hidden" ) .removeAttr( "aria-labelledby" ) .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" ) @@ -5802,33 +6282,126 @@ $.widget( "ui.accordion", { }, refresh: function() { - var maxHeight, overflow, - heightStyle = this.options.heightStyle, - parent = this.element.parent(); - + var options = this.options; + this._processPanels(); - if ( heightStyle === "fill" ) { - // IE 6 treats height like minHeight, so we need to turn off overflow - // in order to get a reliable height - // we use the minHeight support test because we assume that only - // browsers that don't support minHeight will treat height as minHeight - if ( !$.support.minHeight ) { - overflow = parent.css( "overflow" ); - parent.css( "overflow", "hidden"); + // was collapsed or no panel + if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { + options.active = false; + this.active = $(); + // active false only when collapsible is true + } else if ( options.active === false ) { + this._activate( 0 ); + // was active, but active panel is gone + } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + // all remaining panel are disabled + if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { + options.active = false; + this.active = $(); + // activate previous panel + } else { + this._activate( Math.max( 0, options.active - 1 ) ); } - maxHeight = parent.height(); - this.element.siblings( ":visible" ).each(function() { - var elem = $( this ), - position = elem.css( "position" ); + // was active, active panel still exists + } else { + // make sure active index is correct + options.active = this.headers.index( this.active ); + } + + this._destroyIcons(); + + this._refresh(); + }, + + _processPanels: function() { + this.headers = this.element.find( this.options.header ) + .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); + + this.headers.next() + .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) + .filter(":not(.ui-accordion-content-active)") + .hide(); + }, + + _refresh: function() { + var maxHeight, + options = this.options, + heightStyle = options.heightStyle, + parent = this.element.parent(), + accordionId = this.accordionId = "ui-accordion-" + + (this.element.attr( "id" ) || ++uid); + + this.active = this._findActive( options.active ) + .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) + .removeClass( "ui-corner-all" ); + this.active.next() + .addClass( "ui-accordion-content-active" ) + .show(); + + this.headers + .attr( "role", "tab" ) + .each(function( i ) { + var header = $( this ), + headerId = header.attr( "id" ), + panel = header.next(), + panelId = panel.attr( "id" ); + if ( !headerId ) { + headerId = accordionId + "-header-" + i; + header.attr( "id", headerId ); + } + if ( !panelId ) { + panelId = accordionId + "-panel-" + i; + panel.attr( "id", panelId ); + } + header.attr( "aria-controls", panelId ); + panel.attr( "aria-labelledby", headerId ); + }) + .next() + .attr( "role", "tabpanel" ); + + this.headers + .not( this.active ) + .attr({ + "aria-selected": "false", + "aria-expanded": "false", + tabIndex: -1 + }) + .next() + .attr({ + "aria-hidden": "true" + }) + .hide(); + + // make sure at least one header is in the tab order + if ( !this.active.length ) { + this.headers.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active.attr({ + "aria-selected": "true", + "aria-expanded": "true", + tabIndex: 0 + }) + .next() + .attr({ + "aria-hidden": "false" + }); + } + + this._createIcons(); + + this._setupEvents( options.event ); + + if ( heightStyle === "fill" ) { + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each(function() { + var elem = $( this ), + position = elem.css( "position" ); if ( position === "absolute" || position === "fixed" ) { return; } maxHeight -= elem.outerHeight( true ); }); - if ( overflow ) { - parent.css( "overflow", overflow ); - } this.headers.each(function() { maxHeight -= $( this ).outerHeight( true ); @@ -5873,14 +6446,20 @@ $.widget( "ui.accordion", { }, _setupEvents: function( event ) { - var events = {}; - if ( !event ) { - return; + var events = { + keydown: "_keydown" + }; + if ( event ) { + $.each( event.split(" "), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + }); } - $.each( event.split(" "), function( index, eventName ) { - events[ eventName ] = "_eventHandler"; - }); + + this._off( this.headers.add( this.headers.next() ) ); this._on( this.headers, events ); + this._on( this.headers.next(), { keydown: "_panelKeyDown" }); + this._hoverable( this.headers ); + this._focusable( this.headers ); }, _eventHandler: function( event ) { @@ -5958,7 +6537,6 @@ $.widget( "ui.accordion", { } toHide.attr({ - "aria-expanded": "false", "aria-hidden": "true" }); toHide.prev().attr( "aria-selected", "false" ); @@ -5966,7 +6544,10 @@ $.widget( "ui.accordion", { // if we're opening from collapsed state, remove the previous header from the tab order // if we're collapsing, then keep the collapsing header in the tab order if ( toShow.length && toHide.length ) { - toHide.prev().attr( "tabIndex", -1 ); + toHide.prev().attr({ + "tabIndex": -1, + "aria-expanded": "false" + }); } else if ( toShow.length ) { this.headers.filter(function() { return $( this ).attr( "tabIndex" ) === 0; @@ -5975,14 +6556,12 @@ $.widget( "ui.accordion", { } toShow - .attr({ - "aria-expanded": "true", - "aria-hidden": "false" - }) + .attr( "aria-hidden", "false" ) .prev() .attr({ "aria-selected": "true", - tabIndex: 0 + tabIndex: 0, + "aria-expanded": "true" }); }, @@ -6054,211 +6633,19 @@ $.widget( "ui.accordion", { if ( toHide.length ) { toHide.parent()[0].className = toHide.parent()[0].className; } - this._trigger( "activate", null, data ); } }); - - -// DEPRECATED -if ( $.uiBackCompat !== false ) { - // navigation options - (function( $, prototype ) { - $.extend( prototype.options, { - navigation: false, - navigationFilter: function() { - return this.href.toLowerCase() === location.href.toLowerCase(); - } - }); - - var _create = prototype._create; - prototype._create = function() { - if ( this.options.navigation ) { - var that = this, - headers = this.element.find( this.options.header ), - content = headers.next(), - current = headers.add( content ) - .find( "a" ) - .filter( this.options.navigationFilter ) - [ 0 ]; - if ( current ) { - headers.add( content ).each( function( index ) { - if ( $.contains( this, current ) ) { - that.options.active = Math.floor( index / 2 ); - return false; - } - }); - } - } - _create.call( this ); - }; - }( jQuery, jQuery.ui.accordion.prototype ) ); - - // height options - (function( $, prototype ) { - $.extend( prototype.options, { - heightStyle: null, // remove default so we fall back to old values - autoHeight: true, // use heightStyle: "auto" - clearStyle: false, // use heightStyle: "content" - fillSpace: false // use heightStyle: "fill" - }); - - var _create = prototype._create, - _setOption = prototype._setOption; - - $.extend( prototype, { - _create: function() { - this.options.heightStyle = this.options.heightStyle || - this._mergeHeightStyle(); - - _create.call( this ); - }, - - _setOption: function( key ) { - if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) { - this.options.heightStyle = this._mergeHeightStyle(); - } - _setOption.apply( this, arguments ); - }, - - _mergeHeightStyle: function() { - var options = this.options; - - if ( options.fillSpace ) { - return "fill"; - } - - if ( options.clearStyle ) { - return "content"; - } - - if ( options.autoHeight ) { - return "auto"; - } - } - }); - }( jQuery, jQuery.ui.accordion.prototype ) ); - - // icon options - (function( $, prototype ) { - $.extend( prototype.options.icons, { - activeHeader: null, // remove default so we fall back to old values - headerSelected: "ui-icon-triangle-1-s" - }); - - var _createIcons = prototype._createIcons; - prototype._createIcons = function() { - if ( this.options.icons ) { - this.options.icons.activeHeader = this.options.icons.activeHeader || - this.options.icons.headerSelected; - } - _createIcons.call( this ); - }; - }( jQuery, jQuery.ui.accordion.prototype ) ); - - // expanded active option, activate method - (function( $, prototype ) { - prototype.activate = prototype._activate; - - var _findActive = prototype._findActive; - prototype._findActive = function( index ) { - if ( index === -1 ) { - index = false; - } - if ( index && typeof index !== "number" ) { - index = this.headers.index( this.headers.filter( index ) ); - if ( index === -1 ) { - index = false; - } - } - return _findActive.call( this, index ); - }; - }( jQuery, jQuery.ui.accordion.prototype ) ); - - // resize method - jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh; - - // change events - (function( $, prototype ) { - $.extend( prototype.options, { - change: null, - changestart: null - }); - - var _trigger = prototype._trigger; - prototype._trigger = function( type, event, data ) { - var ret = _trigger.apply( this, arguments ); - if ( !ret ) { - return false; - } - - if ( type === "beforeActivate" ) { - ret = _trigger.call( this, "changestart", event, { - oldHeader: data.oldHeader, - oldContent: data.oldPanel, - newHeader: data.newHeader, - newContent: data.newPanel - }); - } else if ( type === "activate" ) { - ret = _trigger.call( this, "change", event, { - oldHeader: data.oldHeader, - oldContent: data.oldPanel, - newHeader: data.newHeader, - newContent: data.newPanel - }); - } - return ret; - }; - }( jQuery, jQuery.ui.accordion.prototype ) ); - - // animated option - // NOTE: this only provides support for "slide", "bounceslide", and easings - // not the full $.ui.accordion.animations API - (function( $, prototype ) { - $.extend( prototype.options, { - animate: null, - animated: "slide" - }); - - var _create = prototype._create; - prototype._create = function() { - var options = this.options; - if ( options.animate === null ) { - if ( !options.animated ) { - options.animate = false; - } else if ( options.animated === "slide" ) { - options.animate = 300; - } else if ( options.animated === "bounceslide" ) { - options.animate = { - duration: 200, - down: { - easing: "easeOutBounce", - duration: 1000 - } - }; - } else { - options.animate = options.animated; - } - } - - _create.call( this ); - }; - }( jQuery, jQuery.ui.accordion.prototype ) ); -} - })( jQuery ); (function( $, undefined ) { -// used to prevent race conditions with remote data sources -var requestIndex = 0; - $.widget( "ui.autocomplete", { - version: "1.9.2", + version: "1.10.4", defaultElement: "<input>", options: { - appendTo: "body", + appendTo: null, autoFocus: false, delay: 300, minLength: 1, @@ -6279,6 +6666,7 @@ $.widget( "ui.autocomplete", { select: null }, + requestIndex: 0, pending: 0, _create: function() { @@ -6289,10 +6677,21 @@ $.widget( "ui.autocomplete", { // so we use the suppressKeyPressRepeat flag to avoid handling keypress // events when we know the keydown event was used to modify the // search term. #7799 - var suppressKeyPress, suppressKeyPressRepeat, suppressInput; - - this.isMultiLine = this._isMultiLine(); - this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ]; + var suppressKeyPress, suppressKeyPressRepeat, suppressInput, + nodeName = this.element[0].nodeName.toLowerCase(), + isTextarea = nodeName === "textarea", + isInput = nodeName === "input"; + + this.isMultiLine = + // Textareas are always multi-line + isTextarea ? true : + // Inputs are always single-line, even if inside a contentEditable element + // IE also treats inputs as contentEditable + isInput ? false : + // All other element types are determined by whether or not they're contentEditable + this.element.prop( "isContentEditable" ); + + this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; this.isNewMenu = true; this.element @@ -6365,7 +6764,9 @@ $.widget( "ui.autocomplete", { keypress: function( event ) { if ( suppressKeyPress ) { suppressKeyPress = false; - event.preventDefault(); + if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { + event.preventDefault(); + } return; } if ( suppressKeyPressRepeat ) { @@ -6415,17 +6816,14 @@ $.widget( "ui.autocomplete", { this._initSource(); this.menu = $( "<ul>" ) - .addClass( "ui-autocomplete" ) - .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] ) + .addClass( "ui-autocomplete ui-front" ) + .appendTo( this._appendTo() ) .menu({ - // custom key handling for now - input: $(), // disable ARIA support, the live region takes care of that role: null }) - .zIndex( this.element.zIndex() + 1 ) .hide() - .data( "menu" ); + .data( "ui-menu" ); this._on( this.menu.element, { mousedown: function( event ) { @@ -6458,7 +6856,8 @@ $.widget( "ui.autocomplete", { } }, menufocus: function( event, ui ) { - // #7024 - Prevent accidental activation of menu items in Firefox + // support: Firefox + // Prevent accidental activation of menu items in Firefox (#7024 #9118) if ( this.isNewMenu ) { this.isNewMenu = false; if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { @@ -6472,9 +6871,7 @@ $.widget( "ui.autocomplete", { } } - // back compat for _renderItem using item.autocomplete, via #7810 - // TODO remove the fallback, see #8156 - var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ); + var item = ui.item.data( "ui-autocomplete-item" ); if ( false !== this._trigger( "focus", event, { item: item } ) ) { // use value to match what will end up in the input, if it was a key event if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { @@ -6490,9 +6887,7 @@ $.widget( "ui.autocomplete", { } }, menuselect: function( event, ui ) { - // back compat for _renderItem using item.autocomplete, via #7810 - // TODO remove the fallback, see #8156 - var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ), + var item = ui.item.data( "ui-autocomplete-item" ), previous = this.previous; // only trigger when focus was lost (click on menu) @@ -6525,11 +6920,7 @@ $.widget( "ui.autocomplete", { "aria-live": "polite" }) .addClass( "ui-helper-hidden-accessible" ) - .insertAfter( this.element ); - - if ( $.fn.bgiframe ) { - this.menu.element.bgiframe(); - } + .insertBefore( this.element ); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete @@ -6556,25 +6947,31 @@ $.widget( "ui.autocomplete", { this._initSource(); } if ( key === "appendTo" ) { - this.menu.element.appendTo( this.document.find( value || "body" )[0] ); + this.menu.element.appendTo( this._appendTo() ); } if ( key === "disabled" && value && this.xhr ) { this.xhr.abort(); } }, - _isMultiLine: function() { - // Textareas are always multi-line - if ( this.element.is( "textarea" ) ) { - return true; + _appendTo: function() { + var element = this.options.appendTo; + + if ( element ) { + element = element.jquery || element.nodeType ? + $( element ) : + this.document.find( element ).eq( 0 ); } - // Inputs are always single-line, even if inside a contentEditable element - // IE also treats inputs as contentEditable - if ( this.element.is( "input" ) ) { - return false; + + if ( !element ) { + element = this.element.closest( ".ui-front" ); + } + + if ( !element.length ) { + element = this.document[0].body; } - // All other element types are determined by whether or not they're contentEditable - return this.element.prop( "isContentEditable" ); + + return element; }, _initSource: function() { @@ -6645,19 +7042,18 @@ $.widget( "ui.autocomplete", { }, _response: function() { - var that = this, - index = ++requestIndex; + var index = ++this.requestIndex; - return function( content ) { - if ( index === requestIndex ) { - that.__response( content ); + return $.proxy(function( content ) { + if ( index === this.requestIndex ) { + this.__response( content ); } - that.pending--; - if ( !that.pending ) { - that.element.removeClass( "ui-autocomplete-loading" ); + this.pending--; + if ( !this.pending ) { + this.element.removeClass( "ui-autocomplete-loading" ); } - }; + }, this ); }, __response: function( content ) { @@ -6714,10 +7110,9 @@ $.widget( "ui.autocomplete", { }, _suggest: function( items ) { - var ul = this.menu.element - .empty() - .zIndex( this.element.zIndex() + 1 ); + var ul = this.menu.element.empty(); this._renderMenu( ul, items ); + this.isNewMenu = true; this.menu.refresh(); // size and position menu @@ -6833,19 +7228,17 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, { } }); - }( jQuery )); (function( $, undefined ) { -var lastActive, startXPos, startYPos, clickDragged, +var lastActive, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - stateClasses = "ui-state-hover ui-state-active ", typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", formResetHandler = function() { - var buttons = $( this ).find( ":ui-button" ); + var form = $( this ); setTimeout(function() { - buttons.button( "refresh" ); + form.find( ":ui-button" ).button( "refresh" ); }, 1 ); }, radioGroup = function( radio ) { @@ -6853,6 +7246,7 @@ var lastActive, startXPos, startYPos, clickDragged, form = radio.form, radios = $( [] ); if ( name ) { + name = name.replace( /'/g, "\\'" ); if ( form ) { radios = $( form ).find( "[name='" + name + "']" ); } else { @@ -6866,7 +7260,7 @@ var lastActive, startXPos, startYPos, clickDragged, }; $.widget( "ui.button", { - version: "1.9.2", + version: "1.10.4", defaultElement: "<button>", options: { disabled: null, @@ -6894,8 +7288,7 @@ $.widget( "ui.button", { var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", - activeClass = !toggleButton ? "ui-state-active" : "", - focusClass = "ui-state-focus"; + activeClass = !toggleButton ? "ui-state-active" : ""; if ( options.label === null ) { options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); @@ -6927,55 +7320,32 @@ $.widget( "ui.button", { } }); - this.element - .bind( "focus" + this.eventNamespace, function() { - // no need to check disabled, focus won't be triggered anyway - that.buttonElement.addClass( focusClass ); - }) - .bind( "blur" + this.eventNamespace, function() { - that.buttonElement.removeClass( focusClass ); - }); + // Can't use _focusable() because the element that receives focus + // and the element that gets the ui-state-focus class are different + this._on({ + focus: function() { + this.buttonElement.addClass( "ui-state-focus" ); + }, + blur: function() { + this.buttonElement.removeClass( "ui-state-focus" ); + } + }); if ( toggleButton ) { this.element.bind( "change" + this.eventNamespace, function() { - if ( clickDragged ) { - return; - } that.refresh(); }); - // if mouse moves between mousedown and mouseup (drag) set clickDragged flag - // prevents issue where button state changes but checkbox/radio checked state - // does not in Firefox (see ticket #6970) - this.buttonElement - .bind( "mousedown" + this.eventNamespace, function( event ) { - if ( options.disabled ) { - return; - } - clickDragged = false; - startXPos = event.pageX; - startYPos = event.pageY; - }) - .bind( "mouseup" + this.eventNamespace, function( event ) { - if ( options.disabled ) { - return; - } - if ( startXPos !== event.pageX || startYPos !== event.pageY ) { - clickDragged = true; - } - }); } if ( this.type === "checkbox" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { - if ( options.disabled || clickDragged ) { + if ( options.disabled ) { return false; } - $( this ).toggleClass( "ui-state-active" ); - that.buttonElement.attr( "aria-pressed", that.element[0].checked ); }); } else if ( this.type === "radio" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { - if ( options.disabled || clickDragged ) { + if ( options.disabled ) { return false; } $( this ).addClass( "ui-state-active" ); @@ -7016,7 +7386,9 @@ $.widget( "ui.button", { $( this ).addClass( "ui-state-active" ); } }) - .bind( "keyup" + this.eventNamespace, function() { + // see #8559, we bind to blur here in case the button element loses + // focus between keydown and keyup, it would be left in an "active" state + .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() { $( this ).removeClass( "ui-state-active" ); }); @@ -7083,7 +7455,7 @@ $.widget( "ui.button", { this.element .removeClass( "ui-helper-hidden-accessible" ); this.buttonElement - .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) + .removeClass( baseClasses + " ui-state-active " + typeClasses ) .removeAttr( "role" ) .removeAttr( "aria-pressed" ) .html( this.buttonElement.find(".ui-button-text").html() ); @@ -7096,10 +7468,9 @@ $.widget( "ui.button", { _setOption: function( key, value ) { this._super( key, value ); if ( key === "disabled" ) { + this.element.prop( "disabled", !!value ); if ( value ) { - this.element.prop( "disabled", true ); - } else { - this.element.prop( "disabled", false ); + this.buttonElement.removeClass( "ui-state-focus" ); } return; } @@ -7183,9 +7554,9 @@ $.widget( "ui.button", { }); $.widget( "ui.buttonset", { - version: "1.9.2", + version: "1.10.4", options: { - items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)" + items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" }, _create: function() { @@ -7243,11 +7614,10 @@ $.widget( "ui.buttonset", { (function( $, undefined ) { -$.extend($.ui, { datepicker: { version: "1.9.2" } }); +$.extend($.ui, { datepicker: { version: "1.10.4" } }); -var PROP_NAME = 'datepicker'; -var dpuuid = new Date().getTime(); -var instActive; +var PROP_NAME = "datepicker", + instActive; /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. @@ -7255,50 +7625,49 @@ var instActive; allowing multiple different settings on the same page. */ function Datepicker() { - this.debug = false; // Change this to true to start debugging this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false; // True if the popup picker is showing , false if not this._inDialog = false; // True if showing within a "dialog", false if not - this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division - this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class - this._appendClass = 'ui-datepicker-append'; // The name of the append marker class - this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class - this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class - this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class - this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class - this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class - this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class + this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division + this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class + this._appendClass = "ui-datepicker-append"; // The name of the append marker class + this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class + this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class + this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class + this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class + this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class + this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - closeText: 'Done', // Display text for close link - prevText: 'Prev', // Display text for previous month link - nextText: 'Next', // Display text for next month link - currentText: 'Today', // Display text for current month link - monthNames: ['January','February','March','April','May','June', - 'July','August','September','October','November','December'], // Names of months for drop-down and formatting - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting - dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday - weekHeader: 'Wk', // Column header for week of the year - dateFormat: 'mm/dd/yy', // See format options on parseDate + this.regional[""] = { // Default regional settings + closeText: "Done", // Display text for close link + prevText: "Prev", // Display text for previous month link + nextText: "Next", // Display text for next month link + currentText: "Today", // Display text for current month link + monthNames: ["January","February","March","April","May","June", + "July","August","September","October","November","December"], // Names of months for drop-down and formatting + monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting + dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting + dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting + dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday + weekHeader: "Wk", // Column header for week of the year + dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year - yearSuffix: '' // Additional text to append to the year in the month headers + yearSuffix: "" // Additional text to append to the year in the month headers }; this._defaults = { // Global defaults for all the date picker instances - showOn: 'focus', // 'focus' for popup on focus, - // 'button' for trigger button, or 'both' for either - showAnim: 'fadeIn', // Name of jQuery animation for popup + showOn: "focus", // "focus" for popup on focus, + // "button" for trigger button, or "both" for either + showAnim: "fadeIn", // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations defaultDate: null, // Used when field is blank: actual date, // +/-number for offset from today, null for today - appendText: '', // Display text following the input box, e.g. showing the format - buttonText: '...', // Text for trigger button - buttonImage: '', // URL for trigger button image + appendText: "", // Display text following the input box, e.g. showing the format + buttonText: "...", // Text for trigger button + buttonImage: "", // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them @@ -7306,7 +7675,7 @@ function Datepicker() { gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: false, // True if month can be selected directly, false if only prev/next changeYear: false, // True if year can be selected directly, false if only prev/next - yearRange: 'c-10:c+10', // Range of years to display in drop-down, + yearRange: "c-10:c+10", // Range of years to display in drop-down, // either relative to today's year (-nn:+nn), relative to currently displayed year // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) showOtherMonths: false, // True to show dates in other months, false to leave blank @@ -7314,14 +7683,14 @@ function Datepicker() { showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it - shortYearCutoff: '+10', // Short year values < this are in the current century, + shortYearCutoff: "+10", // Short year values < this are in the current century, // > this are in the previous century, - // string value starting with '+' for current year + value + // string value starting with "+" for current year + value minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit - duration: 'fast', // Duration of display/closure + duration: "fast", // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker @@ -7332,69 +7701,53 @@ function Datepicker() { showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward stepBigMonths: 12, // Number of months to step back/forward for the big links - altField: '', // Selector for an alternate field to store selected dates into - altFormat: '', // The date format to use for the alternate field + altField: "", // Selector for an alternate field to store selected dates into + altFormat: "", // The date format to use for the alternate field constrainInput: true, // The input is constrained by the current date format showButtonPanel: false, // True to show button panel, false to not show it autoSize: false, // True to size the input for the date format, false to leave as is disabled: false // The initial disabled state }; - $.extend(this._defaults, this.regional['']); - this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')); + $.extend(this._defaults, this.regional[""]); + this.dpDiv = bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); } $.extend(Datepicker.prototype, { /* Class name added to elements to indicate already configured with a date picker. */ - markerClassName: 'hasDatepicker', + markerClassName: "hasDatepicker", //Keep track of the maximum number of rows displayed (see #7043) maxRows: 4, - /* Debug logging (if enabled). */ - log: function () { - if (this.debug) - console.log.apply('', arguments); - }, - // TODO rename to "widget" when switching to widget factory _widgetDatepicker: function() { return this.dpDiv; }, /* Override the default settings for all instances of the date picker. - @param settings object - the new settings to use as defaults (anonymous object) - @return the manager object */ + * @param settings object - the new settings to use as defaults (anonymous object) + * @return the manager object + */ setDefaults: function(settings) { extendRemove(this._defaults, settings || {}); return this; }, /* Attach the date picker to a jQuery selection. - @param target element - the target input field or division or span - @param settings object - the new settings to use for this date picker instance (anonymous) */ + * @param target element - the target input field or division or span + * @param settings object - the new settings to use for this date picker instance (anonymous) + */ _attachDatepicker: function(target, settings) { - // check for settings on the control itself - in namespace 'date:' - var inlineSettings = null; - for (var attrName in this._defaults) { - var attrValue = target.getAttribute('date:' + attrName); - if (attrValue) { - inlineSettings = inlineSettings || {}; - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - var nodeName = target.nodeName.toLowerCase(); - var inline = (nodeName == 'div' || nodeName == 'span'); + var nodeName, inline, inst; + nodeName = target.nodeName.toLowerCase(); + inline = (nodeName === "div" || nodeName === "span"); if (!target.id) { this.uuid += 1; - target.id = 'dp' + this.uuid; + target.id = "dp" + this.uuid; } - var inst = this._newInst($(target), inline); - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); - if (nodeName == 'input') { + inst = this._newInst($(target), inline); + inst.settings = $.extend({}, settings || {}); + if (nodeName === "input") { this._connectDatepicker(target, inst); } else if (inline) { this._inlineDatepicker(target, inst); @@ -7403,13 +7756,13 @@ $.extend(Datepicker.prototype, { /* Create a new instance object. */ _newInst: function(target, inline) { - var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars + var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars return {id: id, input: target, // associated target selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection drawMonth: 0, drawYear: 0, // month being drawn inline: inline, // is datepicker inline or not dpDiv: (!inline ? this.dpDiv : // presentation div - bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}; + bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))}; }, /* Attach the date picker to an input field. */ @@ -7417,16 +7770,12 @@ $.extend(Datepicker.prototype, { var input = $(target); inst.append = $([]); inst.trigger = $([]); - if (input.hasClass(this.markerClassName)) + if (input.hasClass(this.markerClassName)) { return; + } this._attachments(input, inst); input.addClass(this.markerClassName).keydown(this._doKeyDown). - keypress(this._doKeyPress).keyup(this._doKeyUp). - bind("setData.datepicker", function(event, key, value) { - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key) { - return this._get(inst, key); - }); + keypress(this._doKeyPress).keyup(this._doKeyUp); this._autoSize(inst); $.data(target, PROP_NAME, inst); //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) @@ -7437,38 +7786,47 @@ $.extend(Datepicker.prototype, { /* Make attachments based on settings. */ _attachments: function(input, inst) { - var appendText = this._get(inst, 'appendText'); - var isRTL = this._get(inst, 'isRTL'); - if (inst.append) + var showOn, buttonText, buttonImage, + appendText = this._get(inst, "appendText"), + isRTL = this._get(inst, "isRTL"); + + if (inst.append) { inst.append.remove(); + } if (appendText) { - inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); - input[isRTL ? 'before' : 'after'](inst.append); + inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); + input[isRTL ? "before" : "after"](inst.append); } - input.unbind('focus', this._showDatepicker); - if (inst.trigger) + + input.unbind("focus", this._showDatepicker); + + if (inst.trigger) { inst.trigger.remove(); - var showOn = this._get(inst, 'showOn'); - if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field + } + + showOn = this._get(inst, "showOn"); + if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field input.focus(this._showDatepicker); - if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked - var buttonText = this._get(inst, 'buttonText'); - var buttonImage = this._get(inst, 'buttonImage'); - inst.trigger = $(this._get(inst, 'buttonImageOnly') ? - $('<img/>').addClass(this._triggerClass). + } + if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked + buttonText = this._get(inst, "buttonText"); + buttonImage = this._get(inst, "buttonImage"); + inst.trigger = $(this._get(inst, "buttonImageOnly") ? + $("<img/>").addClass(this._triggerClass). attr({ src: buttonImage, alt: buttonText, title: buttonText }) : - $('<button type="button"></button>').addClass(this._triggerClass). - html(buttonImage == '' ? buttonText : $('<img/>').attr( + $("<button type='button'></button>").addClass(this._triggerClass). + html(!buttonImage ? buttonText : $("<img/>").attr( { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? 'before' : 'after'](inst.trigger); + input[isRTL ? "before" : "after"](inst.trigger); inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) + if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { $.datepicker._hideDatepicker(); - else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { + } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { $.datepicker._hideDatepicker(); $.datepicker._showDatepicker(input[0]); - } else + } else { $.datepicker._showDatepicker(input[0]); + } return false; }); } @@ -7476,14 +7834,16 @@ $.extend(Datepicker.prototype, { /* Apply the maximum length for the date format. */ _autoSize: function(inst) { - if (this._get(inst, 'autoSize') && !inst.inline) { - var date = new Date(2009, 12 - 1, 20); // Ensure double digits - var dateFormat = this._get(inst, 'dateFormat'); + if (this._get(inst, "autoSize") && !inst.inline) { + var findMax, max, maxI, i, + date = new Date(2009, 12 - 1, 20), // Ensure double digits + dateFormat = this._get(inst, "dateFormat"); + if (dateFormat.match(/[DM]/)) { - var findMax = function(names) { - var max = 0; - var maxI = 0; - for (var i = 0; i < names.length; i++) { + findMax = function(names) { + max = 0; + maxI = 0; + for (i = 0; i < names.length; i++) { if (names[i].length > max) { max = names[i].length; maxI = i; @@ -7492,25 +7852,21 @@ $.extend(Datepicker.prototype, { return maxI; }; date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? - 'monthNames' : 'monthNamesShort')))); + "monthNames" : "monthNamesShort")))); date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? - 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); + "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); } - inst.input.attr('size', this._formatDate(inst, date).length); + inst.input.attr("size", this._formatDate(inst, date).length); } }, /* Attach an inline date picker to a div. */ _inlineDatepicker: function(target, inst) { var divSpan = $(target); - if (divSpan.hasClass(this.markerClassName)) + if (divSpan.hasClass(this.markerClassName)) { return; - divSpan.addClass(this.markerClassName).append(inst.dpDiv). - bind("setData.datepicker", function(event, key, value){ - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key){ - return this._get(inst, key); - }); + } + divSpan.addClass(this.markerClassName).append(inst.dpDiv); $.data(target, PROP_NAME, inst); this._setDate(inst, this._getDefaultDate(inst), true); this._updateDatepicker(inst); @@ -7525,186 +7881,219 @@ $.extend(Datepicker.prototype, { }, /* Pop-up the date picker in a "dialog" box. - @param input element - ignored - @param date string or Date - the initial date to display - @param onSelect function - the function to call when a date is selected - @param settings object - update the dialog date picker instance's settings (anonymous object) - @param pos int[2] - coordinates for the dialog's position within the screen or - event - with x/y coordinates or - leave empty for default (screen centre) - @return the manager object */ + * @param input element - ignored + * @param date string or Date - the initial date to display + * @param onSelect function - the function to call when a date is selected + * @param settings object - update the dialog date picker instance's settings (anonymous object) + * @param pos int[2] - coordinates for the dialog's position within the screen or + * event - with x/y coordinates or + * leave empty for default (screen centre) + * @return the manager object + */ _dialogDatepicker: function(input, date, onSelect, settings, pos) { - var inst = this._dialogInst; // internal instance + var id, browserWidth, browserHeight, scrollX, scrollY, + inst = this._dialogInst; // internal instance + if (!inst) { this.uuid += 1; - var id = 'dp' + this.uuid; - this._dialogInput = $('<input type="text" id="' + id + - '" style="position: absolute; top: -100px; width: 0px;"/>'); + id = "dp" + this.uuid; + this._dialogInput = $("<input type='text' id='" + id + + "' style='position: absolute; top: -100px; width: 0px;'/>"); this._dialogInput.keydown(this._doKeyDown); - $('body').append(this._dialogInput); + $("body").append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); inst.settings = {}; $.data(this._dialogInput[0], PROP_NAME, inst); } extendRemove(inst.settings, settings || {}); - date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); + date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); this._dialogInput.val(date); this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); if (!this._pos) { - var browserWidth = document.documentElement.clientWidth; - var browserHeight = document.documentElement.clientHeight; - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; - var scrollY = document.documentElement.scrollTop || document.body.scrollTop; + browserWidth = document.documentElement.clientWidth; + browserHeight = document.documentElement.clientHeight; + scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; + scrollY = document.documentElement.scrollTop || document.body.scrollTop; this._pos = // should use actual width/height below [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; } // move input on screen for focus, but hidden behind dialog - this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); + this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); inst.settings.onSelect = onSelect; this._inDialog = true; this.dpDiv.addClass(this._dialogClass); this._showDatepicker(this._dialogInput[0]); - if ($.blockUI) + if ($.blockUI) { $.blockUI(this.dpDiv); + } $.data(this._dialogInput[0], PROP_NAME, inst); return this; }, /* Detach a datepicker from its control. - @param target element - the target input field or division or span */ + * @param target element - the target input field or division or span + */ _destroyDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); + var nodeName, + $target = $(target), + inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { return; } - var nodeName = target.nodeName.toLowerCase(); + + nodeName = target.nodeName.toLowerCase(); $.removeData(target, PROP_NAME); - if (nodeName == 'input') { + if (nodeName === "input") { inst.append.remove(); inst.trigger.remove(); $target.removeClass(this.markerClassName). - unbind('focus', this._showDatepicker). - unbind('keydown', this._doKeyDown). - unbind('keypress', this._doKeyPress). - unbind('keyup', this._doKeyUp); - } else if (nodeName == 'div' || nodeName == 'span') + unbind("focus", this._showDatepicker). + unbind("keydown", this._doKeyDown). + unbind("keypress", this._doKeyPress). + unbind("keyup", this._doKeyUp); + } else if (nodeName === "div" || nodeName === "span") { $target.removeClass(this.markerClassName).empty(); + } }, /* Enable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ + * @param target element - the target input field or division or span + */ _enableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); + var nodeName, inline, + $target = $(target), + inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { return; } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { + + nodeName = target.nodeName.toLowerCase(); + if (nodeName === "input") { target.disabled = false; - inst.trigger.filter('button'). + inst.trigger.filter("button"). each(function() { this.disabled = false; }).end(). - filter('img').css({opacity: '1.0', cursor: ''}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().removeClass('ui-state-disabled'); + filter("img").css({opacity: "1.0", cursor: ""}); + } else if (nodeName === "div" || nodeName === "span") { + inline = $target.children("." + this._inlineClass); + inline.children().removeClass("ui-state-disabled"); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). prop("disabled", false); } this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry + function(value) { return (value === target ? null : value); }); // delete entry }, /* Disable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ + * @param target element - the target input field or division or span + */ _disableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); + var nodeName, inline, + $target = $(target), + inst = $.data(target, PROP_NAME); + if (!$target.hasClass(this.markerClassName)) { return; } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { + + nodeName = target.nodeName.toLowerCase(); + if (nodeName === "input") { target.disabled = true; - inst.trigger.filter('button'). + inst.trigger.filter("button"). each(function() { this.disabled = true; }).end(). - filter('img').css({opacity: '0.5', cursor: 'default'}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().addClass('ui-state-disabled'); + filter("img").css({opacity: "0.5", cursor: "default"}); + } else if (nodeName === "div" || nodeName === "span") { + inline = $target.children("." + this._inlineClass); + inline.children().addClass("ui-state-disabled"); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). prop("disabled", true); } this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry + function(value) { return (value === target ? null : value); }); // delete entry this._disabledInputs[this._disabledInputs.length] = target; }, /* Is the first field in a jQuery collection disabled as a datepicker? - @param target element - the target input field or division or span - @return boolean - true if disabled, false if enabled */ + * @param target element - the target input field or division or span + * @return boolean - true if disabled, false if enabled + */ _isDisabledDatepicker: function(target) { if (!target) { return false; } for (var i = 0; i < this._disabledInputs.length; i++) { - if (this._disabledInputs[i] == target) + if (this._disabledInputs[i] === target) { return true; + } } return false; }, /* Retrieve the instance data for the target control. - @param target element - the target input field or division or span - @return object - the associated instance data - @throws error if a jQuery problem getting data */ + * @param target element - the target input field or division or span + * @return object - the associated instance data + * @throws error if a jQuery problem getting data + */ _getInst: function(target) { try { return $.data(target, PROP_NAME); } catch (err) { - throw 'Missing instance data for this datepicker'; + throw "Missing instance data for this datepicker"; } }, /* Update or retrieve the settings for a date picker attached to an input field or division. - @param target element - the target input field or division or span - @param name object - the new settings to update or - string - the name of the setting to change or retrieve, - when retrieving also 'all' for all instance settings or - 'defaults' for all global defaults - @param value any - the new value for the setting - (omit if above is an object or to retrieve a value) */ + * @param target element - the target input field or division or span + * @param name object - the new settings to update or + * string - the name of the setting to change or retrieve, + * when retrieving also "all" for all instance settings or + * "defaults" for all global defaults + * @param value any - the new value for the setting + * (omit if above is an object or to retrieve a value) + */ _optionDatepicker: function(target, name, value) { - var inst = this._getInst(target); - if (arguments.length == 2 && typeof name == 'string') { - return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : - (inst ? (name == 'all' ? $.extend({}, inst.settings) : + var settings, date, minDate, maxDate, + inst = this._getInst(target); + + if (arguments.length === 2 && typeof name === "string") { + return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : + (inst ? (name === "all" ? $.extend({}, inst.settings) : this._get(inst, name)) : null)); } - var settings = name || {}; - if (typeof name == 'string') { + + settings = name || {}; + if (typeof name === "string") { settings = {}; settings[name] = value; } + if (inst) { - if (this._curInst == inst) { + if (this._curInst === inst) { this._hideDatepicker(); } - var date = this._getDateDatepicker(target, true); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); + + date = this._getDateDatepicker(target, true); + minDate = this._getMinMaxDate(inst, "min"); + maxDate = this._getMinMaxDate(inst, "max"); extendRemove(inst.settings, settings); // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided - if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) + if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { inst.settings.minDate = this._formatDate(inst, minDate); - if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) + } + if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { inst.settings.maxDate = this._formatDate(inst, maxDate); + } + if ( "disabled" in settings ) { + if ( settings.disabled ) { + this._disableDatepicker(target); + } else { + this._enableDatepicker(target); + } + } this._attachments($(target), inst); this._autoSize(inst); this._setDate(inst, date); @@ -7719,7 +8108,8 @@ $.extend(Datepicker.prototype, { }, /* Redraw the date picker attached to an input field or division. - @param target element - the target input field or division or span */ + * @param target element - the target input field or division or span + */ _refreshDatepicker: function(target) { var inst = this._getInst(target); if (inst) { @@ -7728,8 +8118,9 @@ $.extend(Datepicker.prototype, { }, /* Set the dates for a jQuery selection. - @param target element - the target input field or division or span - @param date Date - the new date */ + * @param target element - the target input field or division or span + * @param date Date - the new date + */ _setDateDatepicker: function(target, date) { var inst = this._getInst(target); if (inst) { @@ -7740,87 +8131,110 @@ $.extend(Datepicker.prototype, { }, /* Get the date(s) for the first entry in a jQuery selection. - @param target element - the target input field or division or span - @param noDefault boolean - true if no default date is to be used - @return Date - the current date */ + * @param target element - the target input field or division or span + * @param noDefault boolean - true if no default date is to be used + * @return Date - the current date + */ _getDateDatepicker: function(target, noDefault) { var inst = this._getInst(target); - if (inst && !inst.inline) + if (inst && !inst.inline) { this._setDateFromField(inst, noDefault); + } return (inst ? this._getDate(inst) : null); }, /* Handle keystrokes. */ _doKeyDown: function(event) { - var inst = $.datepicker._getInst(event.target); - var handled = true; - var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); + var onSelect, dateStr, sel, + inst = $.datepicker._getInst(event.target), + handled = true, + isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); + inst._keyEvent = true; - if ($.datepicker._datepickerShowing) + if ($.datepicker._datepickerShowing) { switch (event.keyCode) { case 9: $.datepicker._hideDatepicker(); handled = false; break; // hide on tab out - case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + - $.datepicker._currentClass + ')', inst.dpDiv); - if (sel[0]) + case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + + $.datepicker._currentClass + ")", inst.dpDiv); + if (sel[0]) { $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); - var onSelect = $.datepicker._get(inst, 'onSelect'); - if (onSelect) { - var dateStr = $.datepicker._formatDate(inst); + } - // trigger custom callback - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); - } - else + onSelect = $.datepicker._get(inst, "onSelect"); + if (onSelect) { + dateStr = $.datepicker._formatDate(inst); + + // trigger custom callback + onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); + } else { $.datepicker._hideDatepicker(); + } + return false; // don't submit the form - break; // select the value on enter case 27: $.datepicker._hideDatepicker(); break; // hide on escape case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); + -$.datepicker._get(inst, "stepBigMonths") : + -$.datepicker._get(inst, "stepMonths")), "M"); break; // previous month/year on page up/+ ctrl case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); + +$.datepicker._get(inst, "stepBigMonths") : + +$.datepicker._get(inst, "stepMonths")), "M"); break; // next month/year on page down/+ ctrl - case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); + case 35: if (event.ctrlKey || event.metaKey) { + $.datepicker._clearDate(event.target); + } handled = event.ctrlKey || event.metaKey; break; // clear on ctrl or command +end - case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); + case 36: if (event.ctrlKey || event.metaKey) { + $.datepicker._gotoToday(event.target); + } handled = event.ctrlKey || event.metaKey; break; // current on ctrl or command +home - case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); + case 37: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); + } handled = event.ctrlKey || event.metaKey; // -1 day on ctrl or command +left - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); + if (event.originalEvent.altKey) { + $.datepicker._adjustDate(event.target, (event.ctrlKey ? + -$.datepicker._get(inst, "stepBigMonths") : + -$.datepicker._get(inst, "stepMonths")), "M"); + } // next month/year on alt +left on Mac break; - case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); + case 38: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, -7, "D"); + } handled = event.ctrlKey || event.metaKey; break; // -1 week on ctrl or command +up - case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); + case 39: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); + } handled = event.ctrlKey || event.metaKey; // +1 day on ctrl or command +right - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); + if (event.originalEvent.altKey) { + $.datepicker._adjustDate(event.target, (event.ctrlKey ? + +$.datepicker._get(inst, "stepBigMonths") : + +$.datepicker._get(inst, "stepMonths")), "M"); + } // next month/year on alt +right break; - case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); + case 40: if (event.ctrlKey || event.metaKey) { + $.datepicker._adjustDate(event.target, +7, "D"); + } handled = event.ctrlKey || event.metaKey; break; // +1 week on ctrl or command +down default: handled = false; } - else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home + } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home $.datepicker._showDatepicker(this); - else { + } else { handled = false; } + if (handled) { event.preventDefault(); event.stopPropagation(); @@ -7829,22 +8243,27 @@ $.extend(Datepicker.prototype, { /* Filter entered characters - based on date format. */ _doKeyPress: function(event) { - var inst = $.datepicker._getInst(event.target); - if ($.datepicker._get(inst, 'constrainInput')) { - var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); - var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); - return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); + var chars, chr, + inst = $.datepicker._getInst(event.target); + + if ($.datepicker._get(inst, "constrainInput")) { + chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); + chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); + return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); } }, /* Synchronise manual entry and field/alternate field. */ _doKeyUp: function(event) { - var inst = $.datepicker._getInst(event.target); - if (inst.input.val() != inst.lastVal) { + var date, + inst = $.datepicker._getInst(event.target); + + if (inst.input.val() !== inst.lastVal) { try { - var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), + date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), (inst.input ? inst.input.val() : null), $.datepicker._getFormatConfig(inst)); + if (date) { // only if valid $.datepicker._setDateFromField(inst); $.datepicker._updateAlternate(inst); @@ -7852,86 +8271,92 @@ $.extend(Datepicker.prototype, { } } catch (err) { - $.datepicker.log(err); } } return true; }, /* Pop-up the date picker for a given input field. - If false returned from beforeShow event handler do not show. - @param input element - the input field attached to the date picker or - event - if triggered by focus */ + * If false returned from beforeShow event handler do not show. + * @param input element - the input field attached to the date picker or + * event - if triggered by focus + */ _showDatepicker: function(input) { input = input.target || input; - if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger - input = $('input', input.parentNode)[0]; - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here + if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger + input = $("input", input.parentNode)[0]; + } + + if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here return; - var inst = $.datepicker._getInst(input); - if ($.datepicker._curInst && $.datepicker._curInst != inst) { + } + + var inst, beforeShow, beforeShowSettings, isFixed, + offset, showAnim, duration; + + inst = $.datepicker._getInst(input); + if ($.datepicker._curInst && $.datepicker._curInst !== inst) { $.datepicker._curInst.dpDiv.stop(true, true); if ( inst && $.datepicker._datepickerShowing ) { $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); } } - var beforeShow = $.datepicker._get(inst, 'beforeShow'); - var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; + + beforeShow = $.datepicker._get(inst, "beforeShow"); + beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; if(beforeShowSettings === false){ - //false return; } extendRemove(inst.settings, beforeShowSettings); + inst.lastVal = null; $.datepicker._lastInput = input; $.datepicker._setDateFromField(inst); - if ($.datepicker._inDialog) // hide cursor - input.value = ''; + + if ($.datepicker._inDialog) { // hide cursor + input.value = ""; + } if (!$.datepicker._pos) { // position below input $.datepicker._pos = $.datepicker._findPos(input); $.datepicker._pos[1] += input.offsetHeight; // add the height } - var isFixed = false; + + isFixed = false; $(input).parents().each(function() { - isFixed |= $(this).css('position') == 'fixed'; + isFixed |= $(this).css("position") === "fixed"; return !isFixed; }); - var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; + + offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; $.datepicker._pos = null; //to avoid flashes on Firefox inst.dpDiv.empty(); // determine sizing offscreen - inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); + inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"}); $.datepicker._updateDatepicker(inst); // fix width for dynamic number of date pickers // and adjust position before showing offset = $.datepicker._checkOffset(inst, offset, isFixed); inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? - 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', - left: offset.left + 'px', top: offset.top + 'px'}); + "static" : (isFixed ? "fixed" : "absolute")), display: "none", + left: offset.left + "px", top: offset.top + "px"}); + if (!inst.inline) { - var showAnim = $.datepicker._get(inst, 'showAnim'); - var duration = $.datepicker._get(inst, 'duration'); - var postProcess = function() { - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !! cover.length ){ - var borders = $.datepicker._getBorders(inst.dpDiv); - cover.css({left: -borders[0], top: -borders[1], - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); - } - }; + showAnim = $.datepicker._get(inst, "showAnim"); + duration = $.datepicker._get(inst, "duration"); inst.dpDiv.zIndex($(input).zIndex()+1); $.datepicker._datepickerShowing = true; - // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed - if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) - inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); - if (!showAnim || !duration) - postProcess(); - if (inst.input.is(':visible') && !inst.input.is(':disabled')) + if ( $.effects && $.effects.effect[ showAnim ] ) { + inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); + } else { + inst.dpDiv[showAnim || "show"](showAnim ? duration : null); + } + + if ( $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); + } + $.datepicker._curInst = inst; } }, @@ -7939,66 +8364,61 @@ $.extend(Datepicker.prototype, { /* Generate the date picker content. */ _updateDatepicker: function(inst) { this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) - var borders = $.datepicker._getBorders(inst.dpDiv); instActive = inst; // for delegate hover events inst.dpDiv.empty().append(this._generateHTML(inst)); this._attachHandlers(inst); - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 - cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) - } - inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); - var numMonths = this._getNumberOfMonths(inst); - var cols = numMonths[1]; - var width = 17; - inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); - if (cols > 1) - inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); - inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + - 'Class']('ui-datepicker-multi'); - inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + - 'Class']('ui-datepicker-rtl'); - if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && - // #6694 - don't focus the input if it's already focused - // this breaks the change event in IE - inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) + inst.dpDiv.find("." + this._dayOverClass + " a").mouseover(); + + var origyearshtml, + numMonths = this._getNumberOfMonths(inst), + cols = numMonths[1], + width = 17; + + inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); + if (cols > 1) { + inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); + } + inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + + "Class"]("ui-datepicker-multi"); + inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + + "Class"]("ui-datepicker-rtl"); + + if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); + } + // deffered render of the years select (to avoid flashes on Firefox) if( inst.yearshtml ){ - var origyearshtml = inst.yearshtml; + origyearshtml = inst.yearshtml; setTimeout(function(){ //assure that inst.yearshtml didn't change. if( origyearshtml === inst.yearshtml && inst.yearshtml ){ - inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); + inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); } origyearshtml = inst.yearshtml = null; }, 0); } }, - /* Retrieve the size of left and top borders for an element. - @param elem (jQuery object) the element of interest - @return (number[2]) the left and top borders */ - _getBorders: function(elem) { - var convert = function(value) { - return {thin: 1, medium: 2, thick: 3}[value] || value; - }; - return [parseFloat(convert(elem.css('border-left-width'))), - parseFloat(convert(elem.css('border-top-width')))]; + // #6694 - don't focus the input if it's already focused + // this breaks the change event in IE + // Support: IE and jQuery <1.9 + _shouldFocusInput: function( inst ) { + return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); }, /* Check positioning to remain on screen. */ _checkOffset: function(inst, offset, isFixed) { - var dpWidth = inst.dpDiv.outerWidth(); - var dpHeight = inst.dpDiv.outerHeight(); - var inputWidth = inst.input ? inst.input.outerWidth() : 0; - var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); - var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); + var dpWidth = inst.dpDiv.outerWidth(), + dpHeight = inst.dpDiv.outerHeight(), + inputWidth = inst.input ? inst.input.outerWidth() : 0, + inputHeight = inst.input ? inst.input.outerHeight() : 0, + viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), + viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); - offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); - offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; - offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; + offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); + offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; + offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; // now check if datepicker is showing outside window viewport - move to a better place if so. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? @@ -8011,47 +8431,60 @@ $.extend(Datepicker.prototype, { /* Find an object's position on the screen. */ _findPos: function(obj) { - var inst = this._getInst(obj); - var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; + var position, + inst = this._getInst(obj), + isRTL = this._get(inst, "isRTL"); + + while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { + obj = obj[isRTL ? "previousSibling" : "nextSibling"]; } - var position = $(obj).offset(); + + position = $(obj).offset(); return [position.left, position.top]; }, /* Hide the date picker from view. - @param input element - the input field attached to the date picker */ + * @param input element - the input field attached to the date picker + */ _hideDatepicker: function(input) { - var inst = this._curInst; - if (!inst || (input && inst != $.data(input, PROP_NAME))) + var showAnim, duration, postProcess, onClose, + inst = this._curInst; + + if (!inst || (input && inst !== $.data(input, PROP_NAME))) { return; + } + if (this._datepickerShowing) { - var showAnim = this._get(inst, 'showAnim'); - var duration = this._get(inst, 'duration'); - var postProcess = function() { + showAnim = this._get(inst, "showAnim"); + duration = this._get(inst, "duration"); + postProcess = function() { $.datepicker._tidyDialog(inst); }; // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed - if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : - (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); - if (!showAnim) + if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { + inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); + } else { + inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : + (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); + } + + if (!showAnim) { postProcess(); + } this._datepickerShowing = false; - var onClose = this._get(inst, 'onClose'); - if (onClose) - onClose.apply((inst.input ? inst.input[0] : null), - [(inst.input ? inst.input.val() : ''), inst]); + + onClose = this._get(inst, "onClose"); + if (onClose) { + onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); + } + this._lastInput = null; if (this._inDialog) { - this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); + this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); if ($.blockUI) { $.unblockUI(); - $('body').append(this.dpDiv); + $("body").append(this.dpDiv); } } this._inDialog = false; @@ -8060,50 +8493,54 @@ $.extend(Datepicker.prototype, { /* Tidy up after a dialog display. */ _tidyDialog: function(inst) { - inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); + inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); }, /* Close date picker if clicked elsewhere. */ _checkExternalClick: function(event) { - if (!$.datepicker._curInst) + if (!$.datepicker._curInst) { return; + } var $target = $(event.target), inst = $.datepicker._getInst($target[0]); - if ( ( ( $target[0].id != $.datepicker._mainDivId && - $target.parents('#' + $.datepicker._mainDivId).length == 0 && + if ( ( ( $target[0].id !== $.datepicker._mainDivId && + $target.parents("#" + $.datepicker._mainDivId).length === 0 && !$target.hasClass($.datepicker.markerClassName) && !$target.closest("." + $.datepicker._triggerClass).length && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || - ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) ) - $.datepicker._hideDatepicker(); + ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) { + $.datepicker._hideDatepicker(); + } }, /* Adjust one of the date sub-fields. */ _adjustDate: function(id, offset, period) { - var target = $(id); - var inst = this._getInst(target[0]); + var target = $(id), + inst = this._getInst(target[0]); + if (this._isDisabledDatepicker(target[0])) { return; } this._adjustInstDate(inst, offset + - (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning period); this._updateDatepicker(inst); }, /* Action for current link. */ _gotoToday: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._get(inst, 'gotoCurrent') && inst.currentDay) { + var date, + target = $(id), + inst = this._getInst(target[0]); + + if (this._get(inst, "gotoCurrent") && inst.currentDay) { inst.selectedDay = inst.currentDay; inst.drawMonth = inst.selectedMonth = inst.currentMonth; inst.drawYear = inst.selectedYear = inst.currentYear; - } - else { - var date = new Date(); + } else { + date = new Date(); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); @@ -8114,23 +8551,28 @@ $.extend(Datepicker.prototype, { /* Action for selecting a new month/year. */ _selectMonthYear: function(id, select, period) { - var target = $(id); - var inst = this._getInst(target[0]); - inst['selected' + (period == 'M' ? 'Month' : 'Year')] = - inst['draw' + (period == 'M' ? 'Month' : 'Year')] = + var target = $(id), + inst = this._getInst(target[0]); + + inst["selected" + (period === "M" ? "Month" : "Year")] = + inst["draw" + (period === "M" ? "Month" : "Year")] = parseInt(select.options[select.selectedIndex].value,10); + this._notifyChange(inst); this._adjustDate(target); }, /* Action for selecting a day. */ _selectDay: function(id, month, year, td) { - var target = $(id); + var inst, + target = $(id); + if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { return; } - var inst = this._getInst(target[0]); - inst.selectedDay = inst.currentDay = $('a', td).html(); + + inst = this._getInst(target[0]); + inst.selectedDay = inst.currentDay = $("a", td).html(); inst.selectedMonth = inst.currentMonth = month; inst.selectedYear = inst.currentYear = year; this._selectDate(id, this._formatDate(inst, @@ -8140,372 +8582,427 @@ $.extend(Datepicker.prototype, { /* Erase the input field and hide the date picker. */ _clearDate: function(id) { var target = $(id); - var inst = this._getInst(target[0]); - this._selectDate(target, ''); + this._selectDate(target, ""); }, /* Update the input field with the selected date. */ _selectDate: function(id, dateStr) { - var target = $(id); - var inst = this._getInst(target[0]); + var onSelect, + target = $(id), + inst = this._getInst(target[0]); + dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); - if (inst.input) + if (inst.input) { inst.input.val(dateStr); + } this._updateAlternate(inst); - var onSelect = this._get(inst, 'onSelect'); - if (onSelect) + + onSelect = this._get(inst, "onSelect"); + if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback - else if (inst.input) - inst.input.trigger('change'); // fire the change event - if (inst.inline) + } else if (inst.input) { + inst.input.trigger("change"); // fire the change event + } + + if (inst.inline){ this._updateDatepicker(inst); - else { + } else { this._hideDatepicker(); this._lastInput = inst.input[0]; - if (typeof(inst.input[0]) != 'object') + if (typeof(inst.input[0]) !== "object") { inst.input.focus(); // restore focus + } this._lastInput = null; } }, /* Update any alternate field to synchronise with the main field. */ _updateAlternate: function(inst) { - var altField = this._get(inst, 'altField'); + var altFormat, date, dateStr, + altField = this._get(inst, "altField"); + if (altField) { // update alternate field too - var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); - var date = this._getDate(inst); - var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); + altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); + date = this._getDate(inst); + dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); $(altField).each(function() { $(this).val(dateStr); }); } }, /* Set as beforeShowDay function to prevent selection of weekends. - @param date Date - the date to customise - @return [boolean, string] - is this date selectable?, what is its CSS class? */ + * @param date Date - the date to customise + * @return [boolean, string] - is this date selectable?, what is its CSS class? + */ noWeekends: function(date) { var day = date.getDay(); - return [(day > 0 && day < 6), '']; + return [(day > 0 && day < 6), ""]; }, /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. - @param date Date - the date to get the week for - @return number - the number of the week within the year that contains this date */ + * @param date Date - the date to get the week for + * @return number - the number of the week within the year that contains this date + */ iso8601Week: function(date) { - var checkDate = new Date(date.getTime()); + var time, + checkDate = new Date(date.getTime()); + // Find Thursday of this week starting on Monday checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - var time = checkDate.getTime(); + + time = checkDate.getTime(); checkDate.setMonth(0); // Compare with Jan 1 checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }, /* Parse a string value into a date object. - See formatDate below for the possible formats. - - @param format string - the expected format of the date - @param value string - the date in the above format - @param settings Object - attributes include: - shortYearCutoff number - the cutoff year for determining the century (optional) - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return Date - the extracted date value or null if value is blank */ + * See formatDate below for the possible formats. + * + * @param format string - the expected format of the date + * @param value string - the date in the above format + * @param settings Object - attributes include: + * shortYearCutoff number - the cutoff year for determining the century (optional) + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return Date - the extracted date value or null if value is blank + */ parseDate: function (format, value, settings) { - if (format == null || value == null) - throw 'Invalid arguments'; - value = (typeof value == 'object' ? value.toString() : value + ''); - if (value == '') + if (format == null || value == null) { + throw "Invalid arguments"; + } + + value = (typeof value === "object" ? value.toString() : value + ""); + if (value === "") { return null; - var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - var year = -1; - var month = -1; - var day = -1; - var doy = -1; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Extract a number from the string value - var getNumber = function(match) { - var isDoubled = lookAhead(match); - var size = (match == '@' ? 14 : (match == '!' ? 20 : - (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); - var digits = new RegExp('^\\d{1,' + size + '}'); - var num = value.substring(iValue).match(digits); - if (!num) - throw 'Missing number at position ' + iValue; - iValue += num[0].length; - return parseInt(num[0], 10); - }; - // Extract a name from the string value and convert to an index - var getName = function(match, shortNames, longNames) { - var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { - return [ [k, v] ]; - }).sort(function (a, b) { - return -(a[1].length - b[1].length); - }); - var index = -1; - $.each(names, function (i, pair) { - var name = pair[1]; - if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) { - index = pair[0]; - iValue += name.length; - return false; + } + + var iFormat, dim, extra, + iValue = 0, + shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, + shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : + new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), + dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, + dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, + monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, + monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, + year = -1, + month = -1, + day = -1, + doy = -1, + literal = false, + date, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }, + // Extract a number from the string value + getNumber = function(match) { + var isDoubled = lookAhead(match), + size = (match === "@" ? 14 : (match === "!" ? 20 : + (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), + digits = new RegExp("^\\d{1," + size + "}"), + num = value.substring(iValue).match(digits); + if (!num) { + throw "Missing number at position " + iValue; + } + iValue += num[0].length; + return parseInt(num[0], 10); + }, + // Extract a name from the string value and convert to an index + getName = function(match, shortNames, longNames) { + var index = -1, + names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { + return [ [k, v] ]; + }).sort(function (a, b) { + return -(a[1].length - b[1].length); + }); + + $.each(names, function (i, pair) { + var name = pair[1]; + if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { + index = pair[0]; + iValue += name.length; + return false; + } + }); + if (index !== -1) { + return index + 1; + } else { + throw "Unknown name at position " + iValue; } - }); - if (index != -1) - return index + 1; - else - throw 'Unknown name at position ' + iValue; - }; - // Confirm that a literal character matches the string value - var checkLiteral = function() { - if (value.charAt(iValue) != format.charAt(iFormat)) - throw 'Unexpected literal at position ' + iValue; - iValue++; - }; - var iValue = 0; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) + }, + // Confirm that a literal character matches the string value + checkLiteral = function() { + if (value.charAt(iValue) !== format.charAt(iFormat)) { + throw "Unexpected literal at position " + iValue; + } + iValue++; + }; + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; - else + } else { checkLiteral(); - else + } + } else { switch (format.charAt(iFormat)) { - case 'd': - day = getNumber('d'); + case "d": + day = getNumber("d"); break; - case 'D': - getName('D', dayNamesShort, dayNames); + case "D": + getName("D", dayNamesShort, dayNames); break; - case 'o': - doy = getNumber('o'); + case "o": + doy = getNumber("o"); break; - case 'm': - month = getNumber('m'); + case "m": + month = getNumber("m"); break; - case 'M': - month = getName('M', monthNamesShort, monthNames); + case "M": + month = getName("M", monthNamesShort, monthNames); break; - case 'y': - year = getNumber('y'); + case "y": + year = getNumber("y"); break; - case '@': - var date = new Date(getNumber('@')); + case "@": + date = new Date(getNumber("@")); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; - case '!': - var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); + case "!": + date = new Date((getNumber("!") - this._ticksTo1970) / 10000); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "'": - if (lookAhead("'")) + if (lookAhead("'")){ checkLiteral(); - else + } else { literal = true; + } break; default: checkLiteral(); } + } } + if (iValue < value.length){ - var extra = value.substr(iValue); + extra = value.substr(iValue); if (!/^\s+/.test(extra)) { throw "Extra/unparsed characters found in date: " + extra; } } - if (year == -1) + + if (year === -1) { year = new Date().getFullYear(); - else if (year < 100) + } else if (year < 100) { year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100); + } + if (doy > -1) { month = 1; day = doy; do { - var dim = this._getDaysInMonth(year, month - 1); - if (day <= dim) + dim = this._getDaysInMonth(year, month - 1); + if (day <= dim) { break; + } month++; day -= dim; } while (true); } - var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) - throw 'Invalid date'; // E.g. 31/02/00 + + date = this._daylightSavingAdjust(new Date(year, month - 1, day)); + if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { + throw "Invalid date"; // E.g. 31/02/00 + } return date; }, /* Standard date formats. */ - ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) - COOKIE: 'D, dd M yy', - ISO_8601: 'yy-mm-dd', - RFC_822: 'D, d M y', - RFC_850: 'DD, dd-M-y', - RFC_1036: 'D, d M y', - RFC_1123: 'D, d M yy', - RFC_2822: 'D, d M yy', - RSS: 'D, d M y', // RFC 822 - TICKS: '!', - TIMESTAMP: '@', - W3C: 'yy-mm-dd', // ISO 8601 + ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) + COOKIE: "D, dd M yy", + ISO_8601: "yy-mm-dd", + RFC_822: "D, d M y", + RFC_850: "DD, dd-M-y", + RFC_1036: "D, d M y", + RFC_1123: "D, d M yy", + RFC_2822: "D, d M yy", + RSS: "D, d M y", // RFC 822 + TICKS: "!", + TIMESTAMP: "@", + W3C: "yy-mm-dd", // ISO 8601 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), /* Format a date object into a string value. - The format can be combinations of the following: - d - day of month (no leading zero) - dd - day of month (two digit) - o - day of year (no leading zeros) - oo - day of year (three digit) - D - day name short - DD - day name long - m - month of year (no leading zero) - mm - month of year (two digit) - M - month name short - MM - month name long - y - year (two digit) - yy - year (four digit) - @ - Unix timestamp (ms since 01/01/1970) - ! - Windows ticks (100ns since 01/01/0001) - '...' - literal text - '' - single quote - - @param format string - the desired format of the date - @param date Date - the date value to format - @param settings Object - attributes include: - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return string - the date in the above format */ + * The format can be combinations of the following: + * d - day of month (no leading zero) + * dd - day of month (two digit) + * o - day of year (no leading zeros) + * oo - day of year (three digit) + * D - day name short + * DD - day name long + * m - month of year (no leading zero) + * mm - month of year (two digit) + * M - month name short + * MM - month name long + * y - year (two digit) + * yy - year (four digit) + * @ - Unix timestamp (ms since 01/01/1970) + * ! - Windows ticks (100ns since 01/01/0001) + * "..." - literal text + * '' - single quote + * + * @param format string - the desired format of the date + * @param date Date - the date value to format + * @param settings Object - attributes include: + * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) + * dayNames string[7] - names of the days from Sunday (optional) + * monthNamesShort string[12] - abbreviated names of the months (optional) + * monthNames string[12] - names of the months (optional) + * @return string - the date in the above format + */ formatDate: function (format, date, settings) { - if (!date) - return ''; - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Format a number, with leading zero if necessary - var formatNumber = function(match, value, len) { - var num = '' + value; - if (lookAhead(match)) - while (num.length < len) - num = '0' + num; - return num; - }; - // Format a name, short or long as requested - var formatName = function(match, value, shortNames, longNames) { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }; - var output = ''; - var literal = false; - if (date) - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) + if (!date) { + return ""; + } + + var iFormat, + dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, + dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, + monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, + monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }, + // Format a number, with leading zero if necessary + formatNumber = function(match, value, len) { + var num = "" + value; + if (lookAhead(match)) { + while (num.length < len) { + num = "0" + num; + } + } + return num; + }, + // Format a name, short or long as requested + formatName = function(match, value, shortNames, longNames) { + return (lookAhead(match) ? longNames[value] : shortNames[value]); + }, + output = "", + literal = false; + + if (date) { + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; - else + } else { output += format.charAt(iFormat); - else + } + } else { switch (format.charAt(iFormat)) { - case 'd': - output += formatNumber('d', date.getDate(), 2); + case "d": + output += formatNumber("d", date.getDate(), 2); break; - case 'D': - output += formatName('D', date.getDay(), dayNamesShort, dayNames); + case "D": + output += formatName("D", date.getDay(), dayNamesShort, dayNames); break; - case 'o': - output += formatNumber('o', + case "o": + output += formatNumber("o", Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); break; - case 'm': - output += formatNumber('m', date.getMonth() + 1, 2); + case "m": + output += formatNumber("m", date.getMonth() + 1, 2); break; - case 'M': - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); + case "M": + output += formatName("M", date.getMonth(), monthNamesShort, monthNames); break; - case 'y': - output += (lookAhead('y') ? date.getFullYear() : - (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); + case "y": + output += (lookAhead("y") ? date.getFullYear() : + (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); break; - case '@': + case "@": output += date.getTime(); break; - case '!': + case "!": output += date.getTime() * 10000 + this._ticksTo1970; break; case "'": - if (lookAhead("'")) + if (lookAhead("'")) { output += "'"; - else + } else { literal = true; + } break; default: output += format.charAt(iFormat); } + } } + } return output; }, /* Extract all possible characters from the date format. */ _possibleChars: function (format) { - var chars = ''; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - for (var iFormat = 0; iFormat < format.length; iFormat++) - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) + var iFormat, + chars = "", + literal = false, + // Check whether a format character is doubled + lookAhead = function(match) { + var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); + if (matches) { + iFormat++; + } + return matches; + }; + + for (iFormat = 0; iFormat < format.length; iFormat++) { + if (literal) { + if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; - else + } else { chars += format.charAt(iFormat); - else + } + } else { switch (format.charAt(iFormat)) { - case 'd': case 'm': case 'y': case '@': - chars += '0123456789'; + case "d": case "m": case "y": case "@": + chars += "0123456789"; break; - case 'D': case 'M': + case "D": case "M": return null; // Accept anything case "'": - if (lookAhead("'")) + if (lookAhead("'")) { chars += "'"; - else + } else { literal = true; + } break; default: chars += format.charAt(iFormat); } + } + } return chars; }, @@ -8517,19 +9014,20 @@ $.extend(Datepicker.prototype, { /* Parse existing date and initialise date picker. */ _setDateFromField: function(inst, noDefault) { - if (inst.input.val() == inst.lastVal) { + if (inst.input.val() === inst.lastVal) { return; } - var dateFormat = this._get(inst, 'dateFormat'); - var dates = inst.lastVal = inst.input ? inst.input.val() : null; - var date, defaultDate; - date = defaultDate = this._getDefaultDate(inst); - var settings = this._getFormatConfig(inst); + + var dateFormat = this._get(inst, "dateFormat"), + dates = inst.lastVal = inst.input ? inst.input.val() : null, + defaultDate = this._getDefaultDate(inst), + date = defaultDate, + settings = this._getFormatConfig(inst); + try { date = this.parseDate(dateFormat, dates, settings) || defaultDate; } catch (event) { - this.log(event); - dates = (noDefault ? '' : dates); + dates = (noDefault ? "" : dates); } inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); @@ -8543,53 +9041,56 @@ $.extend(Datepicker.prototype, { /* Retrieve the default date shown on opening. */ _getDefaultDate: function(inst) { return this._restrictMinMax(inst, - this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); + this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); }, /* A date may be specified as an exact value or a relative one. */ _determineDate: function(inst, date, defaultDate) { var offsetNumeric = function(offset) { - var date = new Date(); - date.setDate(date.getDate() + offset); - return date; - }; - var offsetString = function(offset) { - try { - return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - offset, $.datepicker._getFormatConfig(inst)); - } - catch (e) { - // Ignore - } - var date = (offset.toLowerCase().match(/^c/) ? - $.datepicker._getDate(inst) : null) || new Date(); - var year = date.getFullYear(); - var month = date.getMonth(); - var day = date.getDate(); - var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; - var matches = pattern.exec(offset); - while (matches) { - switch (matches[2] || 'd') { - case 'd' : case 'D' : - day += parseInt(matches[1],10); break; - case 'w' : case 'W' : - day += parseInt(matches[1],10) * 7; break; - case 'm' : case 'M' : - month += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - case 'y': case 'Y' : - year += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; + var date = new Date(); + date.setDate(date.getDate() + offset); + return date; + }, + offsetString = function(offset) { + try { + return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), + offset, $.datepicker._getFormatConfig(inst)); + } + catch (e) { + // Ignore + } + + var date = (offset.toLowerCase().match(/^c/) ? + $.datepicker._getDate(inst) : null) || new Date(), + year = date.getFullYear(), + month = date.getMonth(), + day = date.getDate(), + pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, + matches = pattern.exec(offset); + + while (matches) { + switch (matches[2] || "d") { + case "d" : case "D" : + day += parseInt(matches[1],10); break; + case "w" : case "W" : + day += parseInt(matches[1],10) * 7; break; + case "m" : case "M" : + month += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + case "y": case "Y" : + year += parseInt(matches[1],10); + day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); + break; + } + matches = pattern.exec(offset); } - matches = pattern.exec(offset); - } - return new Date(year, month, day); - }; - var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); - newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); + return new Date(year, month, day); + }, + newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : + (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); + + newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); if (newDate) { newDate.setHours(0); newDate.setMinutes(0); @@ -8600,37 +9101,42 @@ $.extend(Datepicker.prototype, { }, /* Handle switch to/from daylight saving. - Hours may be non-zero on daylight saving cut-over: - > 12 when midnight changeover, but then cannot generate - midnight datetime, so jump to 1AM, otherwise reset. - @param date (Date) the date to check - @return (Date) the corrected date */ + * Hours may be non-zero on daylight saving cut-over: + * > 12 when midnight changeover, but then cannot generate + * midnight datetime, so jump to 1AM, otherwise reset. + * @param date (Date) the date to check + * @return (Date) the corrected date + */ _daylightSavingAdjust: function(date) { - if (!date) return null; + if (!date) { + return null; + } date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }, /* Set the date(s) directly. */ _setDate: function(inst, date, noChange) { - var clear = !date; - var origMonth = inst.selectedMonth; - var origYear = inst.selectedYear; - var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); + var clear = !date, + origMonth = inst.selectedMonth, + origYear = inst.selectedYear, + newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); + inst.selectedDay = inst.currentDay = newDate.getDate(); inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); - if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) + if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { this._notifyChange(inst); + } this._adjustInstDate(inst); if (inst.input) { - inst.input.val(clear ? '' : this._formatDate(inst)); + inst.input.val(clear ? "" : this._formatDate(inst)); } }, /* Retrieve the date(s) directly. */ _getDate: function(inst) { - var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : + var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : this._daylightSavingAdjust(new Date( inst.currentYear, inst.currentMonth, inst.currentDay))); return startDate; @@ -8640,64 +9146,71 @@ $.extend(Datepicker.prototype, { * they work with static code transformers like Caja. */ _attachHandlers: function(inst) { - var stepMonths = this._get(inst, 'stepMonths'); - var id = '#' + inst.id.replace( /\\\\/g, "\\" ); - inst.dpDiv.find('[data-handler]').map(function () { + var stepMonths = this._get(inst, "stepMonths"), + id = "#" + inst.id.replace( /\\\\/g, "\\" ); + inst.dpDiv.find("[data-handler]").map(function () { var handler = { prev: function () { - window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); + $.datepicker._adjustDate(id, -stepMonths, "M"); }, next: function () { - window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); + $.datepicker._adjustDate(id, +stepMonths, "M"); }, hide: function () { - window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); + $.datepicker._hideDatepicker(); }, today: function () { - window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); + $.datepicker._gotoToday(id); }, selectDay: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); + $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); return false; }, selectMonth: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); + $.datepicker._selectMonthYear(id, this, "M"); return false; }, selectYear: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); + $.datepicker._selectMonthYear(id, this, "Y"); return false; } }; - $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); + $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); }); }, /* Generate the HTML for the current state of the date picker. */ _generateHTML: function(inst) { - var today = new Date(); - today = this._daylightSavingAdjust( - new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time - var isRTL = this._get(inst, 'isRTL'); - var showButtonPanel = this._get(inst, 'showButtonPanel'); - var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); - var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); - var numMonths = this._getNumberOfMonths(inst); - var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); - var stepMonths = this._get(inst, 'stepMonths'); - var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); - var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var drawMonth = inst.drawMonth - showCurrentAtPos; - var drawYear = inst.drawYear; + var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, + controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, + monthNames, monthNamesShort, beforeShowDay, showOtherMonths, + selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, + cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, + printDate, dRow, tbody, daySettings, otherMonth, unselectable, + tempDate = new Date(), + today = this._daylightSavingAdjust( + new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time + isRTL = this._get(inst, "isRTL"), + showButtonPanel = this._get(inst, "showButtonPanel"), + hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), + navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), + numMonths = this._getNumberOfMonths(inst), + showCurrentAtPos = this._get(inst, "showCurrentAtPos"), + stepMonths = this._get(inst, "stepMonths"), + isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), + currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : + new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), + minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + drawMonth = inst.drawMonth - showCurrentAtPos, + drawYear = inst.drawYear; + if (drawMonth < 0) { drawMonth += 12; drawYear--; } if (maxDate) { - var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), + maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { @@ -8710,133 +9223,142 @@ $.extend(Datepicker.prototype, { } inst.drawMonth = drawMonth; inst.drawYear = drawYear; - var prevText = this._get(inst, 'prevText'); + + prevText = this._get(inst, "prevText"); prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); - var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' + - ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : - (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); - var nextText = this._get(inst, 'nextText'); + + prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + + " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : + (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>")); + + nextText = this._get(inst, "nextText"); nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); - var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' + - ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : - (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); - var currentText = this._get(inst, 'currentText'); - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); + + next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? + "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + + " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : + (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>")); + + currentText = this._get(inst, "currentText"); + gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' + - this._get(inst, 'closeText') + '</button>' : ''); - var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' + - '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; - var firstDay = parseInt(this._get(inst, 'firstDay'),10); + + controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + + this._get(inst, "closeText") + "</button>" : ""); + + buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + + (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + + ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; + + firstDay = parseInt(this._get(inst, "firstDay"),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); - var showWeek = this._get(inst, 'showWeek'); - var dayNames = this._get(inst, 'dayNames'); - var dayNamesShort = this._get(inst, 'dayNamesShort'); - var dayNamesMin = this._get(inst, 'dayNamesMin'); - var monthNames = this._get(inst, 'monthNames'); - var monthNamesShort = this._get(inst, 'monthNamesShort'); - var beforeShowDay = this._get(inst, 'beforeShowDay'); - var showOtherMonths = this._get(inst, 'showOtherMonths'); - var selectOtherMonths = this._get(inst, 'selectOtherMonths'); - var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; - var defaultDate = this._getDefaultDate(inst); - var html = ''; - for (var row = 0; row < numMonths[0]; row++) { - var group = ''; + + showWeek = this._get(inst, "showWeek"); + dayNames = this._get(inst, "dayNames"); + dayNamesMin = this._get(inst, "dayNamesMin"); + monthNames = this._get(inst, "monthNames"); + monthNamesShort = this._get(inst, "monthNamesShort"); + beforeShowDay = this._get(inst, "beforeShowDay"); + showOtherMonths = this._get(inst, "showOtherMonths"); + selectOtherMonths = this._get(inst, "selectOtherMonths"); + defaultDate = this._getDefaultDate(inst); + html = ""; + dow; + for (row = 0; row < numMonths[0]; row++) { + group = ""; this.maxRows = 4; - for (var col = 0; col < numMonths[1]; col++) { - var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); - var cornerClass = ' ui-corner-all'; - var calender = ''; + for (col = 0; col < numMonths[1]; col++) { + selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); + cornerClass = " ui-corner-all"; + calender = ""; if (isMultiMonth) { - calender += '<div class="ui-datepicker-group'; - if (numMonths[1] > 1) + calender += "<div class='ui-datepicker-group"; + if (numMonths[1] > 1) { switch (col) { - case 0: calender += ' ui-datepicker-group-first'; - cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; - case numMonths[1]-1: calender += ' ui-datepicker-group-last'; - cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; - default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break; + case 0: calender += " ui-datepicker-group-first"; + cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; + case numMonths[1]-1: calender += " ui-datepicker-group-last"; + cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; + default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; } - calender += '">'; + } + calender += "'>"; } - calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + - (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + - (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + + calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + + (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + + (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers - '</div><table class="ui-datepicker-calendar"><thead>' + - '<tr>'; - var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); - for (var dow = 0; dow < 7; dow++) { // days of the week - var day = (dow + firstDay) % 7; - thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + - '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; - } - calender += thead + '</tr></thead><tbody>'; - var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); - if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) + "</div><table class='ui-datepicker-calendar'><thead>" + + "<tr>"; + thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); + for (dow = 0; dow < 7; dow++) { // days of the week + day = (dow + firstDay) % 7; + thead += "<th" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + + "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; + } + calender += thead + "</tr></thead><tbody>"; + daysInMonth = this._getDaysInMonth(drawYear, drawMonth); + if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); - var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate - var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) + } + leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; + curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate + numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) this.maxRows = numRows; - var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows - calender += '<tr>'; - var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + - this._get(inst, 'calculateWeek')(printDate) + '</td>'); - for (var dow = 0; dow < 7; dow++) { // create date picker days - var daySettings = (beforeShowDay ? - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); - var otherMonth = (printDate.getMonth() != drawMonth); - var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || + printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); + for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows + calender += "<tr>"; + tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + + this._get(inst, "calculateWeek")(printDate) + "</td>"); + for (dow = 0; dow < 7; dow++) { // create date picker days + daySettings = (beforeShowDay ? + beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); + otherMonth = (printDate.getMonth() !== drawMonth); + unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate); - tbody += '<td class="' + - ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends - (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months - ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key - (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? + tbody += "<td class='" + + ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends + (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months + ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key + (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? // or defaultDate is current printedDate and defaultDate is selectedDate - ' ' + this._dayOverClass : '') + // highlight selected day - (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days - (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates - (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day - (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) - ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title - (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions - (otherMonth && !showOtherMonths ? ' ' : // display for other months - (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + - (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + - (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day - (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months - '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date + " " + this._dayOverClass : "") + // highlight selected day + (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days + (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates + (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day + (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) + ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "'") + "'" : "") + // cell title + (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions + (otherMonth && !showOtherMonths ? " " : // display for other months + (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + + (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + + (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day + (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months + "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date printDate.setDate(printDate.getDate() + 1); printDate = this._daylightSavingAdjust(printDate); } - calender += tbody + '</tr>'; + calender += tbody + "</tr>"; } drawMonth++; if (drawMonth > 11) { drawMonth = 0; drawYear++; } - calender += '</tbody></table>' + (isMultiMonth ? '</div>' + - ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); + calender += "</tbody></table>" + (isMultiMonth ? "</div>" + + ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); group += calender; } html += group; } - html += buttonPanel + ($.ui.ie6 && !inst.inline ? - '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); + html += buttonPanel; inst._keyEvent = false; return html; }, @@ -8844,108 +9366,116 @@ $.extend(Datepicker.prototype, { /* Generate the month and year header. */ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '<div class="ui-datepicker-title">'; - var monthHtml = ''; + + var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, + changeMonth = this._get(inst, "changeMonth"), + changeYear = this._get(inst, "changeYear"), + showMonthAfterYear = this._get(inst, "showMonthAfterYear"), + html = "<div class='ui-datepicker-title'>", + monthHtml = ""; + // month selection - if (secondary || !changeMonth) - monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>'; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">'; - for (var month = 0; month < 12; month++) { - if ((!inMinYear || month >= minDate.getMonth()) && - (!inMaxYear || month <= maxDate.getMonth())) - monthHtml += '<option value="' + month + '"' + - (month == drawMonth ? ' selected="selected"' : '') + - '>' + monthNamesShort[month] + '</option>'; - } - monthHtml += '</select>'; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); + if (secondary || !changeMonth) { + monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; + } else { + inMinYear = (minDate && minDate.getFullYear() === drawYear); + inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); + monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; + for ( month = 0; month < 12; month++) { + if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { + monthHtml += "<option value='" + month + "'" + + (month === drawMonth ? " selected='selected'" : "") + + ">" + monthNamesShort[month] + "</option>"; + } + } + monthHtml += "</select>"; + } + + if (!showMonthAfterYear) { + html += monthHtml + (secondary || !(changeMonth && changeYear) ? " " : ""); + } + // year selection if ( !inst.yearshtml ) { - inst.yearshtml = ''; - if (secondary || !changeYear) - html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; - else { + inst.yearshtml = ""; + if (secondary || !changeYear) { + html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; + } else { // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : + years = this._get(inst, "yearRange").split(":"); + thisYear = new Date().getFullYear(); + determineYear = function(value) { + var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : + (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10))); return (isNaN(year) ? thisYear : year); }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); + year = determineYear(years[0]); + endYear = Math.max(year, determineYear(years[1] || "")); year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">'; + inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; for (; year <= endYear; year++) { - inst.yearshtml += '<option value="' + year + '"' + - (year == drawYear ? ' selected="selected"' : '') + - '>' + year + '</option>'; + inst.yearshtml += "<option value='" + year + "'" + + (year === drawYear ? " selected='selected'" : "") + + ">" + year + "</option>"; } - inst.yearshtml += '</select>'; + inst.yearshtml += "</select>"; html += inst.yearshtml; inst.yearshtml = null; } } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '</div>'; // Close datepicker_header + + html += this._get(inst, "yearSuffix"); + if (showMonthAfterYear) { + html += (secondary || !(changeMonth && changeYear) ? " " : "") + monthHtml; + } + html += "</div>"; // Close datepicker_header return html; }, /* Adjust one of the date sub-fields. */ _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); + var year = inst.drawYear + (period === "Y" ? offset : 0), + month = inst.drawMonth + (period === "M" ? offset : 0), + day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), + date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); + inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') + if (period === "M" || period === "Y") { this._notifyChange(inst); + } }, /* Ensure a date is within any min/max bounds. */ _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var newDate = (minDate && date < minDate ? minDate : date); - newDate = (maxDate && newDate > maxDate ? maxDate : newDate); - return newDate; + var minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + newDate = (minDate && date < minDate ? minDate : date); + return (maxDate && newDate > maxDate ? maxDate : newDate); }, /* Notify change of month/year. */ _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) + var onChange = this._get(inst, "onChangeMonthYear"); + if (onChange) { onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]); + } }, /* Determine the number of months to show. */ _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); + var numMonths = this._get(inst, "numberOfMonths"); + return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); }, /* Determine the current maximum date - ensure no time components are set. */ _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); + return this._determineDate(inst, this._get(inst, minMax + "Date"), null); }, /* Find the number of days in a given month. */ @@ -8960,30 +9490,51 @@ $.extend(Datepicker.prototype, { /* Determines if we should allow a "next/prev" month display change. */ _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, + var numMonths = this._getNumberOfMonths(inst), + date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) + + if (offset < 0) { date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); + } return this._isInRange(inst, date); }, /* Is the given date in the accepted range? */ _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); + var yearSplit, currentYear, + minDate = this._getMinMaxDate(inst, "min"), + maxDate = this._getMinMaxDate(inst, "max"), + minYear = null, + maxYear = null, + years = this._get(inst, "yearRange"); + if (years){ + yearSplit = years.split(":"); + currentYear = new Date().getFullYear(); + minYear = parseInt(yearSplit[0], 10); + maxYear = parseInt(yearSplit[1], 10); + if ( yearSplit[0].match(/[+\-].*/) ) { + minYear += currentYear; + } + if ( yearSplit[1].match(/[+\-].*/) ) { + maxYear += currentYear; + } + } + return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); + (!maxDate || date.getTime() <= maxDate.getTime()) && + (!minYear || date.getFullYear() >= minYear) && + (!maxYear || date.getFullYear() <= maxYear)); }, /* Provide the configuration settings for formatting/parsing. */ _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : + var shortYearCutoff = this._get(inst, "shortYearCutoff"); + shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; + dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), + monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; }, /* Format the given date for display. */ @@ -8993,10 +9544,10 @@ $.extend(Datepicker.prototype, { inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear; } - var date = (day ? (typeof day == 'object' ? day : + var date = (day ? (typeof day === "object" ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); + return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); } }); @@ -9006,18 +9557,26 @@ $.extend(Datepicker.prototype, { * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. */ function bindHover(dpDiv) { - var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; - return dpDiv.delegate(selector, 'mouseout', function() { - $(this).removeClass('ui-state-hover'); - if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); - if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); + var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; + return dpDiv.delegate(selector, "mouseout", function() { + $(this).removeClass("ui-state-hover"); + if (this.className.indexOf("ui-datepicker-prev") !== -1) { + $(this).removeClass("ui-datepicker-prev-hover"); + } + if (this.className.indexOf("ui-datepicker-next") !== -1) { + $(this).removeClass("ui-datepicker-next-hover"); + } }) - .delegate(selector, 'mouseover', function(){ + .delegate(selector, "mouseover", function(){ if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) { - $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - $(this).addClass('ui-state-hover'); - if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); - if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); + $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); + $(this).addClass("ui-state-hover"); + if (this.className.indexOf("ui-datepicker-prev") !== -1) { + $(this).addClass("ui-datepicker-prev-hover"); + } + if (this.className.indexOf("ui-datepicker-next") !== -1) { + $(this).addClass("ui-datepicker-next-hover"); + } } }); } @@ -9025,15 +9584,17 @@ function bindHover(dpDiv) { /* jQuery extend now ignores nulls! */ function extendRemove(target, props) { $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) + for (var name in props) { + if (props[name] == null) { target[name] = props[name]; + } + } return target; -}; +} /* Invoke the datepicker functionality. @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality + Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ @@ -9044,21 +9605,27 @@ $.fn.datepicker = function(options){ /* Initialise the date picker. */ if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find(document.body).append($.datepicker.dpDiv); + $(document).mousedown($.datepicker._checkExternalClick); $.datepicker.initialized = true; } + /* Append datepicker main container to body if not exist. */ + if ($("#"+$.datepicker._mainDivId).length === 0) { + $("body").append($.datepicker.dpDiv); + } + var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. + if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { + return $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. + } + if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { + return $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this[0]].concat(otherArgs)); + } return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. + typeof options === "string" ? + $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options); }); @@ -9067,18 +9634,13 @@ $.fn.datepicker = function(options){ $.datepicker = new Datepicker(); // singleton instance $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.9.2"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; +$.datepicker.version = "1.10.4"; })(jQuery); (function( $, undefined ) { -var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", - sizeRelatedOptions = { +var sizeRelatedOptions = { buttons: true, height: true, maxHeight: true, @@ -9094,19 +9656,20 @@ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ", minWidth: true }; -$.widget("ui.dialog", { - version: "1.9.2", +$.widget( "ui.dialog", { + version: "1.10.4", options: { + appendTo: "body", autoOpen: true, - buttons: {}, + buttons: [], closeOnEscape: true, closeText: "close", dialogClass: "", draggable: true, hide: null, height: "auto", - maxHeight: false, - maxWidth: false, + maxHeight: null, + maxWidth: null, minHeight: 150, minWidth: 150, modal: false, @@ -9115,7 +9678,7 @@ $.widget("ui.dialog", { at: "center", of: window, collision: "fit", - // ensure that the titlebar is never outside the document + // Ensure the titlebar is always visible using: function( pos ) { var topOffset = $( this ).css( pos ).offset().top; if ( topOffset < 0 ) { @@ -9125,137 +9688,56 @@ $.widget("ui.dialog", { }, resizable: true, show: null, - stack: true, - title: "", + title: null, width: 300, - zIndex: 1000 + + // callbacks + beforeClose: null, + close: null, + drag: null, + dragStart: null, + dragStop: null, + focus: null, + open: null, + resize: null, + resizeStart: null, + resizeStop: null }, _create: function() { - this.originalTitle = this.element.attr( "title" ); - // #5742 - .attr() might return a DOMElement - if ( typeof this.originalTitle !== "string" ) { - this.originalTitle = ""; - } - this.oldPosition = { + this.originalCss = { + display: this.element[0].style.display, + width: this.element[0].style.width, + minHeight: this.element[0].style.minHeight, + maxHeight: this.element[0].style.maxHeight, + height: this.element[0].style.height + }; + this.originalPosition = { parent: this.element.parent(), index: this.element.parent().children().index( this.element ) }; + this.originalTitle = this.element.attr("title"); this.options.title = this.options.title || this.originalTitle; - var that = this, - options = this.options, - - title = options.title || " ", - uiDialog, - uiDialogTitlebar, - uiDialogTitlebarClose, - uiDialogTitle, - uiDialogButtonPane; - - uiDialog = ( this.uiDialog = $( "<div>" ) ) - .addClass( uiDialogClasses + options.dialogClass ) - .css({ - display: "none", - outline: 0, // TODO: move to stylesheet - zIndex: options.zIndex - }) - // setting tabIndex makes the div focusable - .attr( "tabIndex", -1) - .keydown(function( event ) { - if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE ) { - that.close( event ); - event.preventDefault(); - } - }) - .mousedown(function( event ) { - that.moveToTop( false, event ); - }) - .appendTo( "body" ); - this.element - .show() - .removeAttr( "title" ) - .addClass( "ui-dialog-content ui-widget-content" ) - .appendTo( uiDialog ); - - uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) ) - .addClass( "ui-dialog-titlebar ui-widget-header " + - "ui-corner-all ui-helper-clearfix" ) - .bind( "mousedown", function() { - // Dialog isn't getting focus when dragging (#8063) - uiDialog.focus(); - }) - .prependTo( uiDialog ); - - uiDialogTitlebarClose = $( "<a href='#'></a>" ) - .addClass( "ui-dialog-titlebar-close ui-corner-all" ) - .attr( "role", "button" ) - .click(function( event ) { - event.preventDefault(); - that.close( event ); - }) - .appendTo( uiDialogTitlebar ); - - ( this.uiDialogTitlebarCloseText = $( "<span>" ) ) - .addClass( "ui-icon ui-icon-closethick" ) - .text( options.closeText ) - .appendTo( uiDialogTitlebarClose ); + this._createWrapper(); - uiDialogTitle = $( "<span>" ) - .uniqueId() - .addClass( "ui-dialog-title" ) - .html( title ) - .prependTo( uiDialogTitlebar ); - - uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) ) - .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); - - ( this.uiButtonSet = $( "<div>" ) ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); - - uiDialog.attr({ - role: "dialog", - "aria-labelledby": uiDialogTitle.attr( "id" ) - }); + this.element + .show() + .removeAttr("title") + .addClass("ui-dialog-content ui-widget-content") + .appendTo( this.uiDialog ); - uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection(); - this._hoverable( uiDialogTitlebarClose ); - this._focusable( uiDialogTitlebarClose ); + this._createTitlebar(); + this._createButtonPane(); - if ( options.draggable && $.fn.draggable ) { + if ( this.options.draggable && $.fn.draggable ) { this._makeDraggable(); } - if ( options.resizable && $.fn.resizable ) { + if ( this.options.resizable && $.fn.resizable ) { this._makeResizable(); } - this._createButtons( options.buttons ); this._isOpen = false; - - if ( $.fn.bgiframe ) { - uiDialog.bgiframe(); - } - - // prevent tabbing out of modal dialogs - this._on( uiDialog, { keydown: function( event ) { - if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) { - return; - } - - var tabbables = $( ":tabbable", uiDialog ), - first = tabbables.filter( ":first" ), - last = tabbables.filter( ":last" ); - - if ( event.target === last[0] && !event.shiftKey ) { - first.focus( 1 ); - return false; - } else if ( event.target === first[0] && event.shiftKey ) { - last.focus( 1 ); - return false; - } - }}); }, _init: function() { @@ -9264,30 +9746,39 @@ $.widget("ui.dialog", { } }, + _appendTo: function() { + var element = this.options.appendTo; + if ( element && (element.jquery || element.nodeType) ) { + return $( element ); + } + return this.document.find( element || "body" ).eq( 0 ); + }, + _destroy: function() { var next, - oldPosition = this.oldPosition; + originalPosition = this.originalPosition; + + this._destroyOverlay(); - if ( this.overlay ) { - this.overlay.destroy(); - } - this.uiDialog.hide(); this.element - .removeClass( "ui-dialog-content ui-widget-content" ) - .hide() - .appendTo( "body" ); - this.uiDialog.remove(); + .removeUniqueId() + .removeClass("ui-dialog-content ui-widget-content") + .css( this.originalCss ) + // Without detaching first, the following becomes really slow + .detach(); + + this.uiDialog.stop( true, true ).remove(); if ( this.originalTitle ) { this.element.attr( "title", this.originalTitle ); } - next = oldPosition.parent.children().eq( oldPosition.index ); + next = originalPosition.parent.children().eq( originalPosition.index ); // Don't try to place the dialog next to itself (#8613) - if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { + if ( next.length && next[0] !== this.element[0] ) { next.before( this.element ); } else { - oldPosition.parent.append( this.element ); + originalPosition.parent.append( this.element ); } }, @@ -9295,160 +9786,282 @@ $.widget("ui.dialog", { return this.uiDialog; }, - close: function( event ) { - var that = this, - maxZ, thisZ; + disable: $.noop, + enable: $.noop, - if ( !this._isOpen ) { - return; - } + close: function( event ) { + var activeElement, + that = this; - if ( false === this._trigger( "beforeClose", event ) ) { + if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; } this._isOpen = false; + this._destroyOverlay(); - if ( this.overlay ) { - this.overlay.destroy(); - } + if ( !this.opener.filter(":focusable").focus().length ) { - if ( this.options.hide ) { - this._hide( this.uiDialog, this.options.hide, function() { - that._trigger( "close", event ); - }); - } else { - this.uiDialog.hide(); - this._trigger( "close", event ); - } + // support: IE9 + // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> + try { + activeElement = this.document[ 0 ].activeElement; - $.ui.dialog.overlay.resize(); + // Support: IE9, IE10 + // If the <body> is blurred, IE will switch windows, see #4520 + if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) { - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - if ( this.options.modal ) { - maxZ = 0; - $( ".ui-dialog" ).each(function() { - if ( this !== that.uiDialog[0] ) { - thisZ = $( this ).css( "z-index" ); - if ( !isNaN( thisZ ) ) { - maxZ = Math.max( maxZ, thisZ ); - } + // Hiding a focused element doesn't trigger blur in WebKit + // so in case we have nothing to focus on, explicitly blur the active element + // https://bugs.webkit.org/show_bug.cgi?id=47182 + $( activeElement ).blur(); } - }); - $.ui.dialog.maxZ = maxZ; + } catch ( error ) {} } - return this; + this._hide( this.uiDialog, this.options.hide, function() { + that._trigger( "close", event ); + }); }, isOpen: function() { return this._isOpen; }, - // the force parameter allows us to move modal dialogs to their correct - // position on open - moveToTop: function( force, event ) { - var options = this.options, - saveScroll; - - if ( ( options.modal && !force ) || - ( !options.stack && !options.modal ) ) { - return this._trigger( "focus", event ); - } + moveToTop: function() { + this._moveToTop(); + }, - if ( options.zIndex > $.ui.dialog.maxZ ) { - $.ui.dialog.maxZ = options.zIndex; - } - if ( this.overlay ) { - $.ui.dialog.maxZ += 1; - $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ; - this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ ); + _moveToTop: function( event, silent ) { + var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length; + if ( moved && !silent ) { + this._trigger( "focus", event ); } - - // Save and then restore scroll - // Opera 9.5+ resets when parent z-index is changed. - // http://bugs.jqueryui.com/ticket/3193 - saveScroll = { - scrollTop: this.element.scrollTop(), - scrollLeft: this.element.scrollLeft() - }; - $.ui.dialog.maxZ += 1; - this.uiDialog.css( "z-index", $.ui.dialog.maxZ ); - this.element.attr( saveScroll ); - this._trigger( "focus", event ); - - return this; + return moved; }, open: function() { + var that = this; if ( this._isOpen ) { + if ( this._moveToTop() ) { + this._focusTabbable(); + } return; } - var hasFocus, - options = this.options, - uiDialog = this.uiDialog; + this._isOpen = true; + this.opener = $( this.document[0].activeElement ); this._size(); - this._position( options.position ); - uiDialog.show( options.show ); - this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null; - this.moveToTop( true ); - - // set focus to the first tabbable element in the content area or the first button - // if there are no tabbable elements, set focus on the dialog itself - hasFocus = this.element.find( ":tabbable" ); + this._position(); + this._createOverlay(); + this._moveToTop( null, true ); + this._show( this.uiDialog, this.options.show, function() { + that._focusTabbable(); + that._trigger("focus"); + }); + + this._trigger("open"); + }, + + _focusTabbable: function() { + // Set focus to the first match: + // 1. First element inside the dialog matching [autofocus] + // 2. Tabbable element inside the content element + // 3. Tabbable element inside the buttonpane + // 4. The close button + // 5. The dialog itself + var hasFocus = this.element.find("[autofocus]"); if ( !hasFocus.length ) { - hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); - if ( !hasFocus.length ) { - hasFocus = uiDialog; - } + hasFocus = this.element.find(":tabbable"); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialogButtonPane.find(":tabbable"); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialogTitlebarClose.filter(":tabbable"); + } + if ( !hasFocus.length ) { + hasFocus = this.uiDialog; } hasFocus.eq( 0 ).focus(); + }, - this._isOpen = true; - this._trigger( "open" ); + _keepFocus: function( event ) { + function checkFocus() { + var activeElement = this.document[0].activeElement, + isActive = this.uiDialog[0] === activeElement || + $.contains( this.uiDialog[0], activeElement ); + if ( !isActive ) { + this._focusTabbable(); + } + } + event.preventDefault(); + checkFocus.call( this ); + // support: IE + // IE <= 8 doesn't prevent moving focus even with event.preventDefault() + // so we check again later + this._delay( checkFocus ); + }, - return this; + _createWrapper: function() { + this.uiDialog = $("<div>") + .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " + + this.options.dialogClass ) + .hide() + .attr({ + // Setting tabIndex makes the div focusable + tabIndex: -1, + role: "dialog" + }) + .appendTo( this._appendTo() ); + + this._on( this.uiDialog, { + keydown: function( event ) { + if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && + event.keyCode === $.ui.keyCode.ESCAPE ) { + event.preventDefault(); + this.close( event ); + return; + } + + // prevent tabbing out of dialogs + if ( event.keyCode !== $.ui.keyCode.TAB ) { + return; + } + var tabbables = this.uiDialog.find(":tabbable"), + first = tabbables.filter(":first"), + last = tabbables.filter(":last"); + + if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) { + first.focus( 1 ); + event.preventDefault(); + } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) { + last.focus( 1 ); + event.preventDefault(); + } + }, + mousedown: function( event ) { + if ( this._moveToTop( event ) ) { + this._focusTabbable(); + } + } + }); + + // We assume that any existing aria-describedby attribute means + // that the dialog content is marked up properly + // otherwise we brute force the content as the description + if ( !this.element.find("[aria-describedby]").length ) { + this.uiDialog.attr({ + "aria-describedby": this.element.uniqueId().attr("id") + }); + } + }, + + _createTitlebar: function() { + var uiDialogTitle; + + this.uiDialogTitlebar = $("<div>") + .addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix") + .prependTo( this.uiDialog ); + this._on( this.uiDialogTitlebar, { + mousedown: function( event ) { + // Don't prevent click on close button (#8838) + // Focusing a dialog that is partially scrolled out of view + // causes the browser to scroll it into view, preventing the click event + if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) { + // Dialog isn't getting focus when dragging (#8063) + this.uiDialog.focus(); + } + } + }); + + // support: IE + // Use type="button" to prevent enter keypresses in textboxes from closing the + // dialog in IE (#9312) + this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) + .button({ + label: this.options.closeText, + icons: { + primary: "ui-icon-closethick" + }, + text: false + }) + .addClass("ui-dialog-titlebar-close") + .appendTo( this.uiDialogTitlebar ); + this._on( this.uiDialogTitlebarClose, { + click: function( event ) { + event.preventDefault(); + this.close( event ); + } + }); + + uiDialogTitle = $("<span>") + .uniqueId() + .addClass("ui-dialog-title") + .prependTo( this.uiDialogTitlebar ); + this._title( uiDialogTitle ); + + this.uiDialog.attr({ + "aria-labelledby": uiDialogTitle.attr("id") + }); }, - _createButtons: function( buttons ) { + _title: function( title ) { + if ( !this.options.title ) { + title.html(" "); + } + title.text( this.options.title ); + }, + + _createButtonPane: function() { + this.uiDialogButtonPane = $("<div>") + .addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"); + + this.uiButtonSet = $("<div>") + .addClass("ui-dialog-buttonset") + .appendTo( this.uiDialogButtonPane ); + + this._createButtons(); + }, + + _createButtons: function() { var that = this, - hasButtons = false; + buttons = this.options.buttons; // if we already have a button pane, remove it this.uiDialogButtonPane.remove(); this.uiButtonSet.empty(); - if ( typeof buttons === "object" && buttons !== null ) { - $.each( buttons, function() { - return !(hasButtons = true); - }); - } - if ( hasButtons ) { - $.each( buttons, function( name, props ) { - var button, click; - props = $.isFunction( props ) ? - { click: props, text: name } : - props; - // Default to a non-submitting button - props = $.extend( { type: "button" }, props ); - // Change the context for the click callback to be the main element - click = props.click; - props.click = function() { - click.apply( that.element[0], arguments ); - }; - button = $( "<button></button>", props ) - .appendTo( that.uiButtonSet ); - if ( $.fn.button ) { - button.button(); - } - }); - this.uiDialog.addClass( "ui-dialog-buttons" ); - this.uiDialogButtonPane.appendTo( this.uiDialog ); - } else { - this.uiDialog.removeClass( "ui-dialog-buttons" ); + if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) { + this.uiDialog.removeClass("ui-dialog-buttons"); + return; } + + $.each( buttons, function( name, props ) { + var click, buttonOptions; + props = $.isFunction( props ) ? + { click: props, text: name } : + props; + // Default to a non-submitting button + props = $.extend( { type: "button" }, props ); + // Change the context for the click callback to be the main element + click = props.click; + props.click = function() { + click.apply( that.element[0], arguments ); + }; + buttonOptions = { + icons: props.icons, + text: props.showText + }; + delete props.icons; + delete props.showText; + $( "<button></button>", props ) + .button( buttonOptions ) + .appendTo( that.uiButtonSet ); + }); + this.uiDialog.addClass("ui-dialog-buttons"); + this.uiDialogButtonPane.appendTo( this.uiDialog ); }, _makeDraggable: function() { @@ -9467,8 +10080,8 @@ $.widget("ui.dialog", { handle: ".ui-dialog-titlebar", containment: "document", start: function( event, ui ) { - $( this ) - .addClass( "ui-dialog-dragging" ); + $( this ).addClass("ui-dialog-dragging"); + that._blockFrames(); that._trigger( "dragStart", event, filteredUi( ui ) ); }, drag: function( event, ui ) { @@ -9479,22 +10092,21 @@ $.widget("ui.dialog", { ui.position.left - that.document.scrollLeft(), ui.position.top - that.document.scrollTop() ]; - $( this ) - .removeClass( "ui-dialog-dragging" ); + $( this ).removeClass("ui-dialog-dragging"); + that._unblockFrames(); that._trigger( "dragStop", event, filteredUi( ui ) ); - $.ui.dialog.overlay.resize(); } }); }, - _makeResizable: function( handles ) { - handles = (handles === undefined ? this.options.resizable : handles); + _makeResizable: function() { var that = this, options = this.options, + handles = options.resizable, // .ui-resizable has position: relative defined in the stylesheet // but dialogs have to use absolute or fixed positioning - position = this.uiDialog.css( "position" ), - resizeHandles = typeof handles === 'string' ? + position = this.uiDialog.css("position"), + resizeHandles = typeof handles === "string" ? handles : "n,e,s,w,se,sw,ne,nw"; @@ -9517,76 +10129,39 @@ $.widget("ui.dialog", { minHeight: this._minHeight(), handles: resizeHandles, start: function( event, ui ) { - $( this ).addClass( "ui-dialog-resizing" ); + $( this ).addClass("ui-dialog-resizing"); + that._blockFrames(); that._trigger( "resizeStart", event, filteredUi( ui ) ); }, resize: function( event, ui ) { that._trigger( "resize", event, filteredUi( ui ) ); }, stop: function( event, ui ) { - $( this ).removeClass( "ui-dialog-resizing" ); options.height = $( this ).height(); options.width = $( this ).width(); + $( this ).removeClass("ui-dialog-resizing"); + that._unblockFrames(); that._trigger( "resizeStop", event, filteredUi( ui ) ); - $.ui.dialog.overlay.resize(); } }) - .css( "position", position ) - .find( ".ui-resizable-se" ) - .addClass( "ui-icon ui-icon-grip-diagonal-se" ); + .css( "position", position ); }, _minHeight: function() { var options = this.options; - if ( options.height === "auto" ) { - return options.minHeight; - } else { - return Math.min( options.minHeight, options.height ); - } + return options.height === "auto" ? + options.minHeight : + Math.min( options.minHeight, options.height ); }, - _position: function( position ) { - var myAt = [], - offset = [ 0, 0 ], - isVisible; - - if ( position ) { - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( - // if (typeof position == 'string' || $.isArray(position)) { - // myAt = $.isArray(position) ? position : position.split(' '); - - if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { - myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ]; - if ( myAt.length === 1 ) { - myAt[ 1 ] = myAt[ 0 ]; - } - - $.each( [ "left", "top" ], function( i, offsetPosition ) { - if ( +myAt[ i ] === myAt[ i ] ) { - offset[ i ] = myAt[ i ]; - myAt[ i ] = offsetPosition; - } - }); - - position = { - my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + - myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), - at: myAt.join( " " ) - }; - } - - position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); - } else { - position = $.ui.dialog.prototype.options.position; - } - - // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is( ":visible" ); + _position: function() { + // Need to show the dialog to get the actual offset in the position plugin + var isVisible = this.uiDialog.is(":visible"); if ( !isVisible ) { this.uiDialog.show(); } - this.uiDialog.position( position ); + this.uiDialog.position( this.options.position ); if ( !isVisible ) { this.uiDialog.hide(); } @@ -9594,8 +10169,8 @@ $.widget("ui.dialog", { _setOptions: function( options ) { var that = this, - resizableOptions = {}, - resize = false; + resize = false, + resizableOptions = {}; $.each( options, function( key, value ) { that._setOption( key, value ); @@ -9610,8 +10185,9 @@ $.widget("ui.dialog", { if ( resize ) { this._size(); + this._position(); } - if ( this.uiDialog.is( ":data(resizable)" ) ) { + if ( this.uiDialog.is(":data(ui-resizable)") ) { this.uiDialog.resizable( "option", resizableOptions ); } }, @@ -9620,78 +10196,82 @@ $.widget("ui.dialog", { var isDraggable, isResizable, uiDialog = this.uiDialog; - switch ( key ) { - case "buttons": - this._createButtons( value ); - break; - case "closeText": - // ensure that we always pass a string - this.uiDialogTitlebarCloseText.text( "" + value ); - break; - case "dialogClass": - uiDialog - .removeClass( this.options.dialogClass ) - .addClass( uiDialogClasses + value ); - break; - case "disabled": - if ( value ) { - uiDialog.addClass( "ui-dialog-disabled" ); - } else { - uiDialog.removeClass( "ui-dialog-disabled" ); - } - break; - case "draggable": - isDraggable = uiDialog.is( ":data(draggable)" ); - if ( isDraggable && !value ) { - uiDialog.draggable( "destroy" ); - } + if ( key === "dialogClass" ) { + uiDialog + .removeClass( this.options.dialogClass ) + .addClass( value ); + } - if ( !isDraggable && value ) { - this._makeDraggable(); - } - break; - case "position": - this._position( value ); - break; - case "resizable": - // currently resizable, becoming non-resizable - isResizable = uiDialog.is( ":data(resizable)" ); - if ( isResizable && !value ) { - uiDialog.resizable( "destroy" ); - } + if ( key === "disabled" ) { + return; + } - // currently resizable, changing handles - if ( isResizable && typeof value === "string" ) { - uiDialog.resizable( "option", "handles", value ); - } + this._super( key, value ); - // currently non-resizable, becoming resizable - if ( !isResizable && value !== false ) { - this._makeResizable( value ); - } - break; - case "title": - // convert whatever was passed in o a string, for html() to not throw up - $( ".ui-dialog-title", this.uiDialogTitlebar ) - .html( "" + ( value || " " ) ); - break; + if ( key === "appendTo" ) { + this.uiDialog.appendTo( this._appendTo() ); } - this._super( key, value ); + if ( key === "buttons" ) { + this._createButtons(); + } + + if ( key === "closeText" ) { + this.uiDialogTitlebarClose.button({ + // Ensure that we always pass a string + label: "" + value + }); + } + + if ( key === "draggable" ) { + isDraggable = uiDialog.is(":data(ui-draggable)"); + if ( isDraggable && !value ) { + uiDialog.draggable("destroy"); + } + + if ( !isDraggable && value ) { + this._makeDraggable(); + } + } + + if ( key === "position" ) { + this._position(); + } + + if ( key === "resizable" ) { + // currently resizable, becoming non-resizable + isResizable = uiDialog.is(":data(ui-resizable)"); + if ( isResizable && !value ) { + uiDialog.resizable("destroy"); + } + + // currently resizable, changing handles + if ( isResizable && typeof value === "string" ) { + uiDialog.resizable( "option", "handles", value ); + } + + // currently non-resizable, becoming resizable + if ( !isResizable && value !== false ) { + this._makeResizable(); + } + } + + if ( key === "title" ) { + this._title( this.uiDialogTitlebar.find(".ui-dialog-title") ); + } }, _size: function() { - /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content - * divs will both have width and height set, so we need to reset them - */ - var nonContentHeight, minContentHeight, autoHeight, - options = this.options, - isVisible = this.uiDialog.is( ":visible" ); + // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content + // divs will both have width and height set, so we need to reset them + var nonContentHeight, minContentHeight, maxContentHeight, + options = this.options; - // reset content sizing + // Reset content sizing this.element.show().css({ width: "auto", minHeight: 0, + maxHeight: "none", height: 0 }); @@ -9707,211 +10287,159 @@ $.widget("ui.dialog", { }) .outerHeight(); minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); + maxContentHeight = typeof options.maxHeight === "number" ? + Math.max( 0, options.maxHeight - nonContentHeight ) : + "none"; if ( options.height === "auto" ) { - // only needed for IE6 support - if ( $.support.minHeight ) { - this.element.css({ - minHeight: minContentHeight, - height: "auto" - }); - } else { - this.uiDialog.show(); - autoHeight = this.element.css( "height", "auto" ).height(); - if ( !isVisible ) { - this.uiDialog.hide(); - } - this.element.height( Math.max( autoHeight, minContentHeight ) ); - } + this.element.css({ + minHeight: minContentHeight, + maxHeight: maxContentHeight, + height: "auto" + }); } else { - this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); + this.element.height( Math.max( 0, options.height - nonContentHeight ) ); } - if (this.uiDialog.is( ":data(resizable)" ) ) { + if (this.uiDialog.is(":data(ui-resizable)") ) { this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); } - } -}); + }, -$.extend($.ui.dialog, { - uuid: 0, - maxZ: 0, + _blockFrames: function() { + this.iframeBlocks = this.document.find( "iframe" ).map(function() { + var iframe = $( this ); - getTitleId: function($el) { - var id = $el.attr( "id" ); - if ( !id ) { - this.uuid += 1; - id = this.uuid; + return $( "<div>" ) + .css({ + position: "absolute", + width: iframe.outerWidth(), + height: iframe.outerHeight() + }) + .appendTo( iframe.parent() ) + .offset( iframe.offset() )[0]; + }); + }, + + _unblockFrames: function() { + if ( this.iframeBlocks ) { + this.iframeBlocks.remove(); + delete this.iframeBlocks; } - return "ui-dialog-title-" + id; }, - overlay: function( dialog ) { - this.$el = $.ui.dialog.overlay.create( dialog ); - } -}); + _allowInteraction: function( event ) { + if ( $( event.target ).closest(".ui-dialog").length ) { + return true; + } + + // TODO: Remove hack when datepicker implements + // the .ui-front logic (#8989) + return !!$( event.target ).closest(".ui-datepicker").length; + }, -$.extend( $.ui.dialog.overlay, { - instances: [], - // reuse old instances due to IE memory leak with alpha transparency (see #5185) - oldInstances: [], - maxZ: 0, - events: $.map( - "focus,mousedown,mouseup,keydown,keypress,click".split( "," ), - function( event ) { - return event + ".dialog-overlay"; - } - ).join( " " ), - create: function( dialog ) { - if ( this.instances.length === 0 ) { - // prevent use of anchors and inputs - // we use a setTimeout in case the overlay is created from an - // event that we're going to be cancelling (see #2804) - setTimeout(function() { - // handle $(el).dialog().dialog('close') (see #4065) - if ( $.ui.dialog.overlay.instances.length ) { - $( document ).bind( $.ui.dialog.overlay.events, function( event ) { - // stop events if the z-index of the target is < the z-index of the overlay - // we cannot return true when we don't want to cancel the event (#3523) - if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) { - return false; + _createOverlay: function() { + if ( !this.options.modal ) { + return; + } + + var that = this, + widgetFullName = this.widgetFullName; + if ( !$.ui.dialog.overlayInstances ) { + // Prevent use of anchors and inputs. + // We use a delay in case the overlay is created from an + // event that we're going to be cancelling. (#2804) + this._delay(function() { + // Handle .dialog().dialog("close") (#4065) + if ( $.ui.dialog.overlayInstances ) { + this.document.bind( "focusin.dialog", function( event ) { + if ( !that._allowInteraction( event ) ) { + event.preventDefault(); + $(".ui-dialog:visible:last .ui-dialog-content") + .data( widgetFullName )._focusTabbable(); } }); } - }, 1 ); - - // handle window resize - $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize ); + }); } - var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) ); - - // allow closing by pressing the escape key - $( document ).bind( "keydown.dialog-overlay", function( event ) { - var instances = $.ui.dialog.overlay.instances; - // only react to the event if we're the top overlay - if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el && - dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE ) { - - dialog.close( event ); - event.preventDefault(); - } - }); - - $el.appendTo( document.body ).css({ - width: this.width(), - height: this.height() + this.overlay = $("<div>") + .addClass("ui-widget-overlay ui-front") + .appendTo( this._appendTo() ); + this._on( this.overlay, { + mousedown: "_keepFocus" }); + $.ui.dialog.overlayInstances++; + }, - if ( $.fn.bgiframe ) { - $el.bgiframe(); + _destroyOverlay: function() { + if ( !this.options.modal ) { + return; } - this.instances.push( $el ); - return $el; - }, - - destroy: function( $el ) { - var indexOf = $.inArray( $el, this.instances ), - maxZ = 0; + if ( this.overlay ) { + $.ui.dialog.overlayInstances--; - if ( indexOf !== -1 ) { - this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] ); + if ( !$.ui.dialog.overlayInstances ) { + this.document.unbind( "focusin.dialog" ); + } + this.overlay.remove(); + this.overlay = null; } + } +}); - if ( this.instances.length === 0 ) { - $( [ document, window ] ).unbind( ".dialog-overlay" ); - } +$.ui.dialog.overlayInstances = 0; - $el.height( 0 ).width( 0 ).remove(); +// DEPRECATED +if ( $.uiBackCompat !== false ) { + // position option with array notation + // just override with old implementation + $.widget( "ui.dialog", $.ui.dialog, { + _position: function() { + var position = this.options.position, + myAt = [], + offset = [ 0, 0 ], + isVisible; + + if ( position ) { + if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) { + myAt = position.split ? position.split(" ") : [ position[0], position[1] ]; + if ( myAt.length === 1 ) { + myAt[1] = myAt[0]; + } - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - $.each( this.instances, function() { - maxZ = Math.max( maxZ, this.css( "z-index" ) ); - }); - this.maxZ = maxZ; - }, + $.each( [ "left", "top" ], function( i, offsetPosition ) { + if ( +myAt[ i ] === myAt[ i ] ) { + offset[ i ] = myAt[ i ]; + myAt[ i ] = offsetPosition; + } + }); - height: function() { - var scrollHeight, - offsetHeight; - // handle IE - if ( $.ui.ie ) { - scrollHeight = Math.max( - document.documentElement.scrollHeight, - document.body.scrollHeight - ); - offsetHeight = Math.max( - document.documentElement.offsetHeight, - document.body.offsetHeight - ); + position = { + my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " + + myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]), + at: myAt.join(" ") + }; + } - if ( scrollHeight < offsetHeight ) { - return $( window ).height() + "px"; + position = $.extend( {}, $.ui.dialog.prototype.options.position, position ); } else { - return scrollHeight + "px"; + position = $.ui.dialog.prototype.options.position; } - // handle "good" browsers - } else { - return $( document ).height() + "px"; - } - }, - - width: function() { - var scrollWidth, - offsetWidth; - // handle IE - if ( $.ui.ie ) { - scrollWidth = Math.max( - document.documentElement.scrollWidth, - document.body.scrollWidth - ); - offsetWidth = Math.max( - document.documentElement.offsetWidth, - document.body.offsetWidth - ); - if ( scrollWidth < offsetWidth ) { - return $( window ).width() + "px"; - } else { - return scrollWidth + "px"; + // need to show the dialog to get the actual offset in the position plugin + isVisible = this.uiDialog.is(":visible"); + if ( !isVisible ) { + this.uiDialog.show(); + } + this.uiDialog.position( position ); + if ( !isVisible ) { + this.uiDialog.hide(); } - // handle "good" browsers - } else { - return $( document ).width() + "px"; } - }, - - resize: function() { - /* If the dialog is draggable and the user drags it past the - * right edge of the window, the document becomes wider so we - * need to stretch the overlay. If the user then drags the - * dialog back to the left, the document will become narrower, - * so we need to shrink the overlay to the appropriate size. - * This is handled by shrinking the overlay before setting it - * to the full document size. - */ - var $overlays = $( [] ); - $.each( $.ui.dialog.overlay.instances, function() { - $overlays = $overlays.add( this ); - }); - - $overlays.css({ - width: 0, - height: 0 - }).css({ - width: $.ui.dialog.overlay.width(), - height: $.ui.dialog.overlay.height() - }); - } -}); - -$.extend( $.ui.dialog.overlay.prototype, { - destroy: function() { - $.ui.dialog.overlay.destroy( this.$el ); - } -}); + }); +} }( jQuery ) ); @@ -10887,7 +11415,7 @@ $.effects.effect.transfer = function( o, done ) { width: target.innerWidth() }, startPosition = elem.offset(), - transfer = $( '<div class="ui-effects-transfer"></div>' ) + transfer = $( "<div class='ui-effects-transfer'></div>" ) .appendTo( document.body ) .addClass( o.className ) .css({ @@ -10907,10 +11435,8 @@ $.effects.effect.transfer = function( o, done ) { (function( $, undefined ) { -var mouseHandled = false; - $.widget( "ui.menu", { - version: "1.9.2", + version: "1.10.4", defaultElement: "<ul>", delay: 300, options: { @@ -10932,6 +11458,9 @@ $.widget( "ui.menu", { _create: function() { this.activeMenu = this.element; + // flag used to prevent firing of the click handler + // as the event bubbles up through nested menus + this.mouseHandled = false; this.element .uniqueId() .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) @@ -10965,14 +11494,19 @@ $.widget( "ui.menu", { }, "click .ui-menu-item:has(a)": function( event ) { var target = $( event.target ).closest( ".ui-menu-item" ); - if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) { - mouseHandled = true; - + if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { this.select( event ); + + // Only set the mouseHandled flag if the event will bubble, see #9469. + if ( !event.isPropagationStopped() ) { + this.mouseHandled = true; + } + // Open submenu on click if ( target.has( ".ui-menu" ).length ) { this.expand( event ); - } else if ( !this.element.is( ":focus" ) ) { + } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { + // Redirect focus to the menu this.element.trigger( "focus", [ true ] ); @@ -11022,7 +11556,7 @@ $.widget( "ui.menu", { } // Reset the mouseHandled flag - mouseHandled = false; + this.mouseHandled = false; } }); }, @@ -11031,7 +11565,7 @@ $.widget( "ui.menu", { // Destroy (sub)menus this.element .removeAttr( "aria-activedescendant" ) - .find( ".ui-menu" ).andSelf() + .find( ".ui-menu" ).addBack() .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" ) .removeAttr( "role" ) .removeAttr( "tabIndex" ) @@ -11173,6 +11707,8 @@ $.widget( "ui.menu", { icon = this.options.icons.submenu, submenus = this.element.find( this.options.menus ); + this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); + // Initialize nested menus submenus.filter( ":not(.ui-menu)" ) .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) @@ -11213,7 +11749,7 @@ $.widget( "ui.menu", { menus.children( ":not(.ui-menu-item)" ).each(function() { var item = $( this ); // hyphen, em dash, en dash - if ( !/[^\-—–\s]/.test( item.text() ) ) { + if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) { item.addClass( "ui-widget-content ui-menu-divider" ); } }); @@ -11234,6 +11770,15 @@ $.widget( "ui.menu", { }[ this.options.role ]; }, + _setOption: function( key, value ) { + if ( key === "icons" ) { + this.element.find( ".ui-menu-icon" ) + .removeClass( this.options.icons.submenu ) + .addClass( value.submenu ); + } + this._super( key, value ); + }, + focus: function( event, item ) { var nested, focused; this.blur( event, event && event.type === "focus" ); @@ -11264,7 +11809,7 @@ $.widget( "ui.menu", { } nested = item.children( ".ui-menu" ); - if ( nested.length && ( /^mouse/.test( event.type ) ) ) { + if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { this._startOpening(nested); } this.activeMenu = item.parent(); @@ -11511,28 +12056,59 @@ var cachedScrollbarWidth, round = Math.round, rhorizontal = /left|center|right/, rvertical = /top|center|bottom/, - roffset = /[\+\-]\d+%?/, + roffset = /[\+\-]\d+(\.[\d]+)?%?/, rposition = /^\w+/, rpercent = /%$/, _position = $.fn.position; function getOffsets( offsets, width, height ) { return [ - parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), - parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) + parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), + parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) ]; } + function parseCss( element, property ) { return parseInt( $.css( element, property ), 10 ) || 0; } +function getDimensions( elem ) { + var raw = elem[0]; + if ( raw.nodeType === 9 ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: 0, left: 0 } + }; + } + if ( $.isWindow( raw ) ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: elem.scrollTop(), left: elem.scrollLeft() } + }; + } + if ( raw.preventDefault ) { + return { + width: 0, + height: 0, + offset: { top: raw.pageY, left: raw.pageX } + }; + } + return { + width: elem.outerWidth(), + height: elem.outerHeight(), + offset: elem.offset() + }; +} + $.position = { scrollbarWidth: function() { if ( cachedScrollbarWidth !== undefined ) { return cachedScrollbarWidth; } var w1, w2, - div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), + div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), innerDiv = div.children()[0]; $( "body" ).append( div ); @@ -11550,23 +12126,27 @@ $.position = { return (cachedScrollbarWidth = w1 - w2); }, getScrollInfo: function( within ) { - var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), - overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), + var overflowX = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-x" ), + overflowY = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-y" ), hasOverflowX = overflowX === "scroll" || ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), hasOverflowY = overflowY === "scroll" || ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); return { - width: hasOverflowX ? $.position.scrollbarWidth() : 0, - height: hasOverflowY ? $.position.scrollbarWidth() : 0 + width: hasOverflowY ? $.position.scrollbarWidth() : 0, + height: hasOverflowX ? $.position.scrollbarWidth() : 0 }; }, getWithinInfo: function( element ) { var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ); + isWindow = $.isWindow( withinElement[0] ), + isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; return { element: withinElement, isWindow: isWindow, + isDocument: isDocument, offset: withinElement.offset() || { left: 0, top: 0 }, scrollLeft: withinElement.scrollLeft(), scrollTop: withinElement.scrollTop(), @@ -11584,32 +12164,21 @@ $.fn.position = function( options ) { // make a copy, we don't want to modify arguments options = $.extend( {}, options ); - var atOffset, targetWidth, targetHeight, targetOffset, basePosition, + var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, target = $( options.of ), within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), - targetElem = target[0], collision = ( options.collision || "flip" ).split( " " ), offsets = {}; - if ( targetElem.nodeType === 9 ) { - targetWidth = target.width(); - targetHeight = target.height(); - targetOffset = { top: 0, left: 0 }; - } else if ( $.isWindow( targetElem ) ) { - targetWidth = target.width(); - targetHeight = target.height(); - targetOffset = { top: target.scrollTop(), left: target.scrollLeft() }; - } else if ( targetElem.preventDefault ) { + dimensions = getDimensions( target ); + if ( target[0].preventDefault ) { // force left top to allow flipping options.at = "left top"; - targetWidth = targetHeight = 0; - targetOffset = { top: targetElem.pageY, left: targetElem.pageX }; - } else { - targetWidth = target.outerWidth(); - targetHeight = target.outerHeight(); - targetOffset = target.offset(); } + targetWidth = dimensions.width; + targetHeight = dimensions.height; + targetOffset = dimensions.offset; // clone to reuse original targetOffset later basePosition = $.extend( {}, targetOffset ); @@ -11723,10 +12292,6 @@ $.fn.position = function( options ) { } }); - if ( $.fn.bgiframe ) { - elem.bgiframe(); - } - if ( options.using ) { // adds feedback as second argument to using callback, if present using = function( props ) { @@ -11913,7 +12478,7 @@ $.ui.position = { } } else if ( overBottom > 0 ) { - newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; + newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { position.top += myOffset + atOffset + offset; } @@ -11971,69 +12536,38 @@ $.ui.position = { testElementParent.removeChild( testElement ); })(); -// DEPRECATED -if ( $.uiBackCompat !== false ) { - // offset option - (function( $ ) { - var _position = $.fn.position; - $.fn.position = function( options ) { - if ( !options || !options.offset ) { - return _position.call( this, options ); - } - var offset = options.offset.split( " " ), - at = options.at.split( " " ); - if ( offset.length === 1 ) { - offset[ 1 ] = offset[ 0 ]; - } - if ( /^\d/.test( offset[ 0 ] ) ) { - offset[ 0 ] = "+" + offset[ 0 ]; - } - if ( /^\d/.test( offset[ 1 ] ) ) { - offset[ 1 ] = "+" + offset[ 1 ]; - } - if ( at.length === 1 ) { - if ( /left|center|right/.test( at[ 0 ] ) ) { - at[ 1 ] = "center"; - } else { - at[ 1 ] = at[ 0 ]; - at[ 0 ] = "center"; - } - } - return _position.call( this, $.extend( options, { - at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ], - offset: undefined - } ) ); - }; - }( jQuery ) ); -} - }( jQuery ) ); (function( $, undefined ) { $.widget( "ui.progressbar", { - version: "1.9.2", + version: "1.10.4", options: { + max: 100, value: 0, - max: 100 + + change: null, + complete: null }, min: 0, _create: function() { + // Constrain initial value + this.oldValue = this.options.value = this._constrainedValue(); + this.element .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) .attr({ + // Only set static values, aria-valuenow and aria-valuemax are + // set inside _refreshValue() role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() + "aria-valuemin": this.min }); this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) .appendTo( this.element ); - this.oldValue = this._value(); this._refreshValue(); }, @@ -12050,52 +12584,87 @@ $.widget( "ui.progressbar", { value: function( newValue ) { if ( newValue === undefined ) { - return this._value(); + return this.options.value; } - this._setOption( "value", newValue ); - return this; + this.options.value = this._constrainedValue( newValue ); + this._refreshValue(); }, - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } + _constrainedValue: function( newValue ) { + if ( newValue === undefined ) { + newValue = this.options.value; } - this._super( key, value ); + this.indeterminate = newValue === false; + + // sanitize value + if ( typeof newValue !== "number" ) { + newValue = 0; + } + + return this.indeterminate ? false : + Math.min( this.options.max, Math.max( this.min, newValue ) ); }, - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; + _setOptions: function( options ) { + // Ensure "value" option is set after other values (like max) + var value = options.value; + delete options.value; + + this._super( options ); + + this.options.value = this._constrainedValue( value ); + this._refreshValue(); + }, + + _setOption: function( key, value ) { + if ( key === "max" ) { + // Don't allow a max less than min + value = Math.max( this.min, value ); } - return Math.min( this.options.max, Math.max( this.min, val ) ); + + this._super( key, value ); }, _percentage: function() { - return 100 * this._value() / this.options.max; + return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); }, _refreshValue: function() { - var value = this.value(), + var value = this.options.value, percentage = this._percentage(); + this.valueDiv + .toggle( this.indeterminate || value > this.min ) + .toggleClass( "ui-corner-right", value === this.options.max ) + .width( percentage.toFixed(0) + "%" ); + + this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate ); + + if ( this.indeterminate ) { + this.element.removeAttr( "aria-valuenow" ); + if ( !this.overlayDiv ) { + this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv ); + } + } else { + this.element.attr({ + "aria-valuemax": this.options.max, + "aria-valuenow": value + }); + if ( this.overlayDiv ) { + this.overlayDiv.remove(); + this.overlayDiv = null; + } + } + if ( this.oldValue !== value ) { this.oldValue = value; this._trigger( "change" ); } - - this.valueDiv - .toggle( value > this.min ) - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); + if ( value === this.options.max ) { + this._trigger( "complete" ); + } } }); @@ -12108,7 +12677,7 @@ $.widget( "ui.progressbar", { var numPages = 5; $.widget( "ui.slider", $.ui.mouse, { - version: "1.9.2", + version: "1.10.4", widgetEventPrefix: "slide", options: { @@ -12120,16 +12689,16 @@ $.widget( "ui.slider", $.ui.mouse, { range: false, step: 1, value: 0, - values: null + values: null, + + // callbacks + change: null, + slide: null, + start: null, + stop: null }, _create: function() { - var i, handleCount, - o = this.options, - existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), - handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", - handles = []; - this._keySliding = false; this._mouseSliding = false; this._animateOff = true; @@ -12142,31 +12711,34 @@ $.widget( "ui.slider", $.ui.mouse, { " ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + - " ui-corner-all" + - ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); + " ui-corner-all"); - this.range = $([]); + this._refresh(); + this._setOption( "disabled", this.options.disabled ); - if ( o.range ) { - if ( o.range === true ) { - if ( !o.values ) { - o.values = [ this._valueMin(), this._valueMin() ]; - } - if ( o.values.length && o.values.length !== 2 ) { - o.values = [ o.values[0], o.values[0] ]; - } - } + this._animateOff = false; + }, - this.range = $( "<div></div>" ) - .appendTo( this.element ) - .addClass( "ui-slider-range" + - // note: this isn't the most fittingly semantic framework class for this element, - // but worked best visually with a variety of themes - " ui-widget-header" + - ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); - } + _refresh: function() { + this._createRange(); + this._createHandles(); + this._setupEvents(); + this._refreshValue(); + }, + + _createHandles: function() { + var i, handleCount, + options = this.options, + existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), + handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", + handles = []; - handleCount = ( o.values && o.values.length ) || 1; + handleCount = ( options.values && options.values.length ) || 1; + + if ( existingHandles.length > handleCount ) { + existingHandles.slice( handleCount ).remove(); + existingHandles = existingHandles.slice( 0, handleCount ); + } for ( i = existingHandles.length; i < handleCount; i++ ) { handles.push( handle ); @@ -12176,124 +12748,71 @@ $.widget( "ui.slider", $.ui.mouse, { this.handle = this.handles.eq( 0 ); - this.handles.add( this.range ).filter( "a" ) - .click(function( event ) { - event.preventDefault(); - }) - .mouseenter(function() { - if ( !o.disabled ) { - $( this ).addClass( "ui-state-hover" ); - } - }) - .mouseleave(function() { - $( this ).removeClass( "ui-state-hover" ); - }) - .focus(function() { - if ( !o.disabled ) { - $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); - $( this ).addClass( "ui-state-focus" ); - } else { - $( this ).blur(); - } - }) - .blur(function() { - $( this ).removeClass( "ui-state-focus" ); - }); - this.handles.each(function( i ) { $( this ).data( "ui-slider-handle-index", i ); }); + }, - this._on( this.handles, { - keydown: function( event ) { - var allowed, curVal, newVal, step, - index = $( event.target ).data( "ui-slider-handle-index" ); - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - case $.ui.keyCode.END: - case $.ui.keyCode.PAGE_UP: - case $.ui.keyCode.PAGE_DOWN: - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - event.preventDefault(); - if ( !this._keySliding ) { - this._keySliding = true; - $( event.target ).addClass( "ui-state-active" ); - allowed = this._start( event, index ); - if ( allowed === false ) { - return; - } - } - break; - } - - step = this.options.step; - if ( this.options.values && this.options.values.length ) { - curVal = newVal = this.values( index ); - } else { - curVal = newVal = this.value(); - } + _createRange: function() { + var options = this.options, + classes = ""; - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - newVal = this._valueMin(); - break; - case $.ui.keyCode.END: - newVal = this._valueMax(); - break; - case $.ui.keyCode.PAGE_UP: - newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.PAGE_DOWN: - newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - if ( curVal === this._valueMax() ) { - return; - } - newVal = this._trimAlignValue( curVal + step ); - break; - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - if ( curVal === this._valueMin() ) { - return; - } - newVal = this._trimAlignValue( curVal - step ); - break; + if ( options.range ) { + if ( options.range === true ) { + if ( !options.values ) { + options.values = [ this._valueMin(), this._valueMin() ]; + } else if ( options.values.length && options.values.length !== 2 ) { + options.values = [ options.values[0], options.values[0] ]; + } else if ( $.isArray( options.values ) ) { + options.values = options.values.slice(0); } + } - this._slide( event, index, newVal ); - }, - keyup: function( event ) { - var index = $( event.target ).data( "ui-slider-handle-index" ); + if ( !this.range || !this.range.length ) { + this.range = $( "<div></div>" ) + .appendTo( this.element ); - if ( this._keySliding ) { - this._keySliding = false; - this._stop( event, index ); - this._change( event, index ); - $( event.target ).removeClass( "ui-state-active" ); - } + classes = "ui-slider-range" + + // note: this isn't the most fittingly semantic framework class for this element, + // but worked best visually with a variety of themes + " ui-widget-header ui-corner-all"; + } else { + this.range.removeClass( "ui-slider-range-min ui-slider-range-max" ) + // Handle range switching from true to min/max + .css({ + "left": "", + "bottom": "" + }); } - }); - this._refreshValue(); + this.range.addClass( classes + + ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) ); + } else { + if ( this.range ) { + this.range.remove(); + } + this.range = null; + } + }, - this._animateOff = false; + _setupEvents: function() { + var elements = this.handles.add( this.range ).filter( "a" ); + this._off( elements ); + this._on( elements, this._handleEvents ); + this._hoverable( elements ); + this._focusable( elements ); }, _destroy: function() { this.handles.remove(); - this.range.remove(); + if ( this.range ) { + this.range.remove(); + } this.element .removeClass( "ui-slider" + " ui-slider-horizontal" + " ui-slider-vertical" + - " ui-slider-disabled" + " ui-widget" + " ui-widget-content" + " ui-corner-all" ); @@ -12321,21 +12840,15 @@ $.widget( "ui.slider", $.ui.mouse, { distance = this._valueMax() - this._valueMin() + 1; this.handles.each(function( i ) { var thisDistance = Math.abs( normValue - that.values(i) ); - if ( distance > thisDistance ) { + if (( distance > thisDistance ) || + ( distance === thisDistance && + (i === that._lastChangedValue || that.values(i) === o.min ))) { distance = thisDistance; closestHandle = $( this ); index = i; } }); - // workaround for bug #3736 (if both handles of a range are at 0, - // the first is always used as the one with least distance, - // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { - index += 1; - closestHandle = $( this.handles[index] ); - } - allowed = this._start( event, index ); if ( allowed === false ) { return false; @@ -12349,7 +12862,7 @@ $.widget( "ui.slider", $.ui.mouse, { .focus(); offset = closestHandle.offset(); - mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); + mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { left: event.pageX - offset.left - ( closestHandle.width() / 2 ), top: event.pageY - offset.top - @@ -12466,7 +12979,7 @@ $.widget( "ui.slider", $.ui.mouse, { } ); otherVal = this.values( index ? 0 : 1 ); if ( allowed !== false ) { - this.values( index, newVal, true ); + this.values( index, newVal ); } } } else { @@ -12507,6 +13020,9 @@ $.widget( "ui.slider", $.ui.mouse, { uiHash.values = this.values(); } + //store the last changed value index for reference when handles overlap + this._lastChangedValue = index; + this._trigger( "change", event, uiHash ); } }, @@ -12559,6 +13075,16 @@ $.widget( "ui.slider", $.ui.mouse, { var i, valsLength = 0; + if ( key === "range" && this.options.range === true ) { + if ( value === "min" ) { + this.options.value = this._values( 0 ); + this.options.values = null; + } else if ( value === "max" ) { + this.options.value = this._values( this.options.values.length-1 ); + this.options.values = null; + } + } + if ( $.isArray( this.options.values ) ) { valsLength = this.options.values.length; } @@ -12566,17 +13092,6 @@ $.widget( "ui.slider", $.ui.mouse, { $.Widget.prototype._setOption.apply( this, arguments ); switch ( key ) { - case "disabled": - if ( value ) { - this.handles.filter( ".ui-state-focus" ).blur(); - this.handles.removeClass( "ui-state-hover" ); - this.handles.prop( "disabled", true ); - this.element.addClass( "ui-disabled" ); - } else { - this.handles.prop( "disabled", false ); - this.element.removeClass( "ui-disabled" ); - } - break; case "orientation": this._detectOrientation(); this.element @@ -12604,6 +13119,11 @@ $.widget( "ui.slider", $.ui.mouse, { this._refreshValue(); this._animateOff = false; break; + case "range": + this._animateOff = true; + this._refresh(); + this._animateOff = false; + break; } }, @@ -12629,7 +13149,7 @@ $.widget( "ui.slider", $.ui.mouse, { val = this._trimAlignValue( val ); return val; - } else { + } else if ( this.options.values && this.options.values.length ) { // .slice() creates a copy of the array // this copy gets trimmed by min and max and then returned vals = this.options.values.slice(); @@ -12638,6 +13158,8 @@ $.widget( "ui.slider", $.ui.mouse, { } return vals; + } else { + return []; } }, @@ -12725,6 +13247,85 @@ $.widget( "ui.slider", $.ui.mouse, { this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); } } + }, + + _handleEvents: { + keydown: function( event ) { + var allowed, curVal, newVal, step, + index = $( event.target ).data( "ui-slider-handle-index" ); + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + case $.ui.keyCode.END: + case $.ui.keyCode.PAGE_UP: + case $.ui.keyCode.PAGE_DOWN: + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + event.preventDefault(); + if ( !this._keySliding ) { + this._keySliding = true; + $( event.target ).addClass( "ui-state-active" ); + allowed = this._start( event, index ); + if ( allowed === false ) { + return; + } + } + break; + } + + step = this.options.step; + if ( this.options.values && this.options.values.length ) { + curVal = newVal = this.values( index ); + } else { + curVal = newVal = this.value(); + } + + switch ( event.keyCode ) { + case $.ui.keyCode.HOME: + newVal = this._valueMin(); + break; + case $.ui.keyCode.END: + newVal = this._valueMax(); + break; + case $.ui.keyCode.PAGE_UP: + newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.PAGE_DOWN: + newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) ); + break; + case $.ui.keyCode.UP: + case $.ui.keyCode.RIGHT: + if ( curVal === this._valueMax() ) { + return; + } + newVal = this._trimAlignValue( curVal + step ); + break; + case $.ui.keyCode.DOWN: + case $.ui.keyCode.LEFT: + if ( curVal === this._valueMin() ) { + return; + } + newVal = this._trimAlignValue( curVal - step ); + break; + } + + this._slide( event, index, newVal ); + }, + click: function( event ) { + event.preventDefault(); + }, + keyup: function( event ) { + var index = $( event.target ).data( "ui-slider-handle-index" ); + + if ( this._keySliding ) { + this._keySliding = false; + this._stop( event, index ); + this._change( event, index ); + $( event.target ).removeClass( "ui-state-active" ); + } + } } }); @@ -12745,7 +13346,7 @@ function modifier( fn ) { } $.widget( "ui.spinner", { - version: "1.9.2", + version: "1.10.4", defaultElement: "<input>", widgetEventPrefix: "spin", options: { @@ -12773,8 +13374,12 @@ $.widget( "ui.spinner", { this._setOption( "min", this.options.min ); this._setOption( "step", this.options.step ); - // format the value, but don't constrain - this._value( this.element.val(), true ); + // Only format if there is a value, prevents the field from being marked + // as invalid in Firefox, see #9573. + if ( this.value() !== "" ) { + // Format the value, but don't constrain. + this._value( this.element.val(), true ); + } this._draw(); this._on( this._events ); @@ -12820,6 +13425,7 @@ $.widget( "ui.spinner", { return; } + this._stop(); this._refresh(); if ( this.previous !== this.element.val() ) { this._trigger( "change", event ); @@ -13086,6 +13692,14 @@ $.widget( "ui.spinner", { value = this._parse( value ); } } + if ( key === "icons" ) { + this.buttons.first().find( ".ui-icon" ) + .removeClass( this.options.icons.up ) + .addClass( value.up ); + this.buttons.last().find( ".ui-icon" ) + .removeClass( this.options.icons.down ) + .addClass( value.down ); + } this._super( key, value ); @@ -13163,14 +13777,20 @@ $.widget( "ui.spinner", { this._stepUp( steps ); }), _stepUp: function( steps ) { - this._spin( (steps || 1) * this.options.step ); + if ( this._start() ) { + this._spin( (steps || 1) * this.options.step ); + this._stop(); + } }, stepDown: modifier(function( steps ) { this._stepDown( steps ); }), _stepDown: function( steps ) { - this._spin( (steps || 1) * -this.options.step ); + if ( this._start() ) { + this._spin( (steps || 1) * -this.options.step ); + this._stop(); + } }, pageUp: modifier(function( pages ) { @@ -13205,17 +13825,17 @@ function getNextTabId() { } function isLocal( anchor ) { + // support: IE7 + // IE7 doesn't normalize the href property when set via script (#9317) + anchor = anchor.cloneNode( false ); + return anchor.hash.length > 1 && - anchor.href.replace( rhash, "" ) === - location.href.replace( rhash, "" ) - // support: Safari 5.1 - // Safari 5.1 doesn't encode spaces in window.location - // but it does encode spaces from anchors (#8777) - .replace( /\s/g, "%20" ); + decodeURIComponent( anchor.href.replace( rhash, "" ) ) === + decodeURIComponent( location.href.replace( rhash, "" ) ); } $.widget( "ui.tabs", { - version: "1.9.2", + version: "1.10.4", delay: 300, options: { active: null, @@ -13234,9 +13854,7 @@ $.widget( "ui.tabs", { _create: function() { var that = this, - options = this.options, - active = options.active, - locationHash = location.hash.substring( 1 ); + options = this.options; this.running = false; @@ -13262,6 +13880,36 @@ $.widget( "ui.tabs", { }); this._processTabs(); + options.active = this._initialActive(); + + // Take disabling tabs via class attribute from HTML + // into account and update option properly. + if ( $.isArray( options.disabled ) ) { + options.disabled = $.unique( options.disabled.concat( + $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { + return that.tabs.index( li ); + }) + ) ).sort(); + } + + // check for length avoids error when initializing empty list + if ( this.options.active !== false && this.anchors.length ) { + this.active = this._findActive( options.active ); + } else { + this.active = $(); + } + + this._refresh(); + + if ( this.active.length ) { + this.load( options.active ); + } + }, + + _initialActive: function() { + var active = this.options.active, + collapsible = this.options.collapsible, + locationHash = location.hash.substring( 1 ); if ( active === null ) { // check the fragment identifier in the URL @@ -13289,38 +13937,16 @@ $.widget( "ui.tabs", { if ( active !== false ) { active = this.tabs.index( this.tabs.eq( active ) ); if ( active === -1 ) { - active = options.collapsible ? false : 0; + active = collapsible ? false : 0; } } - options.active = active; // don't allow collapsible: false and active: false - if ( !options.collapsible && options.active === false && this.anchors.length ) { - options.active = 0; - } - - // Take disabling tabs via class attribute from HTML - // into account and update option properly. - if ( $.isArray( options.disabled ) ) { - options.disabled = $.unique( options.disabled.concat( - $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { - return that.tabs.index( li ); - }) - ) ).sort(); + if ( !collapsible && active === false && this.anchors.length ) { + active = 0; } - // check for length avoids error when initializing empty list - if ( this.options.active !== false && this.anchors.length ) { - this.active = this._findActive( this.options.active ); - } else { - this.active = $(); - } - - this._refresh(); - - if ( this.active.length ) { - this.load( options.active ); - } + return active; }, _getCreateEventData: function() { @@ -13618,7 +14244,7 @@ $.widget( "ui.tabs", { // allow overriding how to find the list for rare usage scenarios (#7715) _getList: function() { - return this.element.find( "ol,ul" ).eq( 0 ); + return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); }, _createPanel: function( id ) { @@ -13675,19 +14301,13 @@ $.widget( "ui.tabs", { }, _setupHeightStyle: function( heightStyle ) { - var maxHeight, overflow, + var maxHeight, parent = this.element.parent(); if ( heightStyle === "fill" ) { - // IE 6 treats height like minHeight, so we need to turn off overflow - // in order to get a reliable height - // we use the minHeight support test because we assume that only - // browsers that don't support minHeight will treat height as minHeight - if ( !$.support.minHeight ) { - overflow = parent.css( "overflow" ); - parent.css( "overflow", "hidden"); - } maxHeight = parent.height(); + maxHeight -= this.element.outerHeight() - this.element.height(); + this.element.siblings( ":visible" ).each(function() { var elem = $( this ), position = elem.css( "position" ); @@ -13697,9 +14317,6 @@ $.widget( "ui.tabs", { } maxHeight -= elem.outerHeight( true ); }); - if ( overflow ) { - parent.css( "overflow", overflow ); - } this.element.children().not( this.panels ).each(function() { maxHeight -= $( this ).outerHeight( true ); @@ -13878,8 +14495,6 @@ $.widget( "ui.tabs", { .removeClass( "ui-tabs-anchor" ) .removeAttr( "role" ) .removeAttr( "tabIndex" ) - .removeData( "href.tabs" ) - .removeData( "load.tabs" ) .removeUniqueId(); this.tabs.add( this.panels ).each(function() { @@ -13904,7 +14519,9 @@ $.widget( "ui.tabs", { var li = $( this ), prev = li.data( "ui-tabs-aria-controls" ); if ( prev ) { - li.attr( "aria-controls", prev ); + li + .attr( "aria-controls", prev ) + .removeData( "ui-tabs-aria-controls" ); } else { li.removeAttr( "aria-controls" ); } @@ -14015,7 +14632,6 @@ $.widget( "ui.tabs", { } }, - // TODO: Remove this function in 1.10 when ajaxOptions is removed _ajaxSettings: function( anchor, event, eventData ) { var that = this; return { @@ -14033,519 +14649,6 @@ $.widget( "ui.tabs", { } }); -// DEPRECATED -if ( $.uiBackCompat !== false ) { - - // helper method for a lot of the back compat extensions - $.ui.tabs.prototype._ui = function( tab, panel ) { - return { - tab: tab, - panel: panel, - index: this.anchors.index( tab ) - }; - }; - - // url method - $.widget( "ui.tabs", $.ui.tabs, { - url: function( index, url ) { - this.anchors.eq( index ).attr( "href", url ); - } - }); - - // TODO: Remove _ajaxSettings() method when removing this extension - // ajaxOptions and cache options - $.widget( "ui.tabs", $.ui.tabs, { - options: { - ajaxOptions: null, - cache: false - }, - - _create: function() { - this._super(); - - var that = this; - - this._on({ tabsbeforeload: function( event, ui ) { - // tab is already cached - if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) { - event.preventDefault(); - return; - } - - ui.jqXHR.success(function() { - if ( that.options.cache ) { - $.data( ui.tab[ 0 ], "cache.tabs", true ); - } - }); - }}); - }, - - _ajaxSettings: function( anchor, event, ui ) { - var ajaxOptions = this.options.ajaxOptions; - return $.extend( {}, ajaxOptions, { - error: function( xhr, status ) { - try { - // Passing index avoid a race condition when this method is - // called after the user has selected another tab. - // Pass the anchor that initiated this request allows - // loadError to manipulate the tab content panel via $(a.hash) - ajaxOptions.error( - xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] ); - } - catch ( error ) {} - } - }, this._superApply( arguments ) ); - }, - - _setOption: function( key, value ) { - // reset cache if switching from cached to not cached - if ( key === "cache" && value === false ) { - this.anchors.removeData( "cache.tabs" ); - } - this._super( key, value ); - }, - - _destroy: function() { - this.anchors.removeData( "cache.tabs" ); - this._super(); - }, - - url: function( index ){ - this.anchors.eq( index ).removeData( "cache.tabs" ); - this._superApply( arguments ); - } - }); - - // abort method - $.widget( "ui.tabs", $.ui.tabs, { - abort: function() { - if ( this.xhr ) { - this.xhr.abort(); - } - } - }); - - // spinner - $.widget( "ui.tabs", $.ui.tabs, { - options: { - spinner: "<em>Loading…</em>" - }, - _create: function() { - this._super(); - this._on({ - tabsbeforeload: function( event, ui ) { - // Don't react to nested tabs or tabs that don't use a spinner - if ( event.target !== this.element[ 0 ] || - !this.options.spinner ) { - return; - } - - var span = ui.tab.find( "span" ), - html = span.html(); - span.html( this.options.spinner ); - ui.jqXHR.complete(function() { - span.html( html ); - }); - } - }); - } - }); - - // enable/disable events - $.widget( "ui.tabs", $.ui.tabs, { - options: { - enable: null, - disable: null - }, - - enable: function( index ) { - var options = this.options, - trigger; - - if ( index && options.disabled === true || - ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) { - trigger = true; - } - - this._superApply( arguments ); - - if ( trigger ) { - this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - } - }, - - disable: function( index ) { - var options = this.options, - trigger; - - if ( index && options.disabled === false || - ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) { - trigger = true; - } - - this._superApply( arguments ); - - if ( trigger ) { - this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - } - } - }); - - // add/remove methods and events - $.widget( "ui.tabs", $.ui.tabs, { - options: { - add: null, - remove: null, - tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>" - }, - - add: function( url, label, index ) { - if ( index === undefined ) { - index = this.anchors.length; - } - - var doInsertAfter, panel, - options = this.options, - li = $( options.tabTemplate - .replace( /#\{href\}/g, url ) - .replace( /#\{label\}/g, label ) ), - id = !url.indexOf( "#" ) ? - url.replace( "#", "" ) : - this._tabId( li ); - - li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true ); - li.attr( "aria-controls", id ); - - doInsertAfter = index >= this.tabs.length; - - // try to find an existing element before creating a new one - panel = this.element.find( "#" + id ); - if ( !panel.length ) { - panel = this._createPanel( id ); - if ( doInsertAfter ) { - if ( index > 0 ) { - panel.insertAfter( this.panels.eq( -1 ) ); - } else { - panel.appendTo( this.element ); - } - } else { - panel.insertBefore( this.panels[ index ] ); - } - } - panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide(); - - if ( doInsertAfter ) { - li.appendTo( this.tablist ); - } else { - li.insertBefore( this.tabs[ index ] ); - } - - options.disabled = $.map( options.disabled, function( n ) { - return n >= index ? ++n : n; - }); - - this.refresh(); - if ( this.tabs.length === 1 && options.active === false ) { - this.option( "active", 0 ); - } - - this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - remove: function( index ) { - index = this._getIndex( index ); - var options = this.options, - tab = this.tabs.eq( index ).remove(), - panel = this._getPanelForTab( tab ).remove(); - - // If selected tab was removed focus tab to the right or - // in case the last tab was removed the tab to the left. - // We check for more than 2 tabs, because if there are only 2, - // then when we remove this tab, there will only be one tab left - // so we don't need to detect which tab to activate. - if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) { - this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); - } - - options.disabled = $.map( - $.grep( options.disabled, function( n ) { - return n !== index; - }), - function( n ) { - return n >= index ? --n : n; - }); - - this.refresh(); - - this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) ); - return this; - } - }); - - // length method - $.widget( "ui.tabs", $.ui.tabs, { - length: function() { - return this.anchors.length; - } - }); - - // panel ids (idPrefix option + title attribute) - $.widget( "ui.tabs", $.ui.tabs, { - options: { - idPrefix: "ui-tabs-" - }, - - _tabId: function( tab ) { - var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab; - a = a[0]; - return $( a ).closest( "li" ).attr( "aria-controls" ) || - a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) || - this.options.idPrefix + getNextTabId(); - } - }); - - // _createPanel method - $.widget( "ui.tabs", $.ui.tabs, { - options: { - panelTemplate: "<div></div>" - }, - - _createPanel: function( id ) { - return $( this.options.panelTemplate ) - .attr( "id", id ) - .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) - .data( "ui-tabs-destroy", true ); - } - }); - - // selected option - $.widget( "ui.tabs", $.ui.tabs, { - _create: function() { - var options = this.options; - if ( options.active === null && options.selected !== undefined ) { - options.active = options.selected === -1 ? false : options.selected; - } - this._super(); - options.selected = options.active; - if ( options.selected === false ) { - options.selected = -1; - } - }, - - _setOption: function( key, value ) { - if ( key !== "selected" ) { - return this._super( key, value ); - } - - var options = this.options; - this._super( "active", value === -1 ? false : value ); - options.selected = options.active; - if ( options.selected === false ) { - options.selected = -1; - } - }, - - _eventHandler: function() { - this._superApply( arguments ); - this.options.selected = this.options.active; - if ( this.options.selected === false ) { - this.options.selected = -1; - } - } - }); - - // show and select event - $.widget( "ui.tabs", $.ui.tabs, { - options: { - show: null, - select: null - }, - _create: function() { - this._super(); - if ( this.options.active !== false ) { - this._trigger( "show", null, this._ui( - this.active.find( ".ui-tabs-anchor" )[ 0 ], - this._getPanelForTab( this.active )[ 0 ] ) ); - } - }, - _trigger: function( type, event, data ) { - var tab, panel, - ret = this._superApply( arguments ); - - if ( !ret ) { - return false; - } - - if ( type === "beforeActivate" ) { - tab = data.newTab.length ? data.newTab : data.oldTab; - panel = data.newPanel.length ? data.newPanel : data.oldPanel; - ret = this._super( "select", event, { - tab: tab.find( ".ui-tabs-anchor" )[ 0], - panel: panel[ 0 ], - index: tab.closest( "li" ).index() - }); - } else if ( type === "activate" && data.newTab.length ) { - ret = this._super( "show", event, { - tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ], - panel: data.newPanel[ 0 ], - index: data.newTab.closest( "li" ).index() - }); - } - return ret; - } - }); - - // select method - $.widget( "ui.tabs", $.ui.tabs, { - select: function( index ) { - index = this._getIndex( index ); - if ( index === -1 ) { - if ( this.options.collapsible && this.options.selected !== -1 ) { - index = this.options.selected; - } else { - return; - } - } - this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace ); - } - }); - - // cookie option - (function() { - - var listId = 0; - - $.widget( "ui.tabs", $.ui.tabs, { - options: { - cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } - }, - _create: function() { - var options = this.options, - active; - if ( options.active == null && options.cookie ) { - active = parseInt( this._cookie(), 10 ); - if ( active === -1 ) { - active = false; - } - options.active = active; - } - this._super(); - }, - _cookie: function( active ) { - var cookie = [ this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ]; - if ( arguments.length ) { - cookie.push( active === false ? -1 : active ); - cookie.push( this.options.cookie ); - } - return $.cookie.apply( null, cookie ); - }, - _refresh: function() { - this._super(); - if ( this.options.cookie ) { - this._cookie( this.options.active, this.options.cookie ); - } - }, - _eventHandler: function() { - this._superApply( arguments ); - if ( this.options.cookie ) { - this._cookie( this.options.active, this.options.cookie ); - } - }, - _destroy: function() { - this._super(); - if ( this.options.cookie ) { - this._cookie( null, this.options.cookie ); - } - } - }); - - })(); - - // load event - $.widget( "ui.tabs", $.ui.tabs, { - _trigger: function( type, event, data ) { - var _data = $.extend( {}, data ); - if ( type === "load" ) { - _data.panel = _data.panel[ 0 ]; - _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ]; - } - return this._super( type, event, _data ); - } - }); - - // fx option - // The new animation options (show, hide) conflict with the old show callback. - // The old fx option wins over show/hide anyway (always favor back-compat). - // If a user wants to use the new animation API, they must give up the old API. - $.widget( "ui.tabs", $.ui.tabs, { - options: { - fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 } - }, - - _getFx: function() { - var hide, show, - fx = this.options.fx; - - if ( fx ) { - if ( $.isArray( fx ) ) { - hide = fx[ 0 ]; - show = fx[ 1 ]; - } else { - hide = show = fx; - } - } - - return fx ? { show: show, hide: hide } : null; - }, - - _toggle: function( event, eventData ) { - var that = this, - toShow = eventData.newPanel, - toHide = eventData.oldPanel, - fx = this._getFx(); - - if ( !fx ) { - return this._super( event, eventData ); - } - - that.running = true; - - function complete() { - that.running = false; - that._trigger( "activate", event, eventData ); - } - - function show() { - eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); - - if ( toShow.length && fx.show ) { - toShow - .animate( fx.show, fx.show.duration, function() { - complete(); - }); - } else { - toShow.show(); - complete(); - } - } - - // start out by hiding, then showing, then completing - if ( toHide.length && fx.hide ) { - toHide.animate( fx.hide, fx.hide.duration, function() { - eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); - show(); - }); - } else { - eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); - toHide.hide(); - show(); - } - } - }); -} - })( jQuery ); (function( $ ) { @@ -14578,10 +14681,14 @@ function removeDescribedBy( elem ) { } $.widget( "ui.tooltip", { - version: "1.9.2", + version: "1.10.4", options: { content: function() { - return $( this ).attr( "title" ); + // support: IE<9, Opera in jQuery <1.7 + // .text() can't accept undefined, so coerce to a string + var title = $( this ).attr( "title" ) || ""; + // Escape title, since we're going from an attribute to raw HTML + return $( "<a>" ).text( title ).html(); }, hide: true, // Disabled elements have inconsistent behavior across browsers (#8661) @@ -14646,7 +14753,7 @@ $.widget( "ui.tooltip", { }); // remove title attributes to prevent native tooltips - this.element.find( this.options.items ).andSelf().each(function() { + this.element.find( this.options.items ).addBack().each(function() { var element = $( this ); if ( element.is( "[title]" ) ) { element @@ -14658,7 +14765,7 @@ $.widget( "ui.tooltip", { _enable: function() { // restore title attributes - this.element.find( this.options.items ).andSelf().each(function() { + this.element.find( this.options.items ).addBack().each(function() { var element = $( this ); if ( element.data( "ui-tooltip-title" ) ) { element.attr( "title", element.data( "ui-tooltip-title" ) ); @@ -14803,7 +14910,7 @@ $.widget( "ui.tooltip", { // as the tooltip is visible, position the tooltip using the most recent // event. if ( this.options.show && this.options.show.delay ) { - delayedShow = setInterval(function() { + delayedShow = this.delayedShow = setInterval(function() { if ( tooltip.is( ":visible" ) ) { position( positionOption.of ); clearInterval( delayedShow ); @@ -14845,6 +14952,9 @@ $.widget( "ui.tooltip", { return; } + // Clear the interval for delayed tracking tooltips + clearInterval( this.delayedShow ); + // only set title if we had one before (see comment in _open()) if ( target.data( "ui-tooltip-title" ) ) { target.attr( "title", target.data( "ui-tooltip-title" ) ); @@ -14890,9 +15000,6 @@ $.widget( "ui.tooltip", { .addClass( "ui-tooltip-content" ) .appendTo( tooltip ); tooltip.appendTo( this.document[0].body ); - if ( $.fn.bgiframe ) { - tooltip.bgiframe(); - } this.tooltips[ id ] = element; return tooltip; }, diff --git a/pub/lib/jquery/jquery-ui.min.js b/pub/lib/jquery/jquery-ui.min.js new file mode 100644 index 0000000000000000000000000000000000000000..6afd61549887ab2cda31836dfd77a7b7aac46734 --- /dev/null +++ b/pub/lib/jquery/jquery-ui.min.js @@ -0,0 +1,12 @@ +/*! jQuery UI - v1.10.4 - 2014-01-17 +* http://jqueryui.com +* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.effect.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js +* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ +(function(t,e){function i(e,i){var n,o,a,r=e.nodeName.toLowerCase();return"area"===r?(n=e.parentNode,o=n.name,e.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap=#"+o+"]")[0],!!a&&s(a)):!1):(/input|select|textarea|button|object/.test(r)?!e.disabled:"a"===r?e.href||i:i)&&s(e)}function s(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var n=0,o=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(i,s){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),s&&s.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(i){if(i!==e)return this.css("zIndex",i);if(this.length)for(var s,n,o=t(this[0]);o.length&&o[0]!==document;){if(s=o.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(n=parseInt(o.css("zIndex"),10),!isNaN(n)&&0!==n))return n;o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])},focusable:function(e){return i(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var s=t.attr(e,"tabindex"),n=isNaN(s);return(n||s>=0)&&i(e,!n)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(i,s){function n(e,i,s,n){return t.each(o,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),n&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var o="Width"===s?["Left","Right"]:["Top","Bottom"],a=s.toLowerCase(),r={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+s]=function(i){return i===e?r["inner"+s].call(this):this.each(function(){t(this).css(a,n(this,i)+"px")})},t.fn["outer"+s]=function(e,i){return"number"!=typeof e?r["outer"+s].call(this,e):this.each(function(){t(this).css(a,n(this,e,!0,i)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i){var s,n=t.plugins[e];if(n&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(s=0;n.length>s;s++)t.options[n[s][0]]&&n[s][1].apply(t.element,i)}},hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)}})})(jQuery),function(t,e){var i=0,s=Array.prototype.slice,n=t.cleanData;t.cleanData=function(e){for(var i,s=0;null!=(i=e[s]);s++)try{t(i).triggerHandler("remove")}catch(o){}n(e)},t.widget=function(i,s,n){var o,a,r,h,l={},c=i.split(".")[0];i=i.split(".")[1],o=c+"-"+i,n||(n=s,s=t.Widget),t.expr[":"][o.toLowerCase()]=function(e){return!!t.data(e,o)},t[c]=t[c]||{},a=t[c][i],r=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new r(t,i)},t.extend(r,a,{version:n.version,_proto:t.extend({},n),_childConstructors:[]}),h=new s,h.options=t.widget.extend({},h.options),t.each(n,function(i,n){return t.isFunction(n)?(l[i]=function(){var t=function(){return s.prototype[i].apply(this,arguments)},e=function(t){return s.prototype[i].apply(this,t)};return function(){var i,s=this._super,o=this._superApply;return this._super=t,this._superApply=e,i=n.apply(this,arguments),this._super=s,this._superApply=o,i}}(),e):(l[i]=n,e)}),r.prototype=t.widget.extend(h,{widgetEventPrefix:a?h.widgetEventPrefix||i:i},l,{constructor:r,namespace:c,widgetName:i,widgetFullName:o}),a?(t.each(a._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,r,i._proto)}),delete a._childConstructors):s._childConstructors.push(r),t.widget.bridge(i,r)},t.widget.extend=function(i){for(var n,o,a=s.call(arguments,1),r=0,h=a.length;h>r;r++)for(n in a[r])o=a[r][n],a[r].hasOwnProperty(n)&&o!==e&&(i[n]=t.isPlainObject(o)?t.isPlainObject(i[n])?t.widget.extend({},i[n],o):t.widget.extend({},o):o);return i},t.widget.bridge=function(i,n){var o=n.prototype.widgetFullName||i;t.fn[i]=function(a){var r="string"==typeof a,h=s.call(arguments,1),l=this;return a=!r&&h.length?t.widget.extend.apply(null,[a].concat(h)):a,r?this.each(function(){var s,n=t.data(this,o);return n?t.isFunction(n[a])&&"_"!==a.charAt(0)?(s=n[a].apply(n,h),s!==n&&s!==e?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):e):t.error("no such method '"+a+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+a+"'")}):this.each(function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new n(a,this))}),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,s){var n,o,a,r=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(r={},n=i.split("."),i=n.shift(),n.length){for(o=r[i]=t.widget.extend({},this.options[i]),a=0;n.length-1>a;a++)o[n[a]]=o[n[a]]||{},o=o[n[a]];if(i=n.pop(),1===arguments.length)return o[i]===e?null:o[i];o[i]=s}else{if(1===arguments.length)return this.options[i]===e?null:this.options[i];r[i]=s}return this._setOptions(r),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var o,a=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=o=t(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,o=this.widget()),t.each(n,function(n,r){function h(){return i||a.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof r?a[r]:r).apply(a,arguments):e}"string"!=typeof r&&(h.guid=r.guid=r.guid||h.guid||t.guid++);var l=n.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,h):s.bind(c,h)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}})}(jQuery),function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,o="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return s._mouseMove(t)},this._mouseUpDelegate=function(t){return s._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(e){var i,s,n,o,a=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=e.pageX,l=e.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var s=t(this).data("ui-draggable"),n=s.options,o=t.extend({},i,{item:s.element});s.sortables=[],t(n.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,o))})},stop:function(e,i){var s=t(this).data("ui-draggable"),n=t.extend({},i,{item:s.element});t.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,n))})},drag:function(e,i){var s=t(this).data("ui-draggable"),n=this;t.each(s.sortables,function(){var o=!1,a=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,t.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==a&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(a.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",e),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",e),s.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._opacity&&t(i.helper).css("opacity",s._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:e.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:e.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(e.pageY-t(document).scrollTop()<s.scrollSensitivity?n=t(document).scrollTop(t(document).scrollTop()-s.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<s.scrollSensitivity&&(n=t(document).scrollTop(t(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(e.pageX-t(document).scrollLeft()<s.scrollSensitivity?n=t(document).scrollLeft(t(document).scrollLeft()-s.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<s.scrollSensitivity&&(n=t(document).scrollLeft(t(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&t.ui.ddmanager&&!s.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),s=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(e,i){var s,n,o,a,r,h,l,c,u,d,p=t(this).data("ui-draggable"),f=p.options,g=f.snapTolerance,m=i.offset.left,v=m+p.helperProportions.width,_=i.offset.top,b=_+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)r=p.snapElements[u].left,h=r+p.snapElements[u].width,l=p.snapElements[u].top,c=l+p.snapElements[u].height,r-g>v||m>h+g||l-g>b||_>c+g||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==f.snapMode&&(s=g>=Math.abs(l-b),n=g>=Math.abs(c-_),o=g>=Math.abs(r-v),a=g>=Math.abs(h-m),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||o||a,"outer"!==f.snapMode&&(s=g>=Math.abs(l-_),n=g>=Math.abs(c-b),o=g>=Math.abs(r-m),a=g>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(s||n||o||a||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=s||n||o||a||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,s=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});s.length&&(e=parseInt(t(s[0]).css("zIndex"),10)||0,t(s).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+s.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var s=t(i.helper),n=t(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(e,i){var s=t(this).data("ui-draggable").options;s._zIndex&&t(i.helper).css("zIndex",s._zIndex)}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}t.widget("ui.droppable",{version:"1.10.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept; +this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],undefined):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},t.ui.ddmanager.droppables[i.scope]=t.ui.ddmanager.droppables[i.scope]||[],t.ui.ddmanager.droppables[i.scope].push(this),i.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var e=0,i=t.ui.ddmanager.droppables[this.options.scope];i.length>e;e++)i[e]===this&&i.splice(e,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,i){"accept"===e&&(this.accept=t.isFunction(i)?i:function(t){return t.is(i)}),t.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var e=t.data(this,"ui-droppable");return e.options.greedy&&!e.options.disabled&&e.options.scope===s.options.scope&&e.accept.call(e.element[0],s.currentItem||s.element)&&t.ui.intersect(s,t.extend(e,{offset:e.element.offset()}),e.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(t,i,s){if(!i.offset)return!1;var n,o,a=(t.positionAbs||t.position.absolute).left,r=(t.positionAbs||t.position.absolute).top,h=a+t.helperProportions.width,l=r+t.helperProportions.height,c=i.offset.left,u=i.offset.top,d=c+i.proportions().width,p=u+i.proportions().height;switch(s){case"fit":return a>=c&&d>=h&&r>=u&&p>=l;case"intersect":return a+t.helperProportions.width/2>c&&d>h-t.helperProportions.width/2&&r+t.helperProportions.height/2>u&&p>l-t.helperProportions.height/2;case"pointer":return n=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,o=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(o,u,i.proportions().height)&&e(n,c,i.proportions().width);case"touch":return(r>=u&&p>=r||l>=u&&p>=l||u>r&&l>p)&&(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d);default:return!1}},t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").bind("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=t.ui.intersect(e,this,this.options.tolerance),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t.data(this,"ui-droppable").options.scope===n}),o.length&&(s=t.data(o[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").unbind("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}}}(jQuery),function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,s,n,o,a=this,r=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)s=t.trim(e[i]),o="ui-resizable-"+s,n=t("<div class='ui-resizable-handle "+o+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(t(this).removeClass("ui-resizable-autohide"),a._handles.show())}).mouseleave(function(){r.disabled||a.resizing||(t(this).addClass("ui-resizable-autohide"),a._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,o,a=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=e(this.helper.css("left")),n=e(this.helper.css("top")),a.containment&&(s+=t(a.containment).scrollLeft()||0,n+=t(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,o=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===o?this.axis+"-resize":o),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(e){var i,s=this.helper,n={},o=this.originalMousePosition,a=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,c=this.size.height,u=e.pageX-o.left||0,d=e.pageY-o.top||0,p=this._change[a];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==c&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(n)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,h=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,s,n,o,a,r=this.options;a={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||t)&&(e=a.minHeight*this.aspectRatio,n=a.minWidth/this.aspectRatio,s=a.maxHeight*this.aspectRatio,o=a.maxWidth/this.aspectRatio,e>a.minWidth&&(a.minWidth=e),n>a.minHeight&&(a.minHeight=n),a.maxWidth>s&&(a.maxWidth=s),a.maxHeight>o&&(a.maxHeight=o)),this._vBoundaries=a},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,s=this.size,n=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===n&&(t.left=e.left+(s.width-t.width),t.top=null),"nw"===n&&(t.top=e.top+(s.height-t.height),t.left=e.left+(s.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,s=this.axis,n=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,o=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,a=i(t.width)&&e.minWidth&&e.minWidth>t.width,r=i(t.height)&&e.minHeight&&e.minHeight>t.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,c=/sw|nw|w/.test(s),u=/nw|ne|n/.test(s);return a&&(t.width=e.minWidth),r&&(t.height=e.minHeight),n&&(t.width=e.maxWidth),o&&(t.height=e.maxHeight),a&&c&&(t.left=h-e.minWidth),n&&c&&(t.left=h-e.maxWidth),r&&u&&(t.top=l-e.minHeight),o&&u&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,s,n,o=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(n=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(s[e],10)||0);n.css({height:o.height()-this.borderDif[0]-this.borderDif[2]||0,width:o.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&t.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,o,a,r,h,l=t(this).data("ui-resizable"),c=l.options,u=l.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(l.containerElement=t(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),s=[],t(["Top","Right","Left","Bottom"]).each(function(t,n){s[t]=e(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,o=l.containerSize.height,a=l.containerSize.width,r=t.ui.hasScroll(p,"left")?p.scrollWidth:a,h=t.ui.hasScroll(p)?p.scrollHeight:o,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(e){var i,s,n,o,a=t(this).data("ui-resizable"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio),a.position.top=a._helper?h.top:0),a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top,i=Math.abs((a._helper?a.offset.left-u.left:a.offset.left-u.left)+a.sizeDiff.width),s=Math.abs((a._helper?a.offset.top-u.top:a.offset.top-h.top)+a.sizeDiff.height),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o&&(i-=Math.abs(a.parentData.left)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):t.each(i.alsoResize,function(t){s(t)})},resize:function(e,i){var s=t(this).data("ui-resizable"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0},h=function(e,s){t(e).each(function(){var e=t(this),n=t(this).data("ui-resizable-alsoresize"),o={},a=s&&s.length?s:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(a,function(t,e){var i=(n[e]||0)+(r[e]||0);i&&i>=0&&(o[e]=i||null)}),e.css(o)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):t.each(n.alsoResize,function(t,e){h(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,c=Math.round((s.width-n.width)/h)*h,u=Math.round((s.height-n.height)/l)*l,d=n.width+c,p=n.height+u,f=i.maxWidth&&d>i.maxWidth,g=i.maxHeight&&p>i.maxHeight,m=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=h),v&&(p+=l),f&&(d-=h),g&&(p-=l),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):(p-l>0?(e.size.height=p,e.position.top=o.top-u):(e.size.height=l,e.position.top=o.top+n.height-l),d-h>0?(e.size.width=d,e.position.left=o.left-c):(e.size.width=h,e.position.left=o.left+n.width-h))}})}(jQuery),function(t){t.widget("ui.selectable",t.ui.mouse,{version:"1.10.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e=t(i.options.filter,i.element[0]),e.addClass("ui-selectee"),e.each(function(){var e=t(this),i=e.offset();t.data(this,"selectable-item",{element:this,$element:e,left:i.left,top:i.top,right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=t("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):undefined}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||o>i.right||i.top>h||a>i.bottom):"fit"===n.tolerance&&(l=i.left>o&&r>i.right&&i.top>a&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):undefined}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-t(document).scrollTop()<a.scrollSensitivity?r=t(document).scrollTop(t(document).scrollTop()-a.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<a.scrollSensitivity&&(r=t(document).scrollTop(t(document).scrollTop()+a.scrollSpeed)),e.pageX-t(document).scrollLeft()<a.scrollSensitivity?r=t(document).scrollLeft(t(document).scrollLeft()-a.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<a.scrollSensitivity&&(r=t(document).scrollLeft(t(document).scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break; +this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return n?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&s||"left"===o&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t("<td> </td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,o,a,r,h,l,c,u,d,p,f=null,g=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],g=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[g].containerCache.over||(this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1);else{for(a=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],o=this.items.length-1;o>=0;o--)t.contains(this.containers[g].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))&&(u=this.items[o].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[o][l]-c)&&(d=!0,u+=this.items[o][l]),a>Math.abs(u-c)&&(a=Math.abs(u-c),r=this.items[o],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[g])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[g].element,!0),this._trigger("change",s,this._uiHash()),this.containers[g]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[g],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[g]._trigger("over",s,this._uiHash(this)),this.containers[g].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}(jQuery),function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function s(e,i){var s,n,a={};for(s in i)n=i[s],e[s]!==n&&(o[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(a[s]=n));return a}var n=["add","remove","toggle"],o={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var e=t(this);return{el:e,start:i(this)}}),o=function(){t.each(n,function(t,i){e[i]&&a[i+"Class"](e[i])})},o(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,o,a,r){return"boolean"==typeof n||n===e?o?t.effects.animateClass.call(this,n?{add:s}:{remove:s},o,a,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,o,a)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.4",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,o;for(o=0;s.length>o;o++)null!==s[o]&&(n=t.data(i+s[o]),n===e&&(n=""),t.css(s[o],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(o)&&o.call(n[0]),t.isFunction(e)&&e()}var n=t(this),o=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):a.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,o=i.queue,a=t.effects.effect[i.effect];return t.fx.off||!a?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):o===!1?this.each(e):this.queue(o||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()}(jQuery),function(t){var e=0,i={},s={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",t.widget("ui.accordion",{version:"1.10.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t(),content:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("<span>").addClass("ui-accordion-header-icon ui-icon "+e.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(e.header).addClass(e.activeHeader),this.headers.addClass("ui-accordion-icons")) +},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),undefined):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),"disabled"===t&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e),undefined)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),o.focus(),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().focus()},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,s=this.options,n=s.heightStyle,o=this.element.parent(),a=this.accordionId="ui-accordion-"+(this.element.attr("id")||++e);this.active=this._findActive(s.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(e){var i=t(this),s=i.attr("id"),n=i.next(),o=n.attr("id");s||(s=a+"-header-"+e,i.attr("id",s)),o||(o=a+"-panel-"+e,n.attr("id",o)),i.attr("aria-controls",o),n.attr("aria-labelledby",s)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(s.event),"fill"===n?(i=o.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===n&&(i=0,this.headers.next().each(function(){i=Math.max(i,t(this).css("height","").height())}).height(i))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n[0]===s[0],a=o&&i.collapsible,r=a?t():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:a?t():n,newPanel:r};e.preventDefault(),o&&!i.collapsible||this._trigger("beforeActivate",e,l)===!1||(i.active=a?!1:this.headers.index(n),this.active=o?t():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),o||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(t,e,n){var o,a,r,h=this,l=0,c=t.length&&(!e.length||t.index()<e.index()),u=this.options.animate||{},d=c&&u.down||u,p=function(){h._toggleComplete(n)};return"number"==typeof d&&(r=d),"string"==typeof d&&(a=d),a=a||d.easing||u.easing,r=r||d.duration||u.duration,e.length?t.length?(o=t.show().outerHeight(),e.animate(i,{duration:r,easing:a,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(s,{duration:r,easing:a,complete:p,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(o-e.outerHeight()-l),l=0)}}),undefined):e.animate(i,r,a,p):t.animate(s,r,a,p)},_toggleComplete:function(t){var e=t.oldPanel;e.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}})}(jQuery),function(t){t.widget("ui.autocomplete",{version:"1.10.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o?!0:a?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,undefined;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:case o.NUMPAD_ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),undefined;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),undefined):(this._searchTimeout(t),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(t),this._change(t),undefined)}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(s){s.target===e.element[0]||s.target===i||t.contains(i,s.target)||e.close()})})},menufocus:function(e,i){if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),undefined;var s=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",e,{item:s})?e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value):this.liveRegion.text(s.value)},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):undefined},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({label:e.label||e.value,value:e.value||e.label},e)})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<a>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[t](e),undefined):(this.search(null,e),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.text(e))}})}(jQuery),function(t){var e,i="ui-button ui-widget ui-state-default ui-corner-all",s="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",n=function(){var e=t(this);setTimeout(function(){e.find(":ui-button").button("refresh")},1)},o=function(e){var i=e.name,s=e.form,n=t([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?t(s).find("[name='"+i+"']"):t("[name='"+i+"']",e.ownerDocument).filter(function(){return!this.form})),n};t.widget("ui.button",{version:"1.10.4",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,n),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var s=this,a=this.options,r="checkbox"===this.type||"radio"===this.type,h=r?"":"ui-state-active";null===a.label&&(a.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(i).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){a.disabled||this===e&&t(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){a.disabled||t(this).removeClass(h)}).bind("click"+this.eventNamespace,function(t){a.disabled&&(t.preventDefault(),t.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),r&&this.element.bind("change"+this.eventNamespace,function(){s.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return a.disabled?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(a.disabled)return!1;t(this).addClass("ui-state-active"),s.buttonElement.attr("aria-pressed","true");var e=s.element[0];o(e).not(e).map(function(){return t(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return a.disabled?!1:(t(this).addClass("ui-state-active"),e=this,s.document.one("mouseup",function(){e=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return a.disabled?!1:(t(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(e){return a.disabled?!1:((e.keyCode===t.ui.keyCode.SPACE||e.keyCode===t.ui.keyCode.ENTER)&&t(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){t(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===t.ui.keyCode.SPACE&&t(this).click()})),this._setOption("disabled",a.disabled),this._resetButton()},_determineButtonType:function(){var t,e,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(t=this.element.parents().last(),e="label[for='"+this.element.attr("id")+"']",this.buttonElement=t.find(e),this.buttonElement.length||(t=t.length?t.siblings():this.element.siblings(),this.buttonElement=t.filter(e),this.buttonElement.length||(this.buttonElement=t.find(e))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(i+" ui-state-active "+s).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(t,e){return this._super(t,e),"disabled"===t?(this.element.prop("disabled",!!e),e&&this.buttonElement.removeClass("ui-state-focus"),undefined):(this._resetButton(),undefined)},refresh:function(){var e=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");e!==this.options.disabled&&this._setOption("disabled",e),"radio"===this.type?o(this.element[0]).each(function(){t(this).is(":checked")?t(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):t(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var e=this.buttonElement.removeClass(s),i=t("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(e.empty()).text(),n=this.options.icons,o=n.primary&&n.secondary,a=[];n.primary||n.secondary?(this.options.text&&a.push("ui-button-text-icon"+(o?"s":n.primary?"-primary":"-secondary")),n.primary&&e.prepend("<span class='ui-button-icon-primary ui-icon "+n.primary+"'></span>"),n.secondary&&e.append("<span class='ui-button-icon-secondary ui-icon "+n.secondary+"'></span>"),this.options.text||(a.push(o?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||e.attr("title",t.trim(i)))):a.push("ui-button-text-only"),e.addClass(a.join(" "))}}),t.widget("ui.buttonset",{version:"1.10.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(t,e){"disabled"===t&&this.buttons.button("option",t,e),this._super(t,e)},refresh:function(){var e="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(e?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(e?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})}(jQuery),function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=s(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(o.inline?e.parent()[0]:o.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function n(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.extend(t.ui,{datepicker:{version:"1.10.4"}});var o,a="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return n(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,a,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,a,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,o,r){var h,l,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],a,p)),n(p.settings,o||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=r?r.length?r:[r.pageX,r.pageY]:null,this._pos||(l=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],a,p),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,a);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,a),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,a);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,a)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,s,o){var a,r,h,l,c=this._getInst(i);return 2===arguments.length&&"string"==typeof s?"defaults"===s?t.extend({},t.datepicker._defaults):c?"all"===s?t.extend({},c.settings):this._get(c,s):null:(a=s||{},"string"==typeof s&&(a={},a[s]=o),c&&(this._curInst===c&&this._hideDatepicker(),r=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(c,"min"),l=this._getMinMaxDate(c,"max"),n(c.settings,a),null!==h&&a.dateFormat!==e&&a.minDate===e&&(c.settings.minDate=this._formatDate(c,h)),null!==l&&a.dateFormat!==e&&a.maxDate===e&&(c.settings.maxDate=this._formatDate(c,l)),"disabled"in a&&(a.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,r),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M"); +break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var s,n,o=t.datepicker._getInst(i.target);return t.datepicker._get(o,"constrainInput")?(s=t.datepicker._possibleChars(t.datepicker._get(o,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!s||s.indexOf(n)>-1):e},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,s,o,a,r,h,l;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),s=t.datepicker._get(i,"beforeShow"),o=s?s.apply(e,[e,i]):{},o!==!1&&(n(i.settings,o),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),a=!1,t(e).parents().each(function(){return a|="fixed"===t(this).css("position"),!a}),r={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),r=t.datepicker._checkOffset(i,r,a),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":a?"fixed":"absolute",display:"none",left:r.left+"px",top:r.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,o=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,s=this._getNumberOfMonths(e),n=s[1],a=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,r=this._curInst;!r||e&&r!==t.data(e,a)||this._datepickerShowing&&(i=this._get(r,"showAnim"),s=this._get(r,"duration"),n=function(){t.datepicker._tidyDialog(r)},t.effects&&(t.effects.effect[i]||t.effects[i])?r.dpDiv.hide(i,t.datepicker._get(r,"showOptions"),s,n):r.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(r,"onClose"),o&&o.apply(r.input?r.input[0]:null,[r.input?r.input.val():"",r]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,s,n){if(null==i||null==s)throw"Invalid arguments";if(s="object"==typeof s?""+s:s+"",""===s)return null;var o,a,r,h,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,g=(n?n.monthNames:null)||this._defaults.monthNames,m=-1,v=-1,_=-1,b=-1,y=!1,w=function(t){var e=i.length>o+1&&i.charAt(o+1)===t;return e&&o++,e},x=function(t){var e=w(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{1,"+i+"}"),o=s.substring(l).match(n);if(!o)throw"Missing number at position "+l;return l+=o[0].length,parseInt(o[0],10)},k=function(i,n,o){var a=-1,r=t.map(w(i)?o:n,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(r,function(t,i){var n=i[1];return s.substr(l,n.length).toLowerCase()===n.toLowerCase()?(a=i[0],l+=n.length,!1):e}),-1!==a)return a+1;throw"Unknown name at position "+l},D=function(){if(s.charAt(l)!==i.charAt(o))throw"Unexpected literal at position "+l;l++};for(o=0;i.length>o;o++)if(y)"'"!==i.charAt(o)||w("'")?D():y=!1;else switch(i.charAt(o)){case"d":_=x("d");break;case"D":k("D",d,p);break;case"o":b=x("o");break;case"m":v=x("m");break;case"M":v=k("M",f,g);break;case"y":m=x("y");break;case"@":h=new Date(x("@")),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"!":h=new Date((x("!")-this._ticksTo1970)/1e4),m=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"'":w("'")?D():y=!0;break;default:D()}if(s.length>l&&(r=s.substr(l),!/^\s+/.test(r)))throw"Extra/unparsed characters found in date: "+r;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),b>-1)for(v=1,_=b;;){if(a=this._getDaysInMonth(m,v-1),a>=_)break;v++,_-=a}if(h=this._daylightSavingAdjust(new Date(m,v-1,_)),h.getFullYear()!==m||h.getMonth()+1!==v||h.getDate()!==_)throw"Invalid date";return h},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,v,_,b,y,w,x,k,D,C,I,P,T,M,S,z,A,E,H,N,W,O,F,R,L=new Date,j=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),V=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),q=this._getNumberOfMonths(t),U=this._get(t,"showCurrentAtPos"),Q=this._get(t,"stepMonths"),X=1!==q[0]||1!==q[1],$=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-U,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-q[0]*q[1]+1,J.getDate())),e=G&&G>e?G:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-Q,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":V?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+Q,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":V?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?$:j,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",x=0;q[0]>x;x++){for(k="",this.maxRows=4,D=0;q[1]>D;D++){if(C=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",P="",X){if(P+="<div class='ui-datepicker-group",q[1]>1)switch(D){case 0:P+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case q[1]-1:P+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:P+=" ui-datepicker-group-middle",I=""}P+="'>"}for(P+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===x?Y?o:s:"")+(/all|right/.test(I)&&0===x?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,G,J,x>0||D>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",T=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,T+="<th"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(P+=T+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),z=(this._getFirstDayOfMonth(te,Z)-c+7)%7,A=Math.ceil((z+S)/7),E=X?this.maxRows>A?this.maxRows:A:A,this.maxRows=E,H=this._daylightSavingAdjust(new Date(te,Z,1-z)),N=0;E>N;N++){for(P+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(H)+"</td>":"",w=0;7>w;w++)O=m?m.apply(t.input?t.input[0]:null,[H]):[!0,""],F=H.getMonth()!==Z,R=F&&!_||!O[0]||G&&G>H||J&&H>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(H.getTime()===C.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===H.getTime()&&b.getTime()===C.getTime()?" "+this._dayOverClass:"")+(R?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!v?"":" "+O[1]+(H.getTime()===$.getTime()?" "+this._currentClass:"")+(H.getTime()===j.getTime()?" ui-datepicker-today":""))+"'"+(F&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(R?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(F&&!v?" ":R?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===j.getTime()?" ui-state-highlight":"")+(H.getTime()===$.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);P+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),P+="</tbody></table>"+(X?"</div>"+(q[0]>0&&D===q[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=P}y+=k}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(_||(b+=y+(!o&&m&&v?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!o&&m&&v?"":" ")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.4"}(jQuery),function(t){var e={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};t.widget("ui.dialog",{version:"1.10.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:t.noop,enable:t.noop,close:function(e){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",e)!==!1){if(this._isOpen=!1,this._destroyOverlay(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&t(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",e)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!e&&this._trigger("focus",t),i},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=t(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var t=this.element.find("[autofocus]");t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).focus()},_keepFocus:function(e){function i(){var e=this.document[0].activeElement,i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),undefined;if(e.keyCode===t.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(n.focus(1),e.preventDefault()):(s.focus(1),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(e),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title||t.html(" "),t.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(e.element[0],arguments)},o={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,t("<button></button>",s).button(o).appendTo(e.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){t(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){s.position=[o.position.left-i.document.scrollLeft(),o.position.top-i.document.scrollTop()],t(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw"; +this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){t(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){s.height=t(this).height(),s.width=t(this).width(),t(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(s){var n=this,o=!1,a={};t.each(s,function(t,s){n._setOption(t,s),t in e&&(o=!0),t in i&&(a[t]=s)}),o&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",a)},_setOption:function(t,e){var i,s,n=this.uiDialog;"dialogClass"===t&&n.removeClass(this.options.dialogClass).addClass(e),"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:""+e}),"draggable"===t&&(i=n.is(":data(ui-draggable)"),i&&!e&&n.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&(s=n.is(":data(ui-resizable)"),s&&!e&&n.resizable("destroy"),s&&"string"==typeof e&&n.resizable("option","handles",e),s||e===!1||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=this,i=this.widgetFullName;t.ui.dialog.overlayInstances||this._delay(function(){t.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(s){e._allowInteraction(s)||(s.preventDefault(),t(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=t("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),t.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(t.ui.dialog.overlayInstances--,t.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),t.ui.dialog.overlayInstances=0,t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{_position:function(){var e,i=this.options.position,s=[],n=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(s=i.split?i.split(" "):[i[0],i[1]],1===s.length&&(s[1]=s[0]),t.each(["left","top"],function(t,e){+s[t]===s[t]&&(n[t]=s[t],s[t]=e)}),i={my:s[0]+(0>n[0]?n[0]:"+"+n[0])+" "+s[1]+(0>n[1]?n[1]:"+"+n[1]),at:s.join(" ")}),i=t.extend({},t.ui.dialog.prototype.options.position,i)):i=t.ui.dialog.prototype.options.position,e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.position(i),e||this.uiDialog.hide()}})}(jQuery),function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var o,a,r,h=t(this),l=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(h,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",g=i.test(u),m={},v="show"===c;h.parent().is(".ui-effects-wrapper")?t.effects.save(h.parent(),l):t.effects.save(h,l),h.show(),o=t.effects.createWrapper(h).css({overflow:"hidden"}),a=o[p](),r=parseFloat(o.css(f))||0,m[p]=v?a:0,g||(h.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),m[f]=v?r:a+r),v&&(o.css(p,0),g||o.css(f,r+a)),o.animate(m,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&h.hide(),t.effects.restore(h,l),t.effects.removeWrapper(h),n()}})}}(jQuery),function(t){t.effects.effect.bounce=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"effect"),l="hide"===h,c="show"===h,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||l?1:0),g=e.duration/f,m=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=a.queue(),y=b.length;for((c||l)&&r.push("opacity"),t.effects.save(a,r),a.show(),t.effects.createWrapper(a),d||(d=a["top"===v?"outerHeight":"outerWidth"]()/3),c&&(o={opacity:1},o[v]=0,a.css("opacity",0).css(v,_?2*-d:2*d).animate(o,g,m)),l&&(d/=Math.pow(2,p-1)),o={},o[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m).animate(o,g,m),d=l?2*d:d/2;l&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,a.animate(n,g,m)),a.queue(function(){l&&a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),a.dequeue()}}(jQuery),function(t){t.effects.effect.clip=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(a,e.mode||"hide"),l="show"===h,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(a,r),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n="IMG"===a[0].tagName?s:a,o=n[d](),l&&(n.css(d,0),n.css(p,o/2)),f[d]=l?o:0,f[p]=l?0:o/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){l||a.hide(),t.effects.restore(a,r),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","opacity","height","width"],a=t.effects.setMode(n,e.mode||"hide"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,o),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===c?-s:s),u[l]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),g||p.hide(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),g="show"===f,m=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*_,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*v,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*v,top:-o*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(g?l*v:0),top:h+(g?c*_:0),opacity:g?0:1}).animate({left:r+(g?0:l*v),top:h+(g?0:c*_),opacity:g?1:0},e.duration||500,e.easing,s)}}(jQuery),function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}}(jQuery),function(t){t.effects.effect.fold=function(e,i){var s,n,o=t(this),a=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(o,e.mode||"hide"),h="show"===r,l="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=h!==d,f=p?["width","height"]:["height","width"],g=e.duration/2,m={},v={};t.effects.save(o,a),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[l?0:1]),h&&s.css(d?{height:0,width:c}:{height:c,width:0}),m[f[0]]=h?n[0]:c,v[f[1]]=h?n[1]:0,s.animate(m,g,e.easing).animate(v,g,e.easing,function(){l&&o.hide(),t.effects.restore(o,a),t.effects.removeWrapper(o),i()})}}(jQuery),function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],o=t.effects.setMode(s,e.mode||"show"),a={backgroundColor:s.css("backgroundColor")};"hide"===o&&(a.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(a,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&s.hide(),t.effects.restore(s,n),i()}})}}(jQuery),function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),o=t.effects.setMode(n,e.mode||"show"),a="show"===o,r="hide"===o,h=a||"hide"===o,l=2*(e.times||5)+(h?1:0),c=e.duration/l,u=0,d=n.queue(),p=d.length;for((a||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;l>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,l+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),o="hide"===n,a=parseInt(e.percent,10)||150,r=a/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:o?a:100,from:o?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),o=t.effects.setMode(s,e.mode||"effect"),a=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===o?0:100),r=e.direction||"both",h=e.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?a/100:1,x:"vertical"!==r?a/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==o&&(n.origin=h||["middle","center"],n.restore=!0),n.from=e.from||("show"===o?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*c.y,width:l.width*c.x,outerHeight:l.outerHeight*c.y,outerWidth:l.outerWidth*c.x},n.fade&&("show"===o&&(n.from.opacity=0,n.to.opacity=1),"hide"===o&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,o,a=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(a,e.mode||"effect"),f=e.restore||"effect"!==p,g=e.scale||"both",m=e.origin||["middle","center"],v=a.css("position"),_=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&a.show(),s={height:a.height(),width:a.width(),outerHeight:a.outerHeight(),outerWidth:a.outerWidth()},"toggle"===e.mode&&"show"===p?(a.from=e.to||b,a.to=e.from||s):(a.from=e.from||("show"===p?b:s),a.to=e.to||("hide"===p?b:s)),o={from:{y:a.from.height/s.height,x:a.from.width/s.width},to:{y:a.to.height/s.height,x:a.to.width/s.width}},("box"===g||"both"===g)&&(o.from.y!==o.to.y&&(_=_.concat(u),a.from=t.effects.setTransition(a,u,o.from.y,a.from),a.to=t.effects.setTransition(a,u,o.to.y,a.to)),o.from.x!==o.to.x&&(_=_.concat(d),a.from=t.effects.setTransition(a,d,o.from.x,a.from),a.to=t.effects.setTransition(a,d,o.to.x,a.to))),("content"===g||"both"===g)&&o.from.y!==o.to.y&&(_=_.concat(c).concat(l),a.from=t.effects.setTransition(a,c,o.from.y,a.from),a.to=t.effects.setTransition(a,c,o.to.y,a.to)),t.effects.save(a,_),a.show(),t.effects.createWrapper(a),a.css("overflow","hidden").css(a.from),m&&(n=t.effects.getBaseline(m,s),a.from.top=(s.outerHeight-a.outerHeight())*n.y,a.from.left=(s.outerWidth-a.outerWidth())*n.x,a.to.top=(s.outerHeight-a.to.outerHeight)*n.y,a.to.left=(s.outerWidth-a.to.outerWidth)*n.x),a.css(a.from),("content"===g||"both"===g)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),l=r.concat(u).concat(d),a.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,l),i.from={height:s.height*o.from.y,width:s.width*o.from.x,outerHeight:s.outerHeight*o.from.y,outerWidth:s.outerWidth*o.from.x},i.to={height:s.height*o.to.y,width:s.width*o.to.x,outerHeight:s.height*o.to.y,outerWidth:s.width*o.to.x},o.from.y!==o.to.y&&(i.from=t.effects.setTransition(i,u,o.from.y,i.from),i.to=t.effects.setTransition(i,u,o.to.y,i.to)),o.from.x!==o.to.x&&(i.from=t.effects.setTransition(i,d,o.from.x,i.from),i.to=t.effects.setTransition(i,d,o.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,l)})})),a.animate(a.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===a.to.opacity&&a.css("opacity",a.from.opacity),"hide"===p&&a.hide(),t.effects.restore(a,_),f||("static"===v?a.css({position:"relative",top:a.to.top,left:a.to.left}):t.each(["top","left"],function(t,e){a.css(e,function(e,i){var s=parseInt(i,10),n=t?a.to.left:a.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(a),i()}})}}(jQuery),function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","height","width"],a=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",h=e.distance||20,l=e.times||3,c=2*l+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},g={},m={},v=n.queue(),_=v.length;for(t.effects.save(n,o),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+h,g[d]=(p?"+=":"-=")+2*h,m[d]=(p?"-=":"+=")+2*h,n.animate(f,u,e.easing),s=1;l>s;s++)n.animate(g,u,e.easing).animate(m,u,e.easing);n.animate(g,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}}(jQuery),function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","width","height"],a=t.effects.setMode(n,e.mode||"show"),r="show"===a,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u={};t.effects.save(n,o),n.show(),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,c?isNaN(s)?"-"+s:-s:s),u[l]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}(jQuery),function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}}(jQuery),function(t){t.widget("ui.menu",{version:"1.10.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,t.proxy(function(t){this.options.disabled&&t.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(t){t.preventDefault()},"click .ui-state-disabled > a":function(t){t.preventDefault()},"click .ui-menu-item:has(a)":function(e){var i=t(e.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&t(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){var i=t(e.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.children(".ui-menu-item").eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){t(e.target).closest(".ui-menu").length||this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,o,a,r,h=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:h=!1,n=this.previousFilter||"",o=String.fromCharCode(e.keyCode),a=!1,clearTimeout(this.filterTimer),o===n?a=!0:o=n+o,r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())}),s=a&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(o=String.fromCharCode(e.keyCode),r=RegExp("^"+i(o),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())})),s.length?(this.focus(e,s),s.length>1?(this.previousFilter=o,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i=this.options.icons.submenu,s=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),s=e.prev("a"),n=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(n),e.attr("aria-labelledby",s.attr("id"))}),e=s.add(this.element),e.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),e.children(":not(.ui-menu-item)").each(function(){var e=t(this);/[^\-\u2014\u2013\s]/.test(e.text())||e.addClass("ui-widget-content ui-menu-divider")}),e.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.height(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(e),undefined)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(e),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)}})}(jQuery),function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var o,a=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(o!==e)return o;var i,s,n=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=n.children()[0];return t("body").append(n),i=a.offsetWidth,n.css("overflow","scroll"),s=a.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),o=i-s},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var o,p,g,m,v,_,b=t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),x=(e.collision||"flip").split(" "),k={};return _=n(b),b[0].preventDefault&&(e.at="left top"),p=_.width,g=_.height,m=_.offset,v=t.extend({},m),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),k[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=g:"center"===e.at[1]&&(v.top+=g/2),o=i(k.at,p,g),v.left+=o[0],v.top+=o[1],this.each(function(){var n,l,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),_=s(this,"marginTop"),D=u+f+s(this,"marginRight")+w.width,C=d+_+s(this,"marginBottom")+w.height,I=t.extend({},v),P=i(k.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?I.left-=u:"center"===e.my[0]&&(I.left-=u/2),"bottom"===e.my[1]?I.top-=d:"center"===e.my[1]&&(I.top-=d/2),I.left+=P[0],I.top+=P[1],t.support.offsetFractions||(I.left=h(I.left),I.top=h(I.top)),n={marginLeft:f,marginTop:_},t.each(["left","top"],function(i,s){t.ui.position[x[i]]&&t.ui.position[x[i]][s](I,{targetWidth:p,targetHeight:g,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:D,collisionHeight:C,offset:[o[0]+P[0],o[1]+P[1]],my:e.my,at:e.at,within:y,elem:c})}),e.using&&(l=function(t){var i=m.left-I.left,s=i+p-u,n=m.top-I.top,o=n+g-d,h={target:{element:b,left:m.left,top:m.top,width:p,height:g},element:{element:c,left:I.left,top:I.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>o?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>g&&g>r(n+o)&&(h.vertical="middle"),h.important=a(r(i),r(s))>a(r(n),r(o))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(I,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,o=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-o-n;e.collisionWidth>o?h>0&&0>=l?(i=t.left+h+e.collisionWidth-o-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+o-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=a(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,o=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-o-n;e.collisionHeight>o?h>0&&0>=l?(i=t.top+h+e.collisionHeight-o-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+o-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=a(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,a=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-a-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-a-o,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-a-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-a-o,t.top+p+f+g>c&&(0>s||r(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,t.top+p+f+g>u&&(i>0||u>r(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,o,a=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(a?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},a&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)e.style[o]=s[o];e.appendChild(r),i=a||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()}(jQuery),function(t,e){t.widget("ui.progressbar",{version:"1.10.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=t("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue() +},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(t){return t===e?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),e)},_constrainedValue:function(t){return t===e&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})}(jQuery),function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,o.addClass("ui-state-active").focus(),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,o;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,o=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),o!==!1&&this.values(e,i))):i!==this.value()&&(o=this._trigger("slide",t,{handle:this.handles[e],value:i}),o!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,o,a,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(a=this.options.step,n=o=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:o=this._valueMin();break;case t.ui.keyCode.END:o=this._valueMax();break;case t.ui.keyCode.PAGE_UP:o=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:o=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;o=this._trimAlignValue(n+a);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;o=this._trimAlignValue(n-a)}this._slide(i,r,o)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})}(jQuery),function(t){function e(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.widget("ui.spinner",{version:"1.10.4",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e={},i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);void 0!==n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var t=this.element[0]===this.document[0].activeElement;t||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var t=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=t.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*t.height())&&t.height()>0&&t.height(t.height()),this.options.disabled&&this.disable()},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){if("culture"===t||"numberFormat"===t){var i=this._parse(this.element.val());return this.options[t]=e,this.element.val(this._format(i)),void 0}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(e.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(e.down)),this._super(t,e),"disabled"===t&&(e?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:e(function(t){this._super(t),this._value(this.element.val())}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:e(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:e(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:e(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:e(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(e(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})}(jQuery),function(t,e){function i(){return++n}function s(t){return t=t.cloneNode(!1),t.hash.length>1&&decodeURIComponent(t.href.replace(o,""))===decodeURIComponent(location.href.replace(o,""))}var n=0,o=/#.*$/;t.widget("ui.tabs",{version:"1.10.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var e=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,s=this.options.collapsible,n=location.hash.substring(1);return null===i&&(n&&this.tabs.each(function(s,o){return t(o).attr("aria-controls")===n?(i=s,!1):e}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=s?!1:0)),!s&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(i){var s=t(this.document[0].activeElement).closest("li"),n=this.tabs.index(s),o=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:n++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:o=!1,n--;break;case t.ui.keyCode.END:n=this.anchors.length-1;break;case t.ui.keyCode.HOME:n=0;break;case t.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(n),e;case t.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(n===this.options.active?!1:n),e;default:return}i.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,o),i.ctrlKey||(s.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):e},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).focus(),t},_setOption:function(t,i){return"active"===t?(this._activate(i),e):"disabled"===t?(this._setupDisabled(i),e):(this._super(t,i),"collapsible"===t&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(i),"heightStyle"===t&&this._setupHeightStyle(i),e)},_tabId:function(t){return t.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=t(),this.anchors.each(function(i,n){var o,a,r,h=t(n).uniqueId().attr("id"),l=t(n).closest("li"),c=l.attr("aria-controls");s(n)?(o=n.hash,a=e.element.find(e._sanitizeSelector(o))):(r=e._tabId(l),o="#"+r,a=e.element.find(o),a.length||(a=e._createPanel(r),a.insertAfter(e.panels[i-1]||e.tablist)),a.attr("aria-live","polite")),a.length&&(e.panels=e.panels.add(a)),c&&l.data("ui-tabs-aria-controls",c),l.attr({"aria-controls":o.substring(1),"aria-labelledby":h}),a.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(e){t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1);for(var i,s=0;i=this.tabs[s];s++)e===!0||-1!==t.inArray(s,e)?t(i).addClass("ui-state-disabled").attr("aria-disabled","true"):t(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=e},_setupEvents:function(e){var i={click:function(t){t.preventDefault()}};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+t+"']"))),t},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var s=this.options.disabled;s!==!1&&(i===e?s=!1:(i=this._getIndex(i),s=t.isArray(s)?t.map(s,function(t){return t!==i?t:null}):t.map(this.tabs,function(t,e){return e!==i?e:null})),this._setupDisabled(s))},disable:function(i){var s=this.options.disabled;if(s!==!0){if(i===e)s=!0;else{if(i=this._getIndex(i),-1!==t.inArray(i,s))return;s=t.isArray(s)?t.merge([i],s).sort():[i]}this._setupDisabled(s)}},load:function(e,i){e=this._getIndex(e);var n=this,o=this.tabs.eq(e),a=o.find(".ui-tabs-anchor"),r=this._getPanelForTab(o),h={tab:o,panel:r};s(a[0])||(this.xhr=t.ajax(this._ajaxSettings(a,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(o.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(t){setTimeout(function(){r.html(t),n._trigger("load",i,h)},1)}).complete(function(t,e){setTimeout(function(){"abort"===e&&n.panels.stop(!1,!0),o.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),t===n.xhr&&delete n.xhr},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href"),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}(jQuery),function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.4",options:{content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null; +return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=o),this._open(e,t,i)})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function o(t){l.of=t,a.is(":hidden")||a.position(l)}var a,r,h,l=t.extend({},this.options.position);if(n){if(a=this._find(s),a.length)return a.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),a=this._tooltip(s),e(s,a.attr("id")),a.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:o}),o(i)):a.position(t.extend({of:s},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){a.is(":visible")&&(o(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:a}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(a)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),o.stop(!0),this._hide(o,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:o}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})}(jQuery); \ No newline at end of file diff --git a/pub/lib/jquery/jquery.js b/pub/lib/jquery/jquery.js index 12c7797fdc6a98f9e3bd37d8416fe33a057deaae..3c88fa8b7fd3f1c1f70f6d99800f315ba7a032f1 100644 --- a/pub/lib/jquery/jquery.js +++ b/pub/lib/jquery/jquery.js @@ -1,235 +1,131 @@ /*! - * jQuery JavaScript Library v1.8.2 + * jQuery JavaScript Library v1.11.0 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * - * Copyright 2012 jQuery Foundation and other contributors + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time) + * Date: 2014-01-23T21:02Z */ -(function( window, undefined ) { -var - // A central reference to the root jQuery(document) - rootjQuery, - // The deferred used on DOM ready - readyList, +(function( global, factory ) { + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper window is present, + // execute the factory and get jQuery + // For environments that do not inherently posses a window with a document + // (such as Node.js), expose a jQuery-making factory as module.exports + // This accentuates the need for the creation of a real window + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - navigator = window.navigator, +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +// - // Map over the $ in case of overwrite - _$ = window.$, +var deletedIds = []; + +var slice = deletedIds.slice; + +var concat = deletedIds.concat; + +var push = deletedIds.push; + +var indexOf = deletedIds.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; - // Save a reference to some core methods - core_push = Array.prototype.push, - core_slice = Array.prototype.slice, - core_indexOf = Array.prototype.indexOf, - core_toString = Object.prototype.toString, - core_hasOwn = Object.prototype.hasOwnProperty, - core_trim = String.prototype.trim, +var trim = "".trim; + +var support = {}; + + + +var + version = "1.11.0", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); }, - // Used for matching numbers - core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, - - // Used for detecting and trimming whitespace - core_rnotwhite = /\S/, - core_rspace = /\s+/, - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - // A simple way to check for HTML strings - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) - rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, - // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // The ready event handler and self cleanup method - DOMContentLoaded = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - } else if ( document.readyState === "complete" ) { - // we're here because readyState === "complete" in oldIE - // which is good enough for us to call the dom ready! - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }, - - // [[Class]] -> type pairs - class2type = {}; + return letter.toUpperCase(); + }; jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context && context.nodeType ? context.ownerDocument || context : document ); - - // scripts is true for back-compat - selector = jQuery.parseHTML( match[1], doc, true ); - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - this.attr.call( selector, context, true ); - } - - return jQuery.merge( this, selector ); - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } + // The current version of jQuery being used + jquery: version, - return jQuery.makeArray( selector, this ); - }, + constructor: jQuery, // Start with an empty selector selector: "", - // The current version of jQuery being used - jquery: "1.8.2", - // The default length of a jQuery object is 0 length: 0, - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - toArray: function() { - return core_slice.call( this ); + return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { - return num == null ? + return num != null ? // Return a 'clean' array - this.toArray() : + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); + slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) - pushStack: function( elems, name, selector ) { + pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; - ret.context = this.context; - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - // Return the newly-formed element set return ret; }, @@ -241,18 +137,14 @@ jQuery.fn = jQuery.prototype = { return jQuery.each( this, callback, args ); }, - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); }, - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { @@ -263,15 +155,10 @@ jQuery.fn = jQuery.prototype = { return this.eq( -1 ); }, - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ), - "slice", core_slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }, end: function() { @@ -280,16 +167,13 @@ jQuery.fn = jQuery.prototype = { // For internal use only. // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice + push: push, + sort: deletedIds.sort, + splice: deletedIds.splice }; -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, + var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, @@ -298,9 +182,10 @@ jQuery.extend = jQuery.fn.extend = function() { // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; - target = arguments[1] || {}; + // skip the boolean and the target - i = 2; + target = arguments[ i ] || {}; + i++; } // Handle case when target is a string or something (possible in deep copy) @@ -309,9 +194,9 @@ jQuery.extend = jQuery.fn.extend = function() { } // extend jQuery itself if only one argument is passed - if ( length === i ) { + if ( i === length ) { target = this; - --i; + i--; } for ( ; i < length; i++ ) { @@ -353,63 +238,17 @@ jQuery.extend = jQuery.fn.extend = function() { }; jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, + // Assume jQuery is ready without the ready module + isReady: true, - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } + error: function( msg ) { + throw new Error( msg ); }, - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, + noop: function() {}, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert @@ -423,20 +262,28 @@ jQuery.extend({ }, isWindow: function( obj ) { + /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }, isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + return obj - parseFloat( obj ) >= 0; }, - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ core_toString.call(obj) ] || "object"; + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; }, isPlainObject: function( obj ) { + var key; + // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well @@ -447,8 +294,8 @@ jQuery.extend({ try { // Not own constructor property must be Object if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { @@ -456,107 +303,35 @@ jQuery.extend({ return false; } + // Support: IE<9 + // Handle iteration over inherited properties before own properties. + if ( support.ownLast ) { + for ( key in obj ) { + return hasOwn.call( obj, key ); + } + } + // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. - - var key; for ( key in obj ) {} - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // scripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, scripts ) { - var parsed; - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - scripts = context; - context = 0; - } - context = context || document; - - // Single tag - if ( (parsed = rsingleTag.exec( data )) ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); - return jQuery.merge( [], - (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); + return key === undefined || hasOwn.call( obj, key ); }, - parseJSON: function( data ) { - if ( !data || typeof data !== "string") { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); + type: function( obj ) { + if ( obj == null ) { + return obj + ""; } - return xml; + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; }, - noop: function() {}, - // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { - if ( data && core_rnotwhite.test( data ) ) { + if ( data && jQuery.trim( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox @@ -578,21 +353,25 @@ jQuery.extend({ // args is for internal usage only each: function( obj, callback, args ) { - var name, + var value, i = 0, length = obj.length, - isObj = length === undefined || jQuery.isFunction( obj ); + isArray = isArraylike( obj ); if ( args ) { - if ( isObj ) { - for ( name in obj ) { - if ( callback.apply( obj[ name ], args ) === false ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { break; } } } else { - for ( ; i < length; ) { - if ( callback.apply( obj[ i++ ], args ) === false ) { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { break; } } @@ -600,15 +379,19 @@ jQuery.extend({ // A special, fast, case for the most common use of each } else { - if ( isObj ) { - for ( name in obj ) { - if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { break; } } } else { - for ( ; i < length; ) { - if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { break; } } @@ -619,11 +402,11 @@ jQuery.extend({ }, // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + trim: trim && !trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : - core_trim.call( text ); + trim.call( text ); } : // Otherwise use our own trimming functionality @@ -635,18 +418,16 @@ jQuery.extend({ // results is for internal usage only makeArray: function( arr, results ) { - var type, - ret = results || []; + var ret = results || []; if ( arr != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - type = jQuery.type( arr ); - - if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { - core_push.call( ret, arr ); + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); } else { - jQuery.merge( ret, arr ); + push.call( ret, arr ); } } @@ -657,8 +438,8 @@ jQuery.extend({ var len; if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); + if ( indexOf ) { + return indexOf.call( arr, elem, i ); } len = arr.length; @@ -676,16 +457,17 @@ jQuery.extend({ }, merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; + var len = +second.length, + j = 0, + i = first.length; - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } + while ( j < len ) { + first[ i++ ] = second[ j++ ]; + } - } else { + // Support: IE<9 + // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) + if ( len !== len ) { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } @@ -696,57 +478,56 @@ jQuery.extend({ return first; }, - grep: function( elems, callback, inv ) { - var retVal, - ret = [], + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], i = 0, - length = elems.length; - inv = !!inv; + length = elems.length, + callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); } } - return ret; + return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { - var value, key, - ret = [], + var value, i = 0, length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + isArray = isArraylike( elems ), + ret = []; - // Go through the array, translating each of the items to their + // Go through the array, translating each of the items to their new values if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { - ret[ ret.length ] = value; + ret.push( value ); } } // Go through every key on the object, } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); if ( value != null ) { - ret[ ret.length ] = value; + ret.push( value ); } } } // Flatten any nested arrays - return ret.concat.apply( [], ret ); + return concat.apply( [], ret ); }, // A global GUID counter for objects @@ -755,7 +536,7 @@ jQuery.extend({ // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { - var tmp, args, proxy; + var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; @@ -770,9 +551,9 @@ jQuery.extend({ } // Simulated bind - args = core_slice.call( arguments, 2 ); + args = slice.call( arguments, 2 ); proxy = function() { - return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed @@ -781,183 +562,2527 @@ jQuery.extend({ return proxy; }, - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; + now: function() { + return +( new Date() ); + }, - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +}); - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v1.10.16 + * http://sizzlejs.com/ + * + * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-01-13 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + compile, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, - chainable = 1; + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; } + return 0; + }, - return chainable ? - elems : + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; }, - now: function() { - return ( new Date() ).getTime(); - } -}); + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { + // Regular expressions - readyList = jQuery.Deferred(); + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready, 1 ); + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - // If IE and not a frame - // continually check to see if the document is ready - var top = false; + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } - // and execute any waiting functions - jQuery.ready(); + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); } - })(); + } } } } - return readyList.promise( obj ); -}; -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.split( core_rspace ), function( _, flag ) { - object[ flag ] = true; - }); - return object; + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; } -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark */ -jQuery.Callbacks = function( options ) { +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); - var // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, + doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", function() { + setDocument(); + }); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if getElementsByClassName can be trusted + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { + div.innerHTML = "<div class='a'></div><div class='a i'></div>"; + + // Support: Safari<4 + // Catch class over-caching + div.firstChild.className = "i"; + // Support: Opera<10 + // Catch gEBCN failure to find non-leading classes + return div.getElementsByClassName("i").length === 2; + }); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = "<select t=''><option selected=''></option></select>"; + + // Support: IE8, Opera 10-12 + // Nothing should be selected when empty strings follow ^= or $= or *= + if ( div.querySelectorAll("[t^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] && match[4] !== undefined ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + } + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +} + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome<14 +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = "<a href='#'></a>"; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = "<input/>"; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + ret = [], + self = this, + len = self.length; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + ret = jQuery.unique( ret ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + } + + return this.pushStack( ret ); + }; +}); +var rnotwhite = (/\S+/g); + + + +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, // Actual callback list list = [], // Stack of fire calls for repeatable lists @@ -999,8 +3124,10 @@ jQuery.Callbacks = function( options ) { (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); - if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { - list.push( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); @@ -1025,7 +3152,7 @@ jQuery.Callbacks = function( options ) { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { @@ -1041,13 +3168,15 @@ jQuery.Callbacks = function( options ) { } return this; }, - // Control if a given callback is in the list + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { - return jQuery.inArray( fn, list ) > -1; + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); }, // Remove all callbacks from the list empty: function() { list = []; + firingLength = 0; return this; }, // Have the list do nothing anymore @@ -1073,9 +3202,9 @@ jQuery.Callbacks = function( options ) { }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { @@ -1097,6 +3226,8 @@ jQuery.Callbacks = function( options ) { return self; }; + + jQuery.extend({ Deferred: function( func ) { @@ -1119,23 +3250,19 @@ jQuery.extend({ var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = fns[ i ]; + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? - function() { - var returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - } : - newDefer[ action ] - ); + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); }); fns = null; }).promise(); @@ -1169,8 +3296,11 @@ jQuery.extend({ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } - // deferred[ resolve | reject | notify ] = list.fire - deferred[ tuple[0] ] = list.fire; + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; deferred[ tuple[0] + "With" ] = list.fireWith; }); @@ -1189,7 +3319,7 @@ jQuery.extend({ // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, - resolveValues = core_slice.call( arguments ), + resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates @@ -1202,10 +3332,11 @@ jQuery.extend({ updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { + + } else if ( !(--remaining) ) { deferred.resolveWith( contexts, values ); } }; @@ -1238,1405 +3369,885 @@ jQuery.extend({ return deferred.promise(); } }); -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - eventName, - i, - isSupported, - clickFn, - div = document.createElement("div"); - - // Preliminary tests - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - a.style.cssText = "top:1px;float:left;opacity:.5"; - - // Can't get basic test support - if ( !all || !all.length ) { - return {}; - } - - // First batch of supports tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: ( document.compatMode === "CSS1Compat" ), - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", clickFn = function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent("onclick"); - div.detachEvent( "onclick", clickFn ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - input.setAttribute( "checked", "checked" ); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: true, - change: true, - focusin: true - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - // Run tests that need a body at doc ready - jQuery(function() { - var container, div, tds, marginDiv, - divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - container = document.createElement("div"); - container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // NOTE: To any future maintainer, we've window.getComputedStyle - // because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = document.createElement("div"); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "<div></div>"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - container.style.zoom = 1; - } - - // Null elements to avoid leaks in IE - body.removeChild( container ); - container = div = tds = marginDiv = null; - }); +// The deferred used on DOM ready +var readyList; - // Null elements to avoid leaks in IE - fragment.removeChild( div ); - all = a = select = opt = input = fragment = div = null; +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); - return support; -})(); -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; + return this; +}; jQuery.extend({ - cache: {}, - - deletedIds: [], - - // Remove at next major release (1.9/2.0) - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); } + }, - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + // Handle when the DOM is ready + ready: function( wait ) { - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); } - return ret; - }, + // Remember that the DOM is ready + jQuery.isReady = true; - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { return; } - var thisCache, i, l, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); } + } +}); - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { +/** + * Clean-up method for dom ready events + */ +function detach() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } +} - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } +/** + * The ready event handler and self cleanup method + */ +function completed() { + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } +} - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; + readyList = jQuery.Deferred(); - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); - // When all else fails, null + // If IE event model is used } else { - cache[ id ] = null; - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); + // If IE and not a frame + // continually check to see if the document is ready + var top = false; -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.substring(5) ); + // detach all dom ready events + detach(); - dataAttr( elem, name, data[ name ] ); - } + // and execute any waiting functions + jQuery.ready(); } - jQuery._data( elem, "parsedAttrs", true ); - } + })(); } - - return data; } + } + return readyList.promise( obj ); +}; - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; +var strundefined = typeof undefined; - return jQuery.access( this, function( value ) { - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } +// Support: IE<9 +// Iteration over object's inherited properties before its own +var i; +for ( i in jQuery( support ) ) { + break; +} +support.ownLast = i !== "0"; - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } +// Note: most support tests are defined in their respective modules. +// false until the test is run +support.inlineBlockNeedsLayout = false; - parts[1] = value; - this.each(function() { - var self = jQuery( this ); +jQuery(function() { + // We need to execute this one support test ASAP because we need to know + // if body.style.zoom needs to be set. - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, + var container, div, + body = document.getElementsByTagName("body")[0]; - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); + if ( !body ) { + // Return for frameset docs that don't have a body + return; } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - data = elem.getAttribute( name ); + // Setup + container = document.createElement( "div" ); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} + div = document.createElement( "div" ); + body.appendChild( container ).appendChild( div ); - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); + if ( typeof div.style.zoom !== strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; - } else { - data = undefined; + if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; } } - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } + body.removeChild( container ); - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; + // Null elements to avoid leaks in IE + container = div = null; +}); - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - dequeue: function( elem, type ) { - type = type || "fx"; - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; +(function() { + var div = document.createElement( "div" ); - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; } + } - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } + // Null elements to avoid leaks in IE. + div = null; +})(); - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( elem ) { + var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], + nodeType = +elem.nodeType || 1; - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery.removeData( elem, type + "queue", true ); - jQuery.removeData( elem, key, true ); - }) - }); - } -}); + // Do not set data on non-element DOM nodes because it will not be cleared (#8335). + return nodeType !== 1 && nodeType !== 9 ? + false : -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; + // Nodes accept data unless otherwise specified; rejection can be conditional + !noData || noData !== true && elem.getAttribute("classid") === noData; +}; - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; + data = elem.getAttribute( name ); - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } + } else { + data = undefined; } - resolve(); - return defer.promise( obj ); } -}); -var nodeHook, boolHook, fixSpecified, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea|)$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute; -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, + return data; +} - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, + return true; +} - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; +function internalData( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } + var ret, thisCache, + internalKey = jQuery.expando, - if ( value && typeof value === "string" ) { - classNames = value.split( core_rspace ); + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - } else { - setClass = " " + elem.className + " "; + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { + return; + } - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; } + } - return this; - }, + if ( !cache[ id ] ) { + // Avoid exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; + } - removeClass: function( value ) { - var removes, className, elem, c, cl, i, l; + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; } - if ( (value && typeof value === "string") || value === undefined ) { - removes = ( value || "" ).split( core_rspace ); - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - if ( elem.nodeType === 1 && elem.className ) { + thisCache = thisCache.data; + } - className = (" " + elem.className + " ").replace( rclass, " " ); + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } - // loop over each item in the removal list - for ( c = 0, cl = removes.length; c < cl; c++ ) { - // Remove until there is nothing to remove, - while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { - className = className.replace( " " + removes[ c ] + " " , " " ); - } - } - elem.className = value ? jQuery.trim( className ) : ""; - } - } - } + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( typeof name === "string" ) { - return this; - }, + // First Try to find as-is property data + ret = thisCache[ name ]; - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; + // Test for null|undefined property data + if ( ret == null ) { - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; } + } else { + ret = thisCache; + } - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( core_rspace ); + return ret; +} - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } + var thisCache, i, + isNode = elem.nodeType, - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } - return false; - }, + if ( name ) { - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; + thisCache = pvt ? cache[ id ] : cache[ id ].data; - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + if ( thisCache ) { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } - ret = elem.value; + i = name.length; + while ( i-- ) { + delete thisCache[ name[i] ]; + } - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { + return; } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { return; } + } - isFunction = jQuery.isFunction( value ); + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); - return this.each(function( i ) { - var val, - self = jQuery(this); + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + /* jshint eqeqeq: false */ + } else if ( support.deleteExpando || cache != cache.window ) { + /* jshint eqeqeq: true */ + delete cache[ id ]; - if ( this.nodeType !== 1 ) { - return; - } + // When all else fails, null + } else { + cache[ id ] = null; + } +} - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } +jQuery.extend({ + cache: {}, - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } + // The following elements (space-suffixed to avoid Object.prototype collisions) + // throw uncatchable exceptions if you attempt to set expando properties + noData: { + "applet ": true, + "embed ": true, + // ...but Flash objects (which have this classid) *can* handle expandos + "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + }, - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); } }); -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; +jQuery.fn.extend({ + data: function( key, value ) { + var i, name, data, + elem = this[0], + attrs = elem && elem.attributes; - // Nothing was selected - if ( index < 0 ) { - return null; - } + // Special expections of .data basically thwart jQuery.access, + // so implement the relevant behavior ourselves - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + name = attrs[i].name; - // Get the specific value for the option - value = jQuery( option ).val(); + if ( name.indexOf("data-") === 0 ) { + name = jQuery.camelCase( name.slice(5) ); - // We don't need an array for one selects - if ( one ) { - return value; + dataAttr( elem, name, data[ name ] ); } - - // Multi-Selects return an array - values.push( value ); } + jQuery._data( elem, "parsedAttrs", true ); } + } - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return arguments.length > 1 ? + + // Sets one value + this.each(function() { + jQuery.data( this, key, value ); + }) : + + // Gets one value + // Try to fetch any internally stored data first + elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); - return values; - }, - set: function( elem, value ) { - var values = jQuery.makeArray( value ); +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); - if ( !values.length ) { - elem.selectedIndex = -1; + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); } - return values; } + return queue || []; } }, - // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 - attrFn: {}, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } + dequeue: function( elem, type ) { + type = type || "fx"; - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; } - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; + if ( fn ) { - } else { - elem.setAttribute( name, value + "" ); - return value; + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); } - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; + if ( !startLength && hooks ) { + hooks.empty.fire(); } }, - removeAttr: function( elem, value ) { - var propName, attrNames, name, isBool, - i = 0; + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); - if ( value && elem.nodeType === 1 ) { +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; - attrNames = value.split( core_rspace ); + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } - for ( ; i < attrNames.length; i++ ) { - name = attrNames[ i ]; + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); } - } - } + }); }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); } - // Does not return so that setAttribute is also used - elem.value = value; + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); } } - }, + resolve(); + return defer.promise( obj ); + } +}); +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); } - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; + // Sets one value + } else if ( value !== undefined ) { + chainable = true; - } else { - return ( elem[ name ] = value ); - } + if ( !jQuery.isFunction( value ) ) { + raw = true; + } - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + // ...except when executing function values } else { - return elem[ name ]; + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; } } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } -}); -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } + return chainable ? + elems : - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; }; +var rcheckableType = (/^(?:checkbox|radio)$/i); -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - fixSpecified = { - name: true, - id: true, - coords: true - }; - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.value = value + "" ); - } - }; +(function() { + var fragment = document.createDocumentFragment(), + div = document.createElement("div"), + input = document.createElement("input"); - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName( "tbody" ).length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = + document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + input.type = "checkbox"; + input.checked = true; + fragment.appendChild( input ); + support.appendChecked = input.checked; - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE6-IE11+ + div.innerHTML = "<textarea>x</textarea>"; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + div.innerHTML = "<input type='radio' checked='checked' name='t'/>"; -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + support.noCloneEvent = true; + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; }); - }); -} -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); + div.cloneNode( true ).click(); + } + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; } - }; -} + } -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; + // Null elements to avoid leaks in IE. + fragment = div = input = null; +})(); - if ( parent ) { - parent.selectedIndex; - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} +(function() { + var i, eventName, + div = document.createElement( "div" ); -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} + // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) + for ( i in { submit: true, change: true, focusin: true }) { + eventName = "on" + i; -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } + if ( !(support[ i + "Bubbles" ] = eventName in window) ) { + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, "t" ); + support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; } - }); -}); -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, - rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} /* * Helper functions for managing events -- not part of the public interface. @@ -2644,14 +4255,16 @@ var rformElems = /^(?:textarea|input|select)$/i, */ jQuery.event = { - add: function( elem, types, handler, data, selector ) { + global: {}, - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, handlers, special; + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { return; } @@ -2668,16 +4281,14 @@ jQuery.event = { } // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; + if ( !(events = elemData.events) ) { + events = elemData.events = {}; } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; @@ -2686,13 +4297,17 @@ jQuery.event = { } // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; @@ -2706,7 +4321,7 @@ jQuery.event = { // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, - origType: tns[1], + origType: origType, data: data, handler: handler, guid: handler.guid, @@ -2716,8 +4331,7 @@ jQuery.event = { }, handleObjIn ); // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { + if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; @@ -2756,13 +4370,12 @@ jQuery.event = { elem = null; }, - global: {}, - // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { - - var t, tns, type, origType, namespaces, origCount, - j, events, special, eventType, handleObj, + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { @@ -2770,11 +4383,12 @@ jQuery.event = { } // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { @@ -2785,23 +4399,23 @@ jQuery.event = { } special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); if ( handleObj.selector ) { - eventType.delegateCount--; + handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); @@ -2811,7 +4425,7 @@ jQuery.event = { // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } @@ -2826,80 +4440,48 @@ jQuery.event = { // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete - jQuery.removeData( elem, "events", true ); + jQuery._removeData( elem, "events" ); } }, - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } - // Event object or event type - var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, - type = event.type || event, - namespaces = []; - // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { + if ( type.indexOf(".") >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } + ontype = type.indexOf(":") < 0 && "on" + type; - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; // Clean up the event in case it is being reused event.result = undefined; @@ -2908,47 +4490,56 @@ jQuery.event = { } // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - for ( old = elem; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old === (elem.ownerDocument || document) ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - cur = eventPath[i][0]; - event.type = eventPath[i][1]; + event.type = i > 1 ? + bubbleType : + special.bindType || type; + // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } - // Note that this is a bare JS function and not a jQuery handler + + // Native handler handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } } } event.type = type; @@ -2956,29 +4547,33 @@ jQuery.event = { // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; + tmp = elem[ ontype ]; - if ( old ) { + if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; - elem[ type ](); + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } jQuery.event.triggered = undefined; - if ( old ) { - elem[ ontype ] = old; + if ( tmp ) { + elem[ ontype ] = tmp; } } } @@ -2990,15 +4585,13 @@ jQuery.event = { dispatch: function( event ) { // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); + event = jQuery.event.fix( event ); - var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, - handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = core_slice.call( arguments ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = []; + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; @@ -3009,81 +4602,142 @@ jQuery.event = { return; } - // Determine handlers that should run if there are delegated events + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG <use> instance trees (#13180) // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ - // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.disabled !== true || event.type !== "click" ) { - selMatch = {}; + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; - sel = handleObj.selector; - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = handleObj.needsContext ? + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } - if ( selMatch[ sel ] ) { + if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); + handlerQueue.push({ elem: cur, handlers: matches }); } } } } // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); } - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - event.data = handleObj.data; - event.handleObj = handleObj; + event = new jQuery.Event( originalEvent ); - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; } - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; } - return event.result; + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, @@ -3103,7 +4757,7 @@ jQuery.event = { mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { - var eventDoc, doc, body, + var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; @@ -3132,64 +4786,57 @@ jQuery.event = { } }, - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) - event.metaKey = !!event.metaKey; - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, - focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, delegateType: "focusin" }, blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, delegateType: "focusout" }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; } }, - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; } } } @@ -3202,7 +4849,8 @@ jQuery.event = { var e = jQuery.extend( new jQuery.Event(), event, - { type: type, + { + type: type, isSimulated: true, originalEvent: {} } @@ -3218,10 +4866,6 @@ jQuery.event = { } }; -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { @@ -3233,9 +4877,9 @@ jQuery.removeEvent = document.removeEventListener ? if ( elem.detachEvent ) { - // #8545, #7054, preventing memory leaks for custom events in IE6-8 – + // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === "undefined" ) { + if ( typeof elem[ name ] === strundefined ) { elem[ name ] = null; } @@ -3256,8 +4900,14 @@ jQuery.Event = function( src, props ) { // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && ( + // Support: IE < 9 + src.returnValue === false || + // Support: Android < 4.0 + src.getPreventDefault && src.getPreventDefault() ) ? + returnTrue : + returnFalse; // Event type } else { @@ -3276,54 +4926,51 @@ jQuery.Event = function( src, props ) { this[ jQuery.expando ] = true; }; -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + preventDefault: function() { var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; if ( !e ) { return; } - // if preventDefault exists run it on the original event + // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); - // otherwise set the returnValue property of the original event to false (IE) + // Support: IE + // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { - this.isPropagationStopped = returnTrue; - var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; if ( !e ) { return; } - // if stopPropagation exists run it on the original event + // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } - // otherwise set the cancelBubble property of the original event to true (IE) + + // Support: IE + // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse + } }; // Create mouseenter/leave events using mouseover/out and event-time checks @@ -3339,8 +4986,7 @@ jQuery.each({ var ret, target = this, related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector; + handleObj = event.handleObj; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window @@ -3355,7 +5001,7 @@ jQuery.each({ }); // IE submit delegation -if ( !jQuery.support.submitBubbles ) { +if ( !support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { @@ -3369,11 +5015,11 @@ if ( !jQuery.support.submitBubbles ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "_submit_attached" ) ) { + if ( form && !jQuery._data( form, "submitBubbles" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); - jQuery._data( form, "_submit_attached", true ); + jQuery._data( form, "submitBubbles", true ); } }); // return undefined since we don't need an event listener @@ -3402,7 +5048,7 @@ if ( !jQuery.support.submitBubbles ) { } // IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { +if ( !support.changeBubbles ) { jQuery.event.special.change = { @@ -3432,13 +5078,13 @@ if ( !jQuery.support.changeBubbles ) { jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); - jQuery._data( elem, "_change_attached", true ); + jQuery._data( elem, "changeBubbles", true ); } }); }, @@ -3461,24 +5107,33 @@ if ( !jQuery.support.changeBubbles ) { } // Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { +if ( !support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); } } }; @@ -3488,12 +5143,12 @@ if ( !jQuery.support.focusinBubbles ) { jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; + var type, origFn; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null + if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; @@ -3575,3710 +5230,3366 @@ jQuery.fn.extend({ }); }, - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var cachedruns, - assertGetIdNotName, - Expr, - getText, - isXML, - contains, - compile, - sortOrder, - hasDuplicate, - outermostContext, + return safeFrag; +} - baseHasDuplicate = true, - strundefined = "undefined", +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /^$|\/(?:java|ecma)script/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, - expando = ( "sizcache" + Math.random() ).replace( ".", "" ), + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + area: [ 1, "<map>", "</map>" ], + param: [ 1, "<object>", "</object>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - Token = String, - document = window.document, - docElem = document.documentElement, - dirruns = 0, - done = 0, - pop = [].pop, - push = [].push, - slice = [].slice, - // Use a stripped-down indexOf if a native one is unavailable - indexOf = [].indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - // Augment a function for special use by Sizzle - markFunction = function( fn, value ) { - fn[ expando ] = value == null || value; - return fn; - }, +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; - createCache = function() { - var cache = {}, - keys = []; +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; - return markFunction(function( key, value ) { - // Only keep the most recent entries - if ( keys.push( key ) > Expr.cacheLength ) { - delete cache[ keys.shift() ]; + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); } + } + } - return (cache[ key ] = value); - }, cache ); - }, - - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // Regex - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - // Prefer arguments not in parens/brackets, - // then attribute selectors and non-pseudos (denoted by :), - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} - // For matchExpr.POS and matchExpr.needsContext - pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), +function cloneCopyEvent( src, dest ) { - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } - rnot = /^:not/, - rsibling = /[\x20\t\r\n\f]*[+~]/, - rendsWithNot = /:not\($/, + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; - rheader = /h\d/i, - rinputs = /input|select|textarea|button/i, + if ( events ) { + delete curData.handle; + curData.events = {}; - rbackslash = /\\(?!\\)/g, + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "POS": new RegExp( pos, "i" ), - "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) - }, + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} - // Support +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; - // Used for testing something on an element - assert = function( fn ) { - var div = document.createElement("div"); + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } - }, + nodeName = dest.nodeName.toLowerCase(); - // Check if getElementsByTagName("*") returns only elements - assertTagNameNoComments = assert(function( div ) { - div.appendChild( document.createComment("") ); - return !div.getElementsByTagName("*").length; - }), - - // Check if getAttribute returns normalized href attributes - assertHrefNotNormalized = assert(function( div ) { - div.innerHTML = "<a href='#'></a>"; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }), - - // Check if attributes should be retrieved by attribute nodes - assertAttributes = assert(function( div ) { - div.innerHTML = "<select></select>"; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }), + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); - // Check if getElementsByClassName can be trusted - assertUsableClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); } - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }), + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - assertUsableName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = document.getElementsByName && - // buggy browsers will return fewer than the correct 2 - document.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - document.getElementsByName( expando + 0 ).length; - assertGetIdNotName = !document.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); -// If slice is not available, provide a backup -try { - slice.call( docElem.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - for ( ; (elem = this[i]); i++ ) { - results.push( elem ); + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; } - return results; - }; -} - -function Sizzle( selector, context, results, seed ) { - results = results || []; - context = context || document; - var match, elem, xml, m, - nodeType = context.nodeType; - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( nodeType !== 1 && nodeType !== 9 ) { - return []; - } - - xml = isXML( context ); + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } - if ( !xml && !seed ) { - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; + dest.defaultChecked = dest.checked = src.checked; - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; } - } - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } } -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); -Sizzle.matchesSelector = function( elem, expr ) { - return Sizzle( expr, null, null, [ elem ] ).length > 0; -}; + if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} + if ( (!support.noCloneEvent || !support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); } } - }); - }); -} + } -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); } + } else { + cloneCopyEvent( elem, clone ); } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; } - // Do not include comment or processing instruction nodes - } else { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } - } - return ret; -}; -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; + destElements = srcElements = node = null; -// Element contains another -contains = Sizzle.contains = docElem.contains ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); - } : - docElem.compareDocumentPosition ? - function( a, b ) { - return b && !!( a.compareDocumentPosition( b ) & 16 ); - } : - function( a, b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - return false; - }; + // Return the cloned set + return clone; + }, -Sizzle.attr = function( elem, name ) { - var val, - xml = isXML( elem ); + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, - if ( !xml ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( xml || assertAttributes ) { - return elem.getAttribute( name ); - } - val = elem.getAttributeNode( name ); - return val ? - typeof elem[ name ] === "boolean" ? - elem[ name ] ? name : null : - val.specified ? val.value : null : - null; -}; + // Ensure a safe fragment + safe = createSafeFragment( context ), -Expr = Sizzle.selectors = { + nodes = [], + i = 0; - // Can be adjusted by the user - cacheLength: 50, + for ( ; i < l; i++ ) { + elem = elems[ i ]; - createPseudo: markFunction, + if ( elem || elem === 0 ) { - match: matchExpr, + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - // IE6/7 return a modified href - attrHandle: assertHrefNotNormalized ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }, + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); - find: { - "ID": assertGetIdNotName ? - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - } : - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }, + // Deserialize a standard representation + tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; - "TAG": assertTagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var results = context.getElementsByTagName( tag ); + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; - // Filter out possible comments - if ( tag === "*" ) { - var elem, - tmp = [], - i = 0; + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } - for ( ; (elem = results[i]); i++ ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); + // Manually add leading whitespace removed by IE + if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } } } - return tmp; + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; } - return results; - }, + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { - "NAME": assertUsableName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; } - }, - "CLASS": assertUsableClassName && function( className, context, xml ) { - if ( typeof context.getElementsByClassName !== strundefined && !xml ) { - return context.getElementsByClassName( className ); + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } } } - }, - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } + tmp = null; + + return safe; }, - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( rbackslash, "" ); + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = support.deleteExpando, + special = jQuery.event.special; - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); + for ( ; (elem = elems[i]) != null; i++ ) { + if ( acceptData || jQuery.acceptData( elem ) ) { - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } + id = elem[ internalKey ]; + data = id && cache[ id ]; - return match.slice( 0, 4 ); - }, + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 3 xn-component of xn+y argument ([+-]?\d*n|) - 4 sign of xn-component - 5 x of xn-component - 6 sign of y-component - 7 y of y-component - */ - match[1] = match[1].toLowerCase(); + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } - if ( match[1] === "nth" ) { - // nth-child requires argument - if ( !match[2] ) { - Sizzle.error( match[0] ); + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + deletedIds.push( id ); + } } + } + } + } +}); - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); - match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, - // other types prohibit arguments - } else if ( match[2] ) { - Sizzle.error( match[0] ); + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); } + }); + }, - return match; - }, + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; - "PSEUDO": function( match ) { - var unquoted, excess; - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } + for ( ; (elem = elems[i]) != null; i++ ) { - if ( match[3] ) { - match[2] = match[3]; - } else if ( (unquoted = match[4]) ) { - // Only check arguments that contain a pseudo - if ( rpseudo.test(unquoted) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } - // excess is a negative index - unquoted = unquoted.slice( 0, excess ); - match[0] = match[0].slice( 0, excess ); + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); } - match[2] = unquoted; + elem.parentNode.removeChild( elem ); } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); } + + return this; }, - filter: { - "ID": assertGetIdNotName ? - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - return elem.getAttribute("id") === id; - }; - } : - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === id; - }; - }, + empty: function() { + var elem, + i = 0; - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); } - nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } - "CLASS": function( className ) { - var pattern = classCache[ expando ][ className ]; - if ( !pattern ) { - pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") ); + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; } - return function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }; - }, + } - "ATTR": function( name, operator, check ) { - return function( elem, context ) { - var result = Sizzle.attr( elem, name ); + return this; + }, - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - result += ""; + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.substr( result.length - check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : - false; - }; - }, + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; - "CHILD": function( type, argument, first, last ) { + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } - if ( type === "nth" ) { - return function( elem ) { - var node, diff, - parent = elem.parentNode; + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { - if ( first === 1 && last === 0 ) { - return true; - } + value = value.replace( rxhtmlTag, "<$1></$2>" ); - if ( parent ) { - diff = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - diff++; - if ( elem === node ) { - break; - } - } + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; } } - // Incorporate the offset (or cast to NaN), then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - }; - } - - return function( elem ) { - var node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } + elem = 0; - if ( type === "first" ) { - return true; - } + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } - node = elem; + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } + replaceWith: function() { + var arg = arguments[ 0 ]; - return true; - } - }; - }, + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); + jQuery.cleanData( getAll( this ) ); - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); + if ( arg ) { + arg.replaceChild( elem, this ); } + }); - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, - return fn; - } + detach: function( selector ) { + return this.remove( selector, true ); }, - pseudos: { - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); + domManip: function( args, callback ) { - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; + // Flatten any nested arrays + args = concat.apply( [], args ); - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; - "enabled": function( elem ) { - return elem.disabled === false; - }, + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } - "disabled": function( elem ) { - return elem.disabled === true; - }, + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); - return elem.selected === true; - }, + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, + callback.call( this[i], node, i ); + } - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - var nodeType; - elem = elem.firstChild; - while ( elem ) { - if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { - return false; + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } } - elem = elem.nextSibling; + + // Fix #11809: Avoid leaking memory + fragment = first = null; } - return true; - }, + } - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; - "text": function( elem ) { - var type, attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - (type = elem.type) === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); - }, + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); - // Input types - "radio": createInputPseudo("radio"), - "checkbox": createInputPseudo("checkbox"), - "file": createInputPseudo("file"), - "password": createInputPseudo("password"), - "image": createInputPseudo("image"), + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } - "submit": createButtonPseudo("submit"), - "reset": createButtonPseudo("reset"), + return this.pushStack( ret ); + }; +}); - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, +var iframe, + elemdisplay = {}; - "focus": function( elem ) { - var doc = elem.ownerDocument; - return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href); - }, +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - "active": function( elem ) { - return elem === elem.ownerDocument.activeElement; - }, + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle ? - // Positional types - "first": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ 0 ]; - }), + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); - "last": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ length - 1 ]; - }), + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), + return display; +} - "even": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = 0; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; - "odd": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = 1; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), + if ( !display ) { + display = actualDisplay( nodeName, doc ); - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); -function siblingCheck( a, b, ret ) { - if ( a === b ) { - return ret; - } + // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse + doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; - var cur = a.nextSibling; + // Support: IE + doc.write(); + doc.close(); - while ( cur ) { - if ( cur === b ) { - return -1; + display = actualDisplay( nodeName, doc ); + iframe.detach(); } - cur = cur.nextSibling; + // Store the correct default display + elemdisplay[ nodeName ] = display; } - return 1; + return display; } -sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? - a.compareDocumentPosition : - a.compareDocumentPosition(b) & 4 - ) ? -1 : 1; - } : - function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; +(function() { + var a, shrinkWrapBlocksVal, + div = document.createElement( "div" ), + divReset = + "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + + "display:block;padding:0;margin:0;border:0"; - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); + // Setup + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + a = div.getElementsByTagName( "a" )[ 0 ]; - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; + a.style.cssText = "float:left;opacity:.5"; - } else if ( !bup ) { - return 1; - } + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + support.opacity = /^0.5/.test( a.style.opacity ); - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + support.cssFloat = !!a.style.cssFloat; - cur = bup; + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } + // Null elements to avoid leaks in IE. + a = div = null; - al = ap.length; - bl = bp.length; + support.shrinkWrapBlocks = function() { + var body, container, div, containerStyles; - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); + if ( shrinkWrapBlocksVal == null ) { + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body ) { + // Test fired too early or in an unsupported environment, exit. + return; } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; -// Always assume the presence of duplicates if sort doesn't -// pass them to our comparison function (as in Google Chrome). -[0, 0].sort( sortOrder ); -baseHasDuplicate = !hasDuplicate; + containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px"; + container = document.createElement( "div" ); + div = document.createElement( "div" ); -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - i = 1; + body.appendChild( container ).appendChild( div ); - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); + // Will be changed later if needed. + shrinkWrapBlocksVal = false; - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - results.splice( i--, 1 ); + if ( typeof div.style.zoom !== strundefined ) { + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1"; + div.innerHTML = "<div></div>"; + div.firstChild.style.width = "5px"; + shrinkWrapBlocksVal = div.offsetWidth !== 3; } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE. + body = container = div = null; } - } - return results; -}; + return shrinkWrapBlocksVal; + }; -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; +})(); +var rmargin = (/^margin/); -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, soFar, groups, preFilters, - cached = tokenCache[ expando ][ selector ]; +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - while ( soFar ) { +var getStyles, curCSS, + rposition = /^(top|right|bottom|left)$/; - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - soFar = soFar.slice( match[0].length ); - } - groups.push( tokens = [] ); - } +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); + }; - matched = false; + curCSS = function( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + style = elem.style; - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); + computed = computed || getStyles( elem ); - // Cast descendant combinators to space - matched.type = match[0].replace( rtrim, " " ); - } + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - // The last two arguments here are (context, xml) for backCompat - (match = preFilters[ type ]( match, document, true ))) ) { + if ( computed ) { - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); - matched.type = type; - matched.matches = match; + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); } - } - if ( !matched ) { - break; - } - } + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && combinator.dir === "parentNode", - doneName = done++; + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - return matcher( elem, context, xml ); - } + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; } - } : + } - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( !xml ) { - var cache, - dirkey = dirruns + " " + doneName + " ", - cachedkey = dirkey + cachedruns; - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( (cache = elem[ expando ]) === cachedkey ) { - return elem.sizset; - } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { - if ( elem.sizset ) { - return elem; - } - } else { - elem[ expando ] = cachedkey; - if ( matcher( elem, context, xml ) ) { - elem.sizset = true; - return elem; - } - elem.sizset = false; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( matcher( elem, context, xml ) ) { - return elem; - } - } - } - } - }; -} + // Support: IE + // IE returns zIndex value as an integer. + return ret === undefined ? + ret : + ret + ""; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} + curCSS = function( elem, name, computed ) { + var left, rs, rsLeft, ret, + style = elem.style; -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; + computed = computed || getStyles( elem ); + ret = computed ? computed[ name ] : undefined; - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; } - } - return newUnmatched; -} + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones - if ( seed && postFinder ) { - return; - } + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - var i, elem, postFilterIn, - preMap = [], - postMap = [], - preexisting = results.length, + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ), + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + // Support: IE + // IE returns zIndex value as an integer. + return ret === undefined ? + ret : + ret + "" || "auto"; + }; +} - // ...intermediate processing is necessary - [] : - // ...otherwise use results directly - results : - matcherIn; - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - // Apply postFilter - if ( postFilter ) { - postFilterIn = condense( matcherOut, postMap ); - postFilter( postFilterIn, [], context, xml ); +function addGetHookIf( conditionFn, hookFn ) { + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + var condition = conditionFn(); - // Un-match failing elements by moving them back to matcherIn - i = postFilterIn.length; - while ( i-- ) { - if ( (elem = postFilterIn[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } + if ( condition == null ) { + // The test was not ready at this point; screw the hook this time + // but check again when needed next time. + return; } - } - // Keep seed and results synchronized - if ( seed ) { - // Ignore postFinder because it can't coexist with seed - i = preFilter && matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - seed[ preMap[i] ] = !(results[ preMap[i] ] = elem); - } - } - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); + if ( condition ) { + // Hook not needed (or it's not possible to use it due to missing dependency), + // remove it. + // Since there are no other hooks for marginRight, remove the whole object. + delete this.get; + return; } + + // Hook needed; redefine it so that the support test is not executed again. + + return (this.get = hookFn).apply( this, arguments ); } - }); + }; } -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; +(function() { + var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal, + pixelPositionVal, reliableMarginRightVal, + div = document.createElement( "div" ), + containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", + divReset = + "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + + "display:block;padding:0;margin:0;border:0"; + + // Setup + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + a = div.getElementsByTagName( "a" )[ 0 ]; - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - // The concatenated values are (context, xml) for backCompat - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + a.style.cssText = "float:left;opacity:.5"; - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && tokens.join("") - ); - } - matchers.push( matcher ); - } - } + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + support.opacity = /^0.5/.test( a.style.opacity ); - return elementMatcher( matchers ); -} + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + support.cssFloat = !!a.style.cssFloat; -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Nested matchers should use non-integer dirruns - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = superMatcher.el; - } + // Null elements to avoid leaks in IE. + a = div = null; - // Add elements passing elementMatchers directly to results - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - for ( j = 0; (matcher = elementMatchers[j]); j++ ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++superMatcher.el; - } - } + jQuery.extend(support, { + reliableHiddenOffsets: function() { + if ( reliableHiddenOffsetsVal != null ) { + return reliableHiddenOffsetsVal; + } - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } + var container, tds, isSupported, + div = document.createElement( "div" ), + body = document.getElementsByTagName( "body" )[ 0 ]; - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } + if ( !body ) { + // Return for frameset docs that don't have a body + return; } - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - for ( j = 0; (matcher = setMatchers[j]); j++ ) { - matcher( unmatched, setMatched, context, xml ); - } + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } + container = document.createElement( "div" ); + container.style.cssText = containerStyles; - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } + body.appendChild( container ).appendChild( div ); - // Add matches to results - push.apply( results, setMatched ); + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName( "td" ); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; - Sizzle.uniqueSort( results ); - } - } + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } + body.removeChild( container ); - return unmatched; - }; + // Null elements to avoid leaks in IE. + div = body = null; - superMatcher.el = 0; - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} + return reliableHiddenOffsetsVal; + }, -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ expando ][ selector ]; + boxSizing: function() { + if ( boxSizingVal == null ) { + computeStyleTests(); + } + return boxSizingVal; + }, - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); + boxSizingReliable: function() { + if ( boxSizingReliableVal == null ) { + computeStyleTests(); } - } + return boxSizingReliableVal; + }, - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; + pixelPosition: function() { + if ( pixelPositionVal == null ) { + computeStyleTests(); + } + return pixelPositionVal; + }, -function multipleContexts( selector, contexts, results, seed ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results, seed ); - } - return results; -} + reliableMarginRight: function() { + var body, container, div, marginDiv; -function select( selector, context, results, seed, xml ) { - var i, tokens, token, type, find, - match = tokenize( selector ), - j = match.length; + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( reliableMarginRightVal == null && window.getComputedStyle ) { + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body ) { + // Test fired too early or in an unsupported environment, exit. + return; + } - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { + container = document.createElement( "div" ); + div = document.createElement( "div" ); + container.style.cssText = containerStyles; - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !xml && - Expr.relative[ tokens[1].type ] ) { + body.appendChild( container ).appendChild( div ); - context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; - if ( !context ) { - return results; - } + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement( "div" ) ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; - selector = selector.slice( tokens.shift().length ); + reliableMarginRightVal = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + + body.removeChild( container ); } - // Fetch a seed set for right-to-left matching - for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { - token = tokens[i]; + return reliableMarginRightVal; + } + }); - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( rbackslash, "" ), - rsibling.test( tokens[0].type ) && context.parentNode || context, - xml - )) ) { + function computeStyleTests() { + var container, div, + body = document.getElementsByTagName( "body" )[ 0 ]; - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && tokens.join(""); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } + if ( !body ) { + // Test fired too early or in an unsupported environment, exit. + return; + } - break; - } - } - } + container = document.createElement( "div" ); + div = document.createElement( "div" ); + container.style.cssText = containerStyles; + + body.appendChild( container ).appendChild( div ); + + div.style.cssText = + "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + + "position:absolute;display:block;padding:1px;border:1px;width:4px;" + + "margin-top:1%;top:1%"; + + // Workaround failing boxSizing test due to offsetWidth returning wrong value + // with some non-1 values of body zoom, ticket #13543 + jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { + boxSizingVal = div.offsetWidth === 4; + }); + + // Will be changed later if needed. + boxSizingReliableVal = true; + pixelPositionVal = false; + reliableMarginRightVal = true; + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + boxSizingReliableVal = + ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; } - } - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - xml, - results, - rsibling.test( selector ) - ); - return results; -} + body.removeChild( container ); + + // Null elements to avoid leaks in IE. + div = body = null; + } -if ( document.querySelectorAll ) { - (function() { - var disconnectedMatch, - oldSelect = select, - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // qSa(:focus) reports false when true (Chrome 21), - // A support test would require too much code (would include document ready) - rbuggyQSA = [":focus"], - - // matchesSelector(:focus) reports false when true (Chrome 21), - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - // A support test would require too much code (would include document ready) - // just skip matchesSelector for :active - rbuggyMatches = [ ":active", ":focus" ], - matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector; +})(); - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select><option selected=''></option></select>"; - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } +// A method for quickly swapping in/out CSS properties to get correct calculations. +jQuery.swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here (do not put tests after this one) - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } - assert(function( div ) { + ret = callback.apply( elem, args || [] ); - // Opera 10-12/IE9 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = "<p test=''></p>"; - if ( div.querySelectorAll("[test^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here (do not put tests after this one) - div.innerHTML = "<input type='hidden'/>"; - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push(":enabled", ":disabled"); - } - }); + return ret; +}; - // rbuggyQSA always contains :focus, so no need for a length check - rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); - - select = function( selector, context, results, seed, xml ) { - // Only use querySelectorAll when not filtering, - // when this is not xml, - // and when no QSA bugs apply - if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - var groups, i, - old = true, - nid = expando, - newContext = context, - newSelector = context.nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - i = groups.length; - while ( i-- ) { - groups[i] = nid + groups[i].join(""); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } +var + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), - return oldSelect( selector, context, results, seed, xml ); - }; + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, - if ( matches ) { - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - disconnectedMatch = matches.call( div, "div" ); + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - // This should fail with an exception - // Gecko does not error, returns false instead - try { - matches.call( div, "[test!='']:sizzle" ); - rbuggyMatches.push( "!=", pseudos ); - } catch ( e ) {} - }); - // rbuggyMatches always contains :active and :focus, so no need for a length check - rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { - Sizzle.matchesSelector = function( elem, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } - // rbuggyMatches always contains :active, so no need for an existence check - if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; - return Sizzle( expr, null, null, [ elem ] ).length > 0; - }; + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; } - })(); -} + } -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; + return origName; +} -// Back-compat -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + elem.style.display = ""; + } -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); + } + } else { -jQuery.fn.extend({ - find: function( selector ) { - var i, l, length, n, r, ret, - self = this; + if ( !values[ index ] ) { + hidden = isHidden( elem ); - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } - }); + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; } + } - ret = this.pushStack( "", "find", selector ); + return elements; +} - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } - return ret; - }, + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } - }); - }, + } + } - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, + return val; +} - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, +function getWidthOrHeight( elem, name, extra ) { - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } - for ( ; i < l; i++ ) { - cur = this[i]; + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; } - cur = cur.parentNode; } } + }, - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true }, - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": support.cssFloat ? "cssFloat" : "styleFloat" + }, - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; } - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } -jQuery.fn.andSelf = jQuery.fn.addBack; + // Make sure that null and NaN values aren't set. See: #7116 + if ( value == null || value !== value ) { + return; + } -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } - return cur; -} + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); + // Support: IE + // Swallow errors from 'invalid' CSS values (#5509) + try { + // Support: Chrome, Safari + // Setting style to blank string required to delete "style: x !important;" + style[ name ] = ""; + style[ name ] = value; + } catch(e) {} + } - if ( !runtil.test( name ) ) { - selector = until; - } + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); + // Otherwise just get the value from the style object + return style[ name ]; } + }, - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + css: function( elem, name, extra, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); - }; -}); + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); } - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; } - return r; + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; } }); -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? + jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }) : + getWidthOrHeight( elem, name, extra ); + } + }, - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; + set: function( elem, value, extra ) { + var styles = extra && getStyles( elem ); + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ) : 0 + ); + } + }; +}); - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); +if ( !support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + // if value === "", then remove inline opacity #12685 + if ( ( value >= 1 || value === "" ) && + jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); + // if there is no filter style applied in a css rule or unset inline opacity, we are done + if ( value === "" || currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; } - } - return safeFrag; + }; } -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style|link)/i, - rnocache = /<(?:script|object|embed|option|style)/i, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rcheckableType = /^(?:checkbox|radio)$/, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - area: [ 1, "<map>", "</map>" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); +jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, + function( elem, computed ) { + if ( computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, + curCSS, [ elem, "marginRight" ] ); + } + } +); -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, -// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, -// unless wrapped in a div with non-breaking characters in front of it. -if ( !jQuery.support.htmlSerialize ) { - wrapMap._default = [ 1, "X<div>", "</div>" ]; -} + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ]; -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); + return expanded; } + }; - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } +jQuery.fn.extend({ + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; - wrap.map(function() { - var elem = this; + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); } - return elem; - }).append( this ); - } + return map; + } - return this; + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); } return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - + if ( isHidden( this ) ) { + jQuery( this ).show(); } else { - self.append( html ); + jQuery( this ).hide(); } }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); + } +}); - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.appendChild( elem ); - } - }); +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.insertBefore( elem, this.firstChild ); - } - }); + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; - before: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this ); - }); + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; } + this.now = ( this.end - this.start ) * eased + this.start; - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); } - }, - after: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - }); + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); } + return this; + } +}; - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); - } - }, +Tween.prototype.init.prototype = Tween.prototype; - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - jQuery.cleanData( [ elem ] ); - } + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } + // passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; } } + } +}; - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - } +// Support: IE <=9 +// Panic based approach to setting things on disconnected nodes - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; } + } +}; - return this; +jQuery.easing = { + linear: function( p ) { + return p; }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + } +}; - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, +jQuery.fx = Tween.prototype.init; - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; +// Back Compat <1.8 extension point +jQuery.fx.step = {}; - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - value = value.replace( rxhtmlTag, "<$1></$2>" ); - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName( "*" ) ); - elem.innerHTML = value; - } - } +var + fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ), + target = tween.cur(), + parts = rfxnum.exec( value ), + unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - elem = 0; + // Starting value computation is required for potential unit mismatches + start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && + rfxnum.exec( jQuery.css( tween.elem, prop ) ), + scale = 1, + maxIterations = 20; - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } + if ( start && start[ 3 ] !== unit ) { + // Trust units reported by jQuery.css + unit = unit || start[ 3 ]; - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, + // Make sure we update the tween properties later on + parts = parts || []; - replaceWith: function( value ) { - if ( !isDisconnected( this[0] ) ) { - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this), old = self.html(); - self.replaceWith( value.call( this, i, old ) ); - }); + // Iteratively approximate from a nonzero starting point + start = +target || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } - if ( typeof value !== "string" ) { - value = jQuery( value ).detach(); + // Update tween properties + if ( parts ) { + start = tween.start = +start || +target || 0; + tween.unit = unit; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[ 1 ] ? + start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : + +parts[ 2 ]; } - return this.each(function() { - var next = this.nextSibling, - parent = this.parentNode; + return tween; + } ] + }; - jQuery( this ).remove(); +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }); + return ( fxNow = jQuery.now() ); +} - if ( next ) { - jQuery(next).before( value ); - } else { - jQuery(parent).append( value ); - } - }); - } +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; - return this.length ? - this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : - this; - }, + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } - detach: function( selector ) { - return this.remove( selector, true ); - }, + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } - domManip: function( args, table, callback ) { + return attrs; +} - // Flatten any nested arrays - args = [].concat.apply( [], args ); +function createTween( value, prop, animation ) { + var tween, + collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( (tween = collection[ index ].call( animation, prop, value )) ) { - var results, first, fragment, iNoClone, - i = 0, - value = args[0], - scripts = [], - l = this.length; + // we're done with this property + return tween; + } + } +} - // We can't cloneNode fragments that contain checked, in WebKit - if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { - return this.each(function() { - jQuery(this).domManip( args, table, callback ); - }); +function defaultPrefilter( elem, props, opts ) { + /* jshint validthis: true */ + var prop, value, toggle, tween, hooks, oldfire, display, dDisplay, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHidden( elem ), + dataShow = jQuery._data( elem, "fxshow" ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; } + hooks.unqueued++; - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - args[0] = value.call( this, i, table ? self.html() : undefined ); - self.domManip( args, table, callback ); + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } }); - } + }); + } - if ( this[0] ) { - results = jQuery.buildFragment( args, this, scripts ); - fragment = results.fragment; - first = fragment.firstChild; + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - if ( fragment.childNodes.length === 1 ) { - fragment = first; + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + display = jQuery.css( elem, "display" ); + dDisplay = defaultDisplay( elem.nodeName ); + if ( display === "none" ) { + display = dDisplay; + } + if ( display === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !support.inlineBlockNeedsLayout || dDisplay === "inline" ) { + style.display = "inline-block"; + } else { + style.zoom = 1; } + } + } - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !support.shrinkWrapBlocks() ) { + anim.always(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - // Fragments from the fragment cache must always be cloned and never used in place. - for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - i === iNoClone ? - fragment : - jQuery.clone( fragment, true, true ) - ); + // show/hide pass + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.exec( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + } else { + continue; } } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } - // Fix #11809: Avoid leaking memory - fragment = first = null; + if ( !jQuery.isEmptyObject( orig ) ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = jQuery._data( elem, "fxshow", {} ); + } - if ( scripts.length ) { - jQuery.each( scripts, function( i, elem ) { - if ( elem.src ) { - if ( jQuery.ajax ) { - jQuery.ajax({ - url: elem.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.error("no ajax"); - } - } else { - jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); - } + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery._removeData( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( prop in orig ) { + tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - }); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } } } - - return this; } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } -function cloneCopyEvent( src, dest ) { +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } - if ( events ) { - delete curData.handle; - curData.events = {}; + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } } + } else { + specialEasing[ name ] = easing; } } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; -function cloneFixAttributes( src, dest ) { - var nodeName; + propFilter( props, animation.opts.specialEasing ); - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } } - // clearAttributes removes the attributes, which we don't want, - // but also removes the attachEvent events, which we *do* want - if ( dest.clearAttributes ) { - dest.clearAttributes(); - } + jQuery.map( props, createTween, animation ); - // mergeAttributes, in contrast, only merges back on the - // original attributes, not the events - if ( dest.mergeAttributes ) { - dest.mergeAttributes( src ); + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); } - nodeName = dest.nodeName.toLowerCase(); + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + }) + ); - if ( nodeName === "object" ) { - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { - dest.innerHTML = src.innerHTML; +jQuery.Animation = jQuery.extend( Animation, { + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); } - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; + var prop, + index = 0, + length = props.length; - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); } + }, - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - - // IE blanks contents when cloning scripts - } else if ( nodeName === "script" && dest.text !== src.text ) { - dest.text = src.text; + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } } +}); - // Event data gets referenced instead of copied if the expando - // gets copied too - dest.removeAttribute( jQuery.expando ); -} - -jQuery.buildFragment = function( args, context, scripts ) { - var fragment, cacheable, cachehit, - first = args[ 0 ]; - - // Set context from what may come in as undefined or a jQuery collection or a node - // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & - // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception - context = context || document; - context = !context.nodeType && context[0] || context; - context = context.ownerDocument || context; +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; - // Only cache "small" (1/2 KB) HTML strings that are associated with the main document - // Cloning options loses the selected state, so don't cache them - // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 - if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && - first.charAt(0) === "<" && !rnocache.test( first ) && - (jQuery.support.checkClone || !rchecked.test( first )) && - (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - // Mark cacheable and look for a hit - cacheable = true; - fragment = jQuery.fragments[ first ]; - cachehit = fragment !== undefined; + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; } - if ( !fragment ) { - fragment = context.createDocumentFragment(); - jQuery.clean( args, context, fragment, scripts ); + // Queueing + opt.old = opt.complete; - // Update the cache, but only store false - // unless this is a second parsing of the same content - if ( cacheable ) { - jQuery.fragments[ first ] = cachehit && fragment; + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); } - } - - return { fragment: fragment, cacheable: cacheable }; -}; - -jQuery.fragments = {}; - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - l = insert.length, - parent = this.length === 1 && this[0].parentNode; - - if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { - insert[ original ]( this[0] ); - return this; - } else { - for ( ; i < l; i++ ) { - elems = ( i > 0 ? this.clone(true) : this ).get(); - jQuery( insert[i] )[ original ]( elems ); - ret = ret.concat( elems ); - } - return this.pushStack( ret, name, insert.selector ); + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); } }; -}); -function getAll( elem ) { - if ( typeof elem.getElementsByTagName !== "undefined" ) { - return elem.getElementsByTagName( "*" ); + return opt; +}; - } else if ( typeof elem.querySelectorAll !== "undefined" ) { - return elem.querySelectorAll( "*" ); +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { - } else { - return []; - } -} + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() -// Used in clean, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var srcElements, - destElements, - i, - clone; + // Empty animations, or finishing resolves immediately + if ( empty || jQuery._data( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); } - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - // IE copies events bound via attachEvent when using cloneNode. - // Calling detachEvent on the clone will also remove the events - // from the original. In order to get around this, we use some - // proprietary methods to clear the events. Thanks to MooTools - // guys for this hotness. - - cloneFixAttributes( elem, clone ); + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); - // Using Sizzle here is crazy slow, so we use getElementsByTagName instead - srcElements = getAll( elem ); - destElements = getAll( clone ); + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } - // Weird iteration because IE will replace the length property - // with an element if you are cloning the body and one of the - // elements on the page has a name or id of "length" - for ( i = 0; srcElements[i]; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - cloneFixAttributes( srcElements[i], destElements[i] ); + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); } } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; } + return this.each(function() { + var index, + data = jQuery._data( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; - // Copy the events from the original to the clone - if ( dataAndEvents ) { - cloneCopyEvent( elem, clone ); + // enable finishing flag on private data + data.finish = true; - if ( deepDataAndEvents ) { - srcElements = getAll( elem ); - destElements = getAll( clone ); + // empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } - for ( i = 0; srcElements[i]; ++i ) { - cloneCopyEvent( srcElements[i], destElements[i] ); + // look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); } } - } - srcElements = destElements = null; + // turn off finishing flag + delete data.finish; + }); + } +}); + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); - // Return the cloned set - return clone; - }, +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; - clean: function( elems, context, fragment, scripts ) { - var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, - safe = context === document && safeFragment, - ret = []; + fxNow = jQuery.now(); - // Ensure that context is a document - if ( !context || typeof context.createDocumentFragment === "undefined" ) { - context = document; + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); } + } - // Use the already-created safe fragment if context permits - for ( i = 0; (elem = elems[i]) != null; i++ ) { - if ( typeof elem === "number" ) { - elem += ""; - } + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; - if ( !elem ) { - continue; - } +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + if ( timer() ) { + jQuery.fx.start(); + } else { + jQuery.timers.pop(); + } +}; - // Convert html string into DOM nodes - if ( typeof elem === "string" ) { - if ( !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); - } else { - // Ensure a safe container in which to render the html - safe = safe || createSafeFragment( context ); - div = context.createElement("div"); - safe.appendChild( div ); +jQuery.fx.interval = 13; - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, "<$1></$2>"); +jQuery.fx.start = function() { + if ( !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; - // Go to html and back, then peel off extra wrappers - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - depth = wrap[0]; - div.innerHTML = wrap[1] + elem + wrap[2]; +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - // String was a <table>, *may* have spurious <tbody> - hasBody = rtbody.test(elem); - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !hasBody ? - div.childNodes : - []; - - for ( j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - } - } - } +// Based off of the plugin by Clint Helfers, with permission. +// http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); - } + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); +}; - elem = div.childNodes; - // Take out of fragment container (we need a fresh div each time) - div.parentNode.removeChild( div ); - } - } +(function() { + var a, input, select, opt, + div = document.createElement("div" ); - if ( elem.nodeType ) { - ret.push( elem ); - } else { - jQuery.merge( ret, elem ); - } - } + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + a = div.getElementsByTagName("a")[ 0 ]; - // Fix #11356: Clear elements from safeFragment - if ( div ) { - elem = div = safe = null; - } + // First batch of tests. + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - for ( i = 0; (elem = ret[i]) != null; i++ ) { - if ( jQuery.nodeName( elem, "input" ) ) { - fixDefaultChecked( elem ); - } else if ( typeof elem.getElementsByTagName !== "undefined" ) { - jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); - } - } - } + a.style.cssText = "top:1px"; - // Append elements to a provided document fragment - if ( fragment ) { - // Special handling of each script element - handleScript = function( elem ) { - // Check if we consider it executable - if ( !elem.type || rscriptType.test( elem.type ) ) { - // Detach the script and store it in the scripts array (if provided) or the fragment - // Return truthy to indicate that it has been handled - return scripts ? - scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : - fragment.appendChild( elem ); - } - }; + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + support.getSetAttribute = div.className !== "t"; - for ( i = 0; (elem = ret[i]) != null; i++ ) { - // Check if we're done after handling an executable script - if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { - // Append to fragment and handle embedded scripts - fragment.appendChild( elem ); - if ( typeof elem.getElementsByTagName !== "undefined" ) { - // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration - jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); - - // Splice the scripts into ret after their former ancestor and advance our index beyond them - ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); - i += jsTags.length; - } - } - } - } + // Get the style information from getAttribute + // (IE uses .cssText instead) + support.style = /top/.test( a.getAttribute("style") ); - return ret; - }, + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + support.hrefNormalized = a.getAttribute("href") === "/a"; - cleanData: function( elems, /* internal */ acceptData ) { - var data, id, elem, type, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + support.checkOn = !!input.value; - for ( ; (elem = elems[i]) != null; i++ ) { + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + support.optSelected = opt.selected; - if ( acceptData || jQuery.acceptData( elem ) ) { + // Tests for enctype support on a form (#6743) + support.enctype = !!document.createElement("form").enctype; - id = elem[ internalKey ]; - data = id && cache[ id ]; + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); + // Support: IE8 only + // Check if we can trust getAttribute("value") + input = document.createElement( "input" ); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { + // Null elements to avoid leaks in IE. + a = input = select = opt = div = null; +})(); - delete cache[ id ]; - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; +var rreturn = /\r/g; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); +jQuery.fn.extend({ + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; - } else { - elem[ internalKey ] = null; - } + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - jQuery.deletedIds.push( id ); - } + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; } - } - } - } -}); -// Limit scope pollution from any deprecated API -(function() { - -var matched, browser; -// Use of jQuery.browser is frowned upon. -// More details: http://api.jquery.com/jQuery.browser -// jQuery.uaMatch maintained for back-compat -jQuery.uaMatch = function( ua ) { - ua = ua.toLowerCase(); + ret = elem.value; - var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || - []; + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } - return { - browser: match[ 1 ] || "", - version: match[ 2 ] || "0" - }; -}; + return; + } -matched = jQuery.uaMatch( navigator.userAgent ); -browser = {}; + isFunction = jQuery.isFunction( value ); -if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; -} + return this.each(function( i ) { + var val; -// Chrome is Webkit, but Webkit is also Safari. -if ( browser.chrome ) { - browser.webkit = true; -} else if ( browser.webkit ) { - browser.safari = true; -} + if ( this.nodeType !== 1 ) { + return; + } -jQuery.browser = browser; + if ( isFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } -jQuery.sub = function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + }); + } - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; -}; + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; -})(); -var curCSS, iframe, iframeDoc, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity=([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), - elemdisplay = {}, + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + jQuery.text( elem ); + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; - eventsToggle = jQuery.fn.toggle; + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { + // Get the specific value for the option + value = jQuery( option ).val(); - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } + // We don't need an array for one selects + if ( one ) { + return value; + } - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; + // Multi-Selects return an array + values.push( value ); + } + } - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } + return values; + }, - return origName; -} + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; -function isHidden( elem, el ) { - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} + while ( i-- ) { + option = options[ i ]; -function showHide( elements, show ) { - var elem, display, - values = [], - index = 0, - length = elements.length; + if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) { - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - values[ index ] = jQuery._data( elem, "olddisplay" ); - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && elem.style.display === "none" ) { - elem.style.display = ""; - } + // Support: IE6 + // When new option element is added to select box we need to + // force reflow of newly added node in order to workaround delay + // of initialization properties + try { + option.selected = optionSet = true; - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - display = curCSS( elem, "display" ); + } catch ( _ ) { + + // Will be executed only in IE6 + option.scrollHeight; + } - if ( !values[ index ] && display !== "none" ) { - jQuery._data( elem, "olddisplay", display ); + } else { + option.selected = false; + } + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + + return options; } } } +}); - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; +// Radios and checkboxes getter/setter +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + // Support: Webkit + // "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + }; } +}); - return elements; -} + + + +var nodeHook, boolHook, + attrHandle = jQuery.expr.attrHandle, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = support.getSetAttribute, + getSetInput = support.input; jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); }, - toggle: function( state, fn2 ) { - var bool = typeof state === "boolean"; - - if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { - return eventsToggle.apply( this, arguments ); - } + removeAttr: function( name ) { return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } + jQuery.removeAttr( this, name ); }); } }); jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, + attr: function( elem, name, value ) { + var hooks, ret, + nType = elem.nodeType; - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === strundefined ) { + return jQuery.prop( elem, name, value ); + } - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); + } - // Check if we're setting a value if ( value !== undefined ) { - type = typeof value; - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } + if ( value === null ) { + jQuery.removeAttr( elem, name ); - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } + } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; + } else { + elem.setAttribute( name, value + "" ); + return value; } - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } + } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } + ret = jQuery.find.attr( elem, name ); - // Otherwise just get the value from the style object - return style[ name ]; + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; } }, - css: function( elem, name, numeric, extra ) { - var val, num, hooks, - origName = jQuery.camelCase( name ); + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( rnotwhite ); - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + // Boolean attributes get special treatment (#10870) + if ( jQuery.expr.match.bool.test( name ) ) { + // Set corresponding property to false + if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + elem[ propName ] = false; + // Support: IE<9 + // Also clear defaultChecked/defaultSelected (if appropriate) + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name ); + elem.removeAttribute( getSetAttribute ? name : propName ); + } } + }, - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } } + } +}); - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( numeric || extra !== undefined ) { - num = parseFloat( val ); - return numeric || jQuery.isNumeric( num ) ? num || 0 : val; +// Hook for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; } - return val; - }, - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var ret, name, - old = {}; + return name; + } +}; + +// Retrieve booleans specially +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } + var getter = attrHandle[ name ] || jQuery.find.attr; - ret = callback.call( elem ); + attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? + function( elem, name, isXML ) { + var ret, handle; + if ( !isXML ) { + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ name ]; + attrHandle[ name ] = ret; + ret = getter( elem, name, isXML ) != null ? + name.toLowerCase() : + null; + attrHandle[ name ] = handle; + } + return ret; + } : + function( elem, name, isXML ) { + if ( !isXML ) { + return elem[ jQuery.camelCase( "default-" + name ) ] ? + name.toLowerCase() : + null; + } + }; +}); - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; +// fix oldIE attroperties +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } } + }; +} - return ret; - } -}); +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { -// NOTE: To any future maintainer, we've window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - curCSS = function( elem, name ) { - var ret, width, minWidth, maxWidth, - computed = window.getComputedStyle( elem, null ), - style = elem.style; + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = { + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } - if ( computed ) { + ret.value = value += ""; - ret = computed[ name ]; - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); + // Break association with cloned elements by also using setAttribute (#9646) + if ( name === "value" || value === elem.getAttribute( name ) ) { + return value; } + } + }; - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; + // Some attributes are constructed with empty-string values when not defined + attrHandle.id = attrHandle.name = attrHandle.coords = + function( elem, name, isXML ) { + var ret; + if ( !isXML ) { + return (ret = elem.getAttributeNode( name )) && ret.value !== "" ? + ret.value : + null; + } + }; + + // Fixing value retrieval on a button requires this module + jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + if ( ret && ret.specified ) { + return ret.value; + } + }, + set: nodeHook.set + }; - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } } - } + }; + }); +} - return ret; +if ( !support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } }; -} else if ( document.documentElement.currentStyle ) { - curCSS = function( elem, name ) { - var left, rsLeft, - ret = elem.currentStyle && elem.currentStyle[ name ], - style = elem.style; +} - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - // Remember the original values - left = style.left; - rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; +var rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i; - // Put in the new values to get a computed value out - if ( rsLeft ) { - elem.runtimeStyle.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; +jQuery.fn.extend({ + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, - // Revert the changed values - style.left = left; - if ( rsLeft ) { - elem.runtimeStyle.left = rsLeft; - } - } + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + } +}); - return ret === "" ? "auto" : ret; - }; -} +jQuery.extend({ + propFix: { + "for": "htmlFor", + "class": "className" + }, -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; -function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } - val = 0; + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - // we use jQuery.css instead of curCSS here - // because of the reliableMarginRight CSS hook! - val += jQuery.css( elem, extra + cssExpand[ i ], true ); + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; } - // From this point on we use curCSS for maximum performance (relevant in animations) - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; - } + if ( value !== undefined ) { + return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? + ret : + ( elem[ name ] = value ); - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; - } } else { - // at this point, extra isn't content, so add padding - val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; + return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? + ret : + elem[ name ]; + } + }, - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + return tabindex ? + parseInt( tabindex, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + -1; } } } +}); - return val; +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !support.hrefNormalized ) { + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); } -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - valueIsBorderBox = true, - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; +// Support: Safari, IE9+ +// mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + var parent = elem.parentNode; - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } + if ( parent ) { + parent.selectedIndex; - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; } + }; +} - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } +jQuery.each([ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +}); - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox - ) - ) + "px"; +// IE6/7 call enctype encoding +if ( !support.enctype ) { + jQuery.propFix.enctype = "encoding"; } -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - if ( elemdisplay[ nodeName ] ) { - return elemdisplay[ nodeName ]; - } - var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), - display = elem.css("display"); - elem.remove(); - // If the simple way fails, - // get element's real default display by attaching it to a temp iframe - if ( display === "none" || display === "" ) { - // Use the already-created iframe if possible - iframe = document.body.appendChild( - iframe || jQuery.extend( document.createElement("iframe"), { - frameBorder: 0, - width: 0, - height: 0 - }) - ); +var rclass = /[\t\r\n\f]/g; - // Create a cacheable copy of the iframe document on first call. - // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML - // document to it; WebKit & Firefox won't allow reusing the iframe document. - if ( !iframeDoc || !iframe.createElement ) { - iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; - iframeDoc.write("<!doctype html><html><body>"); - iframeDoc.close(); - } +jQuery.fn.extend({ + addClass: function( value ) { + var classes, elem, cur, clazz, j, finalValue, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; - elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } - display = curCSS( elem, "display" ); - document.body.removeChild( iframe ); - } + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( rnotwhite ) || []; - // Store the correct default display - elemdisplay[ nodeName ] = display; + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); - return display; -} + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } -jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { - return jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }); - } else { - return getWidthOrHeight( elem, name, extra ); + // only assign if different to avoid unneeded rendering. + finalValue = jQuery.trim( cur ); + if ( elem.className !== finalValue ) { + elem.className = finalValue; + } } } - }, + } - set: function( elem, value, extra ) { - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" - ) : 0 - ); + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, finalValue, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); } - }; -}); + if ( proceed ) { + classes = ( value || "" ).match( rnotwhite ) || []; -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; + // only assign if different to avoid unneeded rendering. + finalValue = value ? jQuery.trim( cur ) : ""; + if ( elem.className !== finalValue ) { + elem.className = finalValue; + } + } + } + } - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { + return this; + }, - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); + toggleClass: function( value, stateVal ) { + var type = typeof value; - // if there there is no filter style applied in a css rule, we are done - if ( currentStyle && !currentStyle.filter ) { - return; - } - } + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); } - }; -} -// These hooks cannot be added until DOM ready because the support test -// for it is not run until after DOM ready -jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, function() { - if ( computed ) { - return curCSS( elem, "marginRight" ); - } - }); - } - }; - } + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + classNames = value.match( rnotwhite ) || []; - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - var ret = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); } } - }; + + // Toggle whole class name + } else if ( type === strundefined || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } }); - } + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + return false; + } }); -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); - }; - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} -// These hooks are used by animate to expand properties -jQuery.each({ - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i, - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ], - expanded = {}; +// Return jQuery for attributes-only inclusion - for ( i = 0; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - return expanded; - } - }; +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; }); -var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, - rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); }, - serializeArray: function() { - return this.map(function(){ - return this.elements ? jQuery.makeArray( this.elements ) : this; - }) - .filter(function(){ - return this.name && !this.disabled && - ( this.checked || rselectTextarea.test( this.nodeName ) || - rinput.test( this.type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val, i ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); } }); -//Serialize an array of form elements or a set of -//key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; +var nonce = jQuery.now(); + +var rquery = (/\?/); + + + +var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; + +jQuery.parseJSON = function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + // Support: Android 2.3 + // Workaround failure to string-cast null input + return window.JSON.parse( data + "" ); } - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); + var requireNonComma, + depth = null, + str = jQuery.trim( data + "" ); - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); + // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains + // after removing valid tokens + return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { + + // Force termination if we see a misplaced comma + if ( requireNonComma && comma ) { + depth = 0; } - } - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); -}; + // Perform no more replacements after returning to outermost depth + if ( depth === 0 ) { + return token; + } -function buildParams( prefix, obj, traditional, add ) { - var name; + // Commas must not follow "[", "{", or "," + requireNonComma = open || comma; - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); + // Determine new depth + // array/object open ("[" or "{"): depth += true - false (increment) + // array/object close ("]" or "}"): depth += false - true (decrement) + // other cases ("," or primitive): depth += true - true (numeric cast) + depth += !close - !open; - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); + // Remove this token + return ""; + }) ) ? + ( Function( "return " + str ) )() : + jQuery.error( "Invalid JSON: " + data ); +}; - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - } else { - // Serialize scalar item. - add( prefix, obj ); +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; } -} + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data, "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; +}; + + var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, + rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, - rquery = /\?/, - rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, - rts = /([?&])_=[^&]*/, - rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, + rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) @@ -7299,7 +8610,7 @@ var transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = ["*/"] + ["*"]; + allTypes = "*/".concat("*"); // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set @@ -7327,215 +8638,238 @@ function addToPrefiltersOrTransports( structure ) { dataTypeExpression = "*"; } - var dataType, list, placeBefore, - dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), + var dataType, i = 0, - length = dataTypes.length; + dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression - for ( ; i < length; i++ ) { - dataType = dataTypes[ i ]; - // We control if we're asked to add before - // any existing element - placeBefore = /^\+/.test( dataType ); - if ( placeBefore ) { - dataType = dataType.substr( 1 ) || "*"; + while ( (dataType = dataTypes[i++]) ) { + // Prepend if requested + if ( dataType.charAt( 0 ) === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); + + // Otherwise append + } else { + (structure[ dataType ] = structure[ dataType ] || []).push( func ); } - list = structure[ dataType ] = structure[ dataType ] || []; - // then we add to the structure accordingly - list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } // Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, - dataType /* internal */, inspected /* internal */ ) { - - dataType = dataType || options.dataTypes[ 0 ]; - inspected = inspected || {}; - - inspected[ dataType ] = true; - - var selection, - list = structure[ dataType ], - i = 0, - length = list ? list.length : 0, - executeOnly = ( structure === prefilters ); - - for ( ; i < length && ( executeOnly || !selection ); i++ ) { - selection = list[ i ]( options, originalOptions, jqXHR ); - // If we got redirected to another dataType - // we try there if executing only and not done already - if ( typeof selection === "string" ) { - if ( !executeOnly || inspected[ selection ] ) { - selection = undefined; - } else { - options.dataTypes.unshift( selection ); - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, selection, inspected ); +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); } - } - } - // If we're only executing or nothing was selected - // we try the catchall dataType if not done already - if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, "*", inspected ); + }); + return selected; } - // unnecessary when only executing (prefilters) - // but it'll be ignored by the caller in that case - return selection; + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { - var key, deep, + var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; + for ( key in src ) { if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } + + return target; } -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + var firstDataType, ct, finalDataType, type, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); + } } - // Don't do a request if no elements are being requested - if ( !this.length ) { - return this; + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } } - var selector, type, response, - self = this, - off = url.indexOf(" "); + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } } - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; + current = dataTypes.shift(); - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } + // Convert to each sequential dataType + while ( current ) { - // Request the remote document - jQuery.ajax({ - url: url, + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params, - complete: function( jqXHR, status ) { - if ( callback ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - } + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); } - }).done(function( responseText ) { - // Save response for use in complete callback - response = arguments; + prev = current; + current = dataTypes.shift(); - // See if a selector was specified - self.html( selector ? + if ( current ) { - // Create a dummy div to hold the results - jQuery("<div>") + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { - // inject the contents of the document in, removing the scripts - // to avoid any 'Permission Denied' errors in IE - .append( responseText.replace( rscript, "" ) ) + current = prev; - // Locate the specified elements - .find( selector ) : + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { - // If not, just inject the full result - responseText ); + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - }); + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { - return this; -}; + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { -// Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ - jQuery.fn[ o ] = function( f ){ - return this.on( o, f ); - }; -}); + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s[ "throws" ] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } } + } - return jQuery.ajax({ - type: method, - url: url, - data: data, - success: callback, - dataType: type - }); - }; -}); + return { state: "success", data: response }; +} jQuery.extend({ - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, + // Counter for holding the number of active queries + active: 0, - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - if ( settings ) { - // Building a settings object - ajaxExtend( target, jQuery.ajaxSettings ); - } else { - // Extending ajaxSettings - settings = target; - target = jQuery.ajaxSettings; - } - ajaxExtend( target, settings ); - return target; - }, + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, ajaxSettings: { url: ajaxLocation, + type: "GET", isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, - type: "GET", - contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", /* timeout: 0, data: null, @@ -7549,11 +8883,11 @@ jQuery.extend({ */ accepts: { - xml: "application/xml, text/xml", - html: "text/html", + "*": allTypes, text: "text/plain", - json: "application/json, text/javascript", - "*": allTypes + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" }, contents: { @@ -7564,16 +8898,16 @@ jQuery.extend({ responseFields: { xml: "responseXML", - text: "responseText" + text: "responseText", + json: "responseJSON" }, - // List of data converters - // 1) key format is "source_type destination_type" (a single space in-between) - // 2) the catchall symbol "*" can be used for source_type + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space converters: { // Convert anything to text - "* text": window.String, + "* text": String, // Text to html (true = no transformation) "text html": true, @@ -7590,11 +8924,24 @@ jQuery.extend({ // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { - context: true, - url: true + url: true, + context: true } }, + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), @@ -7610,34 +8957,34 @@ jQuery.extend({ // Force options to be an object options = options || {}; - var // ifModified key - ifModifiedKey, - // Response headers + var // Cross-domain detection vars + parts, + // Loop variable + i, + // URL without anti-cache param + cacheURL, + // Response headers as string responseHeadersString, - responseHeaders, - // transport - transport, // timeout handle timeoutTimer, - // Cross-domain detection vars - parts, + // To know if global events are to be dispatched fireGlobals, - // Loop variable - i, + + transport, + // Response headers + responseHeaders, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, - // Context for global events - // It's the callbackContext if one was provided in the options - // and if it's a DOM node or a jQuery collection - globalEventContext = callbackContext !== s && - ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? - jQuery( callbackContext ) : jQuery.event, + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, // Deferreds deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), + completeDeferred = jQuery.Callbacks("once memory"), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) @@ -7649,203 +8996,99 @@ jQuery.extend({ strAbort = "canceled", // Fake xhr jqXHR = { - readyState: 0, - // Caches the header - setRequestHeader: function( name, value ) { - if ( !state ) { - var lname = name.toLowerCase(); - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; - while( ( match = rheaders.exec( responseHeadersString ) ) ) { + while ( (match = rheaders.exec( responseHeadersString )) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } - return match === undefined ? null : match; + return match == null ? null : match; }, - // Overrides response content-type header - overrideMimeType: function( type ) { + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + var lname = name.toLowerCase(); if ( !state ) { - s.mimeType = type; + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; } return this; }, - // Cancel the request - abort: function( statusText ) { - statusText = statusText || strAbort; - if ( transport ) { - transport.abort( statusText ); + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; } - done( 0, statusText ); return this; - } - }; - - // Callback for when everything is done - // It is defined here because jslint complains if it is declared - // at the end of the function (which would be more logical and readable) - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ ifModifiedKey ] = modified; - } - modified = jqXHR.getResponseHeader("Etag"); - if ( modified ) { - jQuery.etag[ ifModifiedKey ] = modified; - } - } - - // If not modified - if ( status === 304 ) { - - statusText = "notmodified"; - isSuccess = true; - - // If we have data - } else { - - isSuccess = ajaxConvert( s, response ); - statusText = isSuccess.state; - success = isSuccess.data; - error = isSuccess.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( !statusText || status ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + }, - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( state < 2 ) { + for ( code in map ) { + // Lazy-add the new callback in a way that preserves old ones + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } else { + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; } - } - } + }; // Attach deferreds - deferred.promise( jqXHR ); + deferred.promise( jqXHR ).complete = completeDeferred.add; jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.add; - - // Status-dependent callbacks - jqXHR.statusCode = function( map ) { - if ( map ) { - var tmp; - if ( state < 2 ) { - for ( tmp in map ) { - statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; - } - } else { - tmp = map[ jqXHR.status ]; - jqXHR.always( tmp ); - } - } - return this; - }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // Handle falsy url in the settings object (#10093: consistency with old signature) // We also use the url parameter if available - s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ) || false; - s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== - ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ); + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) + ); } // Convert data if not already a string @@ -7864,58 +9107,58 @@ jQuery.extend({ // We can fire global events as of now if asked to fireGlobals = s.global; + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger("ajaxStart"); + } + // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + cacheURL = s.url; // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { - s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; + cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); // #9682: remove data so that it's not used in an eventual retry delete s.data; } - // Get ifModifiedKey before adding the anti-cache parameter - ifModifiedKey = s.url; - // Add anti-cache in url if needed if ( s.cache === false ) { + s.url = rts.test( cacheURL ) ? - var ts = jQuery.now(), - // try replacing _= if it is there - ret = s.url.replace( rts, "$1_=" + ts ); + // If there is already a '_' parameter, set its value + cacheURL.replace( rts, "$1_=" + nonce++ ) : - // if nothing was replaced, add timestamp to the end - s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); + // Otherwise add one to the end + cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; } } - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { - ifModifiedKey = ifModifiedKey || s.url; - if ( jQuery.lastModified[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); } - if ( jQuery.etag[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); } } + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", @@ -7931,9 +9174,8 @@ jQuery.extend({ // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - + // Abort if not done already and return + return jqXHR.abort(); } // aborting is no longer a cancellation @@ -7952,21 +9194,22 @@ jQuery.extend({ done( -1, "No Transport" ); } else { jqXHR.readyState = 1; + // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout( function(){ - jqXHR.abort( "timeout" ); + timeoutTimer = setTimeout(function() { + jqXHR.abort("timeout"); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); - } catch (e) { + } catch ( e ) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); @@ -7977,421 +9220,422 @@ jQuery.extend({ } } - return jqXHR; - }, - - // Counter for holding the number of active queries - active: 0, + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; - // Last-Modified header cache for next request - lastModified: {}, - etag: {} + // Called once + if ( state === 2 ) { + return; + } -}); + // State is "done" now + state = 2; -/* Handles responses to an ajax request: - * - sets all responseXXX fields accordingly - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields; + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } + // Cache response headers + responseHeadersString = headers || ""; - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); - } - } + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} -// Chain conversions given the request and the original response -function ajaxConvert( s, response ) { - - var conv, conv2, current, tmp, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(), - prev = dataTypes[ 0 ], - converters = {}, - i = 0; + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } + // If successful, handle type chaining + if ( isSuccess ) { - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader("etag"); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } - // Convert to each sequential dataType, tolerating list modification - for ( ; (current = dataTypes[++i]); ) { + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; - // There's only work to do if current dataType is non-auto - if ( current !== "*" ) { + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; - // Convert response if prev dataType is non-auto and differs from current - if ( prev !== "*" && prev !== current ) { + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } - // If conv2 outputs current - tmp = conv2.split(" "); - if ( tmp[ 1 ] === current ) { + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.splice( i--, 0, current ); - } + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - break; - } - } - } + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger("ajaxStop"); } + } + } - // Apply converter (if not an equivalence) - if ( conv !== true ) { + return jqXHR; + }, - // Unless errors are allowed to bubble, catch and return them - if ( conv && s["throws"] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, - // Update prev for next iteration - prev = current; - } + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); } +}); - return { state: "success", data: response }; -} -var oldCallbacks = [], - rquestion = /\?/, - rjsonp = /(=)\?(?=&|$)|\?\?/, - nonce = jQuery.now(); +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); - this[ callback ] = true; - return callback; - } + return jQuery.ajax({ + url: url, + type: method, + dataType: type, + data: data, + success: callback + }); + }; }); -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { + jQuery.fn[ type ] = function( fn ) { + return this.on( type, fn ); + }; +}); - var callbackName, overwritten, responseContainer, - data = s.data, - url = s.url, - hasCallback = s.jsonp !== false, - replaceInUrl = hasCallback && rjsonp.test( url ), - replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && - !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && - rjsonp.test( data ); - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { +jQuery._evalUrl = function( url ) { + return jQuery.ajax({ + url: url, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); +}; - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - overwritten = window[ callbackName ]; - // Insert callback into url or form data - if ( replaceInUrl ) { - s.url = url.replace( rjsonp, "$1" + callbackName ); - } else if ( replaceInData ) { - s.data = data.replace( rjsonp, "$1" + callbackName ); - } else if ( hasCallback ) { - s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; +jQuery.fn.extend({ + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); } - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); } - return responseContainer[ 0 ]; - }; - // force json dataType - s.dataTypes[ 0 ] = "json"; + wrap.map(function() { + var elem = this; - // Install callback - window[ callbackName ] = function() { - responseContainer = arguments; - }; + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; + return elem; + }).append( this ); + } - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; + return this; + }, - // save the callback name for future use - oldCallbacks.push( callbackName ); - } + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); - responseContainer = overwritten = undefined; - }); + if ( contents.length ) { + contents.wrapAll( html ); - // Delegate to script - return "script"; - } -}); -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + } else { + self.append( html ); + } + }); }, - contents: { - script: /javascript|ecmascript/ + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); } }); -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - // This transport only deals with cross domain requests - if ( s.crossDomain ) { +jQuery.expr.filters.hidden = function( elem ) { + // Support: Opera <= 12.12 + // Opera reports offsetWidths and offsetHeights less than zero on some elements + return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || + (!support.reliableHiddenOffsets() && + ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); +}; - var script, - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; +jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); +}; - return { - send: function( _, callback ) { - script = document.createElement( "script" ); - script.async = "async"; +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } +function buildParams( prefix, obj, traditional, add ) { + var name; - script.src = s.url; + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { + } else { + // Item is non-scalar (array or object), encode its numeric index. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} - // Remove the script - if ( head && script.parentNode ) { - head.removeChild( script ); - } +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; - // Dereference the script - script = undefined; + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - }, + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); - abort: function() { - if ( script ) { - script.onload( 0, 1 ); - } - } - }; - } -}); -var xhrCallbacks, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject ? function() { - // Abort all pending requests - for ( var key in xhrCallbacks ) { - xhrCallbacks[ key ]( 0, 1 ); + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); } - } : false, - xhrId = 0; + } -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function() { + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + }) + .filter(function() { + var type = this.type; + // Use .is(":disabled") so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + }) + .map(function( i, elem ) { + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); -function createActiveXHR() { - try { - return new window.ActiveXObject( "Microsoft.XMLHTTP" ); - } catch( e ) {} -} // Create the request object // (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ +jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? + // Support: IE6+ function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); + + // XHR cannot access local files, always use ActiveX for that case + return !this.isLocal && + + // Support: IE7-8 + // oldIE XHR does not support non-RFC2616 methods (#13240) + // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx + // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 + // Although this check for six methods instead of eight + // since IE also does not support "trace" and "connect" + /^(get|post|head|put|delete|options)$/i.test( this.type ) && + + createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; -// Determine support properties -(function( xhr ) { - jQuery.extend( jQuery.support, { - ajax: !!xhr, - cors: !!xhr && ( "withCredentials" in xhr ) +var xhrId = 0, + xhrCallbacks = {}, + xhrSupported = jQuery.ajaxSettings.xhr(); + +// Support: IE<10 +// Open requests must be manually aborted on unload (#5280) +if ( window.ActiveXObject ) { + jQuery( window ).on( "unload", function() { + for ( var key in xhrCallbacks ) { + xhrCallbacks[ key ]( undefined, true ); + } }); -})( jQuery.ajaxSettings.xhr() ); +} + +// Determine support properties +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +xhrSupported = support.ajax = !!xhrSupported; // Create transport if the browser can provide an xhr -if ( jQuery.support.ajax ) { +if ( xhrSupported ) { - jQuery.ajaxTransport(function( s ) { + jQuery.ajaxTransport(function( options ) { // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { + if ( !options.crossDomain || support.cors ) { var callback; return { send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); + var i, + xhr = options.xhr(), + id = ++xhrId; // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } + xhr.open( options.type, options.url, options.async, options.username, options.password ); // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; } } // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); } // X-Requested-With header @@ -8399,874 +9643,434 @@ if ( jQuery.support.ajax ) { // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; + if ( !options.crossDomain && !headers["X-Requested-With"] ) { + headers["X-Requested-With"] = "XMLHttpRequest"; } - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); + // Set headers + for ( i in headers ) { + // Support: IE<9 + // IE's ActiveXObject throws a 'Type Mismatch' exception when setting + // request header to a null-value. + // + // To keep consistent with other XHR implementations, cast the value + // to string and ignore `undefined`. + if ( headers[ i ] !== undefined ) { + xhr.setRequestHeader( i, headers[ i ] + "" ); } - } catch( _ ) {} + } // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); + xhr.send( ( options.hasContent && options.data ) || null ); // Listener callback = function( _, isAbort ) { - - var status, - statusText, - responseHeaders, - responses, - xml; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } + var status, statusText, responses; + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + // Clean up + delete xhrCallbacks[ id ]; + callback = undefined; + xhr.onreadystatechange = jQuery.noop; + + // Abort manually if needed + if ( isAbort ) { + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + responses = {}; + status = xhr.status; + + // Support: IE<10 + // Accessing binary-data responseText throws an exception + // (#11426) + if ( typeof xhr.responseText === "string" ) { + responses.text = xhr.responseText; } - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - responses = {}; - xml = xhr.responseXML; - - // Construct response list - if ( xml && xml.documentElement /* #4958 */ ) { - responses.xml = xml; - } - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - try { - responses.text = xhr.responseText; - } catch( _ ) { - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } - // Filter status for non standard behaviors + // Filter status for non standard behaviors - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && options.isLocal && !options.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; } } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } } // Call complete if needed if ( responses ) { - complete( status, statusText, responses, responseHeaders ); + complete( status, statusText, responses, xhr.getAllResponseHeaders() ); } }; - if ( !s.async ) { + if ( !options.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback - setTimeout( callback, 0 ); + setTimeout( callback ); } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; + // Add to the list of active xhr callbacks + xhr.onreadystatechange = xhrCallbacks[ id ] = callback; } }, abort: function() { if ( callback ) { - callback(0,1); + callback( undefined, true ); } } }; } }); } -var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), - target = tween.cur(), - start = +target || 0, - scale = 1, - maxIterations = 20; - - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; - - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } - - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; - } - return tween; - }] - }; - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }, 0 ); - return ( fxNow = jQuery.now() ); -} - -function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { - - // we're done with this property - return; - } - } - }); -} - -function Animation( elem, properties, options ) { - var result, - index = 0, - tweenerIndex = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - percent = 1 - ( remaining / animation.duration || 0 ), - index = 0, - length = animation.tweens.length; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ]); - - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end, easing ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } - - createTweens( animation, props ); - - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - jQuery.fx.timer( - jQuery.extend( tick, { - anim: animation, - queue: animation.opts.queue, - elem: elem - }) - ); - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} } -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } +function createActiveXHR() { + try { + return new window.ActiveXObject( "Microsoft.XMLHTTP" ); + } catch( e ) {} } -jQuery.Animation = jQuery.extend( Animation, { - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } - var prop, - index = 0, - length = props.length; - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, - - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); + contents: { + script: /(?:java|ecma)script/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; } } }); -function defaultPrefilter( elem, props, opts ) { - var index, prop, value, length, dataShow, tween, hooks, oldfire, - anim = this, - style = elem.style, - orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); - - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; } +}); - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; + // This transport only deals with cross domain requests + if ( s.crossDomain ) { - } else { - style.zoom = 1; - } - } - } + var script, + head = document.head || jQuery("head")[0] || document.documentElement; - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.done(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } + return { + send: function( _, callback ) { - // show/hide pass - for ( index in props ) { - value = props[ index ]; - if ( rfxtypes.exec( value ) ) { - delete props[ index ]; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - handled.push( index ); - } - } + script = document.createElement("script"); - length = handled.length; - if ( length ) { - dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery.removeData( elem, "fxshow", true ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + script.async = true; - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; } - } - } - } -} - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; + script.src = s.url; - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; + // Remove the script + if ( script.parentNode ) { + script.parentNode.removeChild( script ); + } -Tween.prototype.init.prototype = Tween.prototype; + // Dereference the script + script = null; -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } + // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending + // Use native DOM manipulation to avoid our domManip AJAX trickery + head.insertBefore( script, head.firstChild ); + }, - // passing any value as a 4th parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, false, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; + abort: function() { + if ( script ) { + script.onload( undefined, true ); + } } - } + }; } -}; +}); -// Remove in 2.0 - this supports IE8's panic based approach -// to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; -jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" || - // special check for .toggle( handler, handler, ... ) - ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; + +var oldCallbacks = [], + rjsonp = /(=)\?(?=&|$)|\?\?/; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); + this[ callback ] = true; + return callback; + } }); -jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() + var callbackName, overwritten, responseContainer, + jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? + "url" : + typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" + ); - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { - // Empty animations resolve immediately - if ( empty ) { - anim.stop( true ); - } - }; + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); + // Insert callback into url or form data + if ( jsonProp ) { + s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); + } else if ( s.jsonp !== false ) { + s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; }; - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } + // force json dataType + s.dataTypes[ 0 ] = "json"; - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); + // Install callback + overwritten = window[ callbackName ]; + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } + // save the callback name for future use + oldCallbacks.push( callbackName ); } - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); } + + responseContainer = overwritten = undefined; }); + + // Delegate to script + return "script"; } }); -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - return attrs; -} +// data: string of html +// context (optional): If specified, the fragment will be created in this context, defaults to document +// keepScripts (optional): If true, will include scripts passed in the html string +jQuery.parseHTML = function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + parsed = jQuery.buildFragment( [ data ], context, scripts ); - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; + if ( scripts && scripts.length ) { + jQuery( scripts ).remove(); } - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } + return jQuery.merge( [], parsed.childNodes ); +}; - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - return opt; -}; +// Keep a copy of the old load method +var _load = jQuery.fn.load; -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; +/** + * Load a url into a page + */ +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); } -}; -jQuery.timers = []; -jQuery.fx = Tween.prototype.init; -jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; + var selector, response, type, + self = this, + off = url.indexOf(" "); - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); } - if ( !timers.length ) { - jQuery.fx.stop(); - } -}; + // If it's a function + if ( jQuery.isFunction( params ) ) { -jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) && !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } -}; + // We assume that it's the callback + callback = params; + params = undefined; -jQuery.fx.interval = 13; + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } -jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; -}; + // If we have elements to modify, make the request + if ( self.length > 0 ) { + jQuery.ajax({ + url: url, -jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 -}; + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params + }).done(function( responseText ) { -// Back Compat <1.8 extension point -jQuery.fx.step = {}; + // Save response for use in complete callback + response = arguments; -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} -var rroot = /^(?:body|html)$/i; + self.html( selector ? -jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } + // If a selector was specified, locate the right elements in a dummy div + // Exclude scripts to avoid IE 'Permission Denied' errors + jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : - var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; + // Otherwise use the full result + responseText ); - if ( !doc ) { - return; + }).complete( callback && function( jqXHR, status ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + }); } - if ( (body = doc.body) === elem ) { - return jQuery.offset.bodyOffset( elem ); - } + return this; +}; - docElem = doc.documentElement; - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== "undefined" ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - clientTop = docElem.clientTop || body.clientTop || 0; - clientLeft = docElem.clientLeft || body.clientLeft || 0; - scrollTop = win.pageYOffset || docElem.scrollTop; - scrollLeft = win.pageXOffset || docElem.scrollLeft; - return { - top: box.top + scrollTop - clientTop, - left: box.left + scrollLeft - clientLeft - }; + +jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; }; -jQuery.offset = { - bodyOffset: function( body ) { - var top = body.offsetTop, - left = body.offsetLeft; - if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.css(body, "marginTop") ) || 0; - left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; - } - return { top: top, left: left }; - }, +var docElem = window.document.documentElement; + +/** + * Gets a window from an element + */ +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} + +jQuery.offset = { setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); + var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, + position = jQuery.css( elem, "position" ), + curElem = jQuery( elem ), + props = {}; // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; + curOffset = curElem.offset(); + curCSSTop = jQuery.css( elem, "top" ); + curCSSLeft = jQuery.css( elem, "left" ); + calculatePosition = ( position === "absolute" || position === "fixed" ) && + jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { @@ -9297,58 +10101,99 @@ jQuery.offset = { } }; - jQuery.fn.extend({ + offset: function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, win, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== strundefined ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + return { + top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), + left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) + }; + }, position: function() { - if ( !this[0] ) { + if ( !this[ 0 ] ) { return; } - var elem = this[0], + var offsetParent, offset, + parentOffset = { top: 0, left: 0 }, + elem = this[ 0 ]; + + // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent + if ( jQuery.css( elem, "position" ) === "fixed" ) { + // we assume that getBoundingClientRect is available when computed position is fixed + offset = elem.getBoundingClientRect(); + } else { + // Get *real* offsetParent + offsetParent = this.offsetParent(); - // Get *real* offsetParent - offsetParent = this.offsetParent(), + // Get correct offsets + offset = this.offset(); + if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { + parentOffset = offsetParent.offset(); + } - // Get correct offsets - offset = this.offset(), - parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); + // Add offsetParent borders + parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); + parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); + } - // Subtract element margins + // Subtract parent offsets and element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; - offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; - - // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; - parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; - - // Subtract the two offsets return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left + top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), + left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) }; }, offsetParent: function() { return this.map(function() { - var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { + var offsetParent = this.offsetParent || docElem; + + while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { offsetParent = offsetParent.offsetParent; } - return offsetParent || document.body; + return offsetParent || docElem; }); } }); - // Create scrollLeft and scrollTop methods -jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { +jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { + return access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { @@ -9360,7 +10205,7 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() + top ? val : jQuery( win ).scrollTop() ); } else { @@ -9370,13 +10215,25 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me }; }); -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} +// Add the top/left cssHooks using jQuery.fn.position +// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 +// getComputedStyle returns percent when specified for top/left/bottom/right +// rather than make the css module depend on the offset module, we just check for it here +jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, + function( elem, computed ) { + if ( computed ) { + computed = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( computed ) ? + jQuery( elem ).position()[ prop ] + "px" : + computed; + } + } + ); +}); + + // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { @@ -9385,7 +10242,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - return jQuery.access( this, function( elem, type, value ) { + return access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { @@ -9410,7 +10267,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, value, extra ) : + jQuery.css( elem, type, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); @@ -9418,23 +10275,63 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { }; }); }); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -// Expose jQuery as an AMD module, but only for AMD loaders that -// understand the issues with loading multiple versions of jQuery -// in a page that all might call define(). The loader will indicate -// they have special allowances for multiple jQuery versions by -// specifying define.amd.jQuery = true. Register as a named module, -// since jQuery can be concatenated with other files that may use define, -// but not use a proper concatenation script that understands anonymous -// AMD modules. A named AMD is safest and most robust way to register. -// Lowercase jquery is used because AMD module names are derived from -// file names, and jQuery is normally delivered in a lowercase file name. -// Do this after creating the global so that if an AMD module wants to call -// noConflict to hide this version of jQuery, it will work. -if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); + + +// The number of elements contained in the matched element set +jQuery.fn.size = function() { + return this.length; +}; + +jQuery.fn.andSelf = jQuery.fn.addBack; + + + + +// Register as a named AMD module, since jQuery can be concatenated with other +// files that may use define, but not via a proper concatenation script that +// understands anonymous AMD modules. A named AMD is safest and most robust +// way to register. Lowercase jquery is used because AMD module names are +// derived from file names, and jQuery is normally delivered in a lowercase +// file name. Do this after creating the global so that if an AMD module wants +// to call noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd ) { + define( "jquery", [], function() { + return jQuery; + }); } -})( window ); + + + +var + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$; + +jQuery.noConflict = function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; +}; + +// Expose jQuery and $ identifiers, even in +// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) +// and CommonJS for browser emulators (#13566) +if ( typeof noGlobal === strundefined ) { + window.jQuery = window.$ = jQuery; +} + + + + +return jQuery; + +})); diff --git a/pub/lib/jquery/jquery.min.js b/pub/lib/jquery/jquery.min.js new file mode 100644 index 0000000000000000000000000000000000000000..73f33fb3aa529308d1f3f2f4fc253c4abed95374 --- /dev/null +++ b/pub/lib/jquery/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="<select t=''><option selected=''></option></select>",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=jb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=kb(b);function nb(){}nb.prototype=d.filters=d.pseudos,d.setFilters=new nb;function ob(a,b){var c,e,f,g,h,i,j,k=x[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=Q.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?db.error(a):x(a,i).slice(0)}function pb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++)if(n.contains(d[b],this))return!0}));for(b=0;e>b;b++)n.find(a,d[b],c);return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=a.document,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,B=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:A.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:z,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=z.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return y.find(a);this.length=1,this[0]=d}return this.context=z,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};B.prototype=n.fn,y=n(z);var C=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!n(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(n.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function E(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return E(a,"nextSibling")},prev:function(a){return E(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(D[a]||(e=n.unique(e)),C.test(a)&&(e=e.reverse())),this.pushStack(e)}});var F=/\S+/g,G={};function H(a){var b=G[a]={};return n.each(a.match(F)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?G[a]||H(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&n.each(arguments,function(a,c){var d;while((d=n.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){if(a===!0?!--n.readyWait:!n.isReady){if(!z.body)return setTimeout(n.ready);n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(z,[n]),n.fn.trigger&&n(z).trigger("ready").off("ready"))}}});function J(){z.addEventListener?(z.removeEventListener("DOMContentLoaded",K,!1),a.removeEventListener("load",K,!1)):(z.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(z.addEventListener||"load"===event.type||"complete"===z.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I)if(I=n.Deferred(),"complete"===z.readyState)setTimeout(n.ready);else if(z.addEventListener)z.addEventListener("DOMContentLoaded",K,!1),a.addEventListener("load",K,!1);else{z.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&z.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!n.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}J(),n.ready()}}()}return I.promise(b)};var L="undefined",M;for(M in n(l))break;l.ownLast="0"!==M,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c=z.getElementsByTagName("body")[0];c&&(a=z.createElement("div"),a.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",b=z.createElement("div"),c.appendChild(a).appendChild(b),typeof b.style.zoom!==L&&(b.style.cssText="border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",(l.inlineBlockNeedsLayout=3===b.offsetWidth)&&(c.style.zoom=1)),c.removeChild(a),a=b=null)}),function(){var a=z.createElement("div");if(null==l.deleteExpando){l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}}a=null}(),n.acceptData=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else c=void 0}return c}function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function R(a,b,d,e){if(n.acceptData(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f +}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(F)||[""],j=b.length;while(j--)if(h=ab.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,m,o=[d||z],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||z,3!==d.nodeType&&8!==d.nodeType&&!_.test(p+n.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[n.expando]?b:new n.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),k=n.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!n.isWindow(d)){for(i=k.delegateType||p,_.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||z)&&o.push(l.defaultView||l.parentWindow||a)}m=0;while((h=o[m++])&&!b.isPropagationStopped())b.type=m>1?i:k.bindType||p,f=(n._data(h,"events")||{})[b.type]&&n._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&n.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&n.acceptData(d)&&g&&d[p]&&!n.isWindow(d)){l=d[g],l&&(d[g]=null),n.event.triggered=p;try{d[p]()}catch(r){}n.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((n.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?n(c,this).index(i)>=0:n.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=$.test(e)?this.mouseHooks:Z.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||z),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||z,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==db()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===db()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=z.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===L&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault())?bb:cb):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:cb,isPropagationStopped:cb,isImmediatePropagationStopped:cb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=bb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=bb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submitBubbles||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?b.form:void 0;c&&!n._data(c,"submitBubbles")&&(n.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),n._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.changeBubbles||(n.event.special.change={setup:function(){return Y.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),n.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),n.event.simulate("change",this,a,!0)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;Y.test(b.nodeName)&&!n._data(b,"changeBubbles")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a,!0)}),n._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!Y.test(this.nodeName)}}),l.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=cb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return n().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=cb),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});function eb(a){var b=fb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var fb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gb=/ jQuery\d+="(?:null|\d+)"/g,hb=new RegExp("<(?:"+fb+")[\\s/>]","i"),ib=/^\s+/,jb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,kb=/<([\w:]+)/,lb=/<tbody/i,mb=/<|&#?\w+;/,nb=/<(?:script|style|link)/i,ob=/checked\s*(?:[^=]|=\s*.checked.)/i,pb=/^$|\/(?:java|ecma)script/i,qb=/^true\/(.*)/,rb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,sb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},tb=eb(z),ub=tb.appendChild(z.createElement("div"));sb.optgroup=sb.option,sb.tbody=sb.tfoot=sb.colgroup=sb.caption=sb.thead,sb.th=sb.td;function vb(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==L?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==L?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||n.nodeName(d,b)?f.push(d):n.merge(f,vb(d,b));return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function wb(a){X.test(a.type)&&(a.defaultChecked=a.checked)}function xb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function yb(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function zb(a){var b=qb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ab(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}function Bb(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)n.event.add(b,c,h[c][d])}g.data&&(g.data=n.extend({},g.data))}}function Cb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events)n.removeEvent(b,d,e.handle);b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(yb(b).text=a.text,zb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&X.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}n.extend({clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!hb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ub.innerHTML=a.outerHTML,ub.removeChild(f=ub.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(d=vb(f),h=vb(a),g=0;null!=(e=h[g]);++g)d[g]&&Cb(e,d[g]);if(b)if(c)for(h=h||vb(a),d=d||vb(f),g=0;null!=(e=h[g]);g++)Bb(e,d[g]);else Bb(a,f);return d=vb(f,"script"),d.length>0&&Ab(d,!i&&vb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k,m=a.length,o=eb(b),p=[],q=0;m>q;q++)if(f=a[q],f||0===f)if("object"===n.type(f))n.merge(p,f.nodeType?[f]:f);else if(mb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(kb.exec(f)||["",""])[1].toLowerCase(),k=sb[i]||sb._default,h.innerHTML=k[1]+f.replace(jb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!l.leadingWhitespace&&ib.test(f)&&p.push(b.createTextNode(ib.exec(f)[0])),!l.tbody){f="table"!==i||lb.test(f)?"<table>"!==k[1]||lb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)n.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}n.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),l.appendChecked||n.grep(vb(p,"input"),wb),q=0;while(f=p[q++])if((!d||-1===n.inArray(f,d))&&(g=n.contains(f.ownerDocument,f),h=vb(o.appendChild(f),"script"),g&&Ab(h),c)){e=0;while(f=h[e++])pb.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.deleteExpando,m=n.event.special;null!=(d=a[h]);h++)if((b||n.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle);j[f]&&(delete j[f],k?delete d[i]:typeof d.removeAttribute!==L?d.removeAttribute(i):d[i]=null,c.push(f))}}}),n.fn.extend({text:function(a){return W(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||z).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=xb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(vb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&Ab(vb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(vb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return W(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(gb,""):void 0;if(!("string"!=typeof a||nb.test(a)||!l.htmlSerialize&&hb.test(a)||!l.leadingWhitespace&&ib.test(a)||sb[(kb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(jb,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(vb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(vb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&ob.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(i=n.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=n.map(vb(i,"script"),yb),f=g.length;k>j;j++)d=i,j!==o&&(d=n.clone(d,!0,!0),f&&n.merge(g,vb(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,n.map(g,zb),j=0;f>j;j++)d=g[j],pb.test(d.type||"")&&!n._data(d,"globalEval")&&n.contains(h,d)&&(d.src?n._evalUrl&&n._evalUrl(d.src):n.globalEval((d.text||d.textContent||d.innerHTML||"").replace(rb,"")));i=c=null}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],g=n(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),n(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Db,Eb={};function Fb(b,c){var d=n(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:n.css(d[0],"display");return d.detach(),e}function Gb(a){var b=z,c=Eb[a];return c||(c=Fb(a,b),"none"!==c&&c||(Db=(Db||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Db[0].contentWindow||Db[0].contentDocument).document,b.write(),b.close(),c=Fb(a,b),Db.detach()),Eb[a]=c),c}!function(){var a,b,c=z.createElement("div"),d="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],a.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(a.style.opacity),l.cssFloat=!!a.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===c.style.backgroundClip,a=c=null,l.shrinkWrapBlocks=function(){var a,c,e,f;if(null==b){if(a=z.getElementsByTagName("body")[0],!a)return;f="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",c=z.createElement("div"),e=z.createElement("div"),a.appendChild(c).appendChild(e),b=!1,typeof e.style.zoom!==L&&(e.style.cssText=d+";width:1px;padding:1px;zoom:1",e.innerHTML="<div></div>",e.firstChild.style.width="5px",b=3!==e.offsetWidth),a.removeChild(c),a=c=e=null}return b}}();var Hb=/^margin/,Ib=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Jb,Kb,Lb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Jb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),Ib.test(g)&&Hb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):z.documentElement.currentStyle&&(Jb=function(a){return a.currentStyle},Kb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Jb(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ib.test(g)&&!Lb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Mb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h=z.createElement("div"),i="border:0;width:0;height:0;position:absolute;top:0;left:-9999px",j="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",b=h.getElementsByTagName("a")[0],b.style.cssText="float:left;opacity:.5",l.opacity=/^0.5/.test(b.style.opacity),l.cssFloat=!!b.style.cssFloat,h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,b=h=null,n.extend(l,{reliableHiddenOffsets:function(){if(null!=c)return c;var a,b,d,e=z.createElement("div"),f=z.getElementsByTagName("body")[0];if(f)return e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=z.createElement("div"),a.style.cssText=i,f.appendChild(a).appendChild(e),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=e.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",d=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display="none",c=d&&0===b[0].offsetHeight,f.removeChild(a),e=f=null,c},boxSizing:function(){return null==d&&k(),d},boxSizingReliable:function(){return null==e&&k(),e},pixelPosition:function(){return null==f&&k(),f},reliableMarginRight:function(){var b,c,d,e;if(null==g&&a.getComputedStyle){if(b=z.getElementsByTagName("body")[0],!b)return;c=z.createElement("div"),d=z.createElement("div"),c.style.cssText=i,b.appendChild(c).appendChild(d),e=d.appendChild(z.createElement("div")),e.style.cssText=d.style.cssText=j,e.style.marginRight=e.style.width="0",d.style.width="1px",g=!parseFloat((a.getComputedStyle(e,null)||{}).marginRight),b.removeChild(c)}return g}});function k(){var b,c,h=z.getElementsByTagName("body")[0];h&&(b=z.createElement("div"),c=z.createElement("div"),b.style.cssText=i,h.appendChild(b).appendChild(c),c.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",n.swap(h,null!=h.style.zoom?{zoom:1}:{},function(){d=4===c.offsetWidth}),e=!0,f=!1,g=!0,a.getComputedStyle&&(f="1%"!==(a.getComputedStyle(c,null)||{}).top,e="4px"===(a.getComputedStyle(c,null)||{width:"4px"}).width),h.removeChild(b),c=h=null)}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Nb=/alpha\([^)]*\)/i,Ob=/opacity\s*=\s*([^)]*)/,Pb=/^(none|table(?!-c[ea]).+)/,Qb=new RegExp("^("+T+")(.*)$","i"),Rb=new RegExp("^([+-])=("+T+")","i"),Sb={position:"absolute",visibility:"hidden",display:"block"},Tb={letterSpacing:0,fontWeight:400},Ub=["Webkit","O","Moz","ms"];function Vb(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ub.length;while(e--)if(b=Ub[e]+c,b in a)return b;return d}function Wb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=n._data(d,"olddisplay",Gb(d.nodeName)))):f[g]||(e=V(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Xb(a,b,c){var d=Qb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Yb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Zb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Jb(a),g=l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Kb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ib.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Yb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Kb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=Vb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Rb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]="",i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Vb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Kb(a,b,d)),"normal"===f&&b in Tb&&(f=Tb[b]),""===c||c?(e=parseFloat(f),c===!0||n.isNumeric(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?0===a.offsetWidth&&Pb.test(n.css(a,"display"))?n.swap(a,Sb,function(){return Zb(a,b,d)}):Zb(a,b,d):void 0},set:function(a,c,d){var e=d&&Jb(a);return Xb(a,c,d?Yb(a,b,d,l.boxSizing()&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Ob.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Nb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Nb.test(f)?f.replace(Nb,e):f+" "+e)}}),n.cssHooks.marginRight=Mb(l.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},Kb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Hb.test(a)||(n.cssHooks[a+b].set=Xb)}),n.fn.extend({css:function(a,b){return W(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Jb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b) +},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(lc,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],fc[c]=fc[c]||[],fc[c].unshift(b)},prefilter:function(a,b){b?ec.unshift(a):ec.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=lc(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&dc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(hc(b,!0),a,d,e)}}),n.each({slideDown:hc("show"),slideUp:hc("hide"),slideToggle:hc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(_b=n.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||n.fx.stop(),_b=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ac||(ac=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(ac),ac=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e=z.createElement("div");e.setAttribute("className","t"),e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=e.getElementsByTagName("a")[0],c=z.createElement("select"),d=c.appendChild(z.createElement("option")),b=e.getElementsByTagName("input")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==e.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=d.selected,l.enctype=!!z.createElement("form").enctype,c.disabled=!0,l.optDisabled=!d.disabled,b=z.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value,a=b=c=d=e=null}();var mc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.text(a)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nc,oc,pc=n.expr.attrHandle,qc=/^(?:checked|selected)$/i,rc=l.getSetAttribute,sc=l.input;n.fn.extend({attr:function(a,b){return W(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===L?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?oc:nc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(F);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)?sc&&rc||!qc.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(rc?c:d)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),oc={set:function(a,b,c){return b===!1?n.removeAttr(a,c):sc&&rc||!qc.test(c)?a.setAttribute(!rc&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=pc[b]||n.find.attr;pc[b]=sc&&rc||!qc.test(b)?function(a,b,d){var e,f;return d||(f=pc[b],pc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,pc[b]=f),e}:function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),sc&&rc||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void(a.defaultValue=b):nc&&nc.set(a,b,c)}}),rc||(nc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},pc.id=pc.name=pc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:nc.set},n.attrHooks.contenteditable={set:function(a,b,c){nc.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var tc=/^(?:input|select|textarea|button|object)$/i,uc=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return W(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):tc.test(a.nodeName)||uc.test(a.nodeName)&&a.href?0:-1}}}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var vc=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(F)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(vc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(F)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===L||"boolean"===c)&&(this.className&&n._data(this,"__className__",this.className),this.className=this.className||a===!1?"":n._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(vc," ").indexOf(b)>=0)return!0;return!1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var wc=n.now(),xc=/\?/,yc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(yc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var zc,Ac,Bc=/#.*$/,Cc=/([?&])_=[^&]*/,Dc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ec=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fc=/^(?:GET|HEAD)$/,Gc=/^\/\//,Hc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ic={},Jc={},Kc="*/".concat("*");try{Ac=location.href}catch(Lc){Ac=z.createElement("a"),Ac.href="",Ac=Ac.href}zc=Hc.exec(Ac.toLowerCase())||[];function Mc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(F)||[];if(n.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nc(a,b,c,d){var e={},f=a===Jc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Oc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&n.extend(!0,a,c),a}function Pc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Qc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ac,type:"GET",isLocal:Ec.test(zc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Oc(Oc(a,n.ajaxSettings),b):Oc(n.ajaxSettings,a)},ajaxPrefilter:Mc(Ic),ajaxTransport:Mc(Jc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Dc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||Ac)+"").replace(Bc,"").replace(Gc,zc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(F)||[""],null==k.crossDomain&&(c=Hc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===zc[1]&&c[2]===zc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(zc[3]||("http:"===zc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),Nc(Ic,k,b,v),2===t)return v;h=k.global,h&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Fc.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(xc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Cc.test(e)?e.replace(Cc,"$1_="+wc++):e+(xc.test(e)?"&":"?")+"_="+wc++)),k.ifModified&&(n.lastModified[e]&&v.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&v.setRequestHeader("If-None-Match",n.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Kc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Nc(Jc,k,b,v)){v.readyState=1,h&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Pc(k,v,c)),u=Qc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(n.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a))return this.each(function(b){n(this).wrapAll(a.call(this,b))});if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!l.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||n.css(a,"display"))},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var Rc=/%20/g,Sc=/\[\]$/,Tc=/\r?\n/g,Uc=/^(?:submit|button|image|reset|file)$/i,Vc=/^(?:input|select|textarea|keygen)/i;function Wc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Sc.test(a)?d(a,e):Wc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Wc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Wc(c,a[c],b,e);return d.join("&").replace(Rc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Vc.test(this.nodeName)&&!Uc.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Tc,"\r\n")}}):{name:b.name,value:c.replace(Tc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&$c()||_c()}:$c;var Xc=0,Yc={},Zc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Yc)Yc[a](void 0,!0)}),l.cors=!!Zc&&"withCredentials"in Zc,Zc=l.ajax=!!Zc,Zc&&n.ajaxTransport(function(a){if(!a.crossDomain||l.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Xc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Yc[g],b=void 0,f.onreadystatechange=n.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Yc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function $c(){try{return new a.XMLHttpRequest}catch(b){}}function _c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=z.head||n("head")[0]||z.documentElement;return{send:function(d,e){b=z.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var ad=[],bd=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=ad.pop()||n.expando+"_"+wc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(bd.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&bd.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(bd,"$1"+e):b.jsonp!==!1&&(b.url+=(xc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,ad.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||z;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var cd=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&cd)return cd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=a.slice(h,a.length),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&n.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n}); diff --git a/pub/lib/mage/accordion.js b/pub/lib/mage/accordion.js index 4228f81e94b02e25985025769ff7aed544520af9..ced94b6cdc6bbf61e28c3af4dca517922cbcbd46 100644 --- a/pub/lib/mage/accordion.js +++ b/pub/lib/mage/accordion.js @@ -23,7 +23,7 @@ (function($) { - + 'use strict'; /** * Accordion Widget - this widget is a wrapper for the jQuery UI Accordion */ diff --git a/pub/lib/mage/adminhtml/varienLoader.js b/pub/lib/mage/adminhtml/varienLoader.js index 8a21787e3d7dc5919ab537480d890129f1e70882..2ca9f77a86fda18526fd06467960207b516d61d9 100644 --- a/pub/lib/mage/adminhtml/varienLoader.js +++ b/pub/lib/mage/adminhtml/varienLoader.js @@ -194,7 +194,7 @@ varienLoaderHandler.handler = { return; } - request.options.loaderArea = $$('#html-body .wrapper')[0]; // Blocks all page + request.options.loaderArea = $$('#html-body .page-wrapper')[0]; // Blocks all page if(request && request.options.loaderArea){ //Element.clonePosition($('loading-mask'), $(request.options.loaderArea), {offsetLeft:-2}); diff --git a/pub/lib/mage/backend/floating-header.js b/pub/lib/mage/backend/floating-header.js index 114f67d136d9eebb5e019ce4891b516dad8000bd..b81f75ca07b9401011bff6b0b88edb9e9f7918a3 100644 --- a/pub/lib/mage/backend/floating-header.js +++ b/pub/lib/mage/backend/floating-header.js @@ -43,7 +43,9 @@ this._setVars(); this._bind(); this.element.find('script').remove(); + this.element.wrapInner($('<div/>', {'class': 'page-actions-buttons'})); this.element.wrapInner($('<div/>', {'class': 'page-actions-inner', 'data-title': title})); + }, /** diff --git a/pub/lib/mage/dropdown.js b/pub/lib/mage/dropdown.js index 580e3a801793d8f1c635a65ce7fdb709ec4fdaaf..ff1c25f60f0d9fbf170be50a8f49678de83b3e96 100644 --- a/pub/lib/mage/dropdown.js +++ b/pub/lib/mage/dropdown.js @@ -53,9 +53,13 @@ }, options); return this.each(function() { - var elem = $(this); + var elem = $(this), + elemParent = elem.parent(), + itemsClosable = elemParent.find("li:not(.disabled)"); elem.off('open.dropdown, close.dropdown, click.dropdown'); + itemsClosable.off('click.dropdownItemsClosable'); + elem.on('open.dropdown', function() { elem .addClass(options.activeClass) @@ -78,6 +82,16 @@ elem.trigger(isActive ? 'close.dropdown' : 'open.dropdown'); return false; }); + + if (elemParent.hasClass("closable")) { + itemsClosable.on('click.dropdownItemsClosable', function(event) { + $(this) + .parent("ul") + .siblings("[data-toggle=dropdown]") + .first() + .trigger('close.dropdown'); + }); + } }); }; diff --git a/pub/lib/mage/loader.js b/pub/lib/mage/loader.js index a704b11b98dd0b5ef8f887c08635c1a99c826a42..02c2122277c3aceafdc99b673753430947c83eeb 100644 --- a/pub/lib/mage/loader.js +++ b/pub/lib/mage/loader.js @@ -27,17 +27,12 @@ loaderStarted: 0, spinner: $(undefined), options: { - icon: '', + icon: 'icon.gif', texts: { loaderText: $.mage.__('Please wait...'), imgAlt: $.mage.__('Loading...') }, - template: '<div class="loading-mask" data-role="loader" {{if texts.loaderText}}data-text="${texts.loaderText}"{{/if}}>' + - '<div class="loader">' + - '{{if icon}}<img {{if texts.imgAlt}}alt="${texts.imgAlt}"{{/if}} src="${icon}">{{/if}}' + - '{{if texts.loaderText}}<p>${texts.loaderText}</p>{{/if}}' + - '</div>' + - '</div>' + template: null }, /** @@ -112,9 +107,18 @@ */ _render: function() { if (this.spinner.length === 0) { - this.spinner = $.tmpl(this.options.template, this.options)/*.css(this._getCssObj())*/; + this.spinner = $(this.options.template)/*.css(this._getCssObj())*/; } - this.element.prepend(this.spinner); + + var source = this.spinner.html(); + var template = Handlebars.compile(source); + var content = { + imgAlt: this.options.texts.imgAlt, + icon: this.options.icon, + loaderText: this.options.texts.loaderText + }; + var html = template(content); + this.element.prepend(html); }, /** diff --git a/pub/lib/mage/loader_old.js b/pub/lib/mage/loader_old.js new file mode 100644 index 0000000000000000000000000000000000000000..3bea4dea8a537586505a0820b1524f95aaaafee3 --- /dev/null +++ b/pub/lib/mage/loader_old.js @@ -0,0 +1,183 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-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. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +/*jshint browser:true jquery:true */ +/*global console:true*/ +(function($) { + $.widget("mage.loader", { + loaderStarted: 0, + spinner: $(undefined), + options: { + icon: '', + texts: { + loaderText: $.mage.__('Please wait...'), + imgAlt: $.mage.__('Loading...') + }, + template: '<div class="loading-mask" data-role="loader">' + + '<div class="loader">' + + '<img {{if texts.imgAlt}}alt="${texts.imgAlt}"{{/if}} src="${icon}">' + + '<p>{{if texts.loaderText}}${texts.loaderText}{{/if}}</p>' + + '</div>' + + '</div>' + }, + + /** + * Loader creation + * @protected + */ + _create: function() { + this._bind(); + }, + + /** + * Bind on ajax events + * @protected + */ + _bind: function() { + this._on({ + 'processStop': 'hide', + 'processStart': 'show', + 'show.loader': 'show', + 'hide.loader': 'hide', + 'contentUpdated.loader': '_contentUpdated' + }); + }, + + /** + * Verify loader present after content updated + * + * This will be cleaned up by the task MAGETWO-11070 + * + * @param event + * @private + */ + _contentUpdated: function(e) { + this.show(e); + }, + + /** + * Show loader + */ + show: function(e, ctx) { + this._render(); + this.loaderStarted++; + this.spinner.show(); + if (ctx) { + this.spinner + .css({width: ctx.outerWidth(), height: ctx.outerHeight(), position: 'absolute'}) + .position({ + my: 'top left', + at: 'top left', + of: ctx + }); + } + return false; + }, + + /** + * Hide loader + */ + hide: function() { + if (this.loaderStarted > 0) { + this.loaderStarted--; + if (this.loaderStarted === 0) { + this.spinner.hide(); + } + } + return false; + }, + + /** + * Render loader + * @protected + */ + _render: function() { + if (this.spinner.length === 0) { + this.spinner = $.tmpl(this.options.template, this.options)/*.css(this._getCssObj())*/; + } + this.element.prepend(this.spinner); + }, + + /** + * Destroy loader + */ + _destroy: function() { + this.spinner.remove(); + } + }); + + /** + * This widget takes care of registering the needed loader listeners on the body + */ + $.widget("mage.loaderAjax", { + options: { + defaultContainer: '[data-container=body]' + }, + _create: function() { + this._bind(); + // There should only be one instance of this widget, and it should be attached + // to the body only. Having it on the page twice will trigger multiple processStarts. + if (!this.element.is(this.options.defaultContainer) && $.mage.isDevMode(undefined)) { + console.warn("This widget is intended to be attached to the body, not below."); + } + }, + _bind: function() { + this._on(this.options.defaultContainer, { + 'ajaxSend': '_onAjaxSend', + 'ajaxComplete': '_onAjaxComplete' + }); + }, + _getJqueryObj: function(loaderContext) { + var ctx; + // Check to see if context is jQuery object or not. + if (loaderContext) { + if (loaderContext.jquery) { + ctx = loaderContext; + } else { + ctx = $(loaderContext); + } + } else { + ctx = $('[data-container="body"]'); + } + return ctx; + }, + _onAjaxSend: function(e, jqxhr, settings) { + if (settings && settings.showLoader) { + var ctx = this._getJqueryObj(settings.loaderContext); + ctx.trigger('processStart'); + + // Check to make sure the loader is there on the page if not report it on the console. + // NOTE that this check should be removed before going live. It is just an aid to help + // in finding the uses of the loader that maybe broken. + if (console && !ctx.parents('[data-role="loader"]').length) { + console.warn('Expected to start loader but did not find one in the dom'); + } + } + }, + _onAjaxComplete: function(e, jqxhr, settings) { + if (settings && settings.showLoader) { + this._getJqueryObj(settings.loaderContext).trigger('processStop'); + } + } + + }); +})(jQuery); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/some_config/di.xml b/pub/lib/mage/tabs.js similarity index 89% rename from dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/some_config/di.xml rename to pub/lib/mage/tabs.js index c7c5011ea975524750a9ad0d60a0aca0d3888f60..4e359a1246876d172843db5e860360ab43d05d58 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolver/_files/primary/app/etc/some_config/di.xml +++ b/pub/lib/mage/tabs.js @@ -1,5 +1,3 @@ -<?xml version="1.0"?> -<!-- /** * Magento * @@ -22,5 +20,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ---> -<config/> + +(function($) { + 'use strict'; + //Wrapper for widget + $.widget('mage.tabs', $.ui.tabs, { + }); +})(jQuery); \ No newline at end of file diff --git a/pub/opt/magento/var/resource_config.json b/pub/opt/magento/var/resource_config.json new file mode 100644 index 0000000000000000000000000000000000000000..21d66450ee6196e05f7a424d6801469c0225f89c --- /dev/null +++ b/pub/opt/magento/var/resource_config.json @@ -0,0 +1 @@ +{"media_directory":"\/opt\/magento\/pub\/media","allowed_resources":["css","css_secure","js","theme","favicon","wysiwyg","catalog","custom_options","email","captcha","dhl"],"update_time":"3600"} \ No newline at end of file