From 6629c1f70ad04702938fc29c7aca51ef2a4c2446 Mon Sep 17 00:00:00 2001 From: Benjamin Trenkle Date: Tue, 12 Feb 2019 09:31:02 +0100 Subject: [PATCH 1/9] Implement base bevavior for system dashboard performance improvement --- .../com_cpanel/Entities/SystemItem.php | 18 ++++---- .../com_cpanel/Model/SystemModel.php | 2 +- .../com_cpanel/tmpl/system/default.php | 9 ++-- .../com_cpanel/js/admin-system-loader.es6.js | 42 +++++++++++++++++++ 4 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 build/media_source/com_cpanel/js/admin-system-loader.es6.js diff --git a/administrator/components/com_cpanel/Entities/SystemItem.php b/administrator/components/com_cpanel/Entities/SystemItem.php index ffbe29a8fdaaa..805d1317a5ddc 100644 --- a/administrator/components/com_cpanel/Entities/SystemItem.php +++ b/administrator/components/com_cpanel/Entities/SystemItem.php @@ -33,29 +33,29 @@ class SystemItem private $link; /** - * An optional badge of the item + * An optional type for the ajax request * * @var string|null */ - private $badge; + private $type; /** * Class constructor. * * @param string $title The title of the item * @param string $link The link for the item - * @param string $badge The optional badge for the item + * @param string $type The type, requested by the ajax request * * @since 4.0.0 */ - public function __construct($title, $link, $badge = '') + public function __construct($title, $link, $type = '') { $this->title = $title; $this->link = $link; - if (!empty($badge)) + if (!empty($type)) { - $this->badge = $badge; + $this->type = $type; } } @@ -84,14 +84,14 @@ public function getLink() } /** - * The string to display in the notification badge if there is one. Else null. + * The type to load in the notification badge if there is one. Else null. * * @return string|null * * @since 4.0.0 */ - public function getBadge() + public function getType() { - return $this->badge; + return $this->type; } } diff --git a/administrator/components/com_cpanel/Model/SystemModel.php b/administrator/components/com_cpanel/Model/SystemModel.php index 6edfce0ac1006..253cdbc035161 100644 --- a/administrator/components/com_cpanel/Model/SystemModel.php +++ b/administrator/components/com_cpanel/Model/SystemModel.php @@ -94,7 +94,7 @@ public function getItems() $messages = count($messagesModel->getItems()); $infoSection->addItem( - new SystemItem('MOD_MENU_INFORMATION_POST_INSTALL_MESSAGES', 'index.php?option=com_postinstall', $messages) + new SystemItem('MOD_MENU_INFORMATION_POST_INSTALL_MESSAGES', 'index.php?option=com_postinstall', 'postinstall') ); } diff --git a/administrator/components/com_cpanel/tmpl/system/default.php b/administrator/components/com_cpanel/tmpl/system/default.php index 3c28404b00fc5..4f41df266c098 100644 --- a/administrator/components/com_cpanel/tmpl/system/default.php +++ b/administrator/components/com_cpanel/tmpl/system/default.php @@ -9,8 +9,11 @@ defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +HTMLHelper::_('script', 'com_cpanel/admin-system-loader.js', ['version' => 'auto', 'relative' => true]); + /** @var \Joomla\Component\Cpanel\Administrator\View\System\HtmlView $this */ ?> @@ -25,9 +28,9 @@ getItems() as $item) : ?>
  • getTitle()); ?> - getBadge())) : ?> - - getBadge()); ?> + getType())) : ?> + + diff --git a/build/media_source/com_cpanel/js/admin-system-loader.es6.js b/build/media_source/com_cpanel/js/admin-system-loader.es6.js new file mode 100644 index 0000000000000..735420493b680 --- /dev/null +++ b/build/media_source/com_cpanel/js/admin-system-loader.es6.js @@ -0,0 +1,42 @@ +/** + * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ +(() => { + 'use strict'; + + document.addEventListener('DOMContentLoaded', () => { + // Get the elements + const elements = document.querySelectorAll('.system-counter'); + + for (let i = 0, l = elements.length; l > i; i += 1) { + const type = elements[i].getAttribute('data-type'); + + Joomla.request({ + url: 'index.php?option=com_cpanel&task=system.loadSystemInfo&format=json', + method: 'POST', + data: 'type=' + type, + onSuccess: (response) => { + if (response.count > 0) + { + const elem = document.createElement('span'); + + elem.addAttribute('class', 'pull-right badge badge-pill badge-warning'); + elem.innerHTML = parseInt(response.count); + + elements[i].parentNode.replaceChild(elem, elements[i]); + } + else + { + elements[i].classList.remove('fa-spin', 'fa-spinner'); + elements[i].classList.add('text-success', 'fa-check'); + } + }, + onError: () => { + elements[i].classList.remove('fa-spin', 'fa-spinner'); + elements[i].classList.add('text-danger', 'fa-remove'); + } + }); + } + }); +})(); From 381216fe20bbfd2e18a4ab17f838c5e1a04eeaba Mon Sep 17 00:00:00 2001 From: Benjamin Trenkle Date: Tue, 12 Feb 2019 12:58:13 +0100 Subject: [PATCH 2/9] Implement ajax calls + interfaces --- .../Controller/SystemController.php | 165 ++++++++++++++++++ .../com_cpanel/Model/SystemModel.php | 58 +----- .../com_cpanel/tmpl/system/default.php | 2 +- .../language/en-GB/en-GB.com_cpanel.ini | 1 + .../com_cpanel/js/admin-system-loader.es6.js | 15 +- 5 files changed, 184 insertions(+), 57 deletions(-) create mode 100644 administrator/components/com_cpanel/Controller/SystemController.php diff --git a/administrator/components/com_cpanel/Controller/SystemController.php b/administrator/components/com_cpanel/Controller/SystemController.php new file mode 100644 index 0000000000000..01a2e309aa300 --- /dev/null +++ b/administrator/components/com_cpanel/Controller/SystemController.php @@ -0,0 +1,165 @@ +input->get('type'); + + $count = 0; + + switch ($type) + { + case 'postinstall': + $count = $this->countPostInstallMessages(); + break; + + case 'installationwarnings': + $count = $this->countInstallWarnings(); + break; + + case 'checkins': + $count = $this->countCheckins(); + break; + + case 'databaseupdate': + $count = $this->countDatabaseUpdates(); + break; + + case 'systemupdate': + $count = $this->countSystemUpdates(); + break; + + case 'extensionupdate': + $count = $this->countExtensionUpdates(); + break; + + case 'extensiondiscover': + $count = $this->countExtensionDiscover(); + break; + + default: + /** + * @TODO: Plugin event to allow custom sections to be added (see SystemModel) + */ + throw new \Exception(Text::_('COM_CPANEL_ERROR_DASHBOARD_TYPE_NOT_SUPPORTED')); + } + + echo new JsonResponse($count); + } + + protected function countPostInstallMessages() + { + return $this->countItems('com_postinstall', 'Messages'); + } + + protected function countInstallWarnings() + { + return $this->countItems('com_installer', 'Warnings'); + } + + protected function countCheckins() + { + return $this->countItems('com_checkin', 'Checkin'); + } + + protected function countDatabaseUpdates() + { + if (!Factory::getUser()->authorise('core.manage', 'com_installer')) + { + throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED')); + } + + $boot = Factory::getApplication()->bootComponent('com_installer'); + $model = $boot->getMVCFactory()->createModel('Database', 'Administrator', ['ignore_request' => true]); + + $changeSet = $model->getItems(); + + $changeSetCount = 0; + + foreach ($changeSet as $item) + { + $changeSetCount += $item['errorsCount']; + } + + return $changeSetCount; + } + + protected function countSystemUpdates() + { + if (!Factory::getUser()->authorise('core.manage', 'com_joomlaupdate')) + { + throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED')); + } + + $boot = Factory::getApplication()->bootComponent('com_joomlaupdate'); + $model = $boot->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); + + $model->refreshUpdates(true); + + $joomlaUpdate = $model->getUpdateInformation(); + + $hasUpdate = $joomlaUpdate['hasUpdate'] ? $joomlaUpdate['latest'] : ''; + + return $hasUpdate; + } + + protected function countExtensionUpdates() + { + if (!Factory::getUser()->authorise('core.manage', 'com_installer')) + { + throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED')); + } + + $boot = Factory::getApplication()->bootComponent('com_installer'); + $model = $boot->getMVCFactory()->createModel('Discover', 'Administrator', ['ignore_request' => true]); + + $model->discover(); + + $items = count($model->getItems()); + + return $items; + } + + protected function countExtensionDiscover() + { + return $this->countItems('com_installer', 'Discover'); + } + + protected function countItems($extension, $model) + { + if (!Factory::getUser()->authorise('core.manage', $extension)) + { + throw new \Exception(Text::_('JGLOBAL_AUTH_ACCESS_DENIED')); + } + + $boot = Factory::getApplication()->bootComponent($extension); + $model = $boot->getMVCFactory()->createModel($model, 'Administrator', ['ignore_request' => true]); + + $items = count($model->getItems()); + + return $items; + } +} diff --git a/administrator/components/com_cpanel/Model/SystemModel.php b/administrator/components/com_cpanel/Model/SystemModel.php index 253cdbc035161..813e1c7ca9da0 100644 --- a/administrator/components/com_cpanel/Model/SystemModel.php +++ b/administrator/components/com_cpanel/Model/SystemModel.php @@ -64,35 +64,20 @@ public function getItems() if ($user->authorise('core.manage', 'com_checkin')) { - /** @var \Joomla\Component\Checkin\Administrator\Model\CheckinModel $checkinModel */ - $checkinModel = $this->bootComponent('com_checkin')->getMVCFactory()->createModel('Checkin', 'Administrator', ['ignore_request' => true]); - $checkins = count($checkinModel->getItems()); - $maintainSection->addItem( - new SystemItem('MOD_MENU_GLOBAL_CHECKIN', 'index.php?option=com_checkin', $checkins) + new SystemItem('MOD_MENU_GLOBAL_CHECKIN', 'index.php?option=com_checkin', 'checkins') ); } if ($user->authorise('core.manage', 'com_installer')) { - /** @var \Joomla\Component\Installer\Administrator\Extension\InstallerComponent $installerComponent */ - $installerComponent = $this->bootComponent('com_installer'); - - /** @var \Joomla\Component\Installer\Administrator\Model\WarningsModel $warningsModel */ - $warningsModel = $installerComponent->getMVCFactory()->createModel('Warnings', 'Administrator', ['ignore_request' => true]); - $warningMessages = count($warningsModel->getItems()); - $infoSection->addItem( - new SystemItem('MOD_MENU_INFORMATION_WARNINGS', 'index.php?option=com_installer&view=warnings', $warningMessages) + new SystemItem('MOD_MENU_INFORMATION_WARNINGS', 'index.php?option=com_installer&view=warnings', 'installationwarnings') ); } if ($user->authorise('core.manage', 'com_postinstall')) { - /** @var \Joomla\Component\Postinstall\Administrator\Model\MessagesModel $messagesModel */ - $messagesModel = $this->bootComponent('com_postinstall')->getMVCFactory()->createModel('Messages', 'Administrator', ['ignore_request' => true]); - $messages = count($messagesModel->getItems()); - $infoSection->addItem( new SystemItem('MOD_MENU_INFORMATION_POST_INSTALL_MESSAGES', 'index.php?option=com_postinstall', 'postinstall') ); @@ -107,38 +92,19 @@ public function getItems() if ($user->authorise('core.manage', 'com_installer')) { - /** @var \Joomla\Component\Installer\Administrator\Model\DatabaseModel $warningsModel */ - $databaseModel = $installerComponent->getMVCFactory()->createModel('Database', 'Administrator', ['ignore_request' => true]); - $changeSet = $databaseModel->getItems(); - $changeSetCount = 0; - - foreach ($changeSet as $item) - { - $changeSetCount += $item['errorsCount']; - } - $infoSection->addItem( - new SystemItem( - 'MOD_MENU_SYSTEM_INFORMATION_DATABASE', - 'index.php?option=com_installer&view=database', - $changeSetCount === 0 ? '' : $changeSetCount - ) + new SystemItem('MOD_MENU_SYSTEM_INFORMATION_DATABASE', 'index.php?option=com_installer&view=database', 'databaseupdate') ); } // Install if ($user->authorise('core.manage', 'com_installer')) { - /** @var \Joomla\Component\Installer\Administrator\Model\DiscoverModel $discoverModel */ - $discoverModel = $this->bootComponent('com_installer')->getMVCFactory()->createModel('Discover', 'Administrator', ['ignore_request' => true]); - $discoverModel->discover(); - $discoveredExtensions = count($discoverModel->getItems()); - $installSection->addItem( new SystemItem('MOD_MENU_INSTALL_EXTENSIONS', 'index.php?option=com_installer&view=install') ); $installSection->addItem( - new SystemItem('MOD_MENU_INSTALL_DISCOVER', 'index.php?option=com_installer&view=discover', $discoveredExtensions) + new SystemItem('MOD_MENU_INSTALL_DISCOVER', 'index.php?option=com_installer&view=discover', 'extensiondiscover') ); $installSection->addItem( new SystemItem('MOD_MENU_INSTALL_LANGUAGES', 'index.php?option=com_installer&view=languages') @@ -199,27 +165,15 @@ public function getItems() if ($user->authorise('core.manage', 'com_joomlaupdate')) { - /** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $joomlaUpdateModel */ - $joomlaUpdateModel = $this->bootComponent('com_joomlaupdate')->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); - $joomlaUpdateModel->refreshUpdates(true); - $joomlaUpdate = $joomlaUpdateModel->getUpdateInformation(); - $hasUpdate = $joomlaUpdate['hasUpdate'] ? $joomlaUpdate['latest'] : ''; - $updateSection->addItem( - new SystemItem('MOD_MENU_UPDATE_JOOMLA', 'index.php?option=com_joomlaupdate', $hasUpdate) + new SystemItem('MOD_MENU_UPDATE_JOOMLA', 'index.php?option=com_joomlaupdate', 'systemupdate') ); } if ($user->authorise('core.manage', 'com_installer')) { - Updater::getInstance()->findUpdates(); - - /** @var \Joomla\Component\Installer\Administrator\Model\UpdateModel $updateModel */ - $updateModel = $installerComponent->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); - $extensionsCount = count($updateModel->getItems()); - $updateSection->addItem( - new SystemItem('MOD_MENU_UPDATE_EXTENSIONS', 'index.php?option=com_installer&view=update', $extensionsCount) + new SystemItem('MOD_MENU_UPDATE_EXTENSIONS', 'index.php?option=com_installer&view=update', 'extensionupdate') ); $updateSection->addItem( diff --git a/administrator/components/com_cpanel/tmpl/system/default.php b/administrator/components/com_cpanel/tmpl/system/default.php index 4f41df266c098..473e297c1f221 100644 --- a/administrator/components/com_cpanel/tmpl/system/default.php +++ b/administrator/components/com_cpanel/tmpl/system/default.php @@ -29,7 +29,7 @@
  • getTitle()); ?> getType())) : ?> - + diff --git a/administrator/language/en-GB/en-GB.com_cpanel.ini b/administrator/language/en-GB/en-GB.com_cpanel.ini index 5a0badc921fee..e625bf175d085 100644 --- a/administrator/language/en-GB/en-GB.com_cpanel.ini +++ b/administrator/language/en-GB/en-GB.com_cpanel.ini @@ -7,6 +7,7 @@ COM_CPANEL="Control Panel" COM_CPANEL_MESSAGES_BODY_NOCLOSE="There are important post-installation messages that require your attention." COM_CPANEL_MESSAGES_BODYMORE_NOCLOSE="This information area won't appear when you have hidden all the messages." COM_CPANEL_MESSAGES_REVIEW="Read Messages" +COM_CPANEL_ERROR_DASHBOARD_TYPE_NOT_SUPPORTED="This dashboard type is not supported." COM_CPANEL_MESSAGES_TITLE="You have post-installation messages" COM_CPANEL_MSG_EACCELERATOR_BODY="eAccelerator is not compatible with Joomla! By selecting the Change to File Caching button below we will change the cache handler to file. If you want to use a different cache handler, please change it in the Global Configuration page." COM_CPANEL_MSG_EACCELERATOR_BUTTON="Change to File." diff --git a/build/media_source/com_cpanel/js/admin-system-loader.es6.js b/build/media_source/com_cpanel/js/admin-system-loader.es6.js index 735420493b680..7c6852b7e26e6 100644 --- a/build/media_source/com_cpanel/js/admin-system-loader.es6.js +++ b/build/media_source/com_cpanel/js/admin-system-loader.es6.js @@ -16,13 +16,20 @@ url: 'index.php?option=com_cpanel&task=system.loadSystemInfo&format=json', method: 'POST', data: 'type=' + type, - onSuccess: (response) => { - if (response.count > 0) + onSuccess: (resp) => { + const response = JSON.parse(resp); + + if (response.error || !response.success) + { + elements[i].classList.remove('fa-spin', 'fa-spinner'); + elements[i].classList.add('text-danger', 'fa-remove'); + } + else if (response.data) { const elem = document.createElement('span'); - elem.addAttribute('class', 'pull-right badge badge-pill badge-warning'); - elem.innerHTML = parseInt(response.count); + elem.classList.add('pull-right', 'badge', 'badge-pill', 'badge-warning'); + elem.innerHTML = response.data; elements[i].parentNode.replaceChild(elem, elements[i]); } From 7d438edc85cb1506bb1957a60f0371f239a7e267 Mon Sep 17 00:00:00 2001 From: Benjamin Trenkle Date: Sat, 16 Feb 2019 13:31:57 +0100 Subject: [PATCH 3/9] Remove unnecessary methods --- .../Controller/SystemController.php | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/administrator/components/com_cpanel/Controller/SystemController.php b/administrator/components/com_cpanel/Controller/SystemController.php index 01a2e309aa300..e80fa09a9d408 100644 --- a/administrator/components/com_cpanel/Controller/SystemController.php +++ b/administrator/components/com_cpanel/Controller/SystemController.php @@ -33,15 +33,15 @@ public function loadSystemInfo() switch ($type) { case 'postinstall': - $count = $this->countPostInstallMessages(); + $count = $this->countItems('com_postinstall', 'Messages'); break; case 'installationwarnings': - $count = $this->countInstallWarnings(); + $count = $this->countItems('com_installer', 'Warnings'); break; case 'checkins': - $count = $this->countCheckins(); + $count = $this->countItems('com_checkin', 'Checkin'); break; case 'databaseupdate': @@ -57,7 +57,7 @@ public function loadSystemInfo() break; case 'extensiondiscover': - $count = $this->countExtensionDiscover(); + $count = $this->countItems('com_installer', 'Discover'); break; default: @@ -70,21 +70,6 @@ public function loadSystemInfo() echo new JsonResponse($count); } - protected function countPostInstallMessages() - { - return $this->countItems('com_postinstall', 'Messages'); - } - - protected function countInstallWarnings() - { - return $this->countItems('com_installer', 'Warnings'); - } - - protected function countCheckins() - { - return $this->countItems('com_checkin', 'Checkin'); - } - protected function countDatabaseUpdates() { if (!Factory::getUser()->authorise('core.manage', 'com_installer')) @@ -143,11 +128,6 @@ protected function countExtensionUpdates() return $items; } - protected function countExtensionDiscover() - { - return $this->countItems('com_installer', 'Discover'); - } - protected function countItems($extension, $model) { if (!Factory::getUser()->authorise('core.manage', $extension)) From 2105ca6d204543e2e0faf40e0336182ea42d26a0 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Sun, 17 Feb 2019 23:35:38 +0100 Subject: [PATCH 4/9] Implementing mod_submenu and system preset --- .../sql/updates/mysql/4.0.0-2019-02-17.sql | 5 + .../updates/postgresql/4.0.0-2019-02-17.sql | 5 + .../com_cpanel/View/Cpanel/HtmlView.php | 17 +- .../com_cpanel/tmpl/cpanel/default.php | 24 +- .../com_menus/Helper/MenusHelper.php | 4 +- .../components/com_menus/presets/menu.xsd | 5 + .../components/com_menus/presets/system.xml | 297 ++++++++++++++++++ .../language/en-GB/en-GB.lib_joomla.ini | 2 + .../language/en-GB/en-GB.mod_submenu.ini | 11 + .../language/en-GB/en-GB.mod_submenu.sys.ini | 7 + .../modules/mod_submenu/Menu/Menu.php | 67 ++++ .../modules/mod_submenu/mod_submenu.php | 43 +++ .../modules/mod_submenu/mod_submenu.xml | 62 ++++ .../modules/mod_submenu/tmpl/default.php | 41 +++ installation/sql/mysql/joomla.sql | 1 + installation/sql/postgresql/joomla.sql | 1 + 16 files changed, 577 insertions(+), 15 deletions(-) create mode 100644 administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql create mode 100644 administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql create mode 100644 administrator/components/com_menus/presets/system.xml create mode 100644 administrator/language/en-GB/en-GB.mod_submenu.ini create mode 100644 administrator/language/en-GB/en-GB.mod_submenu.sys.ini create mode 100644 administrator/modules/mod_submenu/Menu/Menu.php create mode 100644 administrator/modules/mod_submenu/mod_submenu.php create mode 100644 administrator/modules/mod_submenu/mod_submenu.xml create mode 100644 administrator/modules/mod_submenu/tmpl/default.php diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql new file mode 100644 index 0000000000000..b2b038e829b2a --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql @@ -0,0 +1,5 @@ +INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES +(319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0); + +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES +('System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql new file mode 100644 index 0000000000000..8282533165219 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql @@ -0,0 +1,5 @@ +INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state", "namespace") VALUES +(319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '1970-01-01 00:00:00', 0, 0); + +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); diff --git a/administrator/components/com_cpanel/View/Cpanel/HtmlView.php b/administrator/components/com_cpanel/View/Cpanel/HtmlView.php index 9b2770fdba95a..268b77f4c5cd2 100644 --- a/administrator/components/com_cpanel/View/Cpanel/HtmlView.php +++ b/administrator/components/com_cpanel/View/Cpanel/HtmlView.php @@ -11,6 +11,7 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; @@ -30,6 +31,13 @@ class HtmlView extends BaseHtmlView */ protected $modules = null; + /** + * Array of cpanel modules + * + * @var array + */ + protected $quickicons = null; + /** * Execute and display a template script. * @@ -39,12 +47,19 @@ class HtmlView extends BaseHtmlView */ public function display($tpl = null) { + $app = Factory::getApplication(); + // Set toolbar items for the page ToolbarHelper::title(Text::_('COM_CPANEL'), 'home-2 cpanel'); ToolbarHelper::help('screen.cpanel'); // Display the cpanel modules - $this->modules = ModuleHelper::getModules('cpanel'); + $dashboard = $app->input->getCmd('dashboard'); + $position = $dashboard ? 'cpanel-' . $dashboard : 'cpanel'; + $this->modules = ModuleHelper::getModules($position); + + $quickicons = $dashboard ? 'icon-' . $dashboard : 'icon'; + $this->quickicons = ModuleHelper::getModules($quickicons); parent::display($tpl); } diff --git a/administrator/components/com_cpanel/tmpl/cpanel/default.php b/administrator/components/com_cpanel/tmpl/cpanel/default.php index e68533e3640a0..9b40153ba0fb7 100644 --- a/administrator/components/com_cpanel/tmpl/cpanel/default.php +++ b/administrator/components/com_cpanel/tmpl/cpanel/default.php @@ -15,23 +15,21 @@ $user = Factory::getUser(); ?> +quickicons) : ?>
    - -
    - -
    - +
    + quickicons as $iconmodule) + { + echo ModuleHelper::renderModule($iconmodule); + } + ?> +
    +
    modules as $module) { echo ModuleHelper::renderModule($module, array('style' => 'well')); diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index daf3457ca0c22..637b3a84f3bb1 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -611,6 +611,8 @@ public static function getPresets() static::addPreset('joomla', 'JLIB_MENUS_PRESET_JOOMLA', JPATH_ADMINISTRATOR . '/components/com_menus/presets/joomla.xml'); static::addPreset('modern', 'JLIB_MENUS_PRESET_MODERN', JPATH_ADMINISTRATOR . '/components/com_menus/presets/modern.xml'); + static::addPreset('system', 'JLIB_MENUS_PRESET_SYSTEM', JPATH_ADMINISTRATOR . '/components/com_menus/presets/system.xml'); + static::addPreset('user', 'JLIB_MENUS_PRESET_USER', JPATH_ADMINISTRATOR . '/components/com_menus/presets/user.xml'); // Load from template folder automatically $app = Factory::getApplication(); @@ -737,7 +739,6 @@ public static function preprocess($item) if ($item->link = in_array($item->type, array('separator', 'heading', 'container')) ? '#' : trim($item->link)) { - $item->submenu = array(); $item->class = $item->img ?? ''; $item->scope = $item->scope ?? null; $item->browserNav = $item->browserNav ? '_blank' : ''; @@ -865,6 +866,7 @@ protected static function parseXmlNode($node, $replace = array()) $item->browserNav = (string) $node['target']; $item->access = (int) $node['access']; $item->scope = (string) $node['scope'] ?: 'default'; + $item->permission = (string) $node['permission']; $item->setParams(new Registry(trim($node->params))); $item->getParams()->set('menu-permission', (string) $node['permission']); diff --git a/administrator/components/com_menus/presets/menu.xsd b/administrator/components/com_menus/presets/menu.xsd index de9ff3c193301..a8e233a71305d 100644 --- a/administrator/components/com_menus/presets/menu.xsd +++ b/administrator/components/com_menus/presets/menu.xsd @@ -63,6 +63,11 @@ + + + + + diff --git a/administrator/components/com_menus/presets/system.xml b/administrator/components/com_menus/presets/system.xml new file mode 100644 index 0000000000000..09a16859ed128 --- /dev/null +++ b/administrator/components/com_menus/presets/system.xml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index 5760b8781a74e..c75458a49b9c3 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -687,6 +687,8 @@ JLIB_MEDIA_ERROR_WARNNOTADMIN="Uploaded file is not an image file and you do not JLIB_MENUS_PRESET_JOOMLA="Preset - Joomla" JLIB_MENUS_PRESET_MODERN="Preset - Modern" +JLIB_MENUS_PRESET_SYSTEM="Preset - System" +JLIB_MENUS_PRESET_USER="Preset - User" JLIB_NO_EDITOR_PLUGIN_PUBLISHED="Unable to display an editor because no editor plugin is published." diff --git a/administrator/language/en-GB/en-GB.mod_submenu.ini b/administrator/language/en-GB/en-GB.mod_submenu.ini new file mode 100644 index 0000000000000..5d110a53e73b4 --- /dev/null +++ b/administrator/language/en-GB/en-GB.mod_submenu.ini @@ -0,0 +1,11 @@ +; Joomla! Project +; Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +MOD_SUBMENU="Administrator Submenu" +MOD_SUBMENU_FIELD_MENUTYPE_LABEL="Menu to Show" +MOD_SUBMENU_FIELD_MENUTYPE_OPTION_PREDEFINED="Use a Preset" +MOD_SUBMENU_FIELD_PRESET_DESC="Choose a preset to use in this module" +MOD_SUBMENU_FIELD_PRESET_LABEL="Choose Preset" +MOD_SUBMENU_XML_DESCRIPTION="This module displays an administrator submenu module." diff --git a/administrator/language/en-GB/en-GB.mod_submenu.sys.ini b/administrator/language/en-GB/en-GB.mod_submenu.sys.ini new file mode 100644 index 0000000000000..4bc06c894932b --- /dev/null +++ b/administrator/language/en-GB/en-GB.mod_submenu.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +MOD_SUBMENU="Administrator Submenu" +MOD_SUBMENU_XML_DESCRIPTION="This module displays an administrator submenu module." diff --git a/administrator/modules/mod_submenu/Menu/Menu.php b/administrator/modules/mod_submenu/Menu/Menu.php new file mode 100644 index 0000000000000..d30c96c21f9dc --- /dev/null +++ b/administrator/modules/mod_submenu/Menu/Menu.php @@ -0,0 +1,67 @@ +getIdentity(); + $children = $parent->getChildren(); + + /** + * Trigger onPreprocessMenuItems for the current level of backend menu items. + * $children is an array of MenuItem objects. A plugin can traverse the whole tree, + * but new nodes will only be run through this method if their parents have not been processed yet. + */ + $app->triggerEvent('onPreprocessMenuItems', array('administrator.module.mod_submenu', $children)); + + + foreach ($children as $item) + { + // Exclude item with menu item option set to exclude from menu modules + if ($item->permission) + { + @list($action, $asset) = explode(';', $item->permission); + + if (!$user->authorise($action, $asset)) + { + $parent->removeChild($item); + continue; + } + } + + if ($item->hasChildren()) + { + self::preprocess($item); + } + } + } +} diff --git a/administrator/modules/mod_submenu/mod_submenu.php b/administrator/modules/mod_submenu/mod_submenu.php new file mode 100644 index 0000000000000..dccf088b15b50 --- /dev/null +++ b/administrator/modules/mod_submenu/mod_submenu.php @@ -0,0 +1,43 @@ +get('menutype', '*'); +$root = false; + +if ($menutype === '*') +{ + $name = $params->get('preset', 'system'); + $root = MenusHelper::loadPreset($name); +} +else +{ + $root = MenusHelper::getMenuItems($menutype, true); +} + +if ($root && $root->hasChildren()) +{ + Factory::getLanguage()->load( + 'mod_menu', + JPATH_ADMINISTRATOR, + Factory::getLanguage()->getTag(), + true + ); + + Menu::preprocess($root); + + // Render the module layout + require ModuleHelper::getLayoutPath('mod_submenu', $params->get('layout', 'default')); +} diff --git a/administrator/modules/mod_submenu/mod_submenu.xml b/administrator/modules/mod_submenu/mod_submenu.xml new file mode 100644 index 0000000000000..d4c33f506bbee --- /dev/null +++ b/administrator/modules/mod_submenu/mod_submenu.xml @@ -0,0 +1,62 @@ + + + mod_submenu + Joomla! Project + February 2019 + Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 3.0.0 + MOD_SUBMENU_XML_DESCRIPTION + Joomla\Module\Submenu + + mod_submenu.php + Menu + tmpl + + + en-GB.mod_submenu.ini + en-GB.mod_submenu.sys.ini + + + + +
    + + + + + +
    + +
    + + + +
    +
    +
    +
    diff --git a/administrator/modules/mod_submenu/tmpl/default.php b/administrator/modules/mod_submenu/tmpl/default.php new file mode 100644 index 0000000000000..edef5426d1398 --- /dev/null +++ b/administrator/modules/mod_submenu/tmpl/default.php @@ -0,0 +1,41 @@ + + +
    diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 4fb6731f58be9..440be8cb9a4ba 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -587,6 +587,7 @@ INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `elem (316, 0, 'mod_tags_popular', 'module', 'mod_tags_popular', '', 0, 1, 1, 0, '', '{"maximum":"5","timeframe":"alltime","owncache":"1"}', 0, '0000-00-00 00:00:00', 0, 0), (317, 0, 'mod_tags_similar', 'module', 'mod_tags_similar', '', 0, 1, 1, 0, '', '{"maximum":"5","matchtype":"any","owncache":"1"}', 0, '0000-00-00 00:00:00', 0, 0), (318, 0, 'mod_sampledata', 'module', 'mod_sampledata', '', 1, 1, 1, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0), +(319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0), (401, 0, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, '', '', 0, '0000-00-00 00:00:00', 0, 0), (402, 0, 'plg_authentication_ldap', 'plugin', 'ldap', 'authentication', 0, 0, 1, 0, '', '{"host":"","port":"389","use_ldapV3":"0","negotiate_tls":"0","no_referrals":"0","auth_method":"bind","base_dn":"","search_string":"","users_dn":"","username":"admin","password":"bobby7","ldap_fullname":"fullName","ldap_email":"mail","ldap_uid":"uid"}', 0, '0000-00-00 00:00:00', 3, 0), (403, 0, 'plg_content_contact', 'plugin', 'contact', 'content', 0, 1, 1, 0, '', '', 0, '0000-00-00 00:00:00', 1, 0), diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index d10484f63e3da..54cfcde6a651d 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -596,6 +596,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem (315, 0, 'mod_stats_admin', 'module', 'mod_stats_admin', '', 1, 1, 1, 0, '', '{"serverinfo":"0","siteinfo":"0","counter":"0","increase":"0","cache":"1","cache_time":"900","cachemode":"static"}', 0, '1970-01-01 00:00:00', 0, 0), (316, 0, 'mod_tags_popular', 'module', 'mod_tags_popular', '', 0, 1, 1, 0, '', '{"maximum":"5","timeframe":"alltime","owncache":"1"}', 0, '1970-01-01 00:00:00', 0, 0), (317, 0, 'mod_tags_similar', 'module', 'mod_tags_similar', '', 0, 1, 1, 0, '', '{"maximum":"5","matchtype":"any","owncache":"1"}', 0, '1970-01-01 00:00:00', 0, 0), +(319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '1970-01-01 00:00:00', 0, 0), (401, 0, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, '', '', 0, '1970-01-01 00:00:00', 0, 0), (402, 0, 'plg_authentication_ldap', 'plugin', 'ldap', 'authentication', 0, 0, 1, 0, '', '{"host":"","port":"389","use_ldapV3":"0","negotiate_tls":"0","no_referrals":"0","auth_method":"bind","base_dn":"","search_string":"","users_dn":"","username":"admin","password":"bobby7","ldap_fullname":"fullName","ldap_email":"mail","ldap_uid":"uid"}', 0, '1970-01-01 00:00:00', 3, 0), (403, 0, 'plg_content_contact', 'plugin', 'contact', 'content', 0, 1, 1, 0, '', '', 0, '1970-01-01 00:00:00', 1, 0), From 99dc376b634d8ce91867402aa3dd22c3de5a3481 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Mon, 18 Feb 2019 00:10:10 +0100 Subject: [PATCH 5/9] Switching system view of cpanel to dashboard view --- .../com_cpanel/Entities/SystemHeader.php | 123 --------- .../com_cpanel/Entities/SystemItem.php | 97 ------- .../com_cpanel/Model/SystemModel.php | 243 ------------------ .../com_cpanel/View/System/HtmlView.php | 78 ------ .../com_cpanel/tmpl/system/default.php | 44 ---- .../com_menus/Helper/MenusHelper.php | 1 + .../components/com_menus/presets/joomla.xml | 2 +- .../components/com_menus/presets/system.xml | 7 + .../modules/mod_submenu/tmpl/default.php | 11 +- 9 files changed, 15 insertions(+), 591 deletions(-) delete mode 100644 administrator/components/com_cpanel/Entities/SystemHeader.php delete mode 100644 administrator/components/com_cpanel/Entities/SystemItem.php delete mode 100644 administrator/components/com_cpanel/Model/SystemModel.php delete mode 100644 administrator/components/com_cpanel/View/System/HtmlView.php delete mode 100644 administrator/components/com_cpanel/tmpl/system/default.php diff --git a/administrator/components/com_cpanel/Entities/SystemHeader.php b/administrator/components/com_cpanel/Entities/SystemHeader.php deleted file mode 100644 index 829bd825f05d1..0000000000000 --- a/administrator/components/com_cpanel/Entities/SystemHeader.php +++ /dev/null @@ -1,123 +0,0 @@ -title = $title; - $this->icon = $icon; - } - - /** - * Method to add an item to the section - * - * @param SystemItem $item The item to add to this section - * - * @return void - * - * @since 4.0.0 - */ - public function addItem(SystemItem $item) - { - $this->items[] = $item; - } - - /** - * Get the icon associated with the section - * - * @return string - * - * @since 4.0.0 - */ - public function getIcon() - { - return $this->icon; - } - - /** - * Get the title associated with the section - * - * @return string - * - * @since 4.0.0 - */ - public function getTitle() - { - return $this->title; - } - - /** - * Get the items added into the section - * - * @return SystemItem[] - * - * @since 4.0.0 - */ - public function getItems() - { - return $this->items; - } - - /** - * Does the section contain any items - * - * @return boolean - * - * @since 4.0.0 - */ - public function hasItems() - { - return count($this->items) !== 0; - } -} diff --git a/administrator/components/com_cpanel/Entities/SystemItem.php b/administrator/components/com_cpanel/Entities/SystemItem.php deleted file mode 100644 index 805d1317a5ddc..0000000000000 --- a/administrator/components/com_cpanel/Entities/SystemItem.php +++ /dev/null @@ -1,97 +0,0 @@ -title = $title; - $this->link = $link; - - if (!empty($type)) - { - $this->type = $type; - } - } - - /** - * The item title - * - * @return string - * - * @since 4.0.0 - */ - public function getTitle() - { - return $this->title; - } - - /** - * The item link - * - * @return string - * - * @since 4.0.0 - */ - public function getLink() - { - return $this->link; - } - - /** - * The type to load in the notification badge if there is one. Else null. - * - * @return string|null - * - * @since 4.0.0 - */ - public function getType() - { - return $this->type; - } -} diff --git a/administrator/components/com_cpanel/Model/SystemModel.php b/administrator/components/com_cpanel/Model/SystemModel.php deleted file mode 100644 index 813e1c7ca9da0..0000000000000 --- a/administrator/components/com_cpanel/Model/SystemModel.php +++ /dev/null @@ -1,243 +0,0 @@ -authorise('core.admin')) - { - $systemSection->addItem( - new SystemItem('MOD_MENU_CONFIGURATION', 'index.php?option=com_config') - ); - } - - // Maintain - if ($user->authorise('core.manage', 'com_cache')) - { - $maintainSection->addItem( - new SystemItem('MOD_MENU_CLEAR_CACHE', 'index.php?option=com_cache') - ); - $maintainSection->addItem( - new SystemItem('MOD_MENU_PURGE_EXPIRED_CACHE', 'index.php?option=com_cache&view=purge') - ); - } - - if ($user->authorise('core.manage', 'com_checkin')) - { - $maintainSection->addItem( - new SystemItem('MOD_MENU_GLOBAL_CHECKIN', 'index.php?option=com_checkin', 'checkins') - ); - } - - if ($user->authorise('core.manage', 'com_installer')) - { - $infoSection->addItem( - new SystemItem('MOD_MENU_INFORMATION_WARNINGS', 'index.php?option=com_installer&view=warnings', 'installationwarnings') - ); - } - - if ($user->authorise('core.manage', 'com_postinstall')) - { - $infoSection->addItem( - new SystemItem('MOD_MENU_INFORMATION_POST_INSTALL_MESSAGES', 'index.php?option=com_postinstall', 'postinstall') - ); - } - - if ($user->authorise('core.admin')) - { - $infoSection->addItem( - new SystemItem('MOD_MENU_SYSTEM_INFORMATION_SYSINFO', 'index.php?option=com_admin&view=sysinfo') - ); - } - - if ($user->authorise('core.manage', 'com_installer')) - { - $infoSection->addItem( - new SystemItem('MOD_MENU_SYSTEM_INFORMATION_DATABASE', 'index.php?option=com_installer&view=database', 'databaseupdate') - ); - } - - // Install - if ($user->authorise('core.manage', 'com_installer')) - { - $installSection->addItem( - new SystemItem('MOD_MENU_INSTALL_EXTENSIONS', 'index.php?option=com_installer&view=install') - ); - $installSection->addItem( - new SystemItem('MOD_MENU_INSTALL_DISCOVER', 'index.php?option=com_installer&view=discover', 'extensiondiscover') - ); - $installSection->addItem( - new SystemItem('MOD_MENU_INSTALL_LANGUAGES', 'index.php?option=com_installer&view=languages') - ); - } - - if ($user->authorise('core.manage', 'com_installer')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_EXTENSIONS', 'index.php?option=com_installer&view=manage') - ); - } - - if ($user->authorise('core.manage', 'com_languages')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_LANGUAGES', 'index.php?option=com_languages&view=installed') - ); - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_LANGUAGES_CONTENT', 'index.php?option=com_languages&view=languages') - ); - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_LANGUAGES_OVERRIDES', 'index.php?option=com_languages&view=overrides') - ); - } - - if ($user->authorise('core.manage', 'com_csp')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_CSP', 'index.php?option=com_csp') - ); - } - - if ($user->authorise('core.manage', 'com_plugins')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_PLUGINS', 'index.php?option=com_plugins') - ); - } - - if ($user->authorise('core.manage', 'com_redirect')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_MANAGE_REDIRECTS', 'index.php?option=com_redirect') - ); - } - - if ($user->authorise('core.manage', 'com_modules')) - { - $manageSection->addItem( - new SystemItem('MOD_MENU_EXTENSIONS_MODULE_MANAGER_SITE', 'index.php?option=com_modules&view=modules&client_id=0') - ); - - $manageSection->addItem( - new SystemItem('MOD_MENU_EXTENSIONS_MODULE_MANAGER_ADMINISTRATOR', 'index.php?option=com_modules&view=modules&client_id=1') - ); - } - - if ($user->authorise('core.manage', 'com_joomlaupdate')) - { - $updateSection->addItem( - new SystemItem('MOD_MENU_UPDATE_JOOMLA', 'index.php?option=com_joomlaupdate', 'systemupdate') - ); - } - - if ($user->authorise('core.manage', 'com_installer')) - { - $updateSection->addItem( - new SystemItem('MOD_MENU_UPDATE_EXTENSIONS', 'index.php?option=com_installer&view=update', 'extensionupdate') - ); - - $updateSection->addItem( - new SystemItem('MOD_MENU_UPDATE_SOURCES', 'index.php?option=com_installer&view=updatesites') - ); - } - - // Templates - if ($user->authorise('core.manage', 'com_templates')) - { - $templateSection->addItem( - new SystemItem('MOD_MENU_TEMPLATE_SITE_TEMPLATES', 'index.php?option=com_templates&view=templates&client_id=0') - ); - - $templateSection->addItem( - new SystemItem('MOD_MENU_TEMPLATE_SITE_STYLES', 'index.php?option=com_templates&view=styles&client_id=0') - ); - - $templateSection->addItem( - new SystemItem('MOD_MENU_TEMPLATE_ADMIN_TEMPLATES', 'index.php?option=com_templates&view=templates&client_id=1') - ); - - $templateSection->addItem( - new SystemItem('MOD_MENU_TEMPLATE_ADMIN_STYLES', 'index.php?option=com_templates&view=styles&client_id=1') - ); - } - - // Access - if ($user->authorise('core.manage', 'com_users')) - { - $accessSection->addItem( - new SystemItem('MOD_MENU_ACCESS_GROUPS', 'index.php?option=com_users&view=groups') - ); - - $accessSection->addItem( - new SystemItem('MOD_MENU_ACCESS_LEVELS', 'index.php?option=com_users&view=levels') - ); - } - - // Global Configuration - Permissions and Filters - if ($user->authorise('core.admin')) - { - $accessSection->addItem( - new SystemItem('MOD_MENU_ACCESS_SETTINGS', 'index.php?option=com_config#page-permissions') - ); - - $accessSection->addItem( - new SystemItem('MOD_MENU_ACCESS_TEXT_FILTERS', 'index.php?option=com_config#page-filters') - ); - } - - $links = [ - $systemSection, - $maintainSection, - $infoSection, - $installSection, - $manageSection, - $updateSection, - $templateSection, - $accessSection - ]; - - // TODO: Plugin event to allow custom sections to be added - - return $links; - } -} diff --git a/administrator/components/com_cpanel/View/System/HtmlView.php b/administrator/components/com_cpanel/View/System/HtmlView.php deleted file mode 100644 index 87f8c8346e957..0000000000000 --- a/administrator/components/com_cpanel/View/System/HtmlView.php +++ /dev/null @@ -1,78 +0,0 @@ -getModel(); - $this->links = $model->getItems(); - $hasItems = false; - - foreach ($this->links as $section) - { - if ($section->hasItems()) - { - $hasItems = true; - break; - } - } - - if (!$hasItems) - { - throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403); - } - - Factory::getLanguage()->load( - 'mod_menu', - JPATH_ADMINISTRATOR, - Factory::getLanguage()->getTag(), - true - ); - - return parent::display($tpl); - } -} diff --git a/administrator/components/com_cpanel/tmpl/system/default.php b/administrator/components/com_cpanel/tmpl/system/default.php deleted file mode 100644 index 473e297c1f221..0000000000000 --- a/administrator/components/com_cpanel/tmpl/system/default.php +++ /dev/null @@ -1,44 +0,0 @@ - 'auto', 'relative' => true]); - -/** @var \Joomla\Component\Cpanel\Administrator\View\System\HtmlView $this */ -?> - -
    - links as $section) : ?> -
    -

    - - getTitle()); ?> -

    - -
    - -
    - - diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index 637b3a84f3bb1..bd54f4e050b90 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -867,6 +867,7 @@ protected static function parseXmlNode($node, $replace = array()) $item->access = (int) $node['access']; $item->scope = (string) $node['scope'] ?: 'default'; $item->permission = (string) $node['permission']; + $item->ajaxbadge = (string) $node['ajax-badge']; $item->setParams(new Registry(trim($node->params))); $item->getParams()->set('menu-permission', (string) $node['permission']); diff --git a/administrator/components/com_menus/presets/joomla.xml b/administrator/components/com_menus/presets/joomla.xml index d866d767c5d44..1e5aff8ac6569 100644 --- a/administrator/components/com_menus/presets/joomla.xml +++ b/administrator/components/com_menus/presets/joomla.xml @@ -226,7 +226,7 @@ type="component" element="com_cpanel" class="class:cog" - link="index.php?option=com_cpanel&view=system" + link="index.php?option=com_cpanel&view=cpanel&dashboard=system" /> @@ -59,6 +60,7 @@ element="com_installer" link="index.php?option=com_installer&view=warnings" permission="core.manage;com_installer" + ajax-badge="index.php?option=com_cpanel&task=system.loadSystemInfo&format=json&type=installationwarnings" /> @@ -104,6 +108,7 @@ type="component" element="com_installer" link="index.php?option=com_installer&view=discover" + ajax-badge="index.php?option=com_cpanel&task=system.loadSystemInfo&format=json&type=extensiondiscover" /> 'auto', 'relative' => true]); + /** @var \Joomla\CMS\Menu\MenuItem $root */ ?> @@ -26,11 +29,9 @@ getChildren() as $item) : ?>
  • title); ?> - getBadge())) : ?> - - getBadge()); ?> - - + ajaxbadge) : ?> + +
  • From d485e7cfadb44f5aed0ec3c7d2bc00428c0440b8 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Mon, 18 Feb 2019 00:37:47 +0100 Subject: [PATCH 6/9] Fixing JS file --- build/media_source/com_cpanel/js/admin-system-loader.es6.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/media_source/com_cpanel/js/admin-system-loader.es6.js b/build/media_source/com_cpanel/js/admin-system-loader.es6.js index 7c6852b7e26e6..1e61a84cac691 100644 --- a/build/media_source/com_cpanel/js/admin-system-loader.es6.js +++ b/build/media_source/com_cpanel/js/admin-system-loader.es6.js @@ -10,12 +10,11 @@ const elements = document.querySelectorAll('.system-counter'); for (let i = 0, l = elements.length; l > i; i += 1) { - const type = elements[i].getAttribute('data-type'); + const badgeurl = elements[i].getAttribute('data-url'); Joomla.request({ - url: 'index.php?option=com_cpanel&task=system.loadSystemInfo&format=json', + url: badgeurl, method: 'POST', - data: 'type=' + type, onSuccess: (resp) => { const response = JSON.parse(resp); From a8dd3611e82b72d86120fc9b5829d9995aa17e5b Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Mon, 18 Feb 2019 23:51:21 +0100 Subject: [PATCH 7/9] Further quicktask icons --- .../sql/updates/mysql/4.0.0-2019-01-29.sql | 4 ++-- .../sql/updates/mysql/4.0.0-2019-02-17.sql | 4 +++- .../updates/postgresql/4.0.0-2019-01-29.sql | 8 ++++--- .../updates/postgresql/4.0.0-2019-02-17.sql | 7 ++++-- .../com_cpanel/tmpl/cpanel/default.php | 22 +------------------ .../com_menus/Helper/MenusHelper.php | 5 ++++- .../components/com_menus/presets/joomla.xml | 8 ++++--- .../modules/mod_menu/tmpl/default_submenu.php | 2 +- 8 files changed, 26 insertions(+), 34 deletions(-) diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-01-29.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-01-29.sql index dac421622e2bc..0f10a2c012a41 100644 --- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-01-29.sql +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-01-29.sql @@ -1,2 +1,2 @@ -INSERT INTO `#__modules` (`id`, `asset_id`, `title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES (88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); -INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (88, 0); +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES ('Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql index b2b038e829b2a..df5889917f341 100644 --- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-17.sql @@ -1,5 +1,7 @@ -INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES +INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES (319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0); INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES ('System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-01-29.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-01-29.sql index 87c96f420b805..3efb79891ccef 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-01-29.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-01-29.sql @@ -1,3 +1,5 @@ -INSERT INTO "#__modules" ("id", "asset_id", "title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES -(88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); -INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (88, 0); +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql index 8282533165219..e0b5e0ac76d58 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-17.sql @@ -1,5 +1,8 @@ -INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state", "namespace") VALUES +INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state") VALUES (319, 0, 'mod_submenu', 'module', 'mod_submenu', '', 1, 1, 1, 0, '', '{}', 0, '1970-01-01 00:00:00', 0, 0); INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES -('System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); +('System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); diff --git a/administrator/components/com_cpanel/tmpl/cpanel/default.php b/administrator/components/com_cpanel/tmpl/cpanel/default.php index ef5c5908b2e34..a0a42a2149b89 100644 --- a/administrator/components/com_cpanel/tmpl/cpanel/default.php +++ b/administrator/components/com_cpanel/tmpl/cpanel/default.php @@ -21,7 +21,7 @@
    quickicons as $iconmodule) { echo ModuleHelper::renderModule($iconmodule); @@ -31,26 +31,6 @@
    - cpanel && $this->menuitem->hasChildren()) : ?> - menuitem->getChildren() as $item) : ?> - hasChildren()) : ?> -

    title; ?>

    -
      - getChildren() as $child) : ?> -
    • title; ?> - hasChildren()) : ?> -
        - getChildren() as $subchild) : ?> -
      • title; ?>
      • - -
      - -
    • - -
    - - - modules as $module) { diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index d2cb7201e0b58..f73a12f1667e2 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -884,7 +884,8 @@ protected static function parseXmlNode($node, $replace = array()) if ((string) $node['quicktask']) { - $item->getParams()->set('menu-quicktask', (string) $node['quicktask']); + $item->getParams()->set('menu-quicktask', true); + $item->getParams()->set('menu-quicktask-link', (string) $node['quicktask']); $item->getParams()->set('menu-quicktask-title', (string) $node['quicktask-title']); $item->getParams()->set('menu-quicktask-icon', (string) $node['quicktask-icon']); $item->getParams()->set('menu-quicktask-permission', (string) $node['quicktask-permission']); @@ -898,6 +899,8 @@ protected static function parseXmlNode($node, $replace = array()) $item->link = str_replace("{sql:$var}", $val, $item->link); $item->class = str_replace("{sql:$var}", $val, $item->class); $item->icon = str_replace("{sql:$var}", $val, $item->icon); + $params = $item->getParams(); + $params->set('menu-quicktask-link', str_replace("{sql:$var}", $val, $params->get('menu-quicktask-link'))); } return $item; diff --git a/administrator/components/com_menus/presets/joomla.xml b/administrator/components/com_menus/presets/joomla.xml index af67c10a1d7c6..539424ed4dfb3 100644 --- a/administrator/components/com_menus/presets/joomla.xml +++ b/administrator/components/com_menus/presets/joomla.xml @@ -22,7 +22,6 @@ element="com_content" link="index.php?option=com_content" quicktask="index.php?option=com_content&task=article.add" - quicktask-title="MOD_MENU_COM_CONTENT_ARTICLE_ADD" > + class="class:menu" + quicktask="index.php?option=com_menus&task=item.add&menutype={sql:menutype}"> + link="index.php?option=com_users&view=users" + quicktask="index.php?option=com_users&task=user.add"> getParams(); $user = $this->application->getIdentity(); - $link = $params->get('menu-quicktask'); + $link = $params->get('menu-quicktask-link'); $icon = $params->get('menu-quicktask-icon', 'new'); $title = $params->get('menu-quicktask-title', 'MOD_MENU_QUICKTASK_NEW'); $permission = $params->get('menu-quicktask-permission'); From 2f589be7cc9270dd0f273c1ac4446318611a95a4 Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Wed, 20 Feb 2019 21:23:42 +0100 Subject: [PATCH 8/9] Adding dashboard links --- .../sql/updates/mysql/4.0.0-2019-02-20.sql | 19 ++++ .../updates/postgresql/4.0.0-2019-02-20.sql | 23 +++++ .../com_cpanel/View/Cpanel/HtmlView.php | 11 ++- .../com_menus/Helper/MenusHelper.php | 19 +++- .../com_menus/presets/components.xml | 12 +++ .../components/com_menus/presets/content.xml | 87 +++++++++++++++++++ .../components/com_menus/presets/joomla.xml | 4 + .../components/com_menus/presets/menu.xsd | 8 +- .../components/com_menus/presets/menus.xml | 69 +++++++++++++++ .../components/com_menus/presets/users.xml | 73 ++++++++++++++++ .../language/en-GB/en-GB.mod_menu.ini | 6 ++ .../modules/mod_menu/tmpl/default_submenu.php | 12 ++- .../templates/atum/scss/blocks/_sidebar.scss | 11 +++ 13 files changed, 343 insertions(+), 11 deletions(-) create mode 100644 administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-20.sql create mode 100644 administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-20.sql create mode 100644 administrator/components/com_menus/presets/components.xml create mode 100644 administrator/components/com_menus/presets/content.xml create mode 100644 administrator/components/com_menus/presets/menus.xml create mode 100644 administrator/components/com_menus/presets/users.xml diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-20.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-20.sql new file mode 100644 index 0000000000000..7b2c1a9e359b1 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-02-20.sql @@ -0,0 +1,19 @@ +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES +('Content Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"content","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); + +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES +('Menus Submenu', '', NULL, 1, 'cpanel-menus', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"menus","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); + +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES +('Components Submenu', '', NULL, 1, 'cpanel-components', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"components","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); + +INSERT INTO `#__modules` (`title`, `note`, `content`, `ordering`, `position`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `published`, `module`, `access`, `showtitle`, `params`, `client_id`, `language`) VALUES +('Users Submenu', '', NULL, 1, 'cpanel-users', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"users","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); + +INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (LAST_INSERT_ID(), 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-20.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-20.sql new file mode 100644 index 0000000000000..2ebd1f5be4a30 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-02-20.sql @@ -0,0 +1,23 @@ +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Content Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"content","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); + +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Menus Submenu', '', NULL, 1, 'cpanel-menus', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"menus","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); + +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Components Submenu', '', NULL, 1, 'cpanel-components', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"components","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); + +INSERT INTO "#__modules" ("title", "note", "content", "ordering", "position", "checked_out", "checked_out_time", "publish_up", "publish_down", "published", "module", "access", "showtitle", "params", "client_id", "language") VALUES +('Users Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"users","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*') +RETURNING id INTO lastmoduleid; + +INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (lastmoduleid, 0); diff --git a/administrator/components/com_cpanel/View/Cpanel/HtmlView.php b/administrator/components/com_cpanel/View/Cpanel/HtmlView.php index 268b77f4c5cd2..b9c8396616f65 100644 --- a/administrator/components/com_cpanel/View/Cpanel/HtmlView.php +++ b/administrator/components/com_cpanel/View/Cpanel/HtmlView.php @@ -38,6 +38,13 @@ class HtmlView extends BaseHtmlView */ protected $quickicons = null; + /** + * Moduleposition to load + * + * @var string + */ + protected $position = null; + /** * Execute and display a template script. * @@ -55,8 +62,8 @@ public function display($tpl = null) // Display the cpanel modules $dashboard = $app->input->getCmd('dashboard'); - $position = $dashboard ? 'cpanel-' . $dashboard : 'cpanel'; - $this->modules = ModuleHelper::getModules($position); + $this->position = $dashboard ? 'cpanel-' . $dashboard : 'cpanel'; + $this->modules = ModuleHelper::getModules($this->position); $quickicons = $dashboard ? 'icon-' . $dashboard : 'icon'; $this->quickicons = ModuleHelper::getModules($quickicons); diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index f73a12f1667e2..26be43d3c7763 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -613,6 +613,10 @@ public static function getPresets() static::addPreset('modern', 'JLIB_MENUS_PRESET_MODERN', JPATH_ADMINISTRATOR . '/components/com_menus/presets/modern.xml'); static::addPreset('system', 'JLIB_MENUS_PRESET_SYSTEM', JPATH_ADMINISTRATOR . '/components/com_menus/presets/system.xml'); static::addPreset('user', 'JLIB_MENUS_PRESET_USER', JPATH_ADMINISTRATOR . '/components/com_menus/presets/user.xml'); + static::addPreset('content', 'JLIB_MENUS_PRESET_CONTENT', JPATH_ADMINISTRATOR . '/components/com_menus/presets/content.xml'); + static::addPreset('menus', 'JLIB_MENUS_PRESET_MENUS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/menus.xml'); + static::addPreset('components', 'JLIB_MENUS_PRESET_COMPONENTS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/components.xml'); + static::addPreset('users', 'JLIB_MENUS_PRESET_USERS', JPATH_ADMINISTRATOR . '/components/com_menus/presets/users.xml'); // Load from template folder automatically $app = Factory::getApplication(); @@ -824,9 +828,19 @@ protected static function loadXml($elements, $parent, $replace = array()) } // Iterate over the matching records, items goes in the same level (not $item->submenu) as this node. - foreach ($results as $result) + if ('self' == (string) $element['sql_target']) { - static::loadXml($element->menuitem, $parent, $result); + foreach ($results as $result) + { + static::loadXml($element->menuitem, $child, $result); + } + } + else + { + foreach ($results as $result) + { + static::loadXml($element->menuitem, $parent, $result); + } } } } @@ -869,6 +883,7 @@ protected static function parseXmlNode($node, $replace = array()) $item->scope = (string) $node['scope'] ?: 'default'; $item->permission = (string) $node['permission']; $item->ajaxbadge = (string) $node['ajax-badge']; + $item->dashboard = (string) $node['dashboard']; $item->setParams(new Registry(trim($node->params))); $item->getParams()->set('menu-permission', (string) $node['permission']); diff --git a/administrator/components/com_menus/presets/components.xml b/administrator/components/com_menus/presets/components.xml new file mode 100644 index 0000000000000..ae9bb688864bb --- /dev/null +++ b/administrator/components/com_menus/presets/components.xml @@ -0,0 +1,12 @@ + + + + diff --git a/administrator/components/com_menus/presets/content.xml b/administrator/components/com_menus/presets/content.xml new file mode 100644 index 0000000000000..6612b676bd1ea --- /dev/null +++ b/administrator/components/com_menus/presets/content.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/administrator/components/com_menus/presets/joomla.xml b/administrator/components/com_menus/presets/joomla.xml index 539424ed4dfb3..5b84b73fa6327 100644 --- a/administrator/components/com_menus/presets/joomla.xml +++ b/administrator/components/com_menus/presets/joomla.xml @@ -15,6 +15,7 @@ title="MOD_MENU_COM_CONTENT" type="heading" class="class:file-text" + dashboard="content" > - - - - - + @@ -75,5 +71,7 @@ + + diff --git a/administrator/components/com_menus/presets/menus.xml b/administrator/components/com_menus/presets/menus.xml new file mode 100644 index 0000000000000..93dd60d778ed1 --- /dev/null +++ b/administrator/components/com_menus/presets/menus.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + diff --git a/administrator/components/com_menus/presets/users.xml b/administrator/components/com_menus/presets/users.xml new file mode 100644 index 0000000000000..867d49a2673b7 --- /dev/null +++ b/administrator/components/com_menus/presets/users.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/administrator/language/en-GB/en-GB.mod_menu.ini b/administrator/language/en-GB/en-GB.mod_menu.ini index 10a93ddb1e9d0..a92e31b094911 100644 --- a/administrator/language/en-GB/en-GB.mod_menu.ini +++ b/administrator/language/en-GB/en-GB.mod_menu.ini @@ -131,3 +131,9 @@ MOD_MENU_UPDATE_JOOMLA="Joomla" MOD_MENU_UPDATE_SOURCES="Update Sources" MOD_MENU_USER_PROFILE="My Profile" MOD_MENU_XML_DESCRIPTION="This module displays an administrator menu module." + + +MOD_MENU_DASHBOARD_LINK="Dashboard" +MOD_MENU_QUICKTASK_NEW="New Item" +MOD_MENU_COM_CONTENT_MANAGE="Content Settings" +MOD_MENU_COM_CONTENT_MISC="Modules & Media" diff --git a/administrator/modules/mod_menu/tmpl/default_submenu.php b/administrator/modules/mod_menu/tmpl/default_submenu.php index b06ff82bc4a81..5f690988b9d65 100644 --- a/administrator/modules/mod_menu/tmpl/default_submenu.php +++ b/administrator/modules/mod_menu/tmpl/default_submenu.php @@ -105,12 +105,20 @@ echo '' . Text::_($current->get('title')) . ''; } +if ($current->dashboard) +{ + echo ''; +} + if ($current->getParams()->get('menu-quicktask', false)) { $params = $current->getParams(); $user = $this->application->getIdentity(); $link = $params->get('menu-quicktask-link'); - $icon = $params->get('menu-quicktask-icon', 'new'); + $icon = $params->get('menu-quicktask-icon', 'plus'); $title = $params->get('menu-quicktask-title', 'MOD_MENU_QUICKTASK_NEW'); $permission = $params->get('menu-quicktask-permission'); $scope = $current->scope !== 'default' ? $current->scope : null; @@ -118,7 +126,7 @@ if (!$permission || $user->authorise($permission, $scope)) { echo ''; - echo ''; + echo ''; echo '' . Text::_($title) . ''; echo ''; } diff --git a/administrator/templates/atum/scss/blocks/_sidebar.scss b/administrator/templates/atum/scss/blocks/_sidebar.scss index d76d947cb1f68..56cc6b7013a43 100644 --- a/administrator/templates/atum/scss/blocks/_sidebar.scss +++ b/administrator/templates/atum/scss/blocks/_sidebar.scss @@ -69,6 +69,17 @@ li { color: var(--atum-text-light); list-style-type: none; + position: relative; + > a.btn-dashboard { + position: absolute; + right: 40px; + height: 44px; + top: 0; + display: none; + } + &:hover > a.btn-dashboard { + display:block; + } } // All links From 1ef169d7387abf774aa87368af5ebce58b1de5af Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Wed, 20 Feb 2019 22:52:20 +0100 Subject: [PATCH 9/9] Adding install SQL --- installation/sql/mysql/joomla.sql | 14 ++++++++++++-- installation/sql/postgresql/joomla.sql | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 101a0ea897d95..de9485092a57d 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -1331,7 +1331,12 @@ INSERT INTO `#__modules` (`id`, `asset_id`, `title`, `note`, `content`, `orderin (79, 52, 'Multilanguage status', '', '', 1, '', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 'mod_multilangstatus', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (86, 53, 'Joomla Version', '', '', 1, 'status', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_version', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (87, 55, 'Sample Data', '', '', 0, 'cpanel', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_sampledata', 6, 1, '{"bootstrap_size": "6"}', 1, '*'), -(88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); +(88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(89, 0, 'System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(90, 0, 'Content Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"content","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(91, 0, 'Menus Submenu', '', NULL, 1, 'cpanel-menus', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"menus","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(92, 0, 'Components Submenu', '', NULL, 1, 'cpanel-components', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"components","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(93, 0, 'Users Submenu', '', NULL, 1, 'cpanel-users', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"users","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); -- -------------------------------------------------------- @@ -1367,7 +1372,12 @@ INSERT INTO `#__modules_menu` (`moduleid`, `menuid`) VALUES (79, 0), (86, 0), (87, 0), -(88, 0); +(88, 0), +(89, 0), +(90, 0), +(91, 0), +(92, 0), +(93, 0); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index deda6927e884b..bbfbc57a137c3 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -1332,7 +1332,12 @@ INSERT INTO "#__modules" ("id", "asset_id", "title", "note", "content", "orderin (79, 52, 'Multilanguage status', '', '', 1, '', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 0, 'mod_multilangstatus', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (86, 53, 'Joomla Version', '', '', 1, 'status', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_version', 3, 1, '{"layout":"_:default","moduleclass_sfx":"","cache":"0"}', 1, '*'), (87, 55, 'Sample Data', '', '', 0, 'cpanel', 0, '1970-01-01 00:00:00', '1970-01-01 00:00:00', '1970-01-01 00:00:00', 1, 'mod_sampledata', 6, 1, '{"bootstrap_size": "6"}', 1, '*'), -(88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); +(88, 65, 'Need support?', '', '

    You can find help here:
    Joomla! Support forum
    Joomla! Documentation
    Joomla! News

    ', 1, 'sidebar', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_custom', 1, 1, '{"prepare_content":1,"layout":"_:default","moduleclass_sfx":"","cache":1,"cache_time":900,"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(89, 0, 'System Submenu', '', NULL, 1, 'cpanel-system', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"system","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(90, 0, 'Content Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"content","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(91, 0, 'Menus Submenu', '', NULL, 1, 'cpanel-menus', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"menus","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(92, 0, 'Components Submenu', '', NULL, 1, 'cpanel-components', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"components","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'), +(93, 0, 'Users Submenu', '', NULL, 1, 'cpanel-content', 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 1, 'mod_submenu', 1, 0, '{"menutype":"*","preset":"users","layout":"_:default","moduleclass_sfx":"","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', 1, '*'); SELECT setval('#__modules_id_seq', 88, false); @@ -1368,7 +1373,12 @@ INSERT INTO "#__modules_menu" ("moduleid", "menuid") VALUES (79, 0), (86, 0), (87, 0), -(88, 0); +(88, 0), +(89, 0), +(90, 0), +(91, 0), +(92, 0), +(93, 0); -- -- Table structure for table `#__newsfeeds`