diff --git a/.drone.yml b/.drone.yml index 9f197ff68a3..f37d0bfe6e4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -269,6 +269,6 @@ steps: --- kind: signature -hmac: 71729a12ae3556e03f924ac95c8a5cd14bb6a3c2d20ef6768fdd1e853397fd22 +hmac: 53e23beca546bde246f812a726320210f33d231106cb154a65cc900ecbf7502e ... diff --git a/administrator/components/com_modules/src/Model/ModulesModel.php b/administrator/components/com_modules/src/Model/ModulesModel.php index aa337ba202a..e3ca5fe087a 100644 --- a/administrator/components/com_modules/src/Model/ModulesModel.php +++ b/administrator/components/com_modules/src/Model/ModulesModel.php @@ -13,6 +13,7 @@ use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; +use Joomla\CMS\Filesystem\Path; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\ListModel; use Joomla\Database\DatabaseQuery; @@ -178,6 +179,8 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $listOrder = $this->getState('list.ordering', 'a.position'); $listDirn = $this->getState('list.direction', 'asc'); + $positionList = $this->getValidPositions(); + // If ordering by fields that need translate we need to sort the array of objects after translating them. if (in_array($listOrder, array('pages', 'name'))) { @@ -201,7 +204,14 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $this->setState('list.start', 0); } - return array_slice($result, $limitstart, $limit ?: null); + $result = array_slice($result, $limitstart, $limit ?: null); + + foreach ($result as $row) + { + $row->activePosition = in_array($row->position, $positionList); + } + + return $result; } // If ordering by fields that doesn't need translate just order the query. @@ -226,6 +236,11 @@ protected function _getList($query, $limitstart = 0, $limit = 0) // Translate the results. $this->translate($result); + foreach ($result as $row) + { + $row->activePosition = in_array($row->position, $positionList); + } + return $result; } @@ -479,4 +494,64 @@ protected function getEmptyStateQuery() return $query; } + + /** + * Method to get the positions corresponding to a template. + * + * @return array List of all active template's position names. + * + * @since __DEPLOY_VERSION__ + */ + public function getValidPositions() + { + $clientId = $this->getState('client_id'); + $db = $this->getDbo(); + + // Get List of Template Style IDs that are used in Menus + $templateStylesQuery = $db->getQuery(true); + $templateStylesQuery->select('DISTINCT ' . $db->quoteName('template_style_id')) + ->from($db->quoteName('#__menu')); + + $templateStylesQuery->where($this->_db->quoteName('published') . ' = 1') + ->where($db->quoteName('client_id') . ' = :clientid'); + + // Get List of Template Names that are either set as Default or used in a menu + $query = $db->getQuery(true); + $query->select('DISTINCT ' . $db->quoteName('template')) + ->from($db->quoteName('#__template_styles')); + + $query->where($db->quoteName('client_id') . ' = :client_id') + ->where($db->quoteName('home') . ' = 1') + ->orWhere($db->quoteName('id') . ' IN (' . $templateStylesQuery . ')') + ->bind(':clientid', $clientId, ParameterType::INTEGER) + ->bind(':client_id', $clientId, ParameterType::INTEGER); + $db->setQuery($query); + $templateList = $db->loadColumn(); + + $positions = []; + + foreach ($templateList as $templateName) + { + $basePath = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE; + $path = Path::clean($basePath . '/templates/' . $templateName . '/templateDetails.xml'); + + if (file_exists($path)) + { + $xml = simplexml_load_file($path); + + if (isset($xml->positions[0])) + { + foreach ($xml->positions[0] as $position) + { + if (!array_key_exists((string) $position, $positions)) + { + $positions[] = (string) $position; + } + } + } + } + } + + return $positions; + } } diff --git a/administrator/components/com_modules/tmpl/modules/default.php b/administrator/components/com_modules/tmpl/modules/default.php index bd95ae2d29c..211969ebc1b 100644 --- a/administrator/components/com_modules/tmpl/modules/default.php +++ b/administrator/components/com_modules/tmpl/modules/default.php @@ -147,9 +147,12 @@ position) : ?> - + " aria-labelledby="pv-id ?>"> position; ?> + diff --git a/administrator/components/com_modules/tmpl/modules/modal.php b/administrator/components/com_modules/tmpl/modules/modal.php index 972919a7dd7..2c57aea0a68 100644 --- a/administrator/components/com_modules/tmpl/modules/modal.php +++ b/administrator/components/com_modules/tmpl/modules/modal.php @@ -99,7 +99,10 @@ position) : ?> - escape($item->position); ?> + escape($item->position); ?> + diff --git a/administrator/language/en-GB/joomla.ini b/administrator/language/en-GB/joomla.ini index f52986c131e..55e161f3f46 100644 --- a/administrator/language/en-GB/joomla.ini +++ b/administrator/language/en-GB/joomla.ini @@ -554,6 +554,8 @@ JGLOBAL_PAGINATION_RESULTS_DESC="Show or hide pagination summary, for example, & JGLOBAL_PAGINATION_RESULTS_LABEL="Pagination Summary" JGLOBAL_PASSWORD="Password" JGLOBAL_PASSWORD_RESET_REQUIRED="You are required to reset your password before proceeding." +JGLOBAL_POSITION_INVALID="Invalid Position" +JGLOBAL_POSITION_VALID="Valid Position" JGLOBAL_PERMISSIONS_ANCHOR="Set Permissions" JGLOBAL_PREVIEW="Preview" JGLOBAL_PREVIEW_POSITION="Position: %s" diff --git a/administrator/templates/atum/templateDetails.xml b/administrator/templates/atum/templateDetails.xml index 2badbf0b226..f5dd0ad1b45 100644 --- a/administrator/templates/atum/templateDetails.xml +++ b/administrator/templates/atum/templateDetails.xml @@ -40,6 +40,13 @@ toolbar cpanel + cpanel-components + cpanel-content + cpanel-help + cpanel-menus + cpanel-privacy + cpanel-system + cpanel-users icon login customtop diff --git a/api/language/en-GB/joomla.ini b/api/language/en-GB/joomla.ini index d77a4d87690..2ed9651471c 100644 --- a/api/language/en-GB/joomla.ini +++ b/api/language/en-GB/joomla.ini @@ -550,6 +550,8 @@ JGLOBAL_PAGINATION_RESULTS_DESC="Show or hide pagination summary, for example, & JGLOBAL_PAGINATION_RESULTS_LABEL="Pagination Summary" JGLOBAL_PASSWORD="Password" JGLOBAL_PASSWORD_RESET_REQUIRED="You are required to reset your password before proceeding." +JGLOBAL_POSITION_INVALID="Invalid Position" +JGLOBAL_POSITION_VALID="Valid Position" JGLOBAL_PERMISSIONS_ANCHOR="Set Permissions" JGLOBAL_PREVIEW="Preview" JGLOBAL_PREVIEW_POSITION="Position: %s"