Skip to content

Commit 43ee714

Browse files
2 parents fe308d7 + c35b79d commit 43ee714

File tree

1,828 files changed

+46163
-34529
lines changed

Some content is hidden

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

1,828 files changed

+46163
-34529
lines changed

.php_cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
1515
->exclude('dev/tests/functional/vendor')
1616
->exclude('dev/tests/integration/tmp')
1717
->exclude('dev/tests/integration/var')
18-
->exclude('lib/internal/Apache')
1918
->exclude('lib/internal/CardinalCommerce')
2019
->exclude('lib/internal/Cm')
2120
->exclude('lib/internal/Credis')

app/code/Magento/AdminNotification/Block/System/Messages.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ public function getSystemMessageDialogJson()
121121
[
122122
'systemMessageDialog' => [
123123
'autoOpen' => false,
124-
'width' => 600,
125-
'ajaxUrl' => $this->_getMessagesUrl(),
124+
'width' => '75%',
125+
'modal' => true,
126+
'dialogClass' => 'ui-dialog-active ui-popup-message',
127+
'ajaxUrl' => $this->_getMessagesUrl()
126128
],
127129
]
128130
);

app/code/Magento/AdminNotification/Block/ToolbarEntry.php

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ class ToolbarEntry extends \Magento\Backend\Block\Template
1818
/**
1919
* Number of notifications showed on expandable window
2020
*/
21-
const NOTIFICATIONS_NUMBER = 4;
21+
const NOTIFICATIONS_NUMBER = 3;
22+
23+
/**
24+
* Number of notifications showed on icon
25+
*/
26+
const NOTIFICATIONS_COUNTER_MAX = 99;
27+
28+
/**
29+
* Length of notification description showed by default
30+
*/
31+
const NOTIFICATION_DESCRIPTION_LENGTH = 150;
2232

2333
/**
2434
* Collection of latest unread notifications
@@ -41,6 +51,26 @@ public function __construct(
4151
$this->_notificationList = $notificationList;
4252
}
4353

54+
/**
55+
* Retrieve notification description start length
56+
*
57+
* @return int
58+
*/
59+
public function getNotificationDescriptionLength()
60+
{
61+
return self::NOTIFICATION_DESCRIPTION_LENGTH;
62+
}
63+
64+
/**
65+
* Retrieve notification counter max value
66+
*
67+
* @return int
68+
*/
69+
public function getNotificationCounterMax()
70+
{
71+
return self::NOTIFICATIONS_COUNTER_MAX;
72+
}
73+
4474
/**
4575
* Retrieve number of unread notifications
4676
*

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,56 @@
88

99
class ListAction extends \Magento\Backend\App\AbstractAction
1010
{
11+
/**
12+
* @var \Magento\Framework\Json\Helper\Data
13+
*/
14+
protected $jsonHelper;
15+
16+
/**
17+
* @var \Magento\AdminNotification\Model\Resource\System\Message\Collection
18+
*/
19+
protected $messageCollection;
20+
21+
/**
22+
* Initialize ListAction
23+
*
24+
* @param \Magento\Backend\App\Action\Context $context
25+
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
26+
* @param \Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection
27+
*/
28+
public function __construct(
29+
\Magento\Backend\App\Action\Context $context,
30+
\Magento\Framework\Json\Helper\Data $jsonHelper,
31+
\Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection
32+
) {
33+
$this->jsonHelper = $jsonHelper;
34+
$this->messageCollection = $messageCollection;
35+
parent::__construct($context);
36+
}
37+
1138
/**
1239
* @return void
1340
*/
1441
public function execute()
1542
{
1643
$severity = $this->getRequest()->getParam('severity');
17-
$messageCollection = $this->_objectManager->get(
18-
'Magento\AdminNotification\Model\Resource\System\Message\Collection'
19-
);
2044
if ($severity) {
21-
$messageCollection->setSeverity($severity);
45+
$this->messageCollection->setSeverity($severity);
2246
}
2347
$result = [];
24-
foreach ($messageCollection->getItems() as $item) {
25-
$result[] = ['severity' => $item->getSeverity(), 'text' => $item->getText()];
48+
foreach ($this->messageCollection->getItems() as $item) {
49+
$result[] = [
50+
'severity' => $item->getSeverity(),
51+
'text' => $item->getText(),
52+
];
53+
}
54+
if (empty($result)) {
55+
$result[] = [
56+
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
57+
'text' => 'You have viewed and resolved all recent system notices. '
58+
. 'Please refresh the web page to clear the notice alert.',
59+
];
2660
}
27-
$this->getResponse()->representJson(
28-
$this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($result)
29-
);
61+
$this->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
3062
}
3163
}

