Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

Commit

Permalink
#319: Update template overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Janssens committed Jun 28, 2017
1 parent ba5e9fe commit 22bf8b3
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
* @package Joomla.Administrator
* @subpackage com_config
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2015 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

// Load tooltips behavior
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('bootstrap.tooltip');

// Load JS message titles
Expand All @@ -36,7 +38,7 @@

<div class="k-container">

<form class="k-container__full" action="<?php echo JRoute::_('index.php?option=com_config'); ?>" id="application-form" method="post" name="adminForm">
<form class="k-container__full" action="<?php echo JRoute::_('index.php?option=com_config'); ?>" id="application-form" method="post" name="adminForm" class="form-validate">

<?php echo $this->loadTemplate('permissions'); ?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
<div class="k-sidebar-item__header">
<?php echo JText::_('COM_CONFIG_SYSTEM'); ?>
</div>
<?php if ($this->userIsSuperAdmin): ?>
<ul class="k-list">
<?php if ($this->userIsSuperAdmin): ?>
<li class="active">
<a href="index.php?option=com_config"><?php echo JText::_('COM_CONFIG_GLOBAL_CONFIGURATION'); ?></a>
</li>
<?php endif; ?>
<li class="active">
<a href="index.php?option=com_config"><?php echo JText::_('COM_CONFIG_GLOBAL_CONFIGURATION'); ?></a>
</li>
</ul>
<?php endif; ?>
<div class="k-sidebar-item__header">
<?php echo JText::_('COM_CONFIG_COMPONENT_FIELDSET_LABEL'); ?>
</div>
<ul class="k-list">
<?php foreach ($this->components as $component) : ?>
<li>
<a href="index.php?option=com_config&view=component&component=<?php echo $component; ?>"><?php echo JText::_($component); ?></a>
</li>
<?php endforeach; ?>
<?php foreach ($this->components as $component) : ?>
<li>
<a href="index.php?option=com_config&view=component&component=<?php echo $component; ?>"><?php echo JText::_($component); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package Joomla.Administrator
* @subpackage com_config
*
* @copyright Copyright (C) 2005 - 2012 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
*/

Expand All @@ -14,76 +14,107 @@

// Load the tooltip behavior.
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');

// Load JS message titles
JText::script('ERROR');
JText::script('WARNING');
JText::script('NOTICE');
JText::script('MESSAGE');

JFactory::getDocument()->addScriptDeclaration(
'
Joomla.submitbutton = function(task)
{
if (task === "config.cancel.component" || document.formvalidator.isValid(document.getElementById("component-form")))
{
jQuery("#permissions-sliders select").attr("disabled", "disabled");
Joomla.submitform(task, document.getElementById("component-form"));
}
};
// Select first tab
jQuery(document).ready(function() {
jQuery("#configTabs a:first").tab("show");
});'
);
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (document.formvalidator.isValid(document.id('component-form')))
{
Joomla.submitform(task, document.getElementById('component-form'));
}
}
</script>

<?php JFactory::getDocument()->setBuffer($this->loadTemplate('navigation'), 'modules', 'sidebar'); ?>

<div class="k-container">
<form class="k-container__full" action="<?php echo JRoute::_('index.php?option=com_config'); ?>" id="component-form" method="post" name="adminForm" autocomplete="off">
<?php $fieldSets = $this->form->getFieldsets(); ?>
<ul class="nav nav-tabs<?php echo count($fieldSets) == 1 ? ' k-hidden' : '';?>" id="configTabs">
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $label = empty($fieldSet->label) ? 'COM_CONFIG_' . $name . '_FIELDSET_LABEL' : $fieldSet->label; ?>
<li><a href="#<?php echo $name; ?>" data-toggle="tab"><?php echo JText::_($label); ?></a></li>
<?php endforeach; ?>
</ul>
<?php echo count($fieldSets) > 1 ? '<div class="tab-content">' : '';?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php echo count($fieldSets) > 1 ? '<div class="tab-pane" id="'.$name.'">' : '';?>
<form class="form-validate form-horizontal k-tabs-container" action="<?php echo JRoute::_('index.php?option=com_config'); ?>" id="component-form" method="post" name="adminForm" autocomplete="off">
<?php $fieldSets = $this->fieldsets; ?>
<?php if(count($fieldSets) > 1) : ?>
<ul class="nav nav-tabs" id="configTabs">
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php $rel = ''; ?>
<?php if (!empty($fieldSet->showon)) : ?>
<?php JHtml::_('jquery.framework'); ?>
<?php JHtml::_('script', 'jui/cms.js', false, true); ?>
<?php $showonarr = array(); ?>
<?php foreach (preg_split('%\[AND\]|\[OR\]%', $fieldSet->showon) as $showonfield) : ?>
<?php $showon = explode(':', $showonfield, 2); ?>
<?php $showonarr[] = array(
'field' => $this->form->getFormControl() . '[' . $showon[0] . ']',
'values' => explode(',', $showon[1]),
'op' => (preg_match('%\[(AND|OR)\]' . $showonfield . '%', $fieldSet->showon, $matches)) ? $matches[1] : ''
); ?>
<?php endforeach; ?>
<?php $rel = ' data-showon=\'' . json_encode($showonarr) . '\''; ?>
<?php endif; ?>
<?php $label = empty($fieldSet->label) ? 'COM_CONFIG_' . $name . '_FIELDSET_LABEL' : $fieldSet->label; ?>
<li<?php echo $rel; ?>><a data-toggle="tab" href="#<?php echo $name; ?>"><?php echo JText::_($label); ?></a></li>
<?php endforeach; ?>
</ul><!-- /configTabs -->
<?php endif ?>

