From 90a89fddf8e70d036b3779022a1477dc632f78ba Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Thu, 25 Aug 2016 14:28:58 +0100 Subject: [PATCH] Revert "css fix thanks @C-Lodder" This reverts commit f7320cfb331e018b179c9356b642dac330f55c22. --- components/com_config/model/modules.php | 128 ++---------------- .../view/modules/tmpl/default_positions.php | 18 +-- media/jui/css/chosen.css | 4 +- 3 files changed, 14 insertions(+), 136 deletions(-) diff --git a/components/com_config/model/modules.php b/components/com_config/model/modules.php index a1ad3b7d5af8f..6bbc2635a9a0e 100644 --- a/components/com_config/model/modules.php +++ b/components/com_config/model/modules.php @@ -3,7 +3,7 @@ * @package Joomla.Site * @subpackage com_config * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ @@ -131,7 +131,7 @@ public function getPositions() // Load templateDetails.xml file $path = JPath::clean(JPATH_BASE . '/templates/' . $templateName . '/templateDetails.xml'); - $currentTemplatePositions = array(); + $currentPositions = array(); if (file_exists($path)) { @@ -139,129 +139,21 @@ public function getPositions() if (isset($xml->positions[0])) { - // Load language files - $lang->load('tpl_' . $templateName . '.sys', JPATH_BASE, null, false, true) - || $lang->load('tpl_' . $templateName . '.sys', JPATH_BASE . '/templates/' . $templateName, null, false, true); - foreach ($xml->positions[0] as $position) { - $value = (string) $position; - $text = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'TPL_' . strtoupper($templateName) . '_POSITION_' . strtoupper($value)); + // Load language files + $lang->load('tpl_' . $templateName . '.sys', JPATH_BASE, null, false, true) + || $lang->load('tpl_' . $templateName . '.sys', JPATH_BASE . '/templates/' . $templateName, null, false, true); + + $key = (string) $position; + $value = preg_replace('/[^a-zA-Z0-9_\-]/', '_', 'TPL_' . strtoupper($templateName) . '_POSITION_' . strtoupper($key)); // Construct list of positions - $currentTemplatePositions[] = self::createOption($value, JText::_($text) . ' [' . $value . ']'); + $currentPositions[$key] = JText::_($value) . ' [' . $key . ']'; } } } - $templateGroups = array(); - - // Add an empty value to be able to deselect a module position - $option = self::createOption(); - $templateGroups[''] = self::createOptionGroup('', array($option)); - - $templateGroups[$templateName] = self::createOptionGroup($templateName, $currentTemplatePositions); - - // Add custom position to options - $customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION'); - - $editPositions = true; - $customPositions = self::getActivePositions(0, $editPositions); - $templateGroups[$customGroupText] = self::createOptionGroup($customGroupText, $customPositions); - - return $templateGroups; - } - - /** - * Get a list of modules positions - * - * @param integer $clientId Client ID - * @param boolean $editPositions Allow to edit the positions - * - * @return array A list of positions - */ - public static function getActivePositions($clientId, $editPositions = false) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('DISTINCT(position)') - ->from('#__modules') - ->where($db->quoteName('client_id') . ' = ' . (int) $clientId) - ->order('position'); - - $db->setQuery($query); - - try - { - $positions = $db->loadColumn(); - $positions = is_array($positions) ? $positions : array(); - } - catch (RuntimeException $e) - { - JError::raiseWarning(500, $e->getMessage()); - - return; - } - - // Build the list - $options = array(); - - foreach ($positions as $position) - { - if (!$position && !$editPositions) - { - $options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::'); - } - else - { - $options[] = JHtml::_('select.option', $position, $position); - } - } - - return $options; - } - - /** - * Create and return a new Option - * - * @param string $value The option value [optional] - * @param string $text The option text [optional] - * - * @return object The option as an object (stdClass instance) - * - * @since 3.0 - */ - private static function createOption($value = '', $text = '') - { - if (empty($text)) - { - $text = $value; - } - - $option = new stdClass; - $option->value = $value; - $option->text = $text; - - return $option; - } - - /** - * Create and return a new Option Group - * - * @param string $label Value and label for group [optional] - * @param array $options Array of options to insert into group [optional] - * - * @return array Return the new group as an array - * - * @since 3.0 - */ - private static function createOptionGroup($label = '', $options = array()) - { - $group = array(); - $group['value'] = $label; - $group['text'] = $label; - $group['items'] = $options; - - return $group; + return $currentPositions; } } diff --git a/components/com_config/view/modules/tmpl/default_positions.php b/components/com_config/view/modules/tmpl/default_positions.php index 2809582242885..69bf0cbf1f532 100644 --- a/components/com_config/view/modules/tmpl/default_positions.php +++ b/components/com_config/view/modules/tmpl/default_positions.php @@ -3,24 +3,12 @@ * @package Joomla.Site * @subpackage com_config * - * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. + * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; -$positions = $this->model->getPositions(); - -// Add custom position to options -$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION'); -// Build field -$attr = array( - 'id' => 'jform_position', - 'list.select' => $this->item['position'], - 'list.attr' => 'class="chzn-custom-value" ' - . 'data-custom_group_text="' . $customGroupText . '" ' - . 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" ' - . 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ' -); +$positions = $this->model->getPositions(); -echo JHtml::_('select.groupedlist', $positions, 'jform[position]', $attr); +echo JHtml::_('select.genericlist', $positions, 'jform[position]', '', '', '', $this->item['position']); diff --git a/media/jui/css/chosen.css b/media/jui/css/chosen.css index 5c5d6ca89c79a..b948faeaceb4c 100644 --- a/media/jui/css/chosen.css +++ b/media/jui/css/chosen.css @@ -332,9 +332,7 @@ This file is generated by `grunt build`, do not edit it by hand. background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); - /* JUI remove next line */ - /* box-shadow: 0 1px 0 #fff inset; */ - + box-shadow: 0 1px 0 #fff inset; } .chzn-container-active.chzn-with-drop .chzn-single div { border-left: none;