app/code/Magento/AdminNotification/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd">
99
<default>
1010
<system>
1111
<adminnotification>

app/code/Magento/AdminNotification/etc/module.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
99
<module name="Magento_AdminNotification" setup_version="2.0.0">
1010
<sequence>
11-
<module name="Magento_Core"/>
1211
<module name="Magento_Store"/>
1312
</sequence>
1413
</module>

app/code/Magento/AdminNotification/view/adminhtml/layout/default.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@
66
*/
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
9-
<head>
10-
<css src="Magento_Theme::prototype/magento.css"/>
11-
</head>
129
<body>
1310
<referenceContainer name="notifications">
1411
<block class="Magento\AdminNotification\Block\System\Messages" name="system_messages" as="system_messages" before="-" template="Magento_AdminNotification::system/messages.phtml"/>
1512
<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"/>
1613
<block class="Magento\AdminNotification\Block\Window" name="notification_window" as="notification_window" acl="Magento_AdminNotification::show_toolbar" template="notification/window.phtml"/>
1714
</referenceContainer>
1815
<referenceContainer name="header">
19-
<block class="Magento\AdminNotification\Block\ToolbarEntry" before="user" template="toolbar_entry.phtml"/>
16+
<block class="Magento\AdminNotification\Block\ToolbarEntry" name="notification.messages" before="user" template="toolbar_entry.phtml"/>
2017
</referenceContainer>
2118
</body>
2219
</page>

app/code/Magento/AdminNotification/view/adminhtml/templates/notification/window.phtml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@
1212
* @see \Magento\AdminNotification\Block\Window
1313
*/
1414
?>
15-
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification">
15+
<div data-mage-init='{"modalPopup": {}}' class="fade critical-notification admin__scope">
1616
<div class="popup popup-<?php echo preg_replace('#[^a-z0-9]+#', '-', strtolower($block->getSeverityText())) ?>">
1717
<div class="popup-inner">
18-
<header class="popup-header">
19-
<h2 class="popup-title"><?php echo $block->getHeaderText(); ?></h2>
20-
</header>
18+
<div class="popup-header">
19+
<div class="popup-title"><?php echo $block->getHeaderText(); ?></div>
20+
</div>
2121
<div class="popup-content">
2222
<span><?php echo $block->getSeverityText();?></span>
23+
2324
<p class="message-text"><?php echo $block->getNoticeMessageText(); ?></p>
2425

2526
<a href="<?php echo $block->getNoticeMessageUrl(); ?>"><?php echo $block->getReadDetailsText(); ?></a>
2627
</div>
27-
<span class="close" data-dismiss="popup" title="<?php echo __('Close popup'); ?>"><?php echo __('Close'); ?></span>
28+
<span class="action close" data-dismiss="popup" title="<?php echo $block->escapeHtml(__('Close popup'));?>"><?php echo __('Close'); ?></span>
2829
</div>
2930
</div>
3031
</div>

app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages.phtml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,34 @@
1010
<?php /** @var $block \Magento\AdminNotification\Block\System\Messages */ ?>
1111

