From 4fccafa07f65eaa1ac70a18abd20c601004fdb83 Mon Sep 17 00:00:00 2001 From: chmst Date: Mon, 8 Jul 2019 11:57:50 +0200 Subject: [PATCH 01/25] Improvements for quickicons - params for icon count, sr-only text --- .../Controller/DisplayController.php | 12 ++- .../com_menus/Controller/ItemsController.php | 2 - .../language/en-GB/en-GB.mod_quickicon.ini | 31 ++++-- .../mod_quickicon/Helper/QuickIconHelper.php | 95 ++++++++++++++----- .../modules/mod_quickicon/mod_quickicon.xml | 51 +++++----- .../mod_quickicon/js/quickicon.es6.js | 12 +++ layouts/joomla/quickicons/icon.php | 30 ++++-- 7 files changed, 165 insertions(+), 68 deletions(-) diff --git a/administrator/components/com_cache/Controller/DisplayController.php b/administrator/components/com_cache/Controller/DisplayController.php index de02963b282..f554895a580 100644 --- a/administrator/components/com_cache/Controller/DisplayController.php +++ b/administrator/components/com_cache/Controller/DisplayController.php @@ -33,8 +33,6 @@ class DisplayController extends BaseController /** * Method to get The Cache Size - * - * @return integer The cache size in kB * * @since 4.0 */ @@ -44,7 +42,7 @@ public function getQuickiconContent() $data = $model->getData(); - $size = '0.0'; + $size = 0; if (!empty($data)) { @@ -55,7 +53,13 @@ public function getQuickiconContent() } // Number bytes are returned in format xxx.xx MB - $result = strstr(HTMLHelper::_('number.bytes', $size, 'MB', 1, false), '.', true); + $bytes = HTMLHelper::_('number.bytes', $size, 'MB', 1); + $result = strstr($bytes, '.', true); + + // No dot found, so just take the converted size + if (!$result) { + $result = $bytes; + } // Return number only echo new JsonResponse($result); diff --git a/administrator/components/com_menus/Controller/ItemsController.php b/administrator/components/com_menus/Controller/ItemsController.php index 650cc353ecc..0776d9b572b 100644 --- a/administrator/components/com_menus/Controller/ItemsController.php +++ b/administrator/components/com_menus/Controller/ItemsController.php @@ -63,8 +63,6 @@ public function getModel($name = 'Item', $prefix = 'Administrator', $config = ar /** * Method to get the number of published frontend menu items for quickicons - * - * @return integer The amount of items * * @since 4.0 */ diff --git a/administrator/language/en-GB/en-GB.mod_quickicon.ini b/administrator/language/en-GB/en-GB.mod_quickicon.ini index ef66e982b53..30abbbee12a 100644 --- a/administrator/language/en-GB/en-GB.mod_quickicon.ini +++ b/administrator/language/en-GB/en-GB.mod_quickicon.ini @@ -8,33 +8,50 @@ MOD_QUICKICON_ADD_NEW="New %s" MOD_QUICKICON_AMOUNT_THSD="THSD" MOD_QUICKICON_ARTICLE_MANAGER="Articles" MOD_QUICKICON_ARTICLE_MANAGER_1="Article" -MOD_QUICKICON_CACHE="Cache (MB)" +MOD_QUICKICON_ARTICLE_SRONLY="Articles: %s articles are available" +MOD_QUICKICON_ARTICLE_SRONLY_0="Articles: No is available" +MOD_QUICKICON_ARTICLE_SRONLY_1="Articles: One article is available" +MOD_QUICKICON_CACHE="Cache" +MOD_QUICKICON_CACHE_SRONLY="Cache: %s MB are used" +MOD_QUICKICON_CACHE_SRONLY_1="Cache: %s MB is used" +MOD_QUICKICON_CACHE_SRONLY_0="Cache: The Cache is empty" MOD_QUICKICON_CATEGORY_ADD="New Category" MOD_QUICKICON_CATEGORY_MANAGER="Article Categories" MOD_QUICKICON_CATEGORY_MANAGER_1="Article Category" +MOD_QUICKICON_CATEGORY_SRONLY="Article categories: %s categories are available" +MOD_QUICKICON_CATEGORY_SRONLY_0="Article categories: No category is available" +MOD_QUICKICON_CATEGORY_SRONLY_1="Article categories: One category is available" MOD_QUICKICON_CHECKIN="Checkin" MOD_QUICKICON_CHECKINS="Global Checkin" -MOD_QUICKICON_CHECKIN_ALL="Global Checkin" +MOD_QUICKICON_CHECKIN_SRONLY="Global Checkin: %s Items are locked." +MOD_QUICKICON_CHECKIN_SRONLY_0="Global Checkin: No Items are locked." +MOD_QUICKICON_CHECKIN_SRONLY_1="Global Checkin: One Item is locked." MOD_QUICKICON_CONFIGURATION="Configuration" MOD_QUICKICON_CONTENT="Content" -MOD_QUICKICON_EXTENSIONS="Extensions" -MOD_QUICKICON_EXTENSION_MANAGER="Extension Manager" MOD_QUICKICON_GLOBAL_CONFIGURATION="Global Configuration" MOD_QUICKICON_GROUP_DESC="The group of this module (this value is compared with the group value used in Quick Icons plugins to inject icons). The 'mod_quickicon' group always displays the Joomla! core icons." MOD_QUICKICON_GROUP_LABEL="Group" MOD_QUICKICON_HEADER_ICON_LABEL="Header Icon" MOD_QUICKICON_INSTALL_EXTENSIONS="Install Extensions" -MOD_QUICKICON_LANGUAGE_MANAGER="Languages" +MOD_QUICKICON_LOAD_PLUGINS_LABEL="Load 3rd party plugins" MOD_QUICKICON_MAINTENANCE="Maintenance" MOD_QUICKICON_MEDIA_MANAGER="Media" MOD_QUICKICON_MENUITEMS_ADD="New Menu Item" MOD_QUICKICON_MENUITEMS_MANAGER="Menu Items" MOD_QUICKICON_MENUITEMS_MANAGER_1="Menu Item" +MOD_QUICKICON_MENUITEMS_SRONLY="Menu Items. %s Menu Items are available." +MOD_QUICKICON_MENUITEMS_SRONLY_0="Menu Items. No Menu Items are available." +MOD_QUICKICON_MENUITEMS_SRONLY_1="Menu Items: One Menu Item is available." MOD_QUICKICON_MODULE_ADD="New Module" MOD_QUICKICON_MODULE_MANAGER="Modules" MOD_QUICKICON_MODULE_MANAGER_1="Module" +MOD_QUICKICON_MODULE_SRONLY="Modules. %s Modules are available" +MOD_QUICKICON_MODULE_SRONLY_0="Modules. No Module is available" +MOD_QUICKICON_MODULE_SRONLY_1="Modules: One Module is available" MOD_QUICKICON_NAV_LABEL="Quick Links" MOD_QUICKICON_PLUGIN_MANAGER="Plugins" +MOD_QUICKICON_PLUGIN_SRONLY="Plugins. %s Plugins are available" +MOD_QUICKICON_PLUGIN_SRONLY_1="Modules: One Plugin is available" MOD_QUICKICON_SHOW_ARTICLES_LABEL="Articles Icon" MOD_QUICKICON_SHOW_CACHE_LABEL="Cache Icon" MOD_QUICKICON_SHOW_CATEGORIES_LABEL="Categories Icon" @@ -49,7 +66,6 @@ MOD_QUICKICON_SHOW_MODULES_LABEL="Modules Icon" MOD_QUICKICON_SHOW_OVERRIDEUPDATE_LABEL="Override Update Check" MOD_QUICKICON_SHOW_PLUGINS_LABEL="Plugins Icon" MOD_QUICKICON_SHOW_PRIVACYREQUEST_LABEL="Privacy Requests" -MOD_QUICKICON_LOAD_PLUGINS_LABEL="Load 3rd party plugins" MOD_QUICKICON_SHOW_TEMPLATES_LABEL="Templates Icon" MOD_QUICKICON_SHOW_USERS_LABEL="User Icon" MOD_QUICKICON_SITE="Icons Site" @@ -63,4 +79,7 @@ MOD_QUICKICON_UPDATE="Icons Update" MOD_QUICKICON_USERS="Users" MOD_QUICKICON_USER_MANAGER="Users" MOD_QUICKICON_USER_MANAGER_1="User" +MOD_QUICKICON_USER_SRONLY="Users: %s Users are activated." +MOD_QUICKICON_USER_SRONLY_1="Users: One User is activated." +MOD_QUICKICON_WITH_COUNT="Show and count Items" MOD_QUICKICON_XML_DESCRIPTION="This module shows Quick Icons that are visible on the Dashboard (administrator area home page)." diff --git a/administrator/modules/mod_quickicon/Helper/QuickIconHelper.php b/administrator/modules/mod_quickicon/Helper/QuickIconHelper.php index 1a54ad362bf..8d12c7a719a 100644 --- a/administrator/modules/mod_quickicon/Helper/QuickIconHelper.php +++ b/administrator/modules/mod_quickicon/Helper/QuickIconHelper.php @@ -65,54 +65,82 @@ public static function &getButtons(Registry $params, CMSApplication $application if ($params->get('show_users')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_users&task=users.getQuickiconContent&format=json', - 'image' => 'fa fa-users', - 'link' => Route::_('index.php?option=com_users'), - 'linkadd' => Route::_('index.php?option=com_users&task=user.add'), - 'name' => 'MOD_QUICKICON_USER_MANAGER', - 'access' => array('core.manage', 'com_users', 'core.create', 'com_users'), - 'group' => 'MOD_QUICKICON_SITE', + $tmp = [ + 'image' => 'fa fa-users', + 'srOnly' => 'MOD_QUICKICON_USER_SRONLY', + 'link' => Route::_('index.php?option=com_users'), + 'linkadd' => Route::_('index.php?option=com_users&task=users.add'), + 'name' => 'MOD_QUICKICON_USER_MANAGER', + 'access' => array('core.manage', 'com_users', 'core.create', 'com_users'), + 'group' => 'MOD_QUICKICON_SITE', ]; + + if ($params->get('show_users') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_users&task=users.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } - if ($params->get('show_menuItems')) + if ($params->get('show_menuitems')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_menus&task=items.getQuickiconContent&format=json', + $tmp = [ 'image' => 'fa fa-list', + 'srOnly' => 'MOD_QUICKICON_MENUITEMS_SRONLY', 'link' => Route::_('index.php?option=com_menus'), 'linkadd' => Route::_('index.php?option=com_menus&task=item.add'), 'name' => 'MOD_QUICKICON_MENUITEMS_MANAGER', 'access' => array('core.manage', 'com_menus', 'core.create', 'com_menus'), 'group' => 'MOD_QUICKICON_STRUCTURE', ]; + + if ($params->get('show_menuitems') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_menus&task=items.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } if ($params->get('show_articles')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_content&task=articles.getQuickiconContent&format=json', + $tmp = [ 'image' => 'fa fa-file-alt', + 'srOnly' => 'MOD_QUICKICON_ARTICLE_SRONLY', 'link' => Route::_('index.php?option=com_content'), 'linkadd' => Route::_('index.php?option=com_content&task=article.add'), 'name' => 'MOD_QUICKICON_ARTICLE_MANAGER', 'access' => array('core.manage', 'com_content', 'core.create', 'com_content'), 'group' => 'MOD_QUICKICON_SITE', ]; + + if ($params->get('show_articles') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_content&task=articles.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } if ($params->get('show_categories')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_categories&task=categories.getQuickiconContent&format=json', - 'image' => 'fa fa-folder-open', + $tmp = [ 'link' => Route::_('index.php?option=com_categories'), + 'srOnly' => 'MOD_QUICKICON_CATEGORY_SRONLY', + 'image' => 'fa fa-folder-open', 'linkadd' => Route::_('index.php?option=com_categories&task=category.add'), 'name' => 'MOD_QUICKICON_CATEGORY_MANAGER', 'access' => array('core.manage', 'com_categories', 'core.create', 'com_categories'), 'group' => 'MOD_QUICKICON_SITE', ]; + + if ($params->get('show_categories') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_categories&task=categories.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } if ($params->get('show_media')) @@ -128,27 +156,41 @@ public static function &getButtons(Registry $params, CMSApplication $application if ($params->get('show_modules')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_modules&task=modules.getQuickiconContent&format=json', + $tmp = [ 'image' => 'fa fa-cube', + 'srOnly' => 'MOD_QUICKICON_MODULE_SRONLY', 'link' => Route::_('index.php?option=com_modules'), 'linkadd' => Route::_('index.php?option=com_modules&view=select'), 'name' => 'MOD_QUICKICON_MODULE_MANAGER', 'access' => array('core.manage', 'com_modules'), 'group' => 'MOD_QUICKICON_SITE' ]; + + if ($params->get('show_modules') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_modules&task=modules.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } if ($params->get('show_plugins')) { - self::$buttons[$key][] = [ - 'ajaxurl' => 'index.php?option=com_plugins&task=plugins.getQuickiconContent&format=json', - 'image' => 'fa fa-plug', - 'link' => Route::_('index.php?option=com_plugins'), - 'name' => 'MOD_QUICKICON_PLUGIN_MANAGER', - 'access' => array('core.manage', 'com_plugins'), - 'group' => 'MOD_QUICKICON_SITE' + $tmp = [ + 'image' => 'fa fa-plug', + 'srOnly' => 'MOD_QUICKICON_PLUGIN_SRONLY', + 'link' => Route::_('index.php?option=com_plugins'), + 'name' => 'MOD_QUICKICON_PLUGIN_MANAGER', + 'access' => array('core.manage', 'com_plugins'), + 'group' => 'MOD_QUICKICON_SITE' ]; + + if ($params->get('show_plugins') == 2) + { + $tmp['ajaxurl'] = 'index.php?option=com_plugins&task=plugins.getQuickiconContent&format=json'; + } + + self::$buttons[$key][] = $tmp; } if ($params->get('show_templates')) @@ -166,6 +208,7 @@ public static function &getButtons(Registry $params, CMSApplication $application { self::$buttons[$key][] = [ 'ajaxurl' => 'index.php?option=com_checkin&task=getMenuBadgeData&format=json', + 'srOnly' => 'MOD_QUICKICON_CHECKIN_SRONLY', 'image' => 'fa fa-unlock-alt', 'link' => Route::_('index.php?option=com_checkin'), 'name' => 'MOD_QUICKICON_CHECKINS', @@ -178,6 +221,7 @@ public static function &getButtons(Registry $params, CMSApplication $application { self::$buttons[$key][] = [ 'ajaxurl' => 'index.php?option=com_cache&task=display.getQuickiconContent&format=json', + 'srOnly' => 'MOD_QUICKICON_CACHE_SRONLY', 'image' => 'fa fa-cloud', 'link' => Route::_('index.php?option=com_cache'), 'name' => 'MOD_QUICKICON_CACHE', @@ -215,6 +259,7 @@ public static function &getButtons(Registry $params, CMSApplication $application { $default = array( 'link' => null, + 'sronly' => null, 'image' => null, 'text' => null, 'name' => null, diff --git a/administrator/modules/mod_quickicon/mod_quickicon.xml b/administrator/modules/mod_quickicon/mod_quickicon.xml index 0ddf7d5b853..edf43237489 100644 --- a/administrator/modules/mod_quickicon/mod_quickicon.xml +++ b/administrator/modules/mod_quickicon/mod_quickicon.xml @@ -40,8 +40,8 @@ @@ -50,8 +50,8 @@ @@ -60,8 +60,8 @@ @@ -69,79 +69,79 @@ + + + + + + @@ -155,12 +155,14 @@ label="JFIELD_ALT_LAYOUT_LABEL" class="custom-select" /> + + JGLOBAL_USE_GLOBAL + -
> - +
aria-hidden="true"> +
+ +
+
+ -