<?php echo count($fieldSets) > 1 ? '<div class="tab-content" id="configContent">' : '';?>
<?php foreach ($this->fieldsets as $name => $fieldSet) : ?>
<div class="tab-pane" id="<?php echo $name; ?>">
<div class="k-container">
<?php if (count($fieldSets) == 1) : ?>
<div class="k-heading"><?php echo JText::_($fieldSet->label); ?></div>
<?php
if (isset($fieldSet->description) && !empty($fieldSet->description))
{
echo '<p class="k-alert k-alert--info">' . JText::_($fieldSet->description) . '</p>';
}
?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<?php
$class = '';
$rel = '';
if ($showon = $field->getAttribute('showon'))
{
JHtml::_('jquery.framework');
JHtml::_('script', 'jui/cms.js', false, true);
$id = $this->form->getFormControl();
$showon = explode(':', $showon, 2);
$class = ' showon_' . implode(' showon_', explode(',', $showon[1]));
$rel = ' rel="showon_' . $id . '[' . $showon[0] . ']"';
}
?>
<div class="control-group<?php echo $class; ?>"<?php echo $rel; ?>>
<?php if (!$field->hidden && $name != "permissions") : ?>
<div class="control-label">
<?php endif ?>
<?php if (isset($fieldSet->description) && !empty($fieldSet->description)) : ?>
<p class="k-alert k-alert--info"><?php echo JText::_($fieldSet->description) ?></p>
<?php endif ?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<?php $datashowon = ''; ?>
<?php if ($showonstring = $field->getAttribute('showon')) : ?>
<?php JHtml::_('jquery.framework'); ?>
<?php JHtml::_('script', 'jui/cms.js', false, true); ?>
<?php $showonarr = array(); ?>
<?php foreach (preg_split('%\[AND\]|\[OR\]%', $showonstring) as $showonfield) : ?>
<?php $showon = explode(':', $showonfield, 2); ?>
<?php $showonarr[] = array(
'field' => $this->form->getFormControl() . '[' . $this->form->getFieldAttribute($showon[0], 'name') . ']',
'values' => explode(',', $showon[1]),
'op' => (preg_match('%\[(AND|OR)\]' . $showonfield . '%', $showonstring, $matches)) ? $matches[1] : ''
); ?>
<?php endforeach; ?>
<?php $datashowon = ' data-showon=\'' . json_encode($showonarr) . '\''; ?>
<?php endif; ?>
<?php if ($field->hidden) : ?>
<?php echo $field->input; ?>
<?php else : ?>
<div class="k-form-group"<?php echo $datashowon; ?>>
<?php if ($name != "permissions") : ?>
<?php echo $field->label; ?>
</div>
<?php endif; ?>
<div<?php $name != "permissions" ? ' class="controls' : '' ?>>
<?php echo $field->input; ?>
</div>
</div>
<?php endforeach; ?>
<?php echo count($fieldSets) > 1 ? '</div>' : '';?>
<?php endforeach; ?>
<?php echo count($fieldSets) > 1 ? '</div>' : '';?>
<input type="hidden" name="id" value="<?php echo $this->component->id; ?>" />
<input type="hidden" name="component" value="<?php echo $this->component->option; ?>" />
<input type="hidden" name="return" value="<?php echo $this->return; ?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>

</div>
<?php endif; ?>
<div class="<?php if ($name != "permissions") : ?>controls<?php endif; ?>">
<?php echo $field->input; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
<?php echo count($fieldSets) > 1 ? '</div>' : '';?>

<script type="text/javascript">
jQuery('#configTabs a:first').tab('show'); // Select first tab
</script>
<input type="hidden" name="id" value="<?php echo $this->component->id; ?>" />
<input type="hidden" name="component" value="<?php echo $this->component->option; ?>" />
<input type="hidden" name="return" value="<?php echo $this->return; ?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package Joomla.Administrator
* @subpackage com_config
*
* @copyright Copyright (C) 2005 - 2014 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
*/

Expand Down Expand Up @@ -31,4 +31,4 @@
</li>
<?php endforeach; ?>
</ul>
</div>
</div>

0 comments on commit 22bf8b3

Please sign in to comment.