1212
<?php $lastCritical = $block->getLastCritical();?>
13-
<div id="system_messages" class="message-system<?php if ($lastCritical): ?> message-system-unread<?php endif; ?>">
13+
<div id="system_messages" class="message-system<?php if ($lastCritical): ?> message-system-unread<?php endif; ?> admin__scope">
1414
<div class="message-system-inner">
1515
<?php if ($lastCritical): ?>
1616
<ul class="message-system-list">
17-
<li class="error"><!-- warning -->
17+
<li class="message message-warning error">
1818
<?php echo $lastCritical->getText();?>
1919
</li>
2020
</ul>
2121
<?php endif; ?>
2222
<div class="message-system-short">
23-
System Messages:
23+
<span class="message-system-short-label">
24+
<?php echo __('System Messages:')?>
25+
</span>
26+
2427
<?php if ($block->getCriticalCount()): ?>
25-
<span class="error"><a href="#" title="<?php echo $block->escapeHtml(__('Critical System Messages'));?>"><?php echo $block->getCriticalCount();?></a></span>
28+
<div class="message message-warning error">
29+
<a class="message-link" href="#" title="<?php echo $block->escapeHtml(__('Critical System Messages'));?>">
30+
<?php echo $block->getCriticalCount();?>
31+
</a>
32+
</div>
2633
<?php endif;?>
34+
2735
<?php if ($block->getMajorCount()): ?>
28-
<span class="warning"><a href="#" title="<?php echo $block->escapeHtml(__('Major System Messages'));?>"><?php echo $block->getMajorCount();?></a></span>
36+
<div class="message message-warning warning">
37+
<a class="message-link" href="#" title="<?php echo $block->escapeHtml(__('Major System Messages'));?>">
38+
<?php echo $block->getMajorCount();?>
39+
</a>
40+
</div>
2941
<?php endif;?>
3042
</div>
3143
<div id="message-system-all" title="<?php echo $block->escapeHtml(__('System messages'));?>" data-mage-init='<?php echo $block->escapeHtml($block->getSystemMessageDialogJson());?>'></div>

app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88

99
?>
1010
<?php /** @var $block \Magento\AdminNotification\Block\System\Messages\UnreadMessagePopup */ ?>
11-
<div id="system_messages_list" title="<?php echo $block->escapeHtml($block->getPopupTitle()); ?>">
11+
12+
<div id="system_messages_list" class="admin__scope" title="<?php echo $block->escapeHtml($block->getPopupTitle()); ?>">
1213
<ul class="message-system-list">
1314
<?php foreach ($block->getUnreadMessages() as $message): ?>
14-
<li class="<?php echo $block->getItemClass($message);?>">
15+
<li class="message message-warning <?php echo $block->getItemClass($message);?>">
1516
<?php echo $message->getText();?>
1617
</li>
1718
<?php endforeach;?>
1819
</ul>
1920
</div>
21+
2022
<script>
2123
require([
2224
"jquery",
@@ -27,18 +29,21 @@ require([
2729
$("#system_messages_list").dialog({
2830
autoOpen: true,
2931
resizable: false,
30-
width: 650,
32+
width: '75%',
33+
modal: true,
34+
dialogClass: 'ui-popup-message',
3135
position: {
32-
using: function(pos) {
33-
$(this).css({
34-
"position": "absolute",
35-
"top": Math.ceil($(window).height()/2 - $(this).height()/2),
36-
"left": pos.left
37-
});
38-
}
36+
my: 'left+12.5% top',
37+
at: 'center top',
38+
of: 'body'
39+
},
40+
open: function() {
41+
$(this).closest('.ui-dialog').addClass('ui-dialog-active');
42+
43+
var topMargin = $(this).closest('.ui-dialog').children('.ui-dialog-titlebar').outerHeight() + 10;
44+
$(this).closest('.ui-dialog').css('margin-top', topMargin);
3945
}
4046
});
4147
});
42-
4348
});
4449
</script>

0 commit comments

Comments
 